/// <summary> /// This Method is used to Save customer details. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnsave_Click(object sender, EventArgs e) { try { SalesCustomerInfo Info = new SalesCustomerInfo(); Info.CustomerName = txtName.Text; Info.MobileNo = txtMobile.Text; Info.EmailID = txtEmail.Text; Info.DOB = (DateTime.Parse(txtDOB.Text)).ToString("dd/MMM/yyyy"); Info.Anniversary = txtAnniversary.Text.Trim() != "" ? (DateTime.Parse(txtAnniversary.Text)).ToString("dd/MMM/yyyy") : ""; Session["CustomerID"] = BL_Sales.SaveCustomer(Info); UCSalesObj.ClearFields(); UCSalesObj.BindGrid(); SalesPop.Show(); } catch (Exception Ex) { } }
/// <summary> /// This method is used to save cunstomer details. /// </summary> /// <param name="Info"></param> /// <returns></returns> public static string SaveCustomer(SalesCustomerInfo Info) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_Sales_CustomerInformation"; ParameterCollection.Add(new clsParameter("@CustomerName", Info.CustomerName)); ParameterCollection.Add(new clsParameter("@MobileNo", Info.MobileNo)); ParameterCollection.Add(new clsParameter("@EmailID", Info.EmailID)); ParameterCollection.Add(new clsParameter("@DOB", Info.DOB)); ParameterCollection.Add(new clsParameter("@Anniversary", Info.Anniversary)); return DataAccess.ExecuteScalarSp(ParameterCollection).ToString(); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
private void SaveCustomerInfo() { try { DataTable dtCust = new DataTable(); dtCust = Session["SalesCustomerInfo"] as DataTable; SalesCustomerInfo Info = new SalesCustomerInfo(); Info.CustomerName = dtCust.Rows[0]["Name"].ToString(); Info.MobileNo = dtCust.Rows[0]["Mobile"].ToString(); Info.EmailID = dtCust.Rows[0]["EMail"].ToString(); Info.DOB = dtCust.Rows[0]["DOB"].ToString(); Info.Anniversary = dtCust.Rows[0]["Anniversary"].ToString(); string CustID = BL_Sales.SaveCustomer(Info); } catch (Exception Ex) { } }