public static Ui.DataGrid GetCustomerServiceHuifangGridByKeywords(string Keywords, int ServiceID, string orderBy, long startRowIndex, int pageSize)
        {
            long totalRows = 0;
            List <SqlParameter> parameters = new List <SqlParameter>();
            List <string>       conditions = new List <string>();

            conditions.Add("1=1");
            string cmd = string.Empty;

            if (!string.IsNullOrEmpty(Keywords))
            {
                conditions.Add("(HuiFangNote like @Keywords)");
                parameters.Add(new SqlParameter("@Keywords", "%" + Keywords + "%"));
            }
            if (ServiceID > 0)
            {
                conditions.Add("ServiceID=@ServiceID");
                parameters.Add(new SqlParameter("@ServiceID", ServiceID));
            }
            string fieldList = "[CustomerServiceHuifang].*";
            string Statement = " from [CustomerServiceHuifang] where  " + string.Join(" and ", conditions.ToArray()) + cmd;

            CustomerServiceHuifang[] list = new CustomerServiceHuifang[] { };
            list = GetList <CustomerServiceHuifang>(fieldList, Statement, parameters, orderBy, startRowIndex, pageSize, out totalRows).ToArray();
            DataAccess.Ui.DataGrid dg = new Ui.DataGrid();
            if (list.Length == 0)
            {
                dg.rows  = list;
                dg.total = totalRows;
                dg.page  = pageSize;
                return(dg);
            }
            dg.rows  = list;
            dg.total = totalRows;
            dg.page  = pageSize;
            return(dg);
        }
Esempio n. 2
0
        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);
        }