Esempio n. 1
0
        public static bool ReOpenCustomerService(int ServiceID, string AddUserName, int UserID, out string error)
        {
            error = string.Empty;
            var data = CustomerService.GetCustomerService(ServiceID);

            if (data == null)
            {
                error = "工单无效";
                return(false);
            }
            if (data.ServiceStatus == 2)
            {
                error = "选中的任务已销单";
                return(false);
            }
            if (data.ServiceStatus == 5)
            {
                error = "选中的任务已重新开单";
                return(false);
            }
            data.ServiceStatus = 5;
            data.Save();
            var newData = new CustomerService();

            newData.ProjectID        = data.ProjectID;
            newData.ServiceFullName  = data.ServiceFullName;
            newData.ProjectName      = data.ProjectName;
            newData.AddUserName      = AddUserName;
            newData.StartTime        = data.StartTime;
            newData.ServiceArea      = data.ServiceArea;
            newData.ServiceNumber    = data.ServiceNumber + "_1";
            newData.AddCustomerName  = data.AddCustomerName;
            newData.AddCallPhone     = data.AddCallPhone;
            newData.ServiceContent   = data.ServiceContent;
            newData.AddTime          = DateTime.Now;
            newData.ServiceStatus    = 3;
            newData.TaskType         = data.TaskType;
            newData.AddMan           = data.AddMan;
            newData.OrderNumberID    = data.OrderNumberID;
            newData.AddUserID        = UserID;
            newData.DepartmentID     = data.DepartmentID;
            newData.ServiceType1ID   = data.ServiceType1ID;
            newData.ServiceType2ID   = data.ServiceType2ID;
            newData.ServiceType3ID   = data.ServiceType3ID;
            newData.RelatedServiceID = data.ID;
            newData.Save();
            return(true);
        }
        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();
        }
Esempio n. 3
0
        public static bool CheckIsMyService(int ServiceID, int UserID)
        {
            if (UserID <= 0)
            {
                return(false);
            }
            var data = CustomerService.GetCustomerService(ServiceID);

            if (data == null)
            {
                return(false);
            }
            List <int> ProjectIDList = new List <int>();

            ProjectIDList.Add(data.ProjectID);

            var                 myProjectIDList = Project.GetProjectIDListbyIDList(ProjectIDList: ProjectIDList, UserID: UserID);
            RoleModule          roleModule1     = null;
            RoleModule          roleModule2     = null;
            List <string>       conditions      = new List <string>();
            var                 cmdlist         = new List <string>();
            List <SqlParameter> parameters      = new List <SqlParameter>();

            using (SqlHelper helper = new SqlHelper())
            {
                parameters.Add(new SqlParameter("@UserID", UserID));
                //查看微信APP报修派单
                roleModule1 = GetOne <RoleModule>("select ID from [RoleModule] where ModuleId=181 and [UserID]=@UserID or [RoleID] in (select RoleID from [UserRoles] where [UserID]=@UserID)", parameters, helper);
                //查看微信APP投诉派单
                roleModule2 = GetOne <RoleModule>("select ID from [RoleModule] where ModuleId=182 and [UserID]=@UserID or [RoleID] in (select RoleID from [UserRoles] where [UserID]=@UserID)", parameters, helper);
            }
            if (roleModule1 == null && roleModule2 == null)
            {
                return(false);
            }
            if (roleModule1 != null)
            {
                cmdlist.Add("isnull(IsSuggestion,0)=0");
            }
            if (roleModule2 != null)
            {
                cmdlist.Add("isnull(IsSuggestion,0)=1");
            }
            if (cmdlist.Count > 0)
            {
                conditions.Add("(" + string.Join(" or ", cmdlist.ToArray()) + ")");
            }
            //项目权限
            conditions.Add("([ServiceFrom]=@ServiceFrom1 or [ServiceFrom]=@ServiceFrom2)");
            conditions.Add("[ID]=@ServiceID");
            parameters.Add(new SqlParameter("@ServiceID", ServiceID));
            parameters.Add(new SqlParameter("@ServiceFrom1", Utility.EnumModel.WechatServiceFromDefine.weixin.ToString()));
            parameters.Add(new SqlParameter("@ServiceFrom2", Utility.EnumModel.WechatServiceFromDefine.app.ToString()));
            string cmdtext = "select [ProjectID] from [CustomerService] where " + string.Join(" and ", conditions.ToArray());
            var    list    = GetList <CustomerService>(cmdtext, parameters).ToArray();

            if (myProjectIDList.Length > 0)
            {
                list = list.Where(p => myProjectIDList.Contains(p.ProjectID)).ToArray();
            }
            return(list.Length > 0);
        }
Esempio n. 4
0
        public static bool CheckIsMyService(int ServiceID, int UserID)
        {
            if (UserID <= 0)
            {
                return(false);
            }
            int count = 0;
            var data  = CustomerService.GetCustomerService(ServiceID);

            if (data == null)
            {
                return(false);
            }
            List <int> ProjectIDList = new List <int>();

            ProjectIDList.Add(data.ProjectID);

            var myProjectIDList = Project.GetProjectIDListbyIDList(ProjectIDList: ProjectIDList, UserID: UserID);

            using (SqlHelper helper = new SqlHelper())
            {
                List <string>       conditions = new List <string>();
                var                 cmdlist    = new List <string>();
                List <SqlParameter> parameters = new List <SqlParameter>();
                parameters.Add(new SqlParameter("@UserID", UserID));
                //查看微信APP报修派单
                var roleModule1 = GetOne <RoleModule>("select ID from [RoleModule] where ModuleId=181 and [UserID]=@UserID or [RoleID] in (select RoleID from [UserRoles] where [UserID]=@UserID)", parameters, helper);
                //查看微信APP投诉派单
                var roleModule2 = GetOne <RoleModule>("select ID from [RoleModule] where ModuleId=182 and [UserID]=@UserID or [RoleID] in (select RoleID from [UserRoles] where [UserID]=@UserID)", parameters, helper);
                if (roleModule1 == null && roleModule2 == null)
                {
                    return(false);
                }
                if (roleModule1 != null)
                {
                    cmdlist.Add("isnull(IsSuggestion,0)=0");
                }
                if (roleModule2 != null)
                {
                    cmdlist.Add("isnull(IsSuggestion,0)=1");
                }
                if (cmdlist.Count > 0)
                {
                    conditions.Add("(" + string.Join(" or ", cmdlist.ToArray()) + ")");
                }
                //项目权限
                if (myProjectIDList.Length > 0)
                {
                    conditions.Add("[CustomerService].[ProjectID] in (" + string.Join(",", myProjectIDList) + ")");
                }
                conditions.Add("([ServiceFrom]=@ServiceFrom1 or [ServiceFrom]=@ServiceFrom2)");
                conditions.Add("[ID]=@ServiceID");
                parameters.Add(new SqlParameter("@ServiceID", ServiceID));
                parameters.Add(new SqlParameter("@ServiceFrom1", Utility.EnumModel.WechatServiceFromDefine.weixin.ToString()));
                parameters.Add(new SqlParameter("@ServiceFrom2", Utility.EnumModel.WechatServiceFromDefine.app.ToString()));
                string cmdtext = "select count(1) from [CustomerService] where " + string.Join(" and ", conditions.ToArray());
                Utility.LogHelper.WriteDebug("CheckIsMyService.cs", cmdtext);
                var result = helper.ExecuteScalar(cmdtext, CommandType.Text, parameters);
                if (result != null)
                {
                    int.TryParse(result.ToString(), out count);
                }
            }
            return(count > 0);
        }