public string Customer_Complaint(Customer_ComplaintBo obj) { SqlConnection con = new SqlConnection(strConnLive); try { string result = string.Empty; con.Open(); SqlCommand cmd = new SqlCommand("inCore.dbo.Usp_Customer_complaint", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Mode", "Insert"); cmd.Parameters.AddWithValue("@Customername", obj.Customername); cmd.Parameters.AddWithValue("@Mobile", obj.Mobile); cmd.Parameters.AddWithValue("@ComplainType", obj.Related); cmd.Parameters.AddWithValue("@Docketno", obj.DocketNo); cmd.Parameters.AddWithValue("@Address1", obj.Address1); cmd.Parameters.AddWithValue("@Grievance", obj.Issue); cmd.Parameters.AddWithValue("@Pin", obj.Pin); cmd.Parameters.Add("@outputpara", SqlDbType.VarChar, 50); cmd.Parameters["@outputpara"].Direction = ParameterDirection.Output; int i = cmd.ExecuteNonQuery(); result = (string)cmd.Parameters["@outputpara"].Value; return(result); } catch (Exception) { return(null); } finally { con.Close(); } }
public ActionResult Customer_Complaint(Customer_ComplaintBo obj, FormCollection form) { try { obj.Address1 = form["Address1"]; obj.Pin = form["Pin"]; obj.Mobile = form["Mobile"]; obj.Customername = form["Customername"]; obj.Related = form["complaincode"]; //obj.ComplainType = form["ComplainType"].ToString(); obj.Issue = form["Issue"]; obj.DocketNo = form["DocketNo"].ToString(); Customer_ComplaintBo _Complaint = new Customer_ComplaintBo(); ViewBag.flag = 1; ViewBag.Msg = cmplnt_DAL.Customer_Complaint(obj); } catch (Exception e) { ViewBag.Exception = e; } return(View()); }