Пример #1
0
        private void FillOLV()
        {
            try
            {
                ovlSubAccount.Clear();
                List <ListViewColumnsInfo> list = new List <ListViewColumnsInfo>();
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 100, Header = helper.GetMemberName((SubExpencesModel c) => c.SubExpences_ID), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 300, Header = helper.GetMemberName((SubExpencesModel c) => c.SubExpences_Name), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 100, Header = helper.GetMemberName((SubExpencesModel c) => c.Expences_Name), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 100, Header = helper.GetMemberName((SubExpencesModel c) => c.Option_Type), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 55, Header = helper.GetMemberName((SubExpencesModel c) => c.IsActive), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 50, Header = helper.GetMemberName((SubExpencesModel c) => c.Update), Visible = true, IsButton = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 50, Header = helper.GetMemberName((SubExpencesModel c) => c.Delete), Visible = true, IsButton = true
                });
                helper.GenerateListView(ovlSubAccount, list);
                this.ovlSubAccount.ButtonClick += delegate(object sender, CellClickEventArgs e)
                {
                    switch (e.ColumnIndex)
                    {
                    case 5:
                        FrmAddEditSubAccount adddSubAccount = new FrmAddEditSubAccount(e.Model as SubExpencesModel, reciever.GetList());
                        AddEdit(adddSubAccount);
                        break;

                    case 6:
                        var          model  = e.Model as SubExpencesModel;
                        DialogResult result = MessageBox.Show(String.Format("Are you sure? you want to delete sub account => {0}", model.SubExpences_Name), "Delete!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (result.Equals(DialogResult.Yes))
                        {
                            reciever.Delete(model);
                            RefreshList();
                        }
                        break;
                    }
                };
            }
            catch (Exception err) { err.GetBaseException(); }
        }
Пример #2
0
        private void AddEdit(FrmAddEditSubAccount adddSubAccount)
        {
            DialogResult callback = adddSubAccount.ShowDialog(this);

            if (DialogResult.OK == callback)
            {
                RefreshList();
            }
        }
Пример #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FrmAddEditSubAccount addSubAccount = new FrmAddEditSubAccount(reciever.GetList());

            AddEdit(addSubAccount);
        }