private void Changed(object sender, CellValueChangedEventArgs e) { if (e.Column.Name != "clState") { if (CurrentModel.Id > 0) { PodView.SetRowCellValue(e.RowHandle, PodView.Columns["StateChange"], EnumStateChange.Update); } if (CurrentModel.Id == 0) { PodView.SetRowCellValue(e.RowHandle, PodView.Columns["StateChange"], EnumStateChange.Insert); } var ds = PodView.DataSource as List <FranchiseCommissionModel>; if (ds != null) { var checkeds = ds.Where(d => d.Checked.Equals(true)).ToList(); tbxTtlPod.Value = checkeds.Count(); tbxTtlPiece.Value = checkeds.Sum(c => c.TtlPiece); tbxTtlWeight.Value = checkeds.Sum(c => c.TtlGrossWeight); tbxTtlChargeable.Value = checkeds.Sum(c => c.TtlChargeableWeight); TtlSales = checkeds.Sum(c => c.TotalSales); TtlPpn = checkeds.Sum(c => c.PPN); TtlCommission = checkeds.Sum(c => c.Commission); TtlPph = checkeds.Sum(c => c.PPH23); TtlNetCommission = checkeds.Sum(c => c.TotalNetCommission); Balance = checkeds.Sum(c => c.Debs); } } }
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(); }
private void Changing(object sender, CellValueChangedEventArgs e) { if (e.Column.Name == "clChecked") { if (!(bool)PodView.GetRowCellValue(e.RowHandle, PodView.Columns["Checked"])) { PodView.SetRowCellValue(e.RowHandle, PodView.Columns["Checked"], true); } else { PodView.SetRowCellValue(e.RowHandle, PodView.Columns["Checked"], false); } } }