Пример #1
0
        //推送给申请人
        public static void Push(string staffNumber, string companyId, byte status)
        {
            UserModels user1 = (from u in sdb.Users where u.StaffNumber == staffNumber && u.CompanyId == companyId select u).FirstOrDefault();

            if (user1 != null)
            {
                string info = null;
                if (status == 3)
                {
                    info = "你的申请审核通过!";
                }
                else if (status == 1)
                {
                    info = "你的申请处于在审核!";
                }
                else if (status == 5)
                {
                    info = "你的申请无效";
                }
                else
                {
                    info = "你的申请审核拒绝";
                }
                PushPayload payload = CompanyPushAPI.PushObject_auto_alias(user1.CompanyId, user1.UserName, "heh", info, "2");//选择一种方式
                try
                {
                    var result1 = client.SendPush(payload); //推送
                }
                catch (APIRequestException e)               //处理请求异常
                {
                    var message = "Error response from JPush server. Should review and fix it." + "HTTP Status:" + e.Status + "Error Code: " + e.ErrorCode + "Error Message: " + e.ErrorCode;
                }
                catch (APIConnectionException e)//处理连接异常
                {
                    var message = e.Message;
                }
            }
        }
Пример #2
0
        //推送给自己
        public static void PushMe(string companyId, string userName, int status, string applyName)
        {
            PushPayload payload = new PushPayload();

            //对审批流状态进行判断,区分申请的审核类型
            if (status == 0)                                                                                               //进入审批流
            {
                payload = CompanyPushAPI.PushObject_auto_alias(companyId, userName, "heh", info + applyName + info1, "2"); //选择一种方式
            }
            else if (status == 3)                                                                                          //进入自动审核完成,提交就审核完成
            {
                payload = CompanyPushAPI.PushObject_auto_alias(companyId, userName, "heh", info + applyName + info2, "2"); //选择一种方式
            }
            else if (status == 6)                                                                                          //进入手动审核,需要自己审核完成
            {
                payload = CompanyPushAPI.PushObject_auto_alias(companyId, userName, "heh", info + applyName + info3, "2"); //选择一种方式
            }
            //else//进入没有对应的审批流模板,此申请无效
            //{
            //    payload = CompanyPushAPI.PushObject_auto_alias(user.UserName, "heh", "你的请假申请提交成功!此申请无效", "2");//选择一种方式
            //}
            // PushPayload
            try
            {
                var result1 = client.SendPush(payload); //推送
            }
            catch (APIRequestException e)               //处理请求异常
            {
                var message = "Error response from JPush server. Should review and fix it." + "HTTP Status:" + e.Status + "Error Code: " + e.ErrorCode + "Error Message: " + e.ErrorCode;
                //return Json(message, JsonRequestBehavior.AllowGet);
            }
            catch (APIConnectionException e)//处理连接异常
            {
                var message = e.Message;
                // return Json(e.Message, JsonRequestBehavior.AllowGet);
            }
        }
Пример #3
0
        //推送到审核人
        public static void Audit(string temp, string companyId)
        {
            string[] auditors = temp.Split(',');
            string[] audit    = new string[auditors.Length];
            for (int i = 0; i < auditors.Length; i++)
            {
                string temp1 = auditors[i];
                audit[i] = temp1.Substring(0, 11);
            }
            PushPayload payload = CompanyPushAPI.PushObject_auto_alias(companyId, audit, "heh", "你需要审核的申请!", "2");//选择一种方式

            try
            {
                var result1 = client.SendPush(payload); //推送
            }
            catch (APIRequestException e)               //处理请求异常
            {
                var message = "Error response from JPush server. Should review and fix it." + "HTTP Status:" + e.Status + "Error Code: " + e.ErrorCode + "Error Message: " + e.ErrorCode;
            }
            catch (APIConnectionException e)//处理连接异常
            {
                var message = e.Message;
            }
        }