Exemple #1
0
 /// 是否是接收人
 /// <summary>
 /// 是否是接收人
 /// </summary>
 /// <param name="orderid"></param>
 /// <param name="number"></param>
 /// <returns></returns>
 public bool IsToPersonForNumber(string orderid, int lastrecid, WOrderProcessRightJsonData right)
 {
     if (right.RightType_Out == WOrderProcessRightTypeEnum.R04_功能权限)
     {
         right.RightData = BLL.Util.CheckRightForCRM(right.LoginUserID, right.RightData_Out).ToString();
     }
     return(Dal.WOrderToAndCC.Instance.IsToPersonForNumber(orderid, lastrecid, right.RightType_Out, right.LoginUserID, right.RightData_Out));
 }
        ///  处理权限验证
        /// <summary>
        ///  处理权限验证
        /// </summary>
        /// <param name="orderid"></param>
        /// <param name="orderstatus"></param>
        /// <param name="lastrecid"></param>
        /// <param name="ordercreateuserid"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public WOrderOperTypeEnum ValidateWOrderProcessRight(string orderid, int orderstatus, int lastrecid, int ordercreateuserid, ref string message, WOrderProcessRightJsonData right = null)
        {
            message = "";
            WOrderOperTypeEnum oper = WOrderOperTypeEnum.None;
            //登录id
            int loginuserid = BLL.Util.GetLoginUserID();

            //处理权限验证方式(默认:采用当前登录人的id验证)
            if (right == null || Enum.IsDefined(typeof(WOrderProcessRightTypeEnum), right.RightType_Out) == false)
            {
                right = new WOrderProcessRightJsonData()
                {
                    RightType   = (int)WOrderProcessRightTypeEnum.R01_人员ID,
                    RightData   = "",
                    LoginUserID = loginuserid,
                    OrderID     = orderid
                };
            }
            else
            {
                //校验right有效性
                if (right.OrderID != orderid || right.LoginUserID != loginuserid)
                {
                    message = "参数中的权限数据有效性不正确!";
                    return(oper);
                }
            }
            /// 审核权限
            bool PendingRight = BLL.Util.CheckRight(loginuserid, "SYS024BUT102102B");
            /// 处理权限
            bool ProcessRight = BLL.Util.CheckRight(loginuserid, "SYS024BUT102102C");
            /// 回访权限
            bool ReturnRight = BLL.Util.CheckRight(loginuserid, "SYS024BUT102102D");

            if (string.IsNullOrEmpty(orderid))
            {
                message = "传入参数工单ID不正确!";
                return(oper);
            }
            WorkOrderStatus status = (WorkOrderStatus)Enum.Parse(typeof(WorkOrderStatus), orderstatus.ToString());

            switch (status)
            {
            case WorkOrderStatus.Pending:
                //审核
            {
                if (PendingRight)
                {
                    oper = WOrderOperTypeEnum.L03_审核;
                    return(oper);
                }
                else
                {
                    message = "您没有此工单的审核权限!";
                    return(oper);
                }
            }

            case WorkOrderStatus.Untreated:
            case WorkOrderStatus.Processing:
                //处理权限
            {
                //有权限+是创建人+是否上一步处理记录制定的接收人
                if (ProcessRight ||
                    loginuserid == ordercreateuserid ||
                    BLL.WOrderToAndCC.Instance.IsToPersonForNumber(orderid, lastrecid, right))
                {
                    oper = WOrderOperTypeEnum.L04_处理;
                    return(oper);
                }
                else
                {
                    message = "您没有此工单的处理权限!";
                    return(oper);
                }
            }

            case WorkOrderStatus.Processed:
                //回访权限
            {
                if (ReturnRight)
                {
                    if (BLL.WOrderProcess.Instance.IsHasReturnForProcess(orderid) == false)
                    {
                        oper = WOrderOperTypeEnum.L05_回访;
                        return(oper);
                    }
                    else
                    {
                        message = "此工单已经回访过了!";
                        return(oper);
                    }
                }
                else
                {
                    message = "您没有此工单的回访权限!";
                    return(oper);
                }
            }

            case WorkOrderStatus.Completed:
                message = "无法处理已完成的工单!";
                return(oper);

            case WorkOrderStatus.Closed:
                message = "无法处理已关闭的工单!";
                return(oper);

            default:
                message = "工单状态不正确!";
                return(oper);
            }
        }
 /// 处理权限验证
 /// <summary>
 /// 处理权限验证
 /// </summary>
 /// <param name="orderid"></param>
 /// <param name="message"></param>
 /// <param name="oper"></param>
 /// <param name="info"></param>
 /// <returns></returns>
 public bool ValidateWOrderProcessRight(string orderid, ref string message, ref WOrderOperTypeEnum oper, out WOrderInfoInfo info, WOrderProcessRightJsonData right)
 {
     message = "";
     oper    = WOrderOperTypeEnum.None;
     info    = null;
     if (string.IsNullOrEmpty(orderid))
     {
         message = "传入参数工单ID不正确!";
         return(false);
     }
     info = BLL.WOrderInfo.Instance.GetWOrderInfoInfo(orderid);
     if (info == null)
     {
         message = "查不到对应的工单数据!";
         return(false);
     }
     oper = ValidateWOrderProcessRight(orderid, info.WorkOrderStatus_Value, info.LastReceiverID_Value, info.CreateUserID_Value, ref message, right);
     return(oper != WOrderOperTypeEnum.None);
 }
        public static WOrderProcessRightJsonData GetWOrderProcessRightJsonData(string json)
        {
            WOrderProcessRightJsonData right = Newtonsoft.Json.JsonConvert.DeserializeObject <WOrderProcessRightJsonData>(json);

            return(right);
        }