Exemplo n.º 1
0
        private void AddEdit(FrmAddEditCustomer addCustomer)
        {
            DialogResult callback = addCustomer.ShowDialog(this);

            if (DialogResult.OK == callback)
            {
                RefreshList();
            }
        }
Exemplo n.º 2
0
        private void FillOLV()
        {
            try
            {
                ovlCustomer.Clear();
                var modelType = typeof(CustomerModel);
                List <ListViewColumnsInfo> list = new List <ListViewColumnsInfo>();
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 100, Header = helper.GetMemberName((CustomerModel c) => c.Customer_Id), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 300, Header = helper.GetMemberName((CustomerModel c) => c.Comp_Name), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 100, Header = helper.GetMemberName((CustomerModel c) => c.Cust_Mobileno), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 100, Header = helper.GetMemberName((CustomerModel c) => c.Address), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 100, Header = helper.GetMemberName((CustomerModel c) => c.VatNo), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 55, Header = helper.GetMemberName((CustomerModel c) => c.IsActive), Visible = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 50, Header = helper.GetMemberName((CustomerModel c) => c.Update), Visible = true, IsButton = true
                });
                list.Add(new ListViewColumnsInfo()
                {
                    ColumnSize = 50, Header = helper.GetMemberName((CustomerModel c) => c.Delete), Visible = true, IsButton = true
                });
                helper.GenerateListView(ovlCustomer, list);
                this.ovlCustomer.ButtonClick += delegate(object sender, CellClickEventArgs e)
                {
                    switch (e.ColumnIndex)
                    {
                    case 6:
                        FrmAddEditCustomer addCustomer = new FrmAddEditCustomer(e.Model as CustomerModel);
                        AddEdit(addCustomer);
                        break;

                    case 7:
                        var          model  = e.Model as CustomerModel;
                        DialogResult result = MessageBox.Show(String.Format("Are you sure? you want to delete measurement => {0}", model.Comp_Name), "Delete!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (result.Equals(DialogResult.Yes))
                        {
                            reciever.Delete(model);
                            RefreshList();
                        }
                        break;
                    }
                };
            }
            catch (Exception err) { err.GetBaseException(); }
        }
Exemplo n.º 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FrmAddEditCustomer addCustomer = new FrmAddEditCustomer();

            AddEdit(addCustomer);
        }