protected void checkSupplierExists(object source, ServerValidateEventArgs args) { string code = ((TextBox)(this.FV_Supplier.FindControl("tbCode"))).Text; if (TheSupplierMgr.LoadSupplier(code) != null) { args.IsValid = false; } }
protected void lbtnDelete_Click(object sender, EventArgs e) { string code = ((LinkButton)sender).CommandArgument; try { TheSupplierMgr.DeleteSupplier(code); ShowSuccessMessage("MasterData.Supplier.DeleteSupplier.Successfully", code); UpdateView(); } catch (Castle.Facilities.NHibernateIntegration.DataException ex) { ShowErrorMessage("MasterData.Supplier.DeleteSupplier.Fail", code); } }
protected void ODS_PriceList_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { Controls_TextBox tbParty = ((Controls_TextBox)(this.FV_PriceList.FindControl("tbParty"))); priceList = (PriceList)e.InputParameters[0]; priceList.Code = priceList.Code.Trim(); if (this.PriceListType == BusinessConstants.CODE_MASTER_PRICE_LIST_TYPE_VALUE_PURCHASE) { priceList.Party = TheSupplierMgr.LoadSupplier(tbParty.Text.Trim()); } else if (this.PriceListType == BusinessConstants.CODE_MASTER_PRICE_LIST_TYPE_VALUE_SALES) { priceList.Party = TheCustomerMgr.LoadCustomer(tbParty.Text.Trim()); } }
protected void btnInsert_Click(object sender, EventArgs e) { CustomValidator cvInsert = ((CustomValidator)(this.FV_Supplier.FindControl("cvInsert"))); if (cvInsert.IsValid) { TextBox tbCode = (TextBox)(this.FV_Supplier.FindControl("tbCode")); TextBox tbName = (TextBox)(this.FV_Supplier.FindControl("tbName")); CheckBox cbIsActive = (CheckBox)(this.FV_Supplier.FindControl("cbIsActive")); Supplier supplier = new Supplier(); supplier.Code = tbCode.Text.Trim(); supplier.Name = tbName.Text.Trim(); supplier.IsActive = cbIsActive.Checked; TheSupplierMgr.CreateSupplier(supplier, this.CurrentUser); if (CreateEvent != null) { CreateEvent(supplier.Code, e); ShowSuccessMessage("MasterData.Supplier.AddSupplier.Successfully", supplier.Code); } } }