private void AddRow(object sender, EventArgs e) { if (tbxPod.Text == string.Empty) { return; } var found = false; for (var i = 0; i < PodView.RowCount; i++) { if (PodView.GetRowCellValue(i, PodView.Columns["ShipmentCode"]).ToString() == tbxPod.Text) { if (PodView.GetRowCellValue(i, PodView.Columns["StateChange"]).ToString() == EnumStateChange.Idle.ToString()) { PodView.SetRowCellValue(i, PodView.Columns["StateChange"], EnumStateChange.Insert); } if (PodView.GetRowCellValue(i, PodView.Columns["StateChange"]).ToString() == EnumStateChange.Select.ToString()) { PodView.SetRowCellValue(i, PodView.Columns["StateChange"], EnumStateChange.Update); } PodView.SetRowCellValue(i, PodView.Columns["Checked"], true); found = true; } } if (!found) { var shipment = new CorporatePickupDetailDataManager().GetShipmentPickup(tbxPod.Text); if (shipment != null) { var list = PodGrid.DataSource as List <CorporatePickupDetailModel>; if (list == null) { list = new List <CorporatePickupDetailModel>(); } list.Add(shipment); PodGrid.DataSource = list; PodView.RefreshData(); } else { MessageBox.Show(Resources.no_found_data, Resources.title_information, MessageBoxButtons.OK); } } tbxPod.Clear(); tbxPod.Focus(); summary(); }
public override void New() { base.New(); ClearForm(); EnabledForm(true); PodGrid.DataSource = new FranchiseCommissionDataManager().GetActiveCommission(BaseControl.FranchiseId); PodView.RefreshData(); cbxSetoran.SelectedIndex = 0; tbxDate.Focus(); }