Пример #1
0
        protected void grdBooking_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
        {
            CriteriaOperator filter = new BinaryOperator("InventoryTransactionId", Guid.Parse(Session["InventoryTransactionId"].ToString()), BinaryOperatorType.Equal);
            PurchaseInvoiceInventoryTransaction inventoryTransaction = session.FindObject <PurchaseInvoiceInventoryTransaction>(filter);

            if (inventoryTransaction != null)
            {
                if (e.Column.FieldName == "Code")
                {
                    e.Editor.Focus();
                }
                if (e.Column.FieldName == "PurchaseInvoiceInventoryTransactionId.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 == "PurchaseInvoiceInventoryTransactionId!Key")
                {
                    e.Editor.Value = Session["InventoryTransactionId"].ToString();
                }
                if (e.Column.FieldName == "CreateDate")
                {
                    e.Editor.Value = DateTime.Now;
                }
            }
        }
Пример #2
0
        protected void cpInpuCommLine_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[] p = e.Parameter.Split('|');

            switch (p[0])
            {
            case "view":
                if (!hInputCommId.Contains("id"))
                {
                    return;
                }

                InventoryTransaction inventoryTransaction = session.GetObjectByKey <InventoryTransaction>(Guid.Parse(hInputCommId.Get("id").ToString()));

                if (inventoryTransaction != null)
                {
                    txtInputCommWarehouseCode.Text        = inventoryTransaction.Code;
                    txtInputCommWarehouseCreateDate.Value = inventoryTransaction.CreateDate;
                    txtInputCommWarehouseDescription.Text = inventoryTransaction.Description;

                    //CriteriaOperator filter = new BinaryOperator(se
                    PurchaseInvoiceInventoryTransaction pp = session.GetObjectByKey <PurchaseInvoiceInventoryTransaction>(Guid.Parse(hInputCommId.Get("id").ToString()));
                    if (pp != null)
                    {
                        BillItemXDS.CriteriaParameters["BillId"].DefaultValue = pp.PurchaseInvoiceId.BillId.ToString();
                        Session["BillId"] = pp.PurchaseInvoiceId.BillId.ToString();
                    }
                }

                break;

            default:
                break;
            }
        }
Пример #3
0
        protected void grdBooking_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            CriteriaOperator filter = new BinaryOperator("PurchaseInvoiceInventoryTransactionId", Guid.Parse(Session["InventoryTransactionId"].ToString()), BinaryOperatorType.Equal);
            XPCollection <PurchaseInvoiceInventoryAccountingTransaction> purchaseInvoiceTransaction = new XPCollection <PurchaseInvoiceInventoryAccountingTransaction>(session, filter);

            if (purchaseInvoiceTransaction.Count > 0)
            {
                foreach (PurchaseInvoiceInventoryAccountingTransaction item in purchaseInvoiceTransaction)
                {
                    if (item.RowStatus == ROW_NOT_DELETE)
                    {
                        grdBooking.CancelEdit();
                        return;
                    }
                }
            }

            filter = new BinaryOperator("InventoryTransactionId", Guid.Parse(e.NewValues["PurchaseInvoiceInventoryTransactionId!Key"].ToString()), BinaryOperatorType.Equal);
            PurchaseInvoiceInventoryTransaction purchaseInvoiceInventoryTransaction = session.FindObject <PurchaseInvoiceInventoryTransaction>(filter);

            e.NewValues["PurchaseInvoiceInventoryTransactionId"] = purchaseInvoiceInventoryTransaction;
            e.NewValues["TransactionId"] = Guid.NewGuid();
        }