Exemplo n.º 1
0
        private void CheckDataValueInsert(DbWithHoldingTaxType WHTTaxType)
        {
            Spring.Validation.ValidationErrors errors = new Spring.Validation.ValidationErrors();

            if (string.IsNullOrEmpty(WHTTaxType.WhtTypeCode))
            {
                errors.AddError("WHTType.Error", new Spring.Validation.ErrorMessage("RequiredWHTTaxTypeCode"));
            }
            else if (ScgDbQueryProvider.DbWithHoldingTaxTypeQuery.isDuplicationWHTTypeCode(WHTTaxType.WhtTypeCode))
            {
                errors.AddError("WHTType.Error", new Spring.Validation.ErrorMessage("DuplicationWhtTypeCode"));
            }
            if (!errors.IsEmpty)
            {
                throw new ServiceValidationException(errors);
            }
        }
Exemplo n.º 2
0
        private void CheckDataValueUpdate(DbWithHoldingTaxType WHTTaxType)
        {
            Literal ctlLblWhtTypeCodeInGrid = ctlGridWithholdingTax.Rows[ctlGridWithholdingTax.EditIndex].FindControl("ctlLblWhtTypeCode") as Literal;
            TextBox txtWHTTypeCode          = ctlFormViewWHT.FindControl("ctlTxtWHTCode") as TextBox;

            Spring.Validation.ValidationErrors errors = new Spring.Validation.ValidationErrors();

            if (string.IsNullOrEmpty(WHTTaxType.WhtTypeCode))
            {
                errors.AddError("WHTType.Error", new Spring.Validation.ErrorMessage("RequiredWHTTaxTypeCode"));
            }
            else if (
                (ctlLblWhtTypeCodeInGrid.Text != txtWHTTypeCode.Text) &&
                (ScgDbQueryProvider.DbWithHoldingTaxTypeQuery.isDuplicationWHTTypeCode(WHTTaxType.WhtTypeCode)))
            {
                errors.AddError("WHTType.Error", new Spring.Validation.ErrorMessage("DuplicationWhtTypeCode"));
            }
            if (!errors.IsEmpty)
            {
                throw new ServiceValidationException(errors);
            }
        }
Exemplo n.º 3
0
        protected void ctlGridWithholdingTax_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "WHTTypeEdit")
            {
                int   rowIndex       = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                short WHTTaxTypeCode = UIHelper.ParseShort(ctlGridWithholdingTax.DataKeys[rowIndex].Value.ToString());

                ctlGridWithholdingTax.EditIndex = rowIndex;
                IList <DbWithHoldingTaxType> WHTTaxTypeList = new List <DbWithHoldingTaxType>();
                DbWithHoldingTaxType         WHTTaxType     = DbWithHoldingTaxTypeService.FindByIdentity(WHTTaxTypeCode);

                WHTTaxTypeList.Add(WHTTaxType);

                ctlFormViewWHT.DataSource = WHTTaxTypeList;
                ctlFormViewWHT.PageIndex  = 0;

                ctlFormViewWHT.ChangeMode(FormViewMode.Edit);
                ctlFormViewWHT.DataBind();

                updPanelFormView.Update();
                ctlModalPopupWHT.Show();
                //BankLangGridViewFinish();
            }
            else if (e.CommandName == "WHTTypeDelete")
            {
                int   rowIndex       = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                short WHTTaxTypeCode = UIHelper.ParseShort(ctlGridWithholdingTax.DataKeys[rowIndex].Value.ToString());

                DbWithHoldingTaxType WHTTaxType = DbWithHoldingTaxTypeService.FindByIdentity(WHTTaxTypeCode);

                DbWithHoldingTaxTypeService.Delete(WHTTaxType);
                ctlGridWithholdingTax.DataCountAndBind();
                updPanelGridView.Update();

                //ctlMessage.Message = GetMessage("DeleteSuccessFully");
            }
        }
Exemplo n.º 4
0
        protected void ctlFormViewWHT_ItemInserting(object sender, FormViewInsertEventArgs e)
        {
            DbWithHoldingTaxType WHTTaxType = new DbWithHoldingTaxType();

            TextBox  txtWHTTypeCode = ctlFormViewWHT.FindControl("ctlTxtWHTCode") as TextBox;
            TextBox  txtWHTTypeName = ctlFormViewWHT.FindControl("ctlTxtWHTName") as TextBox;
            CheckBox chkPeople      = ctlFormViewWHT.FindControl("chkPeople") as CheckBox;

            CheckBox chkActive = ctlFormViewWHT.FindControl("chkActive") as CheckBox;

            WHTTaxType.WhtTypeCode = txtWHTTypeCode.Text;
            WHTTaxType.WhtTypeName = txtWHTTypeName.Text;
            WHTTaxType.IsPeople    = chkPeople.Checked;
            WHTTaxType.Active      = chkActive.Checked;

            WHTTaxType.UpdPgm  = ProgramCode;
            WHTTaxType.CreDate = DateTime.Now.Date;
            WHTTaxType.UpdDate = DateTime.Now.Date;
            WHTTaxType.CreBy   = UserAccount.UserID;
            WHTTaxType.UpdBy   = UserAccount.UserID;

            try
            {
                CheckDataValueInsert(WHTTaxType);
                DbWithHoldingTaxTypeService.Save(WHTTaxType);

                e.Cancel = true;
                ctlGridWithholdingTax.DataCountAndBind();
                ctlModalPopupWHT.Hide();
                updPanelGridView.Update();
                //ctlMessage.Message = GetMessage("SaveSuccessFully");
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }