private Int64 SaveRecord() { PO clsPO = new PO(); clsPO.GetConnection(); lblPONo.Text = Constants.PURCHASE_ORDER_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsPO.LastTransactionNo(); PODetails clsDetails = new PODetails(); clsDetails.PONo = lblPONo.Text; clsDetails.PODate = Convert.ToDateTime(lblPODate.Text); clsDetails.SupplierID = Convert.ToInt64(cboSupplier.SelectedItem.Value); clsDetails.SupplierCode = cboSupplier.SelectedItem.Text; clsDetails.SupplierContact = txtSupplierContact.Text; clsDetails.SupplierAddress = txtSupplierAddress.Text; clsDetails.SupplierTelephoneNo = txtSupplierTelephoneNo.Text; clsDetails.SupplierTerms = Convert.ToInt32(lblTerms.Text); clsDetails.SupplierTINNo = txtSupplierTINNo.Text; clsDetails.SupplierLTONo = txtSupplierLTONo.Text; switch (lblModeOfterms.Text) { case "Days": clsDetails.SupplierModeOfTerms = 0; break; case "Months": clsDetails.SupplierModeOfTerms = 1; break; case "Years": clsDetails.SupplierModeOfTerms = 2; break; } clsDetails.RequiredDeliveryDate = Convert.ToDateTime(txtRequiredDeliveryDate.Text); clsDetails.RID = Convert.ToInt64(txtRID.Text); clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value); clsDetails.PurchaserID = Convert.ToInt64(Session["UID"].ToString()); clsDetails.PurchaserName = Session["Name"].ToString(); clsDetails.Status = POStatus.Open; clsDetails.Remarks = txtRemarks.Text; bool boIsePurchaseOrder = bool.TryParse(lblIsePurchaseOrder.Text, out boIsePurchaseOrder) ? boIsePurchaseOrder : false; clsDetails.IncludeIneSales = boIsePurchaseOrder; Int64 id = clsPO.Insert(clsDetails); clsPO.CommitAndDispose(); return(id); }