Ejemplo n.º 1
0
        private long SaveRecord()
        {
            SOReturns clsSOReturns = new SOReturns();
            clsSOReturns.GetConnection();
            lblReturnNo.Text = Constants.SALES_RETURN_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsSOReturns.LastTransactionNo();

            SOReturnDetails clsDetails = new SOReturnDetails();

            clsDetails.CNNo = lblReturnNo.Text;
            clsDetails.CNDate = Convert.ToDateTime(lblReturnDate.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.RequiredPostingDate = Convert.ToDateTime(txtRequiredReturnDate.Text);
            clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value);
            clsDetails.SellerID = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.SellerName = Session["Name"].ToString();
            clsDetails.ReturnStatus = SOReturnStatus.Open;
            clsDetails.Remarks = txtRemarks.Text;

            long id = clsSOReturns.Insert(clsDetails);
            clsSOReturns.CommitAndDispose();

            return id;
        }