Exemplo n.º 1
0
 public void UpdateMessage(HttpContext context)
 {
     if (!string.IsNullOrWhiteSpace(context.Request["Id"]))
     {
         try
         {
             Com_Message sn = BllSMS.GetEntityById(int.Parse(context.Request["Id"])).retData as Com_Message;
             if (sn != null)
             {
                 if (!string.IsNullOrWhiteSpace(context.Request["Status"]))
                 {
                     sn.Status = Convert.ToByte(context.Request["Status"]);
                 }
                 if (!string.IsNullOrWhiteSpace(context.Request["IsDelete"]))
                 {
                     sn.IsDelete = Convert.ToByte(context.Request["IsDelete"]);
                 }
                 sn.Id            = int.Parse(context.Request["id"]);
                 jsonModel        = BllSMS.Update(sn);
                 jsonModel.errMsg = sn.Href;
                 context.Response.Write("{\"result\":" + jss.Serialize(jsonModel) + "}");
             }
         }
         catch (Exception ex)
         {
             jsonModel = new JsonModel()
             {
                 errMsg  = ex.Message,
                 retData = "",
                 status  = "no"
             };
             context.Response.Write("{\"result\":" + jss.Serialize(jsonModel) + "}");
         }
     }
 }
Exemplo n.º 2
0
        private void WebMessage(HttpContext context)
        {
            Com_Message model = new Com_Message();

            try
            {
                if (!string.IsNullOrWhiteSpace(context.Request["Receivers"]))
                {
                    List <Com_Message> list       = jss.Deserialize <List <Com_Message> >(context.Request["Receivers"]);
                    Hashtable          ht         = new Hashtable();
                    string             CreateUID  = context.Request["CreateUID"].SafeToString();
                    string             CreateName = context.Request["CreateName"].SafeToString();
                    string             Title      = context.Request["Title"].SafeToString();
                    string             Contents   = HttpUtility.UrlDecode(context.Request["Contents"]).SafeToString();
                    string             Type       = context.Request["Type"].SafeToString();

                    string date = string.IsNullOrWhiteSpace(context.Request["CreateTime"]) ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : context.Request["CreateTime"];
                    for (int i = 0; i < list.Count; i++)
                    {
                        model.CreateTime = Convert.ToDateTime(date);
                        model.Title      = Title;
                        model.Contents   = Contents;
                        model.Type       = Convert.ToByte(Type);
                        model.Receiver   = list[i].Receiver;
                        model.CreateName = CreateName;
                        model.CreateUID  = CreateUID;
                        jsonModel        = BllSMS.Add(model);
                    }
                    //jsonModel = BllSMS.SendMessage(ht, list);
                    context.Response.Write("{\"result\":" + jss.Serialize(jsonModel) + "}");
                }
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errMsg = ex.Message
                };
                context.Response.Write("{\"result\":" + jss.Serialize(jsonModel) + "}");
            }
        }
Exemplo n.º 3
0
        public void AddMessage(HttpContext context)
        {
            try
            {
                Com_Message sm = new Com_Message();
                sm.Contents      = context.Request["Contents"]; //内容
                sm.Title         = context.Request["Title"];    //标题
                sm.Type          = Convert.ToByte(context.Request["Type"]);
                sm.Status        = Convert.ToByte((int)MessageStatus.未读);
                sm.Receiver      = context.Request["Receiver"];      //接受人
                sm.Href          = context.Request["Href"];          //链接地址(可不提供)
                sm.ReceiverEmail = context.Request["ReceiverEmail"]; //收件邮箱
                sm.IsDelete      = Convert.ToByte((int)SysStatus.正常);
                sm.IsSend        = Convert.ToByte((int)MessageIsSend.未发送);
                sm.ReceiverName  = context.Request["ReceiverName"];
                sm.FilePath      = context.Request["FilePath"];
                sm.Timing        = string.IsNullOrWhiteSpace(context.Request["Timing"]) ? Convert.ToByte((int)MessageTiming.立即发送) : Convert.ToByte((int)MessageTiming.定时发送);
                sm.CreateName    = context.Request["CreateName"];
                sm.CreateTime    = DateTime.Now;
                sm.CreateUID     = context.Request["CreateUID"];//发送人
                jsonModel        = BllSMS.Add(sm);
                jsonModel.status = "ok";
                context.Response.Write("{\"result\":" + jss.Serialize(jsonModel) + "}");
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errMsg  = ex.Message,
                    retData = "",
                    status  = "no"
                };

                context.Response.Write("{\"result\":" + jss.Serialize(jsonModel) + "}");
            }
        }