this is my WCF implemented class code and interface
this interface
[OperationContract]
[WebInvoke(Method = "POST",
UriTemplate = "InsertLeaveRequest",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
string InsertLeaveRequest(LeaveRequst leaveRequest);
this bean class
[DataContract]
public class LeaveRequst
{
[DataMember(Name="EmployeeID")]
public int EmployeeID { get; set; }
[DataMember(Name = "LeaveTypeID")]
public int LeaveTypeID { get; set; }
[DataMember(Name = "SessionID")]
public int SessionID { get; set; }
[DataMember(Name = "TotalDays")]
public int TotalDays { get; set; }
[DataMember(Name = "Balance")]
public int Balance { get; set; }
[DataMember(Name = "FromDate")]
public DateTime FromDate { get; set; }
[DataMember(Name = "ToDate")]
public DateTime ToDate { get; set; }
[DataMember(Name = "IsApproved")]
public byte IsApproved { get; set; }
[DataMember(Name = "IsRejected")]
public byte IsRejected { get; set; }
//[DataMember(Name = "IsCancel")]
//public byte IsCancel { get; set; }
[DataMember(Name = "IsExported")]
public byte IsExported { get; set; }
}
this implemented class
public string InsertLeaveRequest(LeaveRequst leaveRequest)
{
string Message="";
string connectionString =
WebConfigurationManager.AppSettings["conn"].ToString();
using (SqlConnection connection = new SqlConnection())
{
connection.ConnectionString = connectionString;
connection.Open();
SqlCommand cmd = new SqlCommand("insert into
biz_EmployeeLeaveLedger(EmployeeID,LeaveTypeID,SessionID,FromDate,ToDate,TotalDays,Balance,IsApproved,IsRejected,IsExported)
values(@EmployeeID,@LeaveTypeID,@SessionID,@FromDate,@ToDate,@TotalDays,@Balance,@IsApproved,@IsRejected,@IsExported)",
connection);
cmd.Parameters.AddWithValue("@EmployeeID",
leaveRequest.EmployeeID);
cmd.Parameters.AddWithValue("@LeaveTypeID",
leaveRequest.LeaveTypeID);
cmd.Parameters.AddWithValue("@SessionID",
leaveRequest.SessionID);
cmd.Parameters.AddWithValue("@FromDate",
leaveRequest.FromDate);
cmd.Parameters.AddWithValue("@ToDate", leaveRequest.ToDate);
cmd.Parameters.AddWithValue("@TotalDays",
leaveRequest.TotalDays);
cmd.Parameters.AddWithValue("@Balance",
leaveRequest.Balance);
cmd.Parameters.AddWithValue("@IsApproved",
leaveRequest.IsApproved);
cmd.Parameters.AddWithValue("@IsRejected",
leaveRequest.IsRejected);
cmd.Parameters.AddWithValue("@IsExported",
leaveRequest.IsExported);
int result = cmd.ExecuteNonQuery();
if (result == 1)
{
Message = result +"Record inserted successfully";
}
else
{
Message = " Record not inserted successfully";
}
connection.Close();
return Message;
}
}
On Tue, Sep 17, 2013 at 12:24 PM, Giuseppe <[email protected]>wrote:
> Show the server code please
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.