public ShipmentListForm() { InitializeComponent(); form = this; Load += ShipmentListLoad; btnView.Click += (sender, args) => LoadGrid(); ShipmentView.RowCellStyle += ChangeColor; ShipmentView.CustomColumnDisplayText += NumberGrid; btnExcel.Click += (sender, args) => { var p = FilterVoid(); var shipments = new ShipmentDataManager().ShipmentListExport(p); GridExport.DataSource = shipments; ExportExcel(GridExport); }; GridShipment.DoubleClick += (o, args) => { var rows = ShipmentView.GetSelectedRows(); if (rows.Count() > 0) { BaseControl.OpenRelatedForm(new TrackingViewForm(), ShipmentView.GetRowCellValue(rows[0], "Code").ToString(), CallingCommand); } }; Shown += ShipmentListShow; }
public override void AfterDelete() { var ds = PodView.DataSource as List <FranchiseCommissionModel>; foreach (var o in ds) { var s = new ShipmentDataManager().GetFirst <ShipmentModel>(WhereTerm.Default(o.ShipmentId, "id")); s.PODStatus = (int)EnumPodStatus.None; new ShipmentDataManager().Update <ShipmentModel>(s); } base.AfterDelete(); }
private void LoadGrid() { if (tbxTo.Value.Subtract(tbxFrom.Value).Days > 31) { MessageBox.Show(@"Tidak bisa lebih dari 31 hari"); return; } var p = FilterVoid(); var shipments = new ShipmentDataManager().ShipmentList(p); GridShipment.DataSource = shipments; GridExport.DataSource = shipments; }
protected override void SaveDetail(bool isUpdate = false) { var details = PodGrid.DataSource as List <CorporatePickupDetailModel>; var manager = new CorporatePickupDetailDataManager(); var smanager = new ShipmentDataManager(); foreach (CorporatePickupDetailModel detail in details) { var pickupDetail = new CorporatePickupDetailModel(); var shipment = new ShipmentModel(); if (detail.StateChange == EnumStateChange.Insert && detail.Checked) { pickupDetail.Rowstatus = true; pickupDetail.Rowversion = DateTime.Now; pickupDetail.CorporatePickupId = CurrentModel.Id; pickupDetail.ShipmentId = detail.ShipmentId; pickupDetail.CreatedPc = Environment.MachineName; pickupDetail.Createdby = BaseControl.UserLogin; pickupDetail.Createddate = DateTime.Now; manager.Save <CorporatePickupDetailModel>(pickupDetail); shipment = smanager.GetFirst <ShipmentModel>(WhereTerm.Default(detail.ShipmentId, "id")); if (shipment != null) { shipment.PODStatus = (int)EnumPodStatus.PickedUp; shipment.ModifiedPc = Environment.MachineName; shipment.Modifiedby = BaseControl.UserLogin; shipment.Modifieddate = DateTime.Now; smanager.Update <ShipmentModel>(shipment); } } else if (detail.StateChange == EnumStateChange.Update && !detail.Checked) { manager.DeActive(detail.Id, BaseControl.UserLogin, DateTime.Now); shipment = smanager.GetFirst <ShipmentModel>(WhereTerm.Default(detail.ShipmentId, "id")); if (shipment != null) { shipment.PODStatus = (int)EnumPodStatus.None; shipment.ModifiedPc = Environment.MachineName; shipment.Modifiedby = BaseControl.UserLogin; shipment.Modifieddate = DateTime.Now; smanager.Update <ShipmentModel>(shipment); } } } }
protected override void SaveDetail(bool isUpdate = false) { var details = PodGrid.DataSource as List <FranchiseCommissionModel>; var manager = new FranchisePickupDetailDataManager(); var smanager = new ShipmentDataManager(); foreach (FranchiseCommissionModel detail in details) { var pickupDetail = new FranchisePickupDetailModel(); var shipment = new ShipmentModel(); if (detail.StateChange == EnumStateChange.Insert && detail.Checked) { pickupDetail.Rowstatus = true; pickupDetail.Rowversion = DateTime.Now; pickupDetail.FranchisePickupId = CurrentModel.Id; pickupDetail.ShipmentId = detail.ShipmentId; pickupDetail.CreatedPc = Environment.MachineName; pickupDetail.Createdby = BaseControl.UserLogin; pickupDetail.Createddate = DateTime.Now; manager.Save <FranchisePickupDetailModel>(pickupDetail); shipment = smanager.GetFirst <ShipmentModel>(WhereTerm.Default(detail.ShipmentId, "id")); if (shipment != null) { shipment.PODStatus = (int)EnumPodStatus.PickedUp; shipment.TrackingStatusId = (int)EnumTrackingStatus.Pickup; shipment.ModifiedPc = Environment.MachineName; shipment.Modifiedby = BaseControl.UserLogin; shipment.Modifieddate = DateTime.Now; smanager.Update <ShipmentModel>(shipment); } } else if (detail.StateChange == EnumStateChange.Update && !detail.Checked) { manager.DeActive(detail.Id, BaseControl.UserLogin, DateTime.Now); shipment = smanager.GetFirst <ShipmentModel>(WhereTerm.Default(detail.ShipmentId, "id")); if (shipment != null) { shipment.PODStatus = (int)EnumPodStatus.None; shipment.TrackingStatusId = (int)EnumTrackingStatus.FranchiseDataEntry; shipment.ModifiedPc = Environment.MachineName; shipment.Modifiedby = BaseControl.UserLogin; shipment.Modifieddate = DateTime.Now; smanager.Update <ShipmentModel>(shipment); } } } var voided = new ShipmentDataManager().Get <ShipmentModel>( new IListParameter[] { WhereTerm.Default(true, "voided"), WhereTerm.Default(5, "sales_type_id", EnumSqlOperator.Equals), WhereTerm.Default(BaseControl.FranchiseId, "franchise_id", EnumSqlOperator.Equals), WhereTerm.Default((int)EnumPodStatus.None, "pod_status") } ); foreach (var v in voided) { var pickupDetail = new FranchisePickupDetailModel(); pickupDetail.Rowstatus = true; pickupDetail.Rowversion = DateTime.Now; pickupDetail.FranchisePickupId = CurrentModel.Id; pickupDetail.ShipmentId = v.Id; pickupDetail.CreatedPc = Environment.MachineName; pickupDetail.Createdby = BaseControl.UserLogin; pickupDetail.Createddate = DateTime.Now; manager.Save <FranchisePickupDetailModel>(pickupDetail); v.PODStatus = (int)EnumPodStatus.PickedUp; v.ModifiedPc = Environment.MachineName; v.Modifiedby = BaseControl.UserLogin; v.Modifieddate = DateTime.Now; smanager.Update <ShipmentModel>(v); } }
protected override void SaveDetail(bool isUpdate = false) { var currnModel = CurrentModel as FranchiseDropPointModel; var details = GridShipment.DataSource as List <FranchiseDropPointPickup>; var manager = new FranchiseDropPointDetailDataManager(); var smanager = new ShipmentDataManager(); foreach (FranchiseDropPointPickup detail in details) { var pickupDetail = new FranchiseDropPointDetailModel(); var shipment = new ShipmentModel(); var status = new ShipmentStatusModel(); pickupDetail.Rowstatus = true; pickupDetail.Rowversion = DateTime.Now; pickupDetail.FranchiseDropPointId = CurrentModel.Id; pickupDetail.ShipmentId = detail.Id; pickupDetail.Createdby = BaseControl.UserLogin; pickupDetail.Createddate = DateTime.Now; manager.Save <FranchiseDropPointDetailModel>(pickupDetail); shipment = smanager.GetFirst <ShipmentModel>(WhereTerm.Default(detail.Id, "id")); if (shipment != null) { shipment.PODStatus = (int)EnumPodStatus.None; shipment.FranchiseId = BaseControl.FranchiseId; shipment.TrackingStatusId = (int)EnumTrackingStatus.AgentPickup; shipment.ModifiedPc = Environment.MachineName; shipment.Modifiedby = BaseControl.UserLogin; shipment.Modifieddate = DateTime.Now; smanager.Update <ShipmentModel>(shipment); new FranchiseCommissionDataManager().CalculateCommission(shipment, BaseControl.FranchiseId, BaseControl.UserLogin); var statusCurr = new ShipmentStatusDataManager().GetFirst <ShipmentStatusModel>(new IListParameter[] { WhereTerm.Default(detail.Id, "shipment_id"), WhereTerm.Default((int)EnumTrackingStatus.AgentPickup, "tracking_status_id") } ); if (statusCurr == null) { status.Rowstatus = true; status.Rowversion = DateTime.Now; status.DateProcess = DateTime.Now; status.ShipmentId = detail.Id; status.TrackingStatusId = (int)EnumTrackingStatus.AgentPickup; status.PositionStatusId = BaseControl.BranchId; status.PositionStatus = EnumPositionStatus.Agent.ToString(); status.BranchId = BaseControl.BranchId; status.StatusBy = BaseControl.UserLogin; status.Reference = currnModel.Code; status.Createdby = BaseControl.UserLogin; status.Createddate = DateTime.Now; new ShipmentStatusDataManager().Save <ShipmentStatusModel>(status); } } } }