Esempio n. 1
0
        protected void ASPxGridView1_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
        {
            AccountingPeriod currentEdit        = session.GetObjectByKey <AccountingPeriod>(Guid.Parse(e.EditingKeyValue.ToString()));
            Guid             accountingPeriodId = Guid.Parse(e.EditingKeyValue.ToString());

            if (AccountingPeriodBO.IsChildOfAnother(session, accountingPeriodId))
            {
                e.Cancel = true;
                (sender as ASPxGridView).CancelEdit();
                throw new Exception("Chu kì kế toán này đang là chu kì trực thuộc của một chu kì khác! Không thể chỉnh sửa");
            }

            Session["AccountingPeriodId_cr"] = currentEdit.AccountingPeriodId;
            ASPxGridLookup grid = ASPxGridView1.FindEditRowCellTemplateControl(ASPxGridView1.Columns[5] as GridViewDataColumn, "cp_Grid1").FindControl("GridUnderPeriod") as ASPxGridLookup;

            if (currentEdit.AccountingPeriodTypeId.IsDefault == true)
            {
                XPOAccountingPeriodLookup.Criteria = "[RowStatus] > 0s And [IsActive] = True And [IsActive] <> True And [Code] <> 'NAAN_DEFAULT' And [AccountingPeriodTypeId.IsDefault] = True";
                grid.Enabled = false;
            }
            else
            {
                XPOAccountingPeriodLookup.Criteria = "[RowStatus] > 0s And [IsActive] = True And [Code] <> 'NAAN_DEFAULT' And [AccountingPeriodTypeId.IsDefault] = True";
                grid.Enabled = true;
            }
        }
Esempio n. 2
0
        protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            Guid accountingPeriodId = (Guid)e.Keys[0];

            if (AccountingPeriodBO.IsChildOfAnother(session, accountingPeriodId) == true)
            {
                e.Cancel = true;
                throw new Exception("Chu kì kế toán này đang là chu kì trực thuộc của một chu kì khác! Không thể xóa");
            }
        }