private void outletItemBindingSource_ListChanged(object sender, ListChangedEventArgs e) { // Exit if no project list if (m_List == null) { return; } // Get the item affected int index = e.NewIndex; outletItem changedOutlet = null; if ((index > -1) && (index < m_List.Count)) { changedOutlet = m_List[index]; } // Get the type of change that occured ListChangedType changeType = e.ListChangedType; // Dispatch a change handler switch (changeType) { case ListChangedType.ItemChanged: CommandCRUOutlet updateOutlet = new CommandCRUOutlet(changedOutlet, true); m_AppController.ExecuteCommand(updateOutlet); break; case ListChangedType.ItemMoved: // Not supported in this app break; } }
private void importBtn_Click(object sender, EventArgs e) { if (dataGridView1.DataSource == null) { return; } if (sourceTxt.Text == "" && sheetTxt.Text == "") { return; } foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value != null) { outletItem myItem = new outletItem(); myItem.OutletCode = row.Cells[2].Value.ToString(); myItem.OutletName = row.Cells[3].Value.ToString(); myItem.SlsmCode = row.Cells[0].Value.ToString(); myItem.OutletAddress = row.Cells[4].Value.ToString(); myItem.OutletRoute = row.Cells[5].Value.ToString(); myItem.OutletStatus = true; CommandCRUOutlet importData = new CommandCRUOutlet(); m_AppController.ExecuteCommand(importData); } } }
private void saveToolStripButton_Click(object sender, EventArgs e) { if (m_List == null) { return; } outletItem currentItem = (outletItem)outletItemBindingSource.Current; CommandCRUOutlet newOutlet = new CommandCRUOutlet(currentItem, false); m_AppController.ExecuteCommand(newOutlet); }