public Object RequestData(int startRow, int pageSize, string sortExpression)
        {
            DbCompanyTax dbCompanyTax = new DbCompanyTax();

            dbCompanyTax.TaxID = TaxID;
            return(ScgDbQueryProvider.DbCompanyTaxQuery.GetCompanyTaxList(dbCompanyTax, startRow, pageSize, sortExpression));
        }
 public void Initialize(string mode, long Id, long taxID)
 {
     Mode         = mode;
     TaxID        = taxID;
     CompanyTaxID = Id;
     if (Mode.Equals(FlagEnum.EditFlag) || !Id.Equals(0))
     {
         DbCompanyTax dbCompanyTax = DbCompanyTaxService.FindByIdentity(CompanyTaxID);
         try
         {
             if (dbCompanyTax.CompanyID != 0)
             {
                 ctlCompanyField.SetValue(dbCompanyTax.CompanyID);
                 ctlCompanyField.Mode = ModeEnum.Readonly;
                 ctlCompanyField.ChangeMode();
             }
         }
         catch { }
         ctlRate.Text             = dbCompanyTax.Rate.ToString("#,##0.0000");
         ctlRateNonDeduct.Text    = dbCompanyTax.RateNonDeduct.ToString("#,##0.0000");
         ctlUseParentRate.Checked = dbCompanyTax.UseParentRate;
         ctlDisable.Checked       = dbCompanyTax.Disable;
         UseParentRate();
         ctlCompanyTaxUpdatePanel.Update();;
     }
     else if (Mode.Equals(FlagEnum.NewFlag))
     {
         ResetValue();
         ctlCompanyField.Mode = ModeEnum.ReadWrite;
         ctlCompanyField.ChangeMode();
     }
 }
        private void CheckDataValueUpdate(DbCompanyTax ct)
        {
            Spring.Validation.ValidationErrors errors = new Spring.Validation.ValidationErrors();
            if (ct.CompanyID <= 0)
            {
                errors.AddError("CompanyTax.Error", new Spring.Validation.ErrorMessage("RequiredCompany"));
            }
            if (!ctlUseParentRate.Checked)
            {
                if (ct.Rate == 0)
                {
                    errors.AddError("CompanyTax.Error", new Spring.Validation.ErrorMessage("RequiredRate"));
                }
            }
            if (CompanyTaxID == 0)
            {
                if (ScgDbDaoProvider.DbCompanyTaxDao.IsDuplicateCompanyCode(ct))
                {
                    errors.AddError("CompanyTax.Error", new Spring.Validation.ErrorMessage("Duplicate Company Code"));
                }
            }

            if (!errors.IsEmpty)
            {
                throw new ServiceValidationException(errors);
            }
        }
        protected void Delete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in ctlGridRole.Rows)
            {
                if (((CheckBox)(row.Cells[0].Controls[1])).Checked)
                {
                    int          rowIndex     = row.RowIndex;
                    string       ID           = ctlGridRole.DataKeys[rowIndex].Value.ToString();
                    DbCompanyTax dbCompanyTax = new DbCompanyTax();
                    dbCompanyTax.ID = UIHelper.ParseLong(ID);
                    DbCompanyTaxService.DeleteCompanyTax(dbCompanyTax);
                }
            }

            RefreshGridView();
        }
        protected void ctlSave_Click1(object sender, ImageClickEventArgs e)
        {
            DbCompanyTax ct;

            try
            {
                if (Mode.Equals(FlagEnum.EditFlag))
                {
                    ct = DbCompanyTaxService.FindByIdentity(CompanyTaxID);
                }
                else
                {
                    ct = new DbCompanyTax();
                }
                ct.TaxID         = TaxID;
                ct.Rate          = UIHelper.ParseDouble(ctlRate.Text);
                ct.RateNonDeduct = UIHelper.ParseDouble(ctlRateNonDeduct.Text);
                ct.UseParentRate = ctlUseParentRate.Checked;
                ct.Disable       = ctlDisable.Checked;
                DbCompany com = ScgDbQueryProvider.DbCompanyQuery.FindByIdentity(UIHelper.ParseLong(ctlCompanyField.CompanyID));
                if (com != null)
                {
                    ct.CompanyID = com.CompanyID;
                }

                ct.CreBy   = UserAccount.UserID;
                ct.CreDate = DateTime.Now;
                ct.UpdBy   = UserAccount.UserID;
                ct.UpdDate = DateTime.Now;
                ct.UpdPgm  = UserAccount.CurrentLanguageCode;
                CheckDataValueUpdate(ct);
                ScgDbDaoProvider.DbCompanyTaxDao.SaveOrUpdate(ct);
                Notify_Ok(sender, e);
            }
            catch (ServiceValidationException ex)
            {
                this.ValidationErrors.MergeErrors(ex.ValidationErrors);
            }

            catch (NullReferenceException)
            {
            }
        }