Esempio n. 1
0
        // 修改
        public ResultContent UpdateSMSQuery(SmsQueryVehicleParam para)
        {
            ResultContent rc = new ResultContent();
            // 要校验
            try
            {
                ISMSQueryVehicleService sqv = new SMSQueryVehicleService();
                IdentityNoService identity = new IdentityNoService();
                EMSMSQueryVehicle entity = sqv.GetSMSQuery(para.smsid);

                //entity.CreateDate = DateTime.Now;
                entity.TenantCode = para.TenantCode;
                entity.CustomerName = para.CustomerName;
                entity.CustomerTelephone = para.Telphone;
                entity.IsProfessional = false;
                entity.SMSVehicle.Clear();
                if (!para.vehicleCodelist.IsNullOrEmpty())
                {
                    for (int i = 0; i < para.vehicleCodelist.Count; i++)
                    {
                        EMSMSVehicle vehicle = new EMSMSVehicle()
                        {
                            smsvehicle_id = identity.GetSMSVehicleID(),
                            VehicleCode = para.vehicleCodelist[i],
                            TenantCode = para.TenantCode,
                            LicenseNumber = para.LicenceNumberlist[i]
                        };
                        entity.SMSVehicle.Add(vehicle);
                    }
                }
                sqv.Modify(entity);
                rc.Result = true;
                rc.Message = "修改成功!";
            }
            catch (Exception ex)
            {
                rc.Result = false;
                rc.Message = ex.Message;
                Logger.Error(ex.Message, ex);
            }
            return rc;
        }
Esempio n. 2
0
        // 新增
        public ResultContent AddSMSQuery(SmsQueryVehicleParam para)
        {
            ResultContent rc = new ResultContent();
            try
            {
                // 要校验
                IdentityNoService identity = new IdentityNoService();
                EMSMSQueryVehicle entity = new EMSMSQueryVehicle();
                entity.sms_vehicle_set_id = identity.GetSMSQueryVehicleSettingID();
                entity.CreateDate = DateTime.Now;
                entity.TenantCode = para.TenantCode;
                entity.CustomerName = para.CustomerName;
                entity.CustomerTelephone = para.Telphone;
                entity.IsProfessional = false;
                if (!para.vehicleCodelist.IsNullOrEmpty())
                {
                    entity.SMSVehicle = new List<EMSMSVehicle>();
                    for (int i = 0; i < para.vehicleCodelist.Count; i++)
                    {
                        EMSMSVehicle vehicle = new EMSMSVehicle()
                        {
                            smsvehicle_id = identity.GetSMSVehicleID(),
                            VehicleCode = para.vehicleCodelist[i],
                            TenantCode = para.TenantCode,
                            LicenseNumber = para.LicenceNumberlist[i]
                        };

                        entity.SMSVehicle.Add(vehicle);
                    }
                }

                SMSQueryVehicleService sqv = new SMSQueryVehicleService();
                sqv.Add(entity);
                rc.Message = "新增成功!";
                rc.Result = true;
            }
            catch (Exception ex)
            {
                rc.Result = false;
                rc.Message = ex.Message;
                Logger.Error(ex.Message, ex);
            }
            return rc;
        }
Esempio n. 3
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;
            }
        }
Esempio n. 4
0
        public ActionResult CreateSMSQuery(string customerName, string telphone, string vehicleCodes, string LicenceNumbers)
        {
            if (string.IsNullOrEmpty(customerName))
            {
                return Json(new
                {
                    result = 0,
                    data = "请输入姓名!"
                });
            }

            if (string.IsNullOrEmpty(telphone))
            {
                return Json(new
                {
                    result = 0,
                    data = "请输入手机号码!"
                });
            }

            List<Guid> codes = new List<Guid>();
            if (!string.IsNullOrEmpty(vehicleCodes))
            {
                string[] codeArray = vehicleCodes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                int length = codeArray.Count();
                for (int i = 0; i < length; i++)
                {
                    codes.Add(new Guid(codeArray[i]));
                }
            }
            if (codes.Count <= 0)
            {
                return Json(new
                {
                    result = 0,
                    data = "请选择查询车辆!"
                });
            }
            List<string> licenceList = new List<string>();
            if (!string.IsNullOrEmpty(LicenceNumbers))
            {
                string[] licenceArray = LicenceNumbers.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                int length = licenceArray.Count();
                for (int i = 0; i < length; i++)
                {
                    licenceList.Add(licenceArray[i]);
                }
            }
            if (licenceList.Count <= 0)
            {
                return Json(new
                {
                    result = 0,
                    data = "请选择查询车辆!"
                });
            }

            SmsQueryVehicleParam param = new SmsQueryVehicleParam();
            param.CustomerName = customerName;
            param.TenantCode = SessionUserInfo.TenantCode;
            param.vehicleCodelist = codes;
            param.Telphone = telphone;
            param.LicenceNumberlist = licenceList;

            List<object> list = _ISysSettingWCFService.GetUeslessVehicle(SessionUserInfo.SelectedUser.TenantCode);
            if (list != null && list.Count > 0)
            {
                List<string> msgList = new List<string>();
                for (int i = 0; i < list.Count; i++)
                {
                    for (int j = 0; j < codes.Count; j++)
                    {
                        if (list[i].ToString() == codes[j].ToString())
                        {
                            if (licenceList.Count > j)
                            {
                                msgList.Add(licenceList[j]);
                                break;
                            }
                        }
                    }
                }

                if (msgList.Count > 0)
                {
                    return Json(new
                    {
                        result = 0,
                        data = string.Format("操作失败,以下车辆已被关注5次\r\n{0}\r\n请重新选择车辆", string.Join(",", msgList.ToArray()))
                    });
                }
            }
            ResultContent DBresult = _ISysSettingWCFService.AddSMSQuery(param);

            return Json(new
            {
                result = DBresult.Result ? 1 : 0,
                data = DBresult.Message
            });
        }
