public objResponse SubmitData(LeadSubmision objLeads) { objResponse Response = new objResponse(); try { SqlParameter[] sqlParameter = new SqlParameter[32]; sqlParameter[0] = new SqlParameter("@businessName", SqlDbType.NVarChar, 100); sqlParameter[0].Value = objLeads.businessName; sqlParameter[1] = new SqlParameter("@contactName", SqlDbType.NVarChar, 100); sqlParameter[1].Value = objLeads.contactName; sqlParameter[2] = new SqlParameter("@contactPhone", SqlDbType.NVarChar, 13); sqlParameter[2].Value = objLeads.contactPhone; sqlParameter[3] = new SqlParameter("@Email", SqlDbType.NVarChar, 100); sqlParameter[3].Value = objLeads.email; sqlParameter[4] = new SqlParameter("@secondaryPhone", SqlDbType.NVarChar, 13); sqlParameter[4].Value = objLeads.secondaryPhone; sqlParameter[9] = new SqlParameter("@cooments", SqlDbType.NVarChar, 200); sqlParameter[9].Value = objLeads.cooments; DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_SubmitData", sqlParameter, DB_CONSTANTS.ConnectionString_ICS); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; Response.ErrorMessage = Response.ResponseData.Tables[0].Rows[0][0].ToString();; } else { Response.ErrorCode = 2001; Response.ErrorMessage = "There is an Error. Please Try After some time."; } } catch (Exception ex) { Response.ErrorMessage = ex.Message.ToString(); BAL.Common.LogManager.LogError("SubmitData", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(Response); }
public ActionResult LeadSubmission(LeadSubmisionModel req) { objResponse Response = new objResponse(); BAL.Leads.LeadsManager objLeadManager = new BAL.Leads.LeadsManager(); LeadSubmision objLeads = new LeadSubmision(); try { objLeads.businessName = req.businessName; objLeads.contactName = req.contactName; objLeads.email = req.email; objLeads.contactPhone = req.contactPhone; objLeads.secondaryPhone = req.secondaryPhone; objLeads.cooments = req.cooments; Response = objLeadManager.SubmitData(objLeads); if (Response.ErrorCode == 0) { if (Response.ErrorMessage.Equals("Lead Already Exists")) { return(Json("", JsonRequestBehavior.AllowGet)); } else { return(Json("1", JsonRequestBehavior.AllowGet)); } } else { return(Json("", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json("", JsonRequestBehavior.AllowGet)); } }