Ejemplo n.º 1
0
        public async Task <ActionResult> Shipper(string keyword, int?pageIndex)
        {
            return(await Task.Run <ActionResult>(() =>
            {
                var getCRMShippersByConditionRequest = new GetShippersByConditionRequest();
                getCRMShippersByConditionRequest.SearchCondition = new ShipperSearchCondition()
                {
                    KeyWord = keyword
                };
                getCRMShippersByConditionRequest.PageSize = BasicFramework.Common.Constants.PAGESIZE;
                getCRMShippersByConditionRequest.PageIndex = pageIndex ?? 0;

                ShipperViewModel vm = new ShipperViewModel();
                var getCRMShippersByConditionResponse = new ShipperManagementService().GetShippersByCondition(getCRMShippersByConditionRequest);

                if (getCRMShippersByConditionResponse.IsSuccess)
                {
                    vm.CRMShipperCollection = getCRMShippersByConditionResponse.Result.ShipperCollection;
                    vm.PageIndex = getCRMShippersByConditionResponse.Result.PageIndex;
                    vm.PageCount = getCRMShippersByConditionResponse.Result.PageCount;
                }
                else
                {
                    throw new Exception(getCRMShippersByConditionResponse.Exception.Message);
                }
                return Json(vm, JsonRequestBehavior.AllowGet);
            }));
        }
Ejemplo n.º 2
0
        public string ImputShippers()
        {
            if (Request.Files.Count > 0)
            {
                HttpPostedFileBase hpf = Request.Files[0] as HttpPostedFileBase;
                if (hpf.ContentLength > 0)
                {
                    try
                    {
                        DataSet ds = this.GetDataFromExcel(hpf);
                        for (int j = 0; j < ds.Tables.Count; j++)
                        {
                            if (ds != null && ds.Tables[j] != null)
                            {
                                IList <InsertShipperExcel> crmshipper = new List <InsertShipperExcel>();
                                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                {
                                    crmshipper.Add(new InsertShipperExcel()
                                    {
                                        Name          = ds.Tables[0].Rows[i]["公司名称"].ToString().Trim(),
                                        TransportMode = ds.Tables[0].Rows[i]["运输方式"].ToString().Trim(),
                                        Code          = ds.Tables[0].Rows[i]["公司名称"].ToString().Trim(),
                                        Creater       = base.UserInfo.Name,
                                        CreateTime    = DateTime.Now
                                    });
                                }

                                var response = new ShipperManagementService().InsertCRMShipperExecl(new GetCRMShippersByConditionRequest()
                                {
                                    InsertShipper = crmshipper
                                });
                                if (response)
                                {
                                    return(new { result = "导入成功!", IsSuccess = true }.ToString());
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    return(new { result = "<h3>导入失败!</h3><br/>excel内容有误!", IsSuccess = false }.ToString());
                }
                return(new { result = "文件内容为空", IsSuccess = false }.ToString());
            }
            return(new { result = "请选择文件", IsSuccess = false }.ToString());
        }
Ejemplo n.º 3
0
        public ActionResult DeleteCRMShipperCooperation(long id)
        {
            var response = new ShipperManagementService().DeleteCRMShipperCooperation(new CRMShipperOperationRequest()
            {
                CRMShipperCooperationID = id
            });

            if (response.IsSuccess)
            {
                return(Json(new { Message = "删除成功", IsSuccess = true }));
            }
            else
            {
                return(Json(new { Message = "删除失败!", IsSuccess = false }));
            }
        }
Ejemplo n.º 4
0
        public ActionResult InsertCRMShipperTransportationLine(long id, string StartPlaceID, string StartPlaceName, string EndPlaceID, string EndPlaceName, string CoverRegionID, string CoverRegionName, int Period)
        {
            var startPlaceIDArray    = StartPlaceID.Split(',');
            var startPlaceNameArray  = StartPlaceName.Split(',');
            var endPlaceIDArray      = EndPlaceID.Split(',');
            var endPlaceNameArray    = EndPlaceName.Split(',');
            var coverRegionIDArray   = CoverRegionID.Split(',');
            var coverRegionNameArray = CoverRegionName.Split(',');

            IList <CRMShipperTransportationLine> lines = new List <CRMShipperTransportationLine>();

            for (int i = 0; i < startPlaceIDArray.Length; i++)
            {
                for (int j = 0; j < endPlaceIDArray.Length; j++)
                {
                    for (int k = 0; k < coverRegionIDArray.Length; k++)
                    {
                        lines.Add(new CRMShipperTransportationLine()
                        {
                            ID              = 0,
                            CRMShipperID    = id,
                            StartCityID     = startPlaceIDArray[i].ObjectToInt64(),
                            StartCityName   = startPlaceNameArray[i],
                            EndCityID       = endPlaceIDArray[j].ObjectToInt64(),
                            EndCityName     = endPlaceNameArray[j],
                            CoverRegionID   = coverRegionIDArray[k].ObjectToInt64(),
                            CoverRegionName = coverRegionNameArray[k],
                            Period          = Period
                        });
                    }
                }
            }

            var response = new ShipperManagementService().AddOrUpdateCRMShipperTransportationLines(new AddOrUpdateCRMShipperTransportationLineRequest()
            {
                CRMShipperTransportationLineCollection = lines
            });

            if (response.IsSuccess)
            {
                return(Json(new { Message = "新增成功", IsSuccess = true, Lines = response.Result.ToJsonString() }));
            }

            return(Json(new { Message = "新增线路失败!", IsSuccess = false }));
        }
Ejemplo n.º 5
0
        public ActionResult CRMShipperTerminalInfoManage(long id, int?ViewType)
        {
            CRMShipperTerminalInfoManageViewModel vm = new CRMShipperTerminalInfoManageViewModel();

            vm.CRMShipperID = id;
            vm.ViewType     = ViewType ?? 0;

            var getCRMShipperTerminalInfoResponse = new ShipperManagementService().GetCRMShipperTerminalInfos(new CRMShipperOperationRequest()
            {
                CRMShipperID = id
            });

            if (getCRMShipperTerminalInfoResponse.IsSuccess)
            {
                vm.CRMShipperTerminalInfoCollection = getCRMShipperTerminalInfoResponse.Result;
            }

            return(View(vm));
        }
Ejemplo n.º 6
0
        public ActionResult ShipperTransportationLine(long id, int?ViewType)
        {
            ShipperTransportationLineViewModel vm = new ShipperTransportationLineViewModel();

            vm.CRMShipperID = id;
            vm.ViewType     = ViewType ?? 0;

            var getCRMShipperTransportationLinesResponse = new ShipperManagementService().GetCRMShipperTransportationLines(new CRMShipperOperationRequest()
            {
                CRMShipperID = id
            });

            if (getCRMShipperTransportationLinesResponse.IsSuccess)
            {
                vm.ShipperTransportationLineCollection = getCRMShipperTransportationLinesResponse.Result;
            }

            return(View(vm));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 通过ID查询到承运商
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <Shipper> GetShipperList()
        {
            var list = (IEnumerable <Shipper>)CacheHelper.Get("ShipperList", () =>
            {
                ShipperManagementService service = new ShipperManagementService();
                var ShipperList = service.GetShipperList().Result;

                if (ShipperList == null || !ShipperList.Any())
                {
                    new List <Shipper>();  //为空
                }
                lock (lockobject)
                {
                    CacheHelper.Insert("ShipperList", ShipperList);
                }
            });

            return(list);
        }
Ejemplo n.º 8
0
        public ActionResult CRMShipperCooperationManage(long id, int?ViewType)
        {
            CRMShipperCooperationManageViewModel vm = new CRMShipperCooperationManageViewModel();

            vm.CRMShipperID      = id;
            vm.ViewType          = ViewType ?? 0;
            vm.AttachmentGroupID = Guid.NewGuid().ToString();

            var getCRMShipperCooperationsResponse = new ShipperManagementService().GetCRMShipperCooperations(new CRMShipperOperationRequest()
            {
                CRMShipperID = id
            });

            if (getCRMShipperCooperationsResponse.IsSuccess)
            {
                vm.CRMShipperCooperationCollection = getCRMShipperCooperationsResponse.Result;
            }

            return(View(vm));
        }
Ejemplo n.º 9
0
        public async Task <ActionResult> ShipperInfos(int?id)
        {
            return(await Task.Run <ActionResult>(() =>
            {
                ShipperInfosModel vm = new ShipperInfosModel();
                var getCRMShipperResponse = new ShipperManagementService().GetCRMShipperInfo(new CRMShipperOperationRequest()
                {
                    CRMShipperID = id
                });
                if (getCRMShipperResponse.IsSuccess)
                {
                    vm.Shipper = getCRMShipperResponse.Result.Shipper;
                    if (vm.Shipper == null)
                    {
                        vm.Shipper = new Shipper();
                    }

                    vm.CRMShipperCooperationCollection = getCRMShipperResponse.Result.ShipperCooperationCollection;
                    vm.CRMShipperTransportationLineCollection = getCRMShipperResponse.Result.ShipperTransportationLineCollection;
                    vm.CRMShipperTerminalInfoCollection = getCRMShipperResponse.Result.ShipperTerminalInfoCollection;

                    if (string.IsNullOrEmpty(vm.Shipper.Str3))
                    {
                        vm.Shipper.Str3 = Guid.NewGuid().ToString();
                    }

                    if (string.IsNullOrEmpty(vm.Shipper.AttachmentGroupID))
                    {
                        vm.Shipper.AttachmentGroupID = Guid.NewGuid().ToString();
                    }
                }
                else
                {
                    throw new Exception(getCRMShipperResponse.Exception.Message);
                }
                return View(vm);
            }));
        }
Ejemplo n.º 10
0
        public async Task <ActionResult> Shipper()
        {
            return(await Task.Run <ActionResult>(() =>
            {
                ShipperViewModel vm = new ShipperViewModel();

                var getCRMShippersByConditionRequest = new GetShippersByConditionRequest();
                getCRMShippersByConditionRequest.SearchCondition = new ShipperSearchCondition();
                getCRMShippersByConditionRequest.PageSize = BasicFramework.Common.Constants.PAGESIZE;
                getCRMShippersByConditionRequest.PageIndex = 0;

                var getCRMShippersByConditionResponse = new ShipperManagementService().GetShippersByCondition(getCRMShippersByConditionRequest);

                if (getCRMShippersByConditionResponse.IsSuccess)
                {
                    vm.CRMShipperCollection = getCRMShippersByConditionResponse.Result.ShipperCollection;
                    vm.PageIndex = getCRMShippersByConditionResponse.Result.PageIndex;
                    vm.PageCount = getCRMShippersByConditionResponse.Result.PageCount;
                }

                return View(vm);
            }));
        }
Ejemplo n.º 11
0
        public ActionResult Create(CRMShipperOperationViewModel vm)
        {
            if (vm.PostedDeliveryOfVehicleTypes != null && vm.PostedDeliveryOfVehicleTypes.Any())
            {
                StringBuilder deliveryOfVehicleSB = new StringBuilder();
                vm.PostedDeliveryOfVehicleTypes.Each((i, s) => {
                    deliveryOfVehicleSB.Append(s).Append("|");
                });
                deliveryOfVehicleSB.Remove(deliveryOfVehicleSB.Length - 1, 1);
                vm.CRMShipper.DeliveryOfVehicleType = deliveryOfVehicleSB.ToString();
            }

            if (vm.PostedSixCards != null && vm.PostedSixCards.Any())
            {
                StringBuilder sixCardsSB = new StringBuilder();
                vm.PostedSixCards.Each((i, s) =>
                {
                    sixCardsSB.Append(s).Append("|");
                });
                sixCardsSB.Remove(sixCardsSB.Length - 1, 1);
                vm.CRMShipper.SixCard = sixCardsSB.ToString();
            }

            if (vm.PostedTermialOfVehicleTypes != null && vm.PostedTermialOfVehicleTypes.Any())
            {
                StringBuilder termialOfVehicleTypeSB = new StringBuilder();
                vm.PostedTermialOfVehicleTypes.Each((i, s) =>
                {
                    termialOfVehicleTypeSB.Append(s).Append("|");
                });
                termialOfVehicleTypeSB.Remove(termialOfVehicleTypeSB.Length - 1, 1);
                vm.CRMShipper.TermialOfVehicleType = termialOfVehicleTypeSB.ToString();
            }

            if (vm.PostedTransportModes != null && vm.PostedTransportModes.Any())
            {
                StringBuilder transportModesSB = new StringBuilder();
                vm.PostedTransportModes.Each((i, s) =>
                {
                    transportModesSB.Append(s).Append("|");
                });
                transportModesSB.Remove(transportModesSB.Length - 1, 1);
                vm.CRMShipper.TransportMode = transportModesSB.ToString();
            }


            if (vm.PostedTrunkOfVehicleTypes != null && vm.PostedTrunkOfVehicleTypes.Any())
            {
                StringBuilder trunkOfVehicleTypesSB = new StringBuilder();
                vm.PostedTrunkOfVehicleTypes.Each((i, s) =>
                {
                    trunkOfVehicleTypesSB.Append(s).Append("|");
                });
                trunkOfVehicleTypesSB.Remove(trunkOfVehicleTypesSB.Length - 1, 1);
                vm.CRMShipper.TrunkOfVehicleType = trunkOfVehicleTypesSB.ToString();
            }
            //创建时间,创建人,更新时间,更新人
            if (vm.ViewType == 1)
            {
                vm.CRMShipper.Creator    = base.UserInfo.Name;
                vm.CRMShipper.CreateTime = DateTime.Now;
            }

            vm.CRMShipper.UpdateTime = DateTime.Now;
            vm.CRMShipper.Updator    = base.UserInfo.Name;
            //
            var insertOrUpdateCRMShipperResponse = new ShipperManagementService().AddOrUpdateCRMShippers(new AddOrUpdateCRMShippersRequest()
            {
                CRMShipperCollection = new List <CRMShipper> {
                    vm.CRMShipper
                }
            });


            // 插入更新结果如果成功
            if (insertOrUpdateCRMShipperResponse.IsSuccess)
            {
                if (insertOrUpdateCRMShipperResponse.Result != null && insertOrUpdateCRMShipperResponse.Result.Any())
                {
                    long id = insertOrUpdateCRMShipperResponse.Result.First();
                    var  getCRMShipperResponse = new ShipperManagementService().GetCRMShipperInfo(new CRMShipperOperationRequest()
                    {
                        CRMShipperID = id
                    });
                    if (getCRMShipperResponse.IsSuccess)
                    {
                        vm.ViewType   = 0;
                        vm.CRMShipper = getCRMShipperResponse.Result.CRMShipper;
                        vm.CRMShipperCooperationCollection        = getCRMShipperResponse.Result.CRMShipperCooperationCollection;
                        vm.CRMShipperTransportationLineCollection = getCRMShipperResponse.Result.CRMShipperTransportationLineCollection;
                        return(View(vm));
                    }
                }
            }
            return(View(vm));
        }
Ejemplo n.º 12
0
        public ActionResult Create(long?id, int?ViewType)
        {
            CRMShipperOperationViewModel vm = new CRMShipperOperationViewModel();

            if (!id.HasValue)
            {
                vm.ViewType   = 1;
                vm.CRMShipper = new CRMShipper();
                vm.CRMShipper.AttachmentGroupID = Guid.NewGuid().ToString();
                vm.CRMShipper.Str3 = Guid.NewGuid().ToString();
            }
            else
            {
                var getCRMShipperResponse = new ShipperManagementService().GetCRMShipperInfo(new CRMShipperOperationRequest()
                {
                    CRMShipperID = id
                });
                if (getCRMShipperResponse.IsSuccess)
                {
                    vm.CRMShipper = getCRMShipperResponse.Result.CRMShipper;
                    if (vm.CRMShipper == null)
                    {
                        vm.CRMShipper = new CRMShipper();
                    }

                    if (!string.IsNullOrEmpty(vm.CRMShipper.DeliveryOfVehicleType))
                    {
                        IList <SelectListItem> selectedDeliveryOfVehicleTypes = new List <SelectListItem>();
                        vm.CRMShipper.DeliveryOfVehicleType.Split('|').Each((i, s) => {
                            selectedDeliveryOfVehicleTypes.Add(new SelectListItem()
                            {
                                Text = s, Value = s
                            });
                        });
                        vm.SelectedDeliveryOfVehicleTypes = selectedDeliveryOfVehicleTypes;
                    }

                    if (!string.IsNullOrEmpty(vm.CRMShipper.SixCard))
                    {
                        IList <SelectListItem> selectedSixCards = new List <SelectListItem>();
                        vm.CRMShipper.SixCard.Split('|').Each((i, s) =>
                        {
                            selectedSixCards.Add(new SelectListItem()
                            {
                                Text = s, Value = s
                            });
                        });
                        vm.SelectedSixCards = selectedSixCards;
                    }

                    if (!string.IsNullOrEmpty(vm.CRMShipper.TermialOfVehicleType))
                    {
                        IList <SelectListItem> selectedTermialOfVehicleTypes = new List <SelectListItem>();
                        vm.CRMShipper.TermialOfVehicleType.Split('|').Each((i, s) =>
                        {
                            selectedTermialOfVehicleTypes.Add(new SelectListItem()
                            {
                                Text = s, Value = s
                            });
                        });
                        vm.SelectedTermialOfVehicleTypes = selectedTermialOfVehicleTypes;
                    }

                    if (!string.IsNullOrEmpty(vm.CRMShipper.TransportMode))
                    {
                        IList <SelectListItem> selectedTransportModes = new List <SelectListItem>();
                        vm.CRMShipper.TransportMode.Split('|').Each((i, s) =>
                        {
                            selectedTransportModes.Add(new SelectListItem()
                            {
                                Text = s, Value = s
                            });
                        });
                        vm.SelectedTransportModes = selectedTransportModes;
                    }

                    if (!string.IsNullOrEmpty(vm.CRMShipper.TrunkOfVehicleType))
                    {
                        IList <SelectListItem> selectedTrunkOfVehicleTypes = new List <SelectListItem>();
                        vm.CRMShipper.TrunkOfVehicleType.Split('|').Each((i, s) =>
                        {
                            selectedTrunkOfVehicleTypes.Add(new SelectListItem()
                            {
                                Text = s, Value = s
                            });
                        });
                        vm.SelectedTrunkOfVehicleTypes = selectedTrunkOfVehicleTypes;
                    }

                    vm.CRMShipperCooperationCollection        = getCRMShipperResponse.Result.CRMShipperCooperationCollection;
                    vm.CRMShipperTransportationLineCollection = getCRMShipperResponse.Result.CRMShipperTransportationLineCollection;
                    vm.CRMShipperTerminalInfoCollection       = getCRMShipperResponse.Result.CRMShipperTerminalInfoCollection;

                    if (string.IsNullOrEmpty(vm.CRMShipper.Str3))
                    {
                        vm.CRMShipper.Str3 = Guid.NewGuid().ToString();
                    }

                    if (string.IsNullOrEmpty(vm.CRMShipper.AttachmentGroupID))
                    {
                        vm.CRMShipper.AttachmentGroupID = Guid.NewGuid().ToString();
                    }
                }

                if (!ViewType.HasValue)
                {
                    vm.ViewType = 0;
                }
                else
                {
                    vm.ViewType = ViewType.Value;
                }

                if (base.UserInfo.ProjectRoleID == 28)
                {
                    vm.ShowEditButton = true;
                }
                else
                {
                    vm.ShowEditButton = false;
                }
            }

            return(View(vm));
        }
Ejemplo n.º 13
0
        public ActionResult Index(bool?useSession)
        {
            QueryCRMShipperViewModel vm = new QueryCRMShipperViewModel();

            vm.PageIndex = 0;
            vm.PageCount = 0;

            ///特殊业务,要求只有特定的人员才能进行修改操作
            if (base.UserInfo.ProjectRoleID == 28)
            {
                vm.ShowEditButton = true;
            }
            else
            {
                vm.ShowEditButton = false;
            }

            if (useSession.HasValue && useSession.Value)
            {
                if (Session["ShipperCRM_SearchCondition"] != null)
                {
                    vm.SearchCondition = (CRMShipperSearchCondition)Session["ShipperCRM_SearchCondition"];
                    vm.PageIndex       = Session["ShipperCRM_PageIndex"] != null ? (int)Session["ShipperCRM_PageIndex"] : 0;

                    //bukan
                    if (!string.IsNullOrEmpty(vm.SearchCondition.TransportMode))
                    {
                        IList <SelectListItem> selectedtransportModeTypes = new List <SelectListItem>();
                        vm.SearchCondition.TransportMode.Split('|').Each((i, s) =>
                        {
                            selectedtransportModeTypes.Add(new SelectListItem()
                            {
                                Text = s, Value = s
                            });
                        });

                        vm.SelectedTransportModes = selectedtransportModeTypes;
                    }

                    if (!string.IsNullOrEmpty(vm.SearchCondition.ProductType))
                    {
                        IList <SelectListItem> selectedProductTypes = new List <SelectListItem>();
                        vm.SearchCondition.ProductType.Split('|').Each((i, s) =>
                        {
                            selectedProductTypes.Add(new SelectListItem()
                            {
                                Text = s, Value = s
                            });
                        });

                        vm.SelectedProductTypes = selectedProductTypes;
                    }
                }
                else
                {
                    vm.SearchCondition = new CRMShipperSearchCondition();
                    vm.PageIndex       = 0;
                }

                var getCRMShippersByConditionResponse = new ShipperManagementService().GetCRMShippersByCondition(new GetCRMShippersByConditionRequest()
                {
                    SearchCondition = vm.SearchCondition,
                    PageSize        = UtilConstants.PAGESIZE,
                    PageIndex       = vm.PageIndex,
                });

                if (getCRMShippersByConditionResponse.IsSuccess)
                {
                    vm.CRMShipperCollection = getCRMShippersByConditionResponse.Result.CRMShipperCollection;
                    vm.PageIndex            = getCRMShippersByConditionResponse.Result.PageIndex;
                    vm.PageCount            = getCRMShippersByConditionResponse.Result.PageCount;
                }
            }
            else
            {
                vm.SearchCondition = new CRMShipperSearchCondition();
            }

            return(View(vm));
        }
Ejemplo n.º 14
0
        public ActionResult Index(QueryCRMShipperViewModel vm, int?PageIndex, string Action)
        {
            if (vm.PostedTransportModes != null && vm.PostedTransportModes.Any())
            {
                StringBuilder transportModeSB = new StringBuilder();
                vm.PostedTransportModes.Each((i, s) =>
                {
                    transportModeSB.Append(s).Append("|");
                });
                transportModeSB.Remove(transportModeSB.Length - 1, 1);
                vm.SearchCondition.TransportMode = transportModeSB.ToString();
            }

            if (vm.PostedProductTypes != null && vm.PostedProductTypes.Any())
            {
                StringBuilder postedProductTypesSB = new StringBuilder();
                vm.PostedProductTypes.Each((i, s) =>
                {
                    postedProductTypesSB.Append(s).Append("|");
                });
                postedProductTypesSB.Remove(postedProductTypesSB.Length - 1, 1);
                vm.SearchCondition.ProductType = postedProductTypesSB.ToString();
            }
            //查询导出
            var getCRMShippersByConditionRequest = new GetCRMShippersByConditionRequest();

            if (Action == "查询" || Action == "Index")
            {
                getCRMShippersByConditionRequest.SearchCondition = vm.SearchCondition;
                getCRMShippersByConditionRequest.PageSize        = UtilConstants.PAGESIZE;
                getCRMShippersByConditionRequest.PageIndex       = PageIndex ?? 0;
            }
            else if (Action == "导出")
            {
                getCRMShippersByConditionRequest.SearchCondition = vm.SearchCondition;
                getCRMShippersByConditionRequest.PageSize        = 0;
                getCRMShippersByConditionRequest.PageIndex       = 0;
            }

            var getCRMShippersByConditionResponse = new ShipperManagementService().GetCRMShippersByCondition(getCRMShippersByConditionRequest);


            if (getCRMShippersByConditionResponse.IsSuccess)
            {
                if (!string.IsNullOrEmpty(vm.SearchCondition.TransportMode))
                {
                    IList <SelectListItem> selectedtransportModeTypes = new List <SelectListItem>();
                    vm.SearchCondition.TransportMode.Split('|').Each((i, s) =>
                    {
                        selectedtransportModeTypes.Add(new SelectListItem()
                        {
                            Text = s, Value = s
                        });
                    });

                    vm.SelectedTransportModes = selectedtransportModeTypes;
                }

                if (!string.IsNullOrEmpty(vm.SearchCondition.ProductType))
                {
                    IList <SelectListItem> selectedProductTypes = new List <SelectListItem>();
                    vm.SearchCondition.ProductType.Split('|').Each((i, s) =>
                    {
                        selectedProductTypes.Add(new SelectListItem()
                        {
                            Text = s, Value = s
                        });
                    });

                    vm.SelectedProductTypes = selectedProductTypes;
                }

                vm.CRMShipperCollection = getCRMShippersByConditionResponse.Result.CRMShipperCollection;
                vm.PageIndex            = getCRMShippersByConditionResponse.Result.PageIndex;
                vm.PageCount            = getCRMShippersByConditionResponse.Result.PageCount;
                Session["ShipperCRM_SearchCondition"] = vm.SearchCondition;
                Session["ShipperCRM_PageIndex"]       = vm.PageIndex;

                if (Action == "导出")
                {
                    return(this.Export(getCRMShippersByConditionResponse.Result.CRMShipperCollection));
                }
            }

            return(View(vm));
        }
Ejemplo n.º 15
0
        public ActionResult Index( )
        {
            ShipperIndexViewModel vm = new ShipperIndexViewModel();

            ShipperSearchCondition ss = new ShipperSearchCondition();

            vm.ShipperSearchCondition = ss;

            //vm.PageIndex = 0;
            //vm.PageCount = 0;
            vm.ShowEditButton = true;

            //if (useSession.HasValue && useSession.Value)
            //{

            //if (Session["ShipperCRM_SearchCondition"] != null)
            //{
            //    vm.ShipperSearchCondition = (ShipperSearchCondition)Session["ShipperCRM_SearchCondition"];
            //    vm.PageIndex = Session["ShipperCRM_PageIndex"] != null ? (int)Session["ShipperCRM_PageIndex"] : 0;

            //bukan
            if (!string.IsNullOrEmpty(vm.ShipperSearchCondition.TransportMode))
            {
                IList <SelectListItem> selectedtransportModeTypes = new List <SelectListItem>();
                vm.ShipperSearchCondition.TransportMode.Split('|').Each((i, s) =>
                {
                    selectedtransportModeTypes.Add(new SelectListItem()
                    {
                        Text = s, Value = s
                    });
                });

                vm.SelectedTransportModes = selectedtransportModeTypes;
            }

            if (!string.IsNullOrEmpty(vm.ShipperSearchCondition.ProductType))
            {
                IList <SelectListItem> selectedProductTypes = new List <SelectListItem>();
                vm.ShipperSearchCondition.ProductType.Split('|').Each((i, s) =>
                {
                    selectedProductTypes.Add(new SelectListItem()
                    {
                        Text = s, Value = s
                    });
                });

                vm.SelectedProductTypes = selectedProductTypes;
            }

            //else
            //{
            //    vm.ShipperSearchCondition = new ShipperSearchCondition();
            //    vm.PageIndex = 0;
            //}

            var getCRMShippersByConditionResponse = new ShipperManagementService().GetShippersByCondition(new GetShippersByConditionRequest()
            {
                SearchCondition = vm.ShipperSearchCondition,
                PageSize        = UtilConstants.PAGESIZE,
                PageIndex       = vm.PageIndex,
            });

            if (getCRMShippersByConditionResponse.IsSuccess)
            {
                vm.ShipperCollection = getCRMShippersByConditionResponse.Result.ShipperCollection;
                vm.PageIndex         = getCRMShippersByConditionResponse.Result.PageIndex;
                vm.PageCount         = getCRMShippersByConditionResponse.Result.PageCount;
            }

            //else
            //{
            //    vm.ShipperSearchCondition = new ShipperSearchCondition();
            //}

            return(View(vm));
        }