public ActionResult Create(string id, int?type)
        {
            QueryCRMDriverViewModel vi = new QueryCRMDriverViewModel();

            if (string.IsNullOrEmpty(id))
            {
                CRMDriver v = new CRMDriver();
                v.Str1            = Guid.NewGuid().ToString();
                v.Str2            = Guid.NewGuid().ToString();
                v.Str3            = Guid.NewGuid().ToString();
                v.Str4            = Guid.NewGuid().ToString();
                v.DriverIsServing = true;
                vi.CreateDriver   = v;
                vi.ViewType       = 0;
            }
            else
            {
                if (type == 1)
                {
                    var response = new DriverManagementService().GetSearcheDriver(id);
                    vi.CreateDriver = response;
                    vi.ViewType     = 1;
                }
                else
                {
                    var response = new DriverManagementService().GetSearcheDriver(id);
                    vi.CreateDriver = response;
                    vi.ViewType     = 0;
                }
            }
            return(View(vi));
        }
        public ActionResult Index(QueryCRMDriverViewModel di, string Action)
        {
            //查询导出
            var request = new GetCRMDriverByConditionRequest();

            if (Action == "查询" || Action == "Index")
            {
                request.SearchCondition = di.SearchCondition;
                request.PageSize        = UtilConstants.PAGESIZE;
                request.PageIndex       = di.PageIndex;
                di.ShowEditButton       = false;
                //特殊操作
                if (base.UserInfo.ProjectRoleID == 28 || base.UserInfo.ProjectRoleID == 1)
                {
                    di.ShowEditButton = true;
                }
            }
            else if (Action == "导出")
            {
                request.SearchCondition = di.SearchCondition;
                request.PageSize        = 0;
                request.PageIndex       = 0;
            }
            var response = new DriverManagementService().GetCRMDriverByCondition(request);

            //{
            //    SearchCondition = requset.SearchCondition,
            //    PageIndex = requset.PageIndex,
            //    PageSize = requset.PageSize
            //});
            if (response.IsSuccess)
            {
                //di.CRMDriverCollection = response.Result.CRMDriverCollection;
                //di.PageIndex = response.Result.PageIndex;
                //di.PageCount = response.Result.PageCount;
                //Session["DriverCRM_SearchCondition"] = di.SearchCondition;
                //Session["DriverCRM_PageIndex"] = di.PageIndex;

                //string uploadFolderPath = Runbow.TWS.Common.Constants.UPLOAD_AMS_PATH;//新路径
                if (Action == "导出")
                {
                    return(this.Export(response.Result.CRMDriverCollection));
                }
                else
                {
                    di.CRMDriverCollection = response.Result.CRMDriverCollection;
                    di.PageIndex           = response.Result.PageIndex;
                    di.PageCount           = response.Result.PageCount;
                }
            }
            return(View(di));
        }
        public ActionResult Index(bool?useSession)
        {
            QueryCRMDriverViewModel di = new QueryCRMDriverViewModel();

            di.SearchCondition = new CRMDriverSearchCondition();
            di.PageIndex       = 0;
            di.PageCount       = 0;
            di.ShowEditButton  = false;
            //特殊操作
            if (base.UserInfo.ProjectRoleID == 28 || base.UserInfo.ProjectRoleID == 1)
            {
                di.ShowEditButton = true;
            }

            //if (useSession.HasValue && useSession.Value)
            //{
            //    if (Session["DriverCRM_SearchCondition"] != null)
            //    {
            //        di.SearchCondition = (CRMDriverSearchCondition)Session["DriverCRM_SearchCondition"];
            //        di.PageIndex = Session["DriverCRM_PageIndex"] != null ? (int)Session["DriverCRM_PageIndex"] : 0;
            //    }
            //    else
            //    {
            //        di.SearchCondition = new CRMDriverSearchCondition();
            //        di.PageIndex = 0;
            //    }
            //}

            var getCRMDriverByConditionResponse = new DriverManagementService().GetCRMDriverByCondition(new GetCRMDriverByConditionRequest()
            {
                SearchCondition = di.SearchCondition,
                PageSize        = UtilConstants.PAGESIZE,
                PageIndex       = di.PageIndex,
            });

            if (getCRMDriverByConditionResponse.IsSuccess)
            {
                di.CRMDriverCollection = getCRMDriverByConditionResponse.Result.CRMDriverCollection;
                di.UserID    = base.UserInfo.ID.ToString();
                di.PageIndex = getCRMDriverByConditionResponse.Result.PageIndex;
                di.PageCount = getCRMDriverByConditionResponse.Result.PageCount;
            }

            //else
            //{
            //    //CRMDriverSearchCondition dri = new CRMDriverSearchCondition();
            //    //di.SearchCondition = dri;
            //    di.SearchCondition = new CRMDriverSearchCondition();
            //}
            return(View(di));
        }
        public ActionResult Create(QueryCRMDriverViewModel vi)
        {
            if (vi.ViewType == 1)
            {
                vi.CreateDriver.CreateUser = base.UserInfo.ID.ToString();
                vi.CreateDriver.CreateTime = DateTime.Now;
            }
            vi.CreateDriver.UpdateUser = base.UserInfo.ID.ToString();
            vi.CreateDriver.UpdateTime = DateTime.Now;


            var response = new DriverManagementService().addCreateDriver(new GetCRMDriverByConditionRequest()
            {
                AddDriver = vi.CreateDriver
            });

            vi.ViewType = 1;
            return(View(vi));
        }