コード例 #1
0
ファイル: Customers.cs プロジェクト: gayanishakaraw/Invent
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == dataGridView1.Columns["Save"].Index)
            {
                if (!Access.Instance.CanProceed(Modules.Inventory, Actions.Edit))
                {
                    return;
                }

                DataAccess.Models.Customer record = (DataAccess.Models.Customer)dataGridView1.Rows[e.RowIndex].DataBoundItem;
                record.CompanyId      = Session.Instance.AuthUser.CompanyId;
                record.RegisteredDate = DateTime.Now;
                CustomerBS.AddCustomer(record);
                PopulateCustomers();

                return;
            }
            if (e.ColumnIndex == dataGridView1.Columns["Delete"].Index)
            {
                if (!Access.Instance.CanProceed(Modules.Inventory, Actions.Edit))
                {
                    return;
                }

                CustomerBS.DeleteCustomer(((DataAccess.Models.Customer)dataGridView1.Rows[e.RowIndex].DataBoundItem).CustomerId);
                PopulateCustomers();

                return;
            }
        }
コード例 #2
0
 public CustomerPage()
 {
     this.InitializeComponent();
     SetStatusTextBox(false);
     controller = new CustomerBS();
 }