public static List <Dictionary <string, object> > GetServiceTypeGridByKeywords(string Keywords) { var list = ServiceType.GetServiceTypes().OrderBy(p => p.SortOrder).ThenBy(p => p.AddTime).ToArray(); if (list.Length > 0) { foreach (var item in list) { var myParentData = list.FirstOrDefault(p => p.ID == item.ParentID); if (myParentData != null) { item.ParentName = myParentData.ServiceTypeName; } } } #region 关键字查询 string cmd = string.Empty; ServiceType[] dataList = new ServiceType[] { }; if (!string.IsNullOrEmpty(Keywords)) { dataList = list.Where(p => p.ServiceTypeName.Contains(Keywords)).ToArray(); } #endregion dataList = dataList.OrderBy(p => p.SortOrder).ThenBy(p => p.ID).ToArray(); var items = list.Select(p => { var dic = new Dictionary <string, object>(); dic["id"] = p.ID; dic["name"] = p.ServiceTypeName; dic["FullName"] = GetFullName(list, p, p.ServiceTypeName); dic["_parentId"] = p.ParentID <= 1 ? 0 : p.ParentID; dic["PaiDanTime"] = p.PaiDanTime > 0 ? p.PaiDanTime : 0; dic["ResponseTime"] = p.ResponseTime > 0 ? p.ResponseTime : 0; dic["CheckTime"] = p.CheckTime > 0 ? p.CheckTime : 0; dic["ChuliTime"] = p.ChuliTime > 0 ? p.ChuliTime : 0; dic["BanJieTime"] = p.BanJieTime > 0 ? p.BanJieTime : 0; dic["HuiFangTime"] = p.HuiFangTime > 0 ? p.HuiFangTime : 0; dic["GuanDanTime"] = p.GuanDanTime > 0 ? p.GuanDanTime : 0; if (list.Any(o => o.ParentID == p.ID)) { dic["state"] = "closed"; } return(dic); }).ToList(); //var dic2 = new Dictionary<string, object>(); //dic2["id"] = 1; //dic2["name"] = new Utility.SiteConfig().CompanyName; //dic2["_parentId"] = 0; //items.Add(dic2); return(items); }
public static void ApproveImportantService(ServiceType_ImportantService data) { var service = CustomerService.GetCustomerService(data.ServiceID); if (service == null) { return; } if (data.ApproveStatus == 1) { service.IsImportantTouSu = true; } else { service.IsImportantTouSu = false; } service.Save(); var serviceTypeList = ServiceType.GetServiceTypes().ToArray(); var myServiceType = serviceTypeList.FirstOrDefault(p => p.ID == service.ServiceType1ID); if (myServiceType == null || data.ApplicationType == 4) { data.Save(); return; } var myServiceType2List = serviceTypeList.Where(p => service.ServiceType2IDList.Contains(p.ID)).ToArray(); var myServiceType3List = serviceTypeList.Where(p => service.ServiceType3IDList.Contains(p.ID)).ToArray(); #region 派单时效 var myPaiDanServiceTypeItem = ServiceType.GetAvailableServiceType(myServiceType2List, myServiceType3List, myServiceType, typeid: 1); data.PaiDanTime = myPaiDanServiceTypeItem.PaiDanTime; #endregion #region 回复时效 var myResponseServiceTypeItem = ServiceType.GetAvailableServiceType(myServiceType2List, myServiceType3List, myServiceType, typeid: 2); data.ResponseTime = myResponseServiceTypeItem.ResponseTime; #endregion #region 核查时效 var myCheckServiceTypeItem = ServiceType.GetAvailableServiceType(myServiceType2List, myServiceType3List, myServiceType, typeid: 3); data.CheckTime = myCheckServiceTypeItem.CheckTime; #endregion #region 处理时效 var myProcessServiceTypeItem = ServiceType.GetAvailableServiceType(myServiceType2List, myServiceType3List, myServiceType, typeid: 4); data.ChuliTime = myCheckServiceTypeItem.ChuliTime; #endregion #region 办结时效 var myBanJieServiceTypeItem = ServiceType.GetAvailableServiceType(myServiceType2List, myServiceType3List, myServiceType, typeid: 5); data.BanJieTime = myBanJieServiceTypeItem.BanJieTime; #endregion #region 关单时效 var myGuanDanServiceTypeItem = ServiceType.GetAvailableServiceType(myServiceType2List, myServiceType3List, myServiceType, typeid: 7); data.GuanDanTime = myGuanDanServiceTypeItem.GuanDanTime; #endregion #region 回访时效 var myHuiFangServiceTypeItem = ServiceType.GetAvailableServiceType(myServiceType2List, myServiceType3List, myServiceType, typeid: 7); data.HuiFangTime = myHuiFangServiceTypeItem.HuiFangTime; #endregion if (data.ApplicationType == 2)//启用第三方(一倍时间) { data.PaiDanTime = data.PaiDanTime > 0 ? data.PaiDanTime * 2 : 0; data.ResponseTime = data.ResponseTime > 0 ? data.ResponseTime * 2 : 0; data.CheckTime = data.CheckTime > 0 ? data.CheckTime * 2 : 0; data.ChuliTime = data.ChuliTime > 0 ? data.ChuliTime * 2 : 0; data.BanJieTime = data.BanJieTime > 0 ? data.BanJieTime * 2 : 0; data.GuanDanTime = data.GuanDanTime > 0 ? data.GuanDanTime * 2 : 0; data.HuiFangTime = data.HuiFangTime > 0 ? data.HuiFangTime * 2 : 0; } else { int addHour = 0; if (data.ApplicationType == 1)//启用第三方(三天) { addHour = 24 * 3; } else if (data.ApplicationType == 3)//修转赔偿意见未达成一致(十五天) { addHour = 24 * 15; } data.PaiDanTime = data.PaiDanTime > 0 ? data.PaiDanTime + addHour : 0; data.ResponseTime = data.ResponseTime > 0 ? data.ResponseTime + addHour : 0; data.CheckTime = data.CheckTime > 0 ? data.CheckTime + addHour : 0; data.ChuliTime = data.ChuliTime > 0 ? data.ChuliTime + addHour : 0; data.BanJieTime = data.BanJieTime > 0 ? data.BanJieTime + addHour : 0; data.GuanDanTime = data.GuanDanTime > 0 ? data.GuanDanTime + addHour : 0; data.HuiFangTime = data.HuiFangTime > 0 ? data.HuiFangTime + addHour : 0; } data.Save(); }