public static bool CheckCanCompleteService(List <int> IDList, out string error)
        {
            error = string.Empty;
            var list = ViewCustomerService.GetViewCustomerServiceByIDList(IDList);

            if (list.Length == 0)
            {
                error = "请选择工单";
                return(false);
            }
            var sServiceIDList = list.Select(p => p.ID).ToList();
            var chuliList      = CustomerServiceChuli.GetCustomerServiceChuliListByServiceIDList(sServiceIDList);

            foreach (var item in list)
            {
                if (item.ServiceStatus == 1)
                {
                    error = "工单已办结,不能重复办结";
                    return(false);
                }
                //if (item.BanJieServiceType == 1)
                //{
                //    var myItemList = chuliList.Where(p => p.ServiceID == item.ID).ToArray();
                //    if (myItemList.Length == 0)
                //    {
                //        error = "工单未处理,不能办结";
                //        return false;
                //    }
                //    continue;
                //}
                if (item.BanJieServiceType == 2)
                {
                    continue;
                }
            }
            return(true);
        }
        public static bool CheckCanCallbackService(List <int> IDList, out string error)
        {
            error = string.Empty;
            var list = ViewCustomerService.GetViewCustomerServiceByIDList(IDList);

            if (list.Length == 0)
            {
                error = "请选择工单";
                return(false);
            }
            foreach (var item in list)
            {
                if (item.CallBackServiceType == 1)
                {
                    if (!item.IsClosed)
                    {
                        error = "工单未关单,不能回访";
                        return(false);
                    }
                    continue;
                }
                if (item.CallBackServiceType == 2)
                {
                    if (item.ServiceStatus != 1)
                    {
                        error = "工单未办结,不能回访";
                        return(false);
                    }
                    continue;
                }
                if (item.BanJieServiceType == 3)
                {
                    continue;
                }
            }
            return(true);
        }
        public static bool CheckCanCloseService(List <int> IDList, out string error)
        {
            error = string.Empty;
            var list = ViewCustomerService.GetViewCustomerServiceByIDList(IDList);

            if (list.Length == 0)
            {
                error = "请选择工单";
                return(false);
            }
            var sServiceIDList = list.Select(p => p.ID).ToList();
            var callBackList   = CustomerServiceHuifang.GetCustomerServiceHuifangListByServiceIDList(sServiceIDList);
            int MinServiceID   = list.Min(p => p.ID);
            int MaxServiceID   = list.Max(p => p.ID);
            var recordList     = PhoneRecord.GetPhoneRecordDetailByServiceIDList(MinServiceID, MaxServiceID);

            foreach (var item in list)
            {
                if (item.IsImportantTouSu)
                {
                    continue;
                }
                if (item.IsClosed)
                {
                    error = "工单已关单,不能重复关单";
                    return(false);
                }
                if (item.CloseServiceType == 1 || item.IsImportantTouSu)
                {
                    if (item.ServiceStatus != 1)
                    {
                        error = "工单未办结,不能关单";
                        return(false);
                    }
                    continue;
                }
                if (item.CloseServiceType == 2)
                {
                    var myRecordList   = recordList.Where(p => p.ServiceID == item.ID && p.PhoneType == 2).ToArray();
                    var myCallBackList = callBackList.Where(p => p.ServiceID == item.ID).ToArray();
                    if (myRecordList.FirstOrDefault(p => p.PickUpTime > DateTime.MinValue) != null)
                    {
                        continue;
                    }
                    if (myCallBackList.FirstOrDefault(p => p.PhoneCallBackType == 1) != null)
                    {
                        continue;
                    }
                    if (myRecordList.Length >= 2)
                    {
                        continue;
                    }
                    if (myCallBackList.Where(p => p.PhoneCallBackType == 2).ToArray().Length >= 2)
                    {
                        continue;
                    }
                    if (myRecordList.Length == 1)
                    {
                        error = "投诉类工单仅回访一次且未接电话,不能关单";
                        return(false);
                    }
                    if (myCallBackList.Where(p => p.PhoneCallBackType == 2).ToArray().Length == 1)
                    {
                        error = "投诉类工单仅回访一次且未接电话,不能关单";
                        return(false);
                    }
                    error = "投诉类工单未回访,不能关单";
                    return(false);
                }
                if (item.CloseServiceType == 3)
                {
                    if (item.ConfirmStatus != 1)
                    {
                        error = "廉洁举报类工单未审计确认,不能关单";
                        return(false);
                    }
                    continue;
                }
                if (item.CloseServiceType == 4)
                {
                    continue;
                }
            }
            return(true);
        }