Esempio n. 5
0
        public ActionResult SearchSMSQuery(string customerName, string vehicleCodes, string telphone)
        {
            List<Guid> codes = new List<Guid>();
            if (!string.IsNullOrEmpty(vehicleCodes))
            {
                string[] codeArray = vehicleCodes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                int length = codeArray.Count();
                for (int i = 0; i < length; i++)
                {
                    codes.Add(new Guid(codeArray[i]));
                }
            }

            SmsQueryVehicleParam param = new SmsQueryVehicleParam();
            param.CustomerName = customerName;
            param.vehicleCodelist = codes;
            param.Telphone = telphone;
            param.TenantCode = SessionUserInfo.TenantCode;
            param.PageIndex = PageIndex;
            param.PageSize = PageSize;

            ESMSQueryInfoViewModel vmList = _ISysSettingWCFService.GetSMSQueryListViewModel(param);
            if (vmList == null || vmList.userListViewModel == null || vmList.userListViewModel.Count <= 0)
            {
                return null;
            }

            var query = from u in vmList.userListViewModel
                        select new
                        {
                            cell = new string[]{
                                    "",//操作列
                                    u.CustomerName,
                                    u.CustomerTelephone,
                                    u.LicenseNumberDesc,
                                    u.sms_vehicle_set_id.ToString(),
                                    u.VehicleCodeList
                                }
                        };


            var result = new
            {
                total = vmList.RowCount / Convert.ToInt32(PageSize) + 1,
                page = GridPageIndex,
                records = vmList.RowCount,
                rows = query
            };

            return Json(result, JsonRequestBehavior.AllowGet);
        }
Esempio n. 6
0
        public ActionResult SaveSMSQuery(ulong smsID, string customerName, string telphone, string vehicleCodes, string LicenceNumbers)
        {
            if (string.IsNullOrEmpty(customerName))
            {
                return Json(new
                {
                    result = 0,
                    data = "请输入姓名!"
                });
            }

            if (string.IsNullOrEmpty(telphone))
            {
                return Json(new
                {
                    result = 0,
                    data = "请输入手机号码!"
                });
            }

            List<Guid> codes = new List<Guid>();
            if (!string.IsNullOrEmpty(vehicleCodes))
            {
                string[] codeArray = vehicleCodes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                int length = codeArray.Count();
                for (int i = 0; i < length; i++)
                {
                    codes.Add(new Guid(codeArray[i]));
                }
            }
            if (codes.Count <= 0)
            {
                return Json(new
                {
                    result = 0,
                    data = "请选择查询车辆!"
                });
            }
            List<string> licenceList = new List<string>();
            if (!string.IsNullOrEmpty(LicenceNumbers))
            {
                string[] licenceArray = LicenceNumbers.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                int length = licenceArray.Count();
                for (int i = 0; i < length; i++)
                {
                    licenceList.Add(licenceArray[i]);
                }
            }
            if (licenceList.Count <= 0)
            {
                return Json(new
                {
                    result = 0,
                    data = "请选择查询车辆!"
                });
            }
            WebManagerWCFService webManagerService = new WebManagerWCFService();

            List<string> msgList = new List<string>();
            for (int i = 0; i < codes.Count; i++)
            {
                List<ulong> smsIDList = webManagerService.GetSmsQuerySmsIDList(SessionUserInfo.SelectedUser.TenantCode, codes[i].ToString());
                if (smsIDList.Count > 5 || smsIDList.Count == 5 && !smsIDList.Contains(smsID))
                {
                    msgList.Add(licenceList[i]);
                }
            }
            if (msgList.Count > 0)
            {
                return Json(new
                {
                    result = 0,
                    data = string.Format("操作失败,以下车辆已被关注5次\r\n{0}\r\n请重新选择车辆", string.Join(",", msgList.ToArray()))
                });
            }

            SmsQueryVehicleParam param = new SmsQueryVehicleParam();
            param.smsid = smsID;
            param.CustomerName = customerName;
            param.TenantCode = SessionUserInfo.TenantCode;
            param.vehicleCodelist = codes;
            param.Telphone = telphone;
            param.LicenceNumberlist = licenceList;

            ResultContent DBresult = _ISysSettingWCFService.UpdateSMSQuery(param);

            return Json(new
            {
                result = DBresult.Result ? 1 : 0,
                data = DBresult.Message
            });
        }