protected void grdBooking_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) { CriteriaOperator filter = new BinaryOperator("InventoryTransactionId", Guid.Parse(Session["SaleBillId"].ToString()), BinaryOperatorType.Equal); SalesInvoiceInventoryTransaction inventoryTransaction = session.FindObject <SalesInvoiceInventoryTransaction>(filter); if (inventoryTransaction != null) { if (e.Column.FieldName == "Code") { e.Editor.Focus(); } if (e.Column.FieldName == "SalesInvoiceInventoryTransactionId.Code") { InventoryTransaction inventory = session.GetObjectByKey <InventoryTransaction>(inventoryTransaction.InventoryTransactionId); e.Editor.Value = inventory.Code; } if (e.Column.FieldName == "IssueDate") { e.Editor.Value = inventoryTransaction.IssueDate; } if (e.Column.FieldName == "AccountingPeriodId!Key") { e.Editor.Value = "5eaa2bf5-34ba-47c6-88df-48ad25bc6e18"; } if (e.Column.FieldName == "SalesInvoiceInventoryTransactionId!Key") { e.Editor.Value = Session["SaleBillId"].ToString(); } if (e.Column.FieldName == "CreateDate") { e.Editor.Value = DateTime.Now; } } }
protected void cpLine_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { string[] para = e.Parameter.Split('|'); switch (para[0]) { case "view": InventoryTransaction inventoryTransaction = session.GetObjectByKey <InventoryTransaction>(Guid.Parse(hOutputCommId.Get("id").ToString())); if (inventoryTransaction != null) { txtOutputCommWarehouseCode.Text = inventoryTransaction.Code; txtOutputCommWarehouseCreateDate.Value = inventoryTransaction.CreateDate; txtOutputCommWarehouseDescription.Text = inventoryTransaction.Description; SalesInvoiceInventoryTransaction pp = session.GetObjectByKey <SalesInvoiceInventoryTransaction>(Guid.Parse(hOutputCommId.Get("id").ToString())); if (pp != null) { BillItemXDS.CriteriaParameters["BillId"].DefaultValue = pp.SalesInvoiceId.BillId.ToString(); Session["BillId"] = pp.SalesInvoiceId.BillId.ToString(); } } cpLine.JSProperties.Add("cpShowFormPrint", "showprint"); break; default: break; } }
protected void grdBooking_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { CriteriaOperator filter = new BinaryOperator("SalesInvoiceInventoryTransactionId", Guid.Parse(Session["SaleBillId"].ToString()), BinaryOperatorType.Equal); XPCollection <SalesInvoiceInventoryAccountingTransaction> saleInvoiceTransaction = new XPCollection <SalesInvoiceInventoryAccountingTransaction>(session, filter); if (saleInvoiceTransaction.Count > 0) { foreach (SalesInvoiceInventoryAccountingTransaction item in saleInvoiceTransaction) { if (item.RowStatus == ROW_NOT_DELETE) { grdBooking.CancelEdit(); return; } } } filter = new BinaryOperator("InventoryTransactionId", Guid.Parse(e.NewValues["SalesInvoiceInventoryTransactionId!Key"].ToString()), BinaryOperatorType.Equal); SalesInvoiceInventoryTransaction salesInvoiceInventoryTransaction = session.FindObject <SalesInvoiceInventoryTransaction>(filter); e.NewValues["SalesInvoiceInventoryTransactionId"] = salesInvoiceInventoryTransaction; e.NewValues["TransactionId"] = Guid.NewGuid(); }