Exemplo n.º 1
0
        public ESMSQueryInfoViewModel GetSMSQueryListViewModel(SmsQueryVehicleParam para)
        {
            IList<Guid> vehicleCodeList = para.vehicleCodelist;
            string customerName = para.CustomerName;
            string telephone = para.Telphone;
            string tenantCode = para.TenantCode;
            int pageIndex = para.PageIndex;
            int pageSize = para.PageSize;
            try
            {
                SMSQueryVehicleService sqv = new SMSQueryVehicleService();
                int rowCount = 0;

                 //IList<EMSMSQueryVehicle> queryList = sqv.GetSMSQueryList(vehicleCodeList, customerName, telephone, tenantCode, pageIndex, pageSize, ref rowCount);
                //代码优化后
                IList<EMSMSQueryVehicle> queryList = sqv.GetNewSMSQueryList(vehicleCodeList, customerName, telephone, tenantCode, pageIndex, pageSize, ref rowCount);
                ESMSQueryInfoViewModel MSmsQuery = new ESMSQueryInfoViewModel();
                if (queryList != null && queryList.Count > 0 && rowCount > 0)
                {
                    List<ESMSQueryViewModel> list = new List<ESMSQueryViewModel>();
                    for (int i = 0; i < queryList.Count; i++)
                    {
                        EMSMSQueryVehicle entity = queryList[i];
                        ESMSQueryViewModel model = new ESMSQueryViewModel();
                        model.Index = i + 1;
                        model.sms_vehicle_set_id = entity.sms_vehicle_set_id;
                        model.CreateDate = entity.CreateDate;
                        model.CustomerName = entity.CustomerName;
                        model.CustomerTelephone = entity.CustomerTelephone;
                        model.IsProfessional = entity.IsProfessional;
                        model.TenantCode = entity.TenantCode;
                        model.LicenseNumberDesc = entity.LicenseNumberDesc;
                        model.VehicleCodeList = entity.VehicleList;
                        list.Add(model);
                    }

                    MSmsQuery.userListViewModel = list;
                    MSmsQuery.RowCount = rowCount;

                }
                return MSmsQuery;
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                return null;
            }
        }