Esempio n. 1
0
		private long SaveRecord()
		{
			POReturns clsPOReturns = new POReturns();
			clsPOReturns.GetConnection();
			lblReturnNo.Text = Constants.PURCHASE_RETURN_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsPOReturns.LastTransactionNo();
			
			POReturnDetails clsDetails = new POReturnDetails();

			clsDetails.MemoNo = lblReturnNo.Text;
			clsDetails.MemoDate = Convert.ToDateTime(lblReturnDate.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);
			switch (lblModeOfterms.Text)
			{
				case "Days":
					clsDetails.SupplierModeOfTerms = 0;
					break;
				case "Months":
					clsDetails.SupplierModeOfTerms = 1;
					break;
				case "Years":
					clsDetails.SupplierModeOfTerms = 2;
					break;
			}
			clsDetails.RequiredPostingDate = Convert.ToDateTime(txtRequiredReturnDate.Text);
			clsDetails.BranchID = Convert.ToInt16(cboBranch.SelectedItem.Value);
			clsDetails.PurchaserID = Convert.ToInt64(Session["UID"].ToString());
            clsDetails.PurchaserName = Session["Name"].ToString();
			clsDetails.ReturnStatus = POReturnStatus.Open;
			clsDetails.Remarks = txtRemarks.Text;
			
			long id = clsPOReturns.Insert(clsDetails);
			clsPOReturns.CommitAndDispose();

			return id;
		}