예제 #1
0
        public frmSubCompany()
        {
            InitializeComponent();

            objMaster = new SubCompanyBO();
            this.SetProperties((INavigation)objMaster);
            this.Shown += new EventHandler(frmCompany_Shown);

            this.Load += new EventHandler(frmSubCompany_Load);

            this.grdLister.CellDoubleClick        += new GridViewCellEventHandler(grdLister_CellDoubleClick);
            this.grdLister.CommandCellClick       += new CommandCellClickEventHandler(grdLister_CommandCellClick);
            this.grdLister.RowsChanging           += new GridViewCollectionChangingEventHandler(grdLister_RowsChanging);
            this.grdLister.RowsChanged            += new GridViewCollectionChangedEventHandler(grdLister_RowsChanged);
            this.chkAmount.ToggleStateChanged     += ChkAmount_ToggleStateChanged;
            chkUseInvoiceEmail.ToggleStateChanged += new StateChangedEventHandler(chkUseInvoiceEmail_ToggleStateChanged);

            this.Shown += new EventHandler(frmSubCompany_Shown);


            FillMapIconCombo();

            OnNew();

            if (this.ThemeName.ToStr().ToLower() != "control default")
            {
                grdLister.AutoCellFormatting = false;
            }
        }
예제 #2
0
        void grdLister_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
            {
                objMaster = new SubCompanyBO();

                try
                {
                    objMaster.GetByPrimaryKey((e.NewItems[0] as GridViewRowInfo).Cells["Id"].Value.ToInt());
                    objMaster.Delete(objMaster.Current);
                }
                catch (Exception ex)
                {
                    if (objMaster.Errors.Count > 0)
                    {
                        ENUtils.ShowMessage(objMaster.ShowErrors());
                    }
                    else
                    {
                        ENUtils.ShowMessage(ex.Message);
                    }
                    e.Cancel = true;
                }
            }
        }