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(); } }
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) { } }