Пример #1
0
 internal static string EditRec(HttpContext context)
 {
     if (context.Request.HttpMethod.ToLower() == "post")
     {
         EditAction.AddEdit(context);
         return("<script type=\"text/JavaScript\">alert(\"ADD Success;\");window.location.href='handler.ashx?do=edit&OriginalId=" + context.Request["OriginalId"] + "';</script>");
     }
     else
     {
         DataTable dt = EditAction.ShowEdit(context);
         if (dt == null)
         {
             var J1    = new { tw = "", Text = "" };
             var J2    = new { tw = "", Text = "" };
             var datas = new { J1, J2 };
             return(CommonHelper.RenderHtml("edit.html", datas));
         }
         else
         {
             var j1   = new { tw = dt.Rows[0]["type"].ToString() == "1"?"selected=\"selected\"":"", Text = dt.Rows[0]["text"] };
             var j2   = new { tw = dt.Rows[1]["type"].ToString() == "1" ? "selected=\"selected\"" : "", Text = dt.Rows[1]["text"] };
             var data = new { j1, j2 };
             return(CommonHelper.RenderHtml("edit.html", data));
         }
     }
 }
Пример #2
0
 public static string SendMessage(HttpContext context)
 {
     if (Login() == "0")
     {
         DataTable dt = EditAction.ShowEdit(context);
         if (dt == null)
         {
             return("请先编辑群发内容列表!");
         }
         else
         {
             var       vSendList = new { j1 = dt.Rows[0]["type"], t1 = dt.Rows[0]["text"], j2 = dt.Rows[1]["type"], t2 = dt.Rows[1]["text"] };
             DataTable dtList    = FakeList(context.Request["originalid"]);
             System.Web.HttpContext.Current.Response.Write("发送托管服务已启动,已开始发送!");
             System.Web.HttpContext.Current.Response.Flush();
             System.Web.HttpContext.Current.Response.Close();
             for (int i = 0; i < dtList.Rows.Count; i++)
             {
                 if (!string.IsNullOrWhiteSpace(vSendList.t1.ToString()))
                 {
                     if (vSendList.j1.ToString() == "0")
                     {
                         SendMsg.SendMessageText(vSendList.t1.ToString(), dtList.Rows[i]["fakeid"].ToString());
                     }
                     else
                     {
                         SendMsg.SendTuWen(vSendList.t1.ToString(), dtList.Rows[i]["fakeid"].ToString());
                     }
                 }
                 Thread.Sleep(2000);
                 if (!string.IsNullOrWhiteSpace(vSendList.t2.ToString()))
                 {
                     if (vSendList.j2.ToString() == "0")
                     {
                         SendMsg.SendMessageText(vSendList.t2.ToString(), dtList.Rows[i]["fakeid"].ToString());
                     }
                     else
                     {
                         SendMsg.SendTuWen(vSendList.t2.ToString(), dtList.Rows[i]["fakeid"].ToString());
                     }
                 }
                 Thread.Sleep(2000);
             }
             return("0");
         }
     }
     else
     {
         return("MP登录失败,请确定帐号密码有效以及未开启短信验证!");
     }
 }