Ejemplo n.º 1
0
        /// <summary>
        /// 给审核人发送一条消息
        /// </summary>
        /// <param name="audit"></param>
        public static void SendToDoToSMSAuditor(SMS.Model.SMSMessage sms)
        {
            try
            {
                string         urlSMSEdit = SMSHost + "/Platform/SendSMSAudit";
                SystemToDoList std        = new SystemToDoList();
                std.CreateTime = DateTime.Now;
                std.Id         = System.Guid.NewGuid().ToString();
                std.IsDealed   = false;
                std.PageId     = "SMSSendSMSAudit" + Util.CommercialSuffix;
                std.PageTitle  = Util.SMSProductName + "审核";
                std.Title      = "您的" + Util.SMSProductName + "审核中有新的【" + Util.SMSProductName + "审核】申请,请及时审核!";
                std.Url        = "/Home/Transfer?url=" + urlSMSEdit + "&urlParam=/Common/GetBaseParam";
                std.ProjectId  = Util.SMSProductId;
                std.TableName  = "";
                std.RowId      = sms.ID;
                std.ToDoType   = "SMSSendSMSAudit" + Util.CommercialSuffix;

                string Param = JsonSerialize.Serialize <SystemToDoList>(std);

                string url = Util.ISMPHost + "/CallBack/SendToDoToOneGroupByPermission";
                IDictionary <string, string> pdic = new Dictionary <string, string>();
                pdic.Add("Param", Param);
                pdic.Add("Identifier", std.ToDoType);
                Post(url, pdic);
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        private string GetAnswer(string str)
        {
            Input         input;
            Output        output;
            Data          data = new Data();
            JsonSerialize js   = new JsonSerialize();

            input  = js.DeSerialize(str);
            output = data.Result(input);
            return(js.Serialize(output));
        }
Ejemplo n.º 3
0
        public bool WriteAnswer(Output output)
        {
            JsonSerialize js   = new JsonSerialize();
            string        body = js.Serialize(output);

            HttpWebResponse result = Request("WriteAnswer", body);

            if (result != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            switch (str)
            {
            case "Xml":
            {
                str = Console.ReadLine();
                XmlSerialize XS = new XmlSerialize();

                Input  input  = new Input();
                Output output = new Output();
                input = XS.DeSerialize(str);

                Data data = new Data();
                output = data.Result(input);

                str = XS.Serialize(output);

                Console.WriteLine(str);
            }
            break;

            case "Json":
            {
                str = Console.ReadLine();
                JsonSerialize JS = new JsonSerialize();

                Input  input  = new Input();
                Output output = new Output();
                input = JS.DeSerialize(str);

                Data data = new Data();
                output = data.Result(input);

                str = JS.Serialize(output);

                Console.WriteLine(str);
            }
            break;

            default:
                new Exception("What can I do?");
                break;
            }
        }
Ejemplo n.º 5
0
        public ActionResult SendSMS(string User, string Pass, string Mobiles, string Content, string SendTime)
        {
            SendSMSResult ret = new SendSMSResult();

            // 判断参数合法性
            if (string.IsNullOrWhiteSpace(User))
            {
                ret.Result = _ERR_USERISEMPTY;
            }
            else if (string.IsNullOrWhiteSpace(Pass))
            {
                ret.Result = _ERR_PASSISEMPTY;
            }
            else if (string.IsNullOrWhiteSpace(Mobiles))
            {
                ret.Result = _ERR_DESTISEMPTY;
            }
            else
            {
                // 发送短信
                try
                {
                    var r = InterfaceProxy.GetSendService().SendSMS(User, Pass, Content, Mobiles.Split(',').ToList(), "http");
                    if (r.Success)
                    {
                        ret.Result = _ERR_SUCCESS;
                        ret.MsgID  = r.Value.Message.ID;
                        if (r.Value.Message.AuditType == SMS.Model.AuditType.Manual)
                        {
                            Util.SendToDoToSMSAuditor(r.Value.Message);
                        }
                    }
                    else
                    {
                        ret.Result = r.Message;
                    }
                }
                catch (Exception ex)
                {
                    ret.Result = _ERR_SERVICE;
                }
            }

            string data = JsonSerialize.Serialize <SendSMSResult>(ret);

            return(base.Content(data));
        }
Ejemplo n.º 6
0
        public ActionResult GetMO(string User, string Pass)
        {
            GetSMSResult ret = new GetSMSResult();

            if (string.IsNullOrWhiteSpace(User))
            {
                ret.Result = _ERR_USERISEMPTY;
            }

            if (string.IsNullOrWhiteSpace(Pass))
            {
                ret.Result = _ERR_PASSISEMPTY;
            }
            try
            {
                SMS.Model.RPCResult <List <SMS.Model.MOSMS> > mos = InterfaceProxy.GetSendService().GetSMS(User, Pass);

                if (mos.Success)
                {
                    ret.Result = _ERR_SUCCESS;
                    List <SMS.Model.MOSMS> msgs = mos.Value;

                    ret.MONum = msgs.Count.ToString();

                    ret.Msgs = (from mo in msgs
                                select new MO()
                    {
                        Mobile = mo.UserNumber,
                        Content = mo.Message,
                        MOTime = mo.ReceiveTime.ToString()
                    }).ToList();
                }
                else
                {
                    ret.Result = mos.Message;
                }
            }
            catch (Exception ex)
            {
                ret.Result = _ERR_SERVICE;
            }
            string data = JsonSerialize.Serialize <GetSMSResult>(ret);

            return(Content(data));
        }
Ejemplo n.º 7
0
        public ActionResult GetReport(string User, string Pass, string MsgID)
        {
            GetReportResult ret = new GetReportResult();

            if (string.IsNullOrWhiteSpace(User))
            {
                ret.Result = _ERR_USERISEMPTY;
            }

            if (string.IsNullOrWhiteSpace(Pass))
            {
                ret.Result = _ERR_PASSISEMPTY;
            }
            try
            {
                var r = InterfaceProxy.GetSendService().GetReport(User, Pass, MsgID);

                if (r.Success)
                {
                    ret.Result = _ERR_SUCCESS;
                    List <SMS.Model.StatusReport> rts = r.Value;

                    ret.Reports = (from sr in rts
                                   select new Report()
                    {
                        MsgID = sr.SMSID,
                        Mobile = sr.Number,
                        Status = sr.Succeed ? "true" : "false"
                    }).ToList();
                }
                else
                {
                    ret.Result = r.Message;
                }
            }
            catch (Exception ex)
            {
                ret.Result = _ERR_SERVICE;
            }

            string data = JsonSerialize.Serialize <GetReportResult>(ret);

            return(Content(data));
        }
Ejemplo n.º 8
0
    protected void btnAwardRole_Click(object sender, EventArgs e)
    {
        int    roleID   = int.Parse(roleGrid.DataKeys[roleGrid.SelectedRowIndex][0].ToString());
        string roleName = roleGrid.DataKeys[roleGrid.SelectedRowIndex][1].ToString();

        FineOffice.Modules.SYS_Role model = roleBll.GetModel(r => r.ID == roleID);
        List <int> menus = GetCheckedNodeIDs();

        model.MenuList = JsonSerialize.Serialize(menus);

        List <int> authoritys = new List <int>();

        int[] selectArray = authorityGrid.SelectedRowIndexArray;
        for (int i = 0; i < selectArray.Length; i++)
        {
            authoritys.Add(int.Parse(authorityGrid.DataKeys[selectArray[i]][0].ToString()));
        }
        model.AuthorityList = JsonSerialize.Serialize(authoritys);
        roleBll.Update(model);
        Alert.Show(string.Format("角色-{0},授权成功!", roleName));
    }
Ejemplo n.º 9
0
        public ActionResult GetBalance(string User, string Pass)
        {
            string _Result     = "";
            int    _SmsBalance = 0;

            if (string.IsNullOrWhiteSpace(User))
            {
                _Result = _ERR_USERISEMPTY;
            }

            else if (string.IsNullOrWhiteSpace(Pass))
            {
                _Result = _ERR_PASSISEMPTY;
            }
            // 查询余额
            try
            {
                SMS.Model.RPCResult <SMS.Model.UserBalance> r = InterfaceProxy.GetSendService().GetBalanceByPlainPass(User, Pass);
                if (r.Success)
                {
                    _Result     = _ERR_SUCCESS;
                    _SmsBalance = r.Value.SmsBalance;
                }
                else
                {
                    _Result = r.Message;
                }
            }
            catch (Exception ex)
            {
                _Result = _ERR_SERVICE;
            }
            GetBalanceResult ret = new GetBalanceResult();

            ret.Result     = _Result;
            ret.SmsBalance = _SmsBalance.ToString();
            string data = JsonSerialize.Serialize <GetBalanceResult>(ret);

            return(Content(data));
        }
Ejemplo n.º 10
0
    public string SendSMS(string UserName, string UserPass, string Destination, string SMContent)
    {
        string[] dest;

        if (UserName == "")
        {
            return(_ERR_USERISEMPTY);
        }

        if (UserPass == "")
        {
            return(_ERR_PASSISEMPTY);
        }

        if (Destination == "")
        {
            return(_ERR_DESTISEMPTY);
        }
        else
        {
            dest = Regex.Split(Destination, ",");
            if (dest.Count() > 100)
            {
                return(_ERR_DESTTOLONG);
            }
        }

        ISMS interface_sms = (ISMS)Activator.GetObject(typeof(ISMS), ConfigurationManager.AppSettings["Pretreatment"]);
        SMS  model_sms     = new SMS();

        // 是否审核
        model_sms.Audit = AuditType.Manual;
        // 是否过滤
        model_sms.Filter = FilterType.Failure;
        // 消息级别
        model_sms.Level = LevelType.Level0;
        // 用户名
        model_sms.Account = UserName;
        // 短信内容
        model_sms.Content  = SMContent;
        model_sms.SPNumber = "";
        // 接收短信的号码
        List <string> num = new List <string>();

        foreach (string destnum in dest)
        {
            num.Add(destnum);
        }
        model_sms.Number       = num;
        model_sms.SendTime     = DateTime.Now;
        model_sms.SerialNumber = Guid.NewGuid();
        // 是否需要短信报告
        model_sms.StatusReport = StatusReportType.Enabled;
        // 通道类型
        model_sms.Channel = ChannelType.Industry;

        // 发送短信
        RPCResult <Guid> r = interface_sms.SendSMS(model_sms);

        SendSMSResult ret = new SendSMSResult();

        ret.Result = r.Message;
        ret.MsgId  = r.Value.ToString();
        string data = JsonSerialize.Serialize <SendSMSResult>(ret);

        return(data);
    }