Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         LoadTrones();
         LoadCPs();
     }
     else
     {
         dBase.BeginTransaction();
         try
         {
             SaveData();
             dBase.Commit();
             RedirectFromPage("保存成功");
         }
         catch (System.Threading.ThreadAbortException)
         {
         }
         catch (System.Data.Common.DbException)
         {
             dBase.Rollback();
             Static.ClientRedirect("保存出错");
         }
     }
 }
Esempio n. 2
0
    private void SaveData()
    {
        var str = Request["troneOrderId"];

        if (string.IsNullOrEmpty(str))
        {
            Static.ClientRedirect("PoolSetPriorityEditor.aspx?returnURL=" + Server.UrlEncode(Request["returnURL"]) + "&id=" + poolid.ToString(), "无添加操作");
            return;
        }
        var ids = str.Split(new char[] { ',' });
        int i;
        var sb = new System.Text.StringBuilder();

        sb.Append("INSERT INTO `daily_config`.`tbl_cp_pool_set` (`cp_pool_id`, `trone_order_id`, `priority`, `status`) VALUES");
        bool iHas = false;

        foreach (var t in ids)
        {
            if (!int.TryParse(t, out i))
            {
                continue;
            }
            if (iHas)
            {
                sb.Append(",");
            }
            sb.AppendFormat("({0}, {1},30, 1)", poolid, i);
            iHas = true;
        }
        if (iHas)
        {
            dBase.ExecuteNonQuery(sb.ToString());
        }
        Static.ClientRedirect("PoolSetPriorityEditor.aspx?returnURL=" + Server.UrlEncode(Request["returnURL"]) + "&id=" + poolid.ToString(), "操作成功");
    }
Esempio n. 3
0
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest Request = context.Request;


            string userName = Request["userName"];
            string password = Request["password"];
            string pType    = Request["pType"];

            if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
            {
                Static.ClientRedirect("用户名或密码为能为空!");
                return;
            }

            string userInfo;

            using (this.dBase = CreateDBase())
            {
                userInfo = DoLogin(userName, password, pType);
            }
            if (userInfo == null)
            {
                Static.ClientRedirect("用户名或密码错误!");
                return;
            }
            if (!Regex.IsMatch(userInfo, "^.+?\\|.+?\\|[^\\|]{0,}$"))
            {
                Static.ClientRedirect(userInfo);
                return;
            }
            if (Mode == AuthorMode.TickForm)
            {
                WriteTick(userInfo.Split(new char[] { '|' }));
            }
            else
            {
                HttpCookie ec = new HttpCookie(AuthorIIdentity.C_SESSION_NAME);
                if (!Request.IsLocal)
                {
                    ec.Domain = Domain;
                }

                ec.HttpOnly = true;
                ec.Value    = AdminCookieEnCode.Encode(userInfo, Request.UserAgent);
                context.Response.Cookies.Add(ec);
            }
            string ret = Request["returnUrl"];

            if (!string.IsNullOrEmpty(ret))
            {
                context.Response.Redirect(ret);
            }
            else
            {
                context.Response.Redirect("~/");
            }
        }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.HttpMethod != "POST")
        {
            return;
        }
        var model = new LightDataModel.tbl_cp_poolItem();

        var s = Request["name"];

        model.name = s;
        int i;

        int.TryParse(Request["price"], out i);
        model.fee = i * 100;

        s = Request["cpid"];
        i = s.IndexOf(',');
        if (i != -1)
        {
            s = s.Substring(0, i);
        }
        int.TryParse(s, out i);
        model.cp_id  = i;
        model.status = true;


        if (model.cp_id == 0 || model.fee == 0 || string.IsNullOrEmpty(model.name))
        {
            Static.alert("所有功均为必填项");
            return;
        }

        model.SaveToDatabase(dBase);
        Static.ClientRedirect("PoolSetEditor.aspx?returnUrl=./poolsetlist.aspx&id=" + model.id, "创建成功");
    }