public string VehicleToDriver(string vehicleNo, long VID, int?Index) { VehicleToDriverViewModel vd = new VehicleToDriverViewModel(); vd.PageIndex = Index ?? 0; vd.VID = (VID); vd.VehicleNo = vehicleNo; var request = new GetCRMDriverByConditionRequest(); int pagesize = 17; request.PageIndex = vd.PageIndex; request.PageSize = pagesize; var response = new DriverManagementService().GetAllDriver(request); if (response.IsSuccess) { vd.Driver = response.Result.CRMDriverCollection; vd.PageIndex = response.Result.PageIndex; vd.PageCount = response.Result.PageCount; } JavaScriptSerializer Serializer = new JavaScriptSerializer(); string js = Serializer.Serialize(response); return(js); }
//查询 public string SearchVehicleToDriver(string driverName)//int? Index, string Action { VehicleToDriverViewModel sv = new VehicleToDriverViewModel(); sv.DriverName = driverName; var request = new GetCRMDriverByConditionRequest(); int pagesize = 17; request.PageIndex = sv.PageIndex; request.PageSize = pagesize; request.driverName = driverName; var response = new DriverManagementService().GetAllDriver(request); if (response.IsSuccess) { sv.Driver = response.Result.CRMDriverCollection; sv.PageIndex = response.Result.PageIndex; sv.PageCount = response.Result.PageCount; } JavaScriptSerializer Serializer = new JavaScriptSerializer(); string js = Serializer.Serialize(response); return(js); }
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 CRMDriver addCreateDriver(GetCRMDriverByConditionRequest request) { CRMDriver CreateDriver = new CRMDriver(); try { CRMDriver Driver = new CRMDriver(); IList <CRMDriver> CRMDriver = new List <CRMDriver>(); CRMDriver.Add(request.AddDriver); DriverManagementAccessor accessor = new DriverManagementAccessor(); CreateDriver = accessor.AddOrUpdateCRMDriver(CRMDriver);// request.PageIndex, request.PageSize, out RowCount } catch (Exception) { throw; } return(CreateDriver); }
/// <summary> /// 通过车辆id查询该车由哪几位司机驾驶 /// </summary> /// <param name="request"></param> /// <returns></returns> public Response <GetCRMDriverByConditionResponse> GetVehicleMappingDriverVID(GetCRMDriverByConditionRequest request) { Response <GetCRMDriverByConditionResponse> response = new Response <GetCRMDriverByConditionResponse>() { Result = new GetCRMDriverByConditionResponse() }; if (request == null || request.SearchCondition == null) { ArgumentNullException ex = new ArgumentNullException("GetCRMVehicleByCondition request "); LogError(ex); response.ErrorCode = ErrorCode.Argument; response.Exception = ex; return(response); } try { DriverManagementAccessor accessor = new DriverManagementAccessor(); int RowCount; if (request.PageSize > 0) { response.Result.CRMDriverCollection = accessor.GetVehicleMappingDriverVID(request.keyword, request.PageIndex, request.PageSize, out RowCount); //request.PageIndex, request.PageSize, out RowCount response.Result.PageCount = RowCount % request.PageSize == 0 ? RowCount / request.PageSize : RowCount / request.PageSize + 1; response.Result.PageIndex = request.PageIndex; } else { response.Result.PageIndex = 0; response.Result.PageCount = 0; response.Result.CRMDriverCollection = accessor.GetCRMDriverByConditionNoPaging(request.SearchCondition); } response.IsSuccess = true; } catch (Exception ex) { LogError(ex); response.IsSuccess = false; response.ErrorCode = ErrorCode.Technical; } return(response); }