Ejemplo n.º 1
0
        public BaseForm()
        {
            InitializeComponent();

            PageLimit      = 1;
            PodStatusModel = new ShipmentStatusModel();
            StartPosition  = FormStartPosition.CenterScreen;
        }
Ejemplo n.º 2
0
        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);
                    }
                }
            }
        }