private Int64 SaveRecord() { SO clsSO = new SO(); clsSO.GetConnection(); lblSONo.Text = Constants.SALES_ORDER_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsSO.LastTransactionNo(); SODetails clsDetails = new SODetails(); clsDetails.SONo = lblSONo.Text; clsDetails.SODate = Convert.ToDateTime(lblSODate.Text); clsDetails.CustomerID = Convert.ToInt64(cboCustomer.SelectedItem.Value); clsDetails.CustomerCode = cboCustomer.SelectedItem.Text; clsDetails.CustomerContact = txtCustomerContact.Text; clsDetails.CustomerAddress = txtCustomerAddress.Text; clsDetails.CustomerTelephoneNo = txtCustomerTelephoneNo.Text; clsDetails.CustomerTerms = Convert.ToInt32(lblTerms.Text); switch (lblModeOfterms.Text) { case "Days": clsDetails.CustomerModeOfTerms = 0; break; case "Months": clsDetails.CustomerModeOfTerms = 1; break; case "Years": clsDetails.CustomerModeOfTerms = 2; break; } clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text); clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value); clsDetails.SellerID = Convert.ToInt64(Session["UID"].ToString()); clsDetails.SellerName = Session["Name"].ToString(); clsDetails.Status = SOStatus.Open; clsDetails.Remarks = txtRemarks.Text; Int64 id = clsSO.Insert(clsDetails); clsSO.CommitAndDispose(); return(id); }