public bool ReceiptVoucherCreating_CRUD() { ClearForm(); //Create temp voucher ReceiptVouches receiptVouches = receiptVouchesBO.CreateNewObject(session); //Update VoucherId VoucherId = receiptVouches.VouchesId; txtIssueDate.Date = DateTime.Now; //Get default code ArtifactCodeRuleBO artifactCodeRuleBO = new ArtifactCodeRuleBO(); txtCode.Text = artifactCodeRuleBO.GetArtifactCodeOfArtifactType(ArtifactTypeEnum.VOUCHER_RECEIPT); //Link to the bill if (BillId != Guid.Empty) { //Link bill to voucher LinkVoucherWithBill(session, BillId, receiptVouches); //Fill bill data into voucher FillBillDataIntoVoucher(session, BillId); } //Get default currency... gridlookupCurrency.ResetToDefault(); spinExchangeRate.Number = 1; UpdateGUIByCurrency(gridlookupCurrency.GetSelectedCurrency(session)); //Bind data to VoucherAllocation gridview gridviewVoucherAllocation_DataBind(); return(true); }
public bool PurchaseInvoiceCreating_CRUD() { //Create new temporary bill NAS.BO.Invoice.PurchaseInvoiceBO purchaseInvoiceBO = new NAS.BO.Invoice.PurchaseInvoiceBO(); Bill bill = purchaseInvoiceBO.InitTemporary(session, BillType); BillId = bill.BillId; hfBillId["BillId"] = BillId.ToString(); formlayoutInvoiceEditingForm_LoadData(); //Get default code ArtifactCodeRuleBO artifactCodeRuleBO = new ArtifactCodeRuleBO(); txtCode.Text = artifactCodeRuleBO.GetArtifactCodeOfArtifactType(ArtifactTypeEnum.INVOICE_PURCHASE); SetControlsProperties(); return(true); }
protected void popReceiptVouchesEdit_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e) { string[] args = e.Parameter.Split('|'); ReceiptVouchesBO bo = new ReceiptVouchesBO(); //ham dinh nghia ben NAS.BO switch (args[0]) { //DND 851 case "cbo_click": if (args.Length > 1) { string textAdsress = ""; if (args[1].Equals("")) { textAdsress = ""; } else { string[] org_code = args[1].ToString().Split('-'); org_code[0] = org_code[0].Trim(); textAdsress = bo.searchOrgnAdress(session, org_code[0]); } memoAddress.Value = textAdsress; txtPayer.Focus(); } break; //END DND 851 case "new": ReceiptVouches tempReceiptVouches = ReceiptVouches.InitNewRow(session); popReceiptVouchesEdit.JSProperties["cpNewRecordId"] = tempReceiptVouches.VouchesId.ToString(); PrivateSession.Instance.ReceiptVoucherId = tempReceiptVouches.VouchesId; dsReceiptVouches.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString(); dsVouchersAmount.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString(); this.InvisibleCommandColumnGridviewIfApprovedCosting(grdVouchersAmount, "CommonOperations"); ClearForm(); txtCode.Text = artifactCodeRuleBO.GetArtifactCodeOfArtifactType(ArtifactTypeEnum.VOUCHER_RECEIPT); //DND 851 dateIssuedDate.Value = DateTime.Now; //END DND break; case "edit": ClearForm(); if (args.Length > 1) { PrivateSession.Instance.ReceiptVoucherId = Guid.Parse(args[1]); dsReceiptVouches.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString(); dsVouchersAmount.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString(); txtCode.Text = CurrentReceiptVouches.Code; this.InvisibleCommandColumnGridviewIfApprovedCosting(grdVouchersAmount, "CommonOperations"); //DND if (bo.searchOrgDefault(session, CurrentReceiptVouches.SourceOrganizationId.OrganizationId.ToString())) { popReceiptVouchesEdit.JSProperties.Add("cpIsDefaultSourceOrg", true); } else { popReceiptVouchesEdit.JSProperties.Add("cpIsDefaultSourceOrg", false); } //END DND } break; case "save": bool isSuccess = true; string recordIdStr = null; try { //Check validation if (!ASPxEdit.AreEditorsValid(frmReceiptVouches, true)) { popReceiptVouchesEdit.JSProperties.Add("cpInvalid", true); return; } //collect data for saving string code = txtCode.Text; DateTime issueDate = new DateTime(); if (!DateTime.TryParse(dateIssuedDate.Text, out issueDate)) { issueDate = DateTime.Now; } string description = memoDescription.Text; string address = memoAddress.Text; //2013-11-18 Khoa.Truong INS START //Guid voucherTypeId = Guid.Parse(cbVouchesType.SelectedItem.Value.ToString()); //Guid sourceOrgId = Guid.Parse(cbSourceOrganization.SelectedItem.Value.ToString()); //2013-11-18 Khoa.Truong INS END //2013-11-18 Khong.Truong DEL START ////DND 851 Guid sourceOrgId; bo = new ReceiptVouchesBO(); //ham dinh nghia ben NAS.BO string cbVouchesType_name = cbVouchesType.Text; if (cbSourceOrganization.Text == null || cbSourceOrganization.Text.Equals("")) { sourceOrgId = Guid.Parse(bo.searchOrganizationId(session)); } else { string[] org_code = cbSourceOrganization.Text.ToString().Split('-'); org_code[0] = org_code[0].Trim(); sourceOrgId = Guid.Parse(bo.searchOrgId(session, org_code[0])); } Guid voucherTypeId = Guid.Parse(bo.searchVouchesTypeId(session, cbVouchesType_name)); ////END DND //2013-11-18 Khong.Truong DEL END string payer = txtPayer.Text; //Logic to save data if (args.Length > 1) { //Update mode //Update general information recordIdStr = args[1]; Guid recordId = Guid.Parse(recordIdStr); ReceiptVouchesBO receiptVouchesBO = new ReceiptVouchesBO(); receiptVouchesBO.Update(PrivateSession.Instance.ReceiptVoucherId, code, issueDate, description, address, payer, Constant.ROWSTATUS_ACTIVE, sourceOrgId, Utility.CurrentSession.Instance.AccessingOrganizationId, voucherTypeId); } else { //Insert mode ReceiptVouchesBO receiptVouchesBO = new ReceiptVouchesBO(); receiptVouchesBO.Insert(PrivateSession.Instance.ReceiptVoucherId, code, issueDate, description, address, payer, Constant.ROWSTATUS_ACTIVE, sourceOrgId, Utility.CurrentSession.Instance.AccessingOrganizationId, voucherTypeId); } } catch (Exception ex) { isSuccess = false; throw; } finally { popReceiptVouchesEdit.JSProperties.Add("cpCallbackArgs", String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower())); } break; default: break; } }
protected void grdTransaction_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) { e.NewValues["Code"] = lblCode.Text + "_" + artifactCodeRuleBO.GetArtifactCodeOfArtifactType(ArtifactTypeEnum.TRANSACTION); }