Beispiel #1
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            string text9  = "";
            string text8  = this.TextBoxGdID.Text.Trim();
            string input  = this.TextBoxUserName.Text.Trim();
            string text2  = this.TextBoxNewpass1.Text.Trim();
            string text3  = this.TextBoxNewpass2.Text.Trim();
            string text4  = this.TextBoxTrueName.Text.Trim();
            string s      = this.DropDownListBL.SelectedValue.Trim();
            string text6  = MyFunc.DefaultValue(base.Request.Form["DropDownListGsGd"], "");
            string text7  = this.TextBoxUseMoney.Text.Trim();
            string text10 = this.TextBoxMaxMem.Text.Trim();

            if ((((text8 == "") || (input == "")) || ((text4 == "") || (s == ""))) || ((text10 == "") || (text6 == "")))
            {
                MyFunc.showmsg("请输入股东帐号,名称,成数和最大会员数");
                base.Response.End();
            }
            else
            {
                Regex regex  = new Regex("[^'*%=\"<>/|]");
                Regex regex2 = new Regex("[^'*%=\"<>/|]");
                if (!regex.IsMatch(input) || !regex2.IsMatch(text4))
                {
                    MyFunc.showmsg("股东帐号或股东名里含有非法字符");
                    base.Response.End();
                }
                else
                {
                    if ((text2 != "") && (text3 != ""))
                    {
                        if (text2 != text3)
                        {
                            MyFunc.showmsg("输入的密码不相同");
                            return;
                        }
                        text9 = ",userpass='******'";
                    }
                    if (text4.Length > 8)
                    {
                        MyFunc.showmsg("股东名称不能大于8个字符(4个汉字)");
                        base.Response.End();
                    }
                    else
                    {
                        try
                        {
                            int num = int.Parse(s);
                            if (((num % 10) == 0) && ((num >= 0) || (num <= 100)))
                            {
                                try
                                {
                                    int num2 = int.Parse(text6);
                                    if ((num2 >= int.Parse(s)) || (num2 <= 100))
                                    {
                                        try
                                        {
                                            if (int.Parse(text7) >= 0)
                                            {
                                                try
                                                {
                                                    int.Parse(text10);
                                                }
                                                catch
                                                {
                                                    MyFunc.showmsg("请输入正确的最大会员数");
                                                    base.Response.End();
                                                    return;
                                                }
                                                DataBase base2 = new DataBase(MyFunc.GetConnStr(2));
                                                int      num9  = 100 - int.Parse(text6);
                                                if (int.Parse(base2.ExecuteScalar("SELECT COUNT(1) FROM agence WHERE gdid=" + text8 + " AND bl+zdlbl>" + num9.ToString()).ToString()) > 0)
                                                {
                                                    MyFunc.showmsg("不能修改股东成数,该股东下有总代理和代理商的成数和大于" + ((100 - int.Parse(s))).ToString());
                                                    base.Response.End();
                                                }
                                                else if (int.Parse(base2.ExecuteScalar("SELECT COUNT(*) FROM agence WHERE userid=" + text8).ToString()) < 1)
                                                {
                                                    base2.Dispose();
                                                    MyFunc.showmsg("没有该股东");
                                                }
                                                else
                                                {
                                                    int num4 = int.Parse(base2.ExecuteScalar("SELECT ISNULL(SUM(usemoney),0) FROM agence WHERE gdid=" + this.TextBoxGdID.Text + " AND isuseable=1 AND classid = 3").ToString());
                                                    int num5 = int.Parse(base2.ExecuteScalar("SELECT ISNULL(SUM(usemoney),0) FROM agence WHERE gdid=" + this.TextBoxGdID.Text + " AND isuseable=0 AND classid = 3").ToString());
                                                    int num6 = (int.Parse(this.TextBoxUseMoney.Text) - num4) - num5;
                                                    if (num6 < 0)
                                                    {
                                                        base2.Dispose();
                                                        MyFunc.showmsg("信用额度一定要大于已用额度:" + ((num4 + num5)).ToString());
                                                        base.Response.End();
                                                    }
                                                    else
                                                    {
                                                        int num7 = int.Parse(base2.ExecuteScalar("SELECT COUNT(1) FROM member WHERE gdid=" + text8).ToString());
                                                        if ((num7 > int.Parse(text10)) && (int.Parse(text10) != 0))
                                                        {
                                                            base2.Dispose();
                                                            MyFunc.showmsg("该股东已有 " + num7.ToString() + " 个会员,设置的最大会员数最小为" + num7.ToString());
                                                            base.Response.End();
                                                        }
                                                        else if (base2.ExecuteNonQuery("UPDATE agence SET truename='" + text4 + "'" + text9 + ",gsbl=" + s + ",maxmem=" + text10 + ",usemoney=" + text7 + " WHERE userid=" + text8) > 0)
                                                        {
                                                            int num8 = int.Parse(text6) - int.Parse(s);
                                                            base2.ExecuteNonQuery("UPDATE agence SET gsbl=" + s + " WHERE gdid=" + text8 + " AND classid=4");
                                                            base2.ExecuteNonQuery("UPDATE agence SET gdbl=100-bl-zdlbl-gsbl WHERE gdid=" + text8 + " AND classid=4");
                                                            base2.Dispose();
                                                            MyFunc.JumpPage("修改股东成功!", "gdlist.aspx");
                                                        }
                                                        else
                                                        {
                                                            base2.Dispose();
                                                            MyFunc.showmsg("修改股东失败!");
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                MyFunc.showmsg("请输入正确的信用额度");
                                                base.Response.End();
                                            }
                                        }
                                        catch
                                        {
                                            MyFunc.showmsg("请输入正确的信用额度");
                                            base.Response.End();
                                        }
                                    }
                                    else
                                    {
                                        MyFunc.showmsg("请选择正确的公司+股东成数");
                                        base.Response.End();
                                    }
                                }
                                catch
                                {
                                    MyFunc.showmsg("请选择正确的公司+股东成数");
                                    base.Response.End();
                                }
                            }
                            else
                            {
                                MyFunc.showmsg("请选择正确的公司成数");
                                base.Response.End();
                            }
                        }
                        catch
                        {
                            MyFunc.showmsg("请选择正确的公司成数");
                            base.Response.End();
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            string input = this.TextBoxUserName.Text.Trim().ToLower();
            string text2 = this.TextBoxNewpass1.Text.Trim();
            string text3 = this.TextBoxNewpass2.Text.Trim();
            string text4 = this.TextBoxTrueName.Text.Trim();
            string s     = this.DropDownListBL.SelectedValue.Trim();
            string text6 = MyFunc.DefaultValue(base.Request.Form["DropDownListGsGd"], "");
            string text8 = this.TextBoxUseMoney.Text.Trim();
            string text7 = this.TextBoxMaxMem.Text.Trim();

            if ((((input == "") || (text2 == "")) || ((text3 == "") || (text4 == ""))) || ((s == "") || (text6 == "")))
            {
                MyFunc.showmsg("请输入股东帐号,密码,名称和比例");
                base.Response.End();
            }
            else if (input.Length < 3)
            {
                MyFunc.showmsg("股东帐号不能小于3个字符");
                base.Response.End();
            }
            else if (text4.Length > 8)
            {
                MyFunc.showmsg("股东名称不能大于8个字符(4个汉字)");
                base.Response.End();
            }
            else
            {
                Regex regex  = new Regex("[^'*%=\"<>/|]");
                Regex regex2 = new Regex("[^'*%=\"<>/|]");
                if (!regex.IsMatch(input) || !regex2.IsMatch(text4))
                {
                    MyFunc.showmsg("股东帐号或股东名里含有非法字符");
                    base.Response.End();
                }
                else if (text2 != text3)
                {
                    MyFunc.showmsg("输入的密码不相同");
                }
                else
                {
                    try
                    {
                        int num = int.Parse(s);
                        if ((num >= 0) || (num <= 100))
                        {
                            try
                            {
                                int num2 = int.Parse(text6);
                                if ((num2 >= int.Parse(s)) || (num2 <= 100))
                                {
                                    try
                                    {
                                        if (int.Parse(text8) >= 0)
                                        {
                                            if (int.Parse(text6) < int.Parse(s))
                                            {
                                                MyFunc.showmsg("公司+股东比例不能小于公司最低比例");
                                                base.Response.End();
                                            }
                                            else
                                            {
                                                try
                                                {
                                                    int.Parse(text7);
                                                }
                                                catch
                                                {
                                                    MyFunc.showmsg("请输入正确的最大会员数");
                                                    base.Response.End();
                                                    return;
                                                }
                                                DataBase base2 = new DataBase(MyFunc.GetConnStr(2));
                                                if (int.Parse(base2.ExecuteScalar("SELECT COUNT(*) FROM agence WHERE username='******'").ToString()) > 0)
                                                {
                                                    base2.Dispose();
                                                    MyFunc.showmsg("该股东帐号已存在!");
                                                    base.Response.End();
                                                }
                                                else if (base2.ExecuteNonQuery("INSERT INTO agence(username,userpass,truename,classid,regtime,isuseable,gsbl,gdbl,usemoney,maxmem,gdid,gdname)VALUES('" + input + "','" + text2 + "','" + text4 + "',2,GetDate(),1," + s + "," + text6 + "," + text8 + "," + text7 + ",'" + this.Session["adminuserid"].ToString() + "','" + this.Session["adminusername"].ToString() + "')") > 0)
                                                {
                                                    string text9 = base2.ExecuteScalar("SELECT userid FROM agence WHERE username='******'").ToString();
                                                    base2.ExecuteNonQuery("UPDATE agence SET arrgd = arrgd+'" + text9.Trim() + ",' WHERE classid = 0 AND userid = '" + this.Session["adminuserid"].ToString() + "'");
                                                    base2.ExecuteNonQuery("INSERT INTO hs(userid,type)VALUES(" + text9 + ",'A');INSERT INTO hs(userid,type)VALUES(" + text9 + ",'B');INSERT INTO hs(userid,type)VALUES(" + text9 + ",'C');INSERT INTO hs(userid,type)VALUES(" + text9 + ",'D')");
                                                    base2.Dispose();
                                                    MyFunc.JumpPage("添加股东成功!", "gdlist.aspx");
                                                }
                                                else
                                                {
                                                    base2.Dispose();
                                                    MyFunc.showmsg("添加股东失败!");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            MyFunc.showmsg("请输入正确的信用额度");
                                            base.Response.End();
                                        }
                                    }
                                    catch
                                    {
                                        MyFunc.showmsg("请输入正确的信用额度");
                                        base.Response.End();
                                    }
                                }
                                else
                                {
                                    MyFunc.showmsg("请选择正确的公司+股东成数");
                                    base.Response.End();
                                }
                            }
                            catch
                            {
                                MyFunc.showmsg("请选择正确的公司+股东成数");
                                base.Response.End();
                            }
                        }
                        else
                        {
                            MyFunc.showmsg("请选择正确的公司成数");
                            base.Response.End();
                        }
                    }
                    catch
                    {
                        MyFunc.showmsg("请选择正确的公司成数");
                        base.Response.End();
                    }
                }
            }
        }
Beispiel #3
0
        private void Updatekygl(string type)
        {
            if (!MyFunc.CheckUserLogin(this.Session.Contents["adminusername"].ToString().Trim(), this.Session.Contents["adminuserpass"].ToString().Trim(), this.Session.Contents["adminclassid"].ToString().Trim(), 1))
            {
                MyFunc.goToLoginPage();
            }
            else if ((((base.Request.Form["war_set_w"] != null) && (base.Request.Form["war_set_l"] != null)) && (((base.Request.Form["SC"] != null) & (base.Request.Form["SO"] != null)) && (base.Request.Form["id"] != null))) && (((base.Request.Form["id"].ToString().Trim() != "") && (base.Request.Form["did"] != null)) && (base.Request.Form["did"].ToString().Trim() != "")))
            {
                string sql   = "";
                string text2 = "";
                string text3 = MyFunc.DefaultValue(base.Request.Form["war_set_w"].ToString().Trim(), "0");
                string text4 = MyFunc.DefaultValue(base.Request.Form["war_set_l"].ToString().Trim(), "0");
                string s     = MyFunc.DefaultValue(base.Request.Form["SC"].ToString().Trim(), "0");
                string text6 = MyFunc.DefaultValue(base.Request.Form["SO"].ToString().Trim(), "0");
                string text7 = base.Request.Form["id"].ToString().Trim();
                string text8 = base.Request.Form["did"].ToString().Trim();
                switch (type)
                {
                case "1":
                    sql   = "UPDATE userhs SET W1=" + text3 + ",L1=" + text4 + ",MAXC1=" + s + ",MAXZ1=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc1,maxz1 FROM agence WHERE userid=" + text8;
                    break;

                case "2":
                    sql   = "UPDATE userhs SET W2=" + text3 + ",L2=" + text4 + ",MAXC2=" + s + ",MAXZ2=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc2,maxz2 FROM agence WHERE userid=" + text8;
                    break;

                case "3":
                    sql   = "UPDATE userhs SET W3=" + text3 + ",L3=" + text4 + ",MAXC3=" + s + ",MAXZ3=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc3,maxz3 FROM agence WHERE userid=" + text8;
                    break;

                case "4":
                    sql   = "UPDATE userhs SET W4=" + text3 + ",L4=" + text4 + ",MAXC4=" + s + ",MAXZ4=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc4,maxz4 FROM agence WHERE userid=" + text8;
                    break;

                case "5":
                    sql   = "UPDATE userhs SET W5=" + text3 + ",L5=" + text4 + ",MAXC5=" + s + ",MAXZ5=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc5,maxz5 FROM agence WHERE userid=" + text8;
                    break;

                case "6":
                    sql   = "UPDATE userhs SET W6=" + text3 + ",L6=" + text4 + ",MAXC6=" + s + ",MAXZ6=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc6,maxz6 FROM agence WHERE userid=" + text8;
                    break;

                case "7":
                    sql   = "UPDATE userhs SET W7=" + text3 + ",L7=" + text4 + ",MAXC7=" + s + ",MAXZ7=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc7,maxz7 FROM agence WHERE userid=" + text8;
                    break;

                case "8":
                    sql   = "UPDATE userhs SET W8=" + text3 + ",L8=" + text4 + ",MAXC8=" + s + ",MAXZ8=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc8,maxz8 FROM agence WHERE userid=" + text8;
                    break;

                case "9":
                    sql   = "UPDATE userhs SET W9=" + text3 + ",L9=" + text4 + ",MAXC9=" + s + ",MAXZ9=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc9,maxz9 FROM agence WHERE userid=" + text8;
                    break;

                case "10":
                    sql   = "UPDATE userhs SET W10=" + text3 + ",L10=" + text4 + ",MAXC10=" + s + ",MAXZ10=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc10,maxz10 FROM agence WHERE userid=" + text8;
                    break;

                case "11":
                    sql   = "UPDATE userhs SET W11=" + text3 + ",L11=" + text4 + ",MAXC11=" + s + ",MAXZ11=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc11,maxz11 FROM agence WHERE userid=" + text8;
                    break;

                case "12":
                    sql   = "UPDATE userhs SET W12=" + text3 + ",L12=" + text4 + ",MAXC12=" + s + ",MAXZ12=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc12,maxz12 FROM agence WHERE userid=" + text8;
                    break;

                case "13":
                    sql   = "UPDATE userhs SET W13=" + text3 + ",L13=" + text4 + ",MAXC13=" + s + ",MAXZ13=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc13,maxz13 FROM agence WHERE userid=" + text8;
                    break;

                case "16":
                    sql   = "UPDATE userhs SET W14=" + text3 + ",L14=" + text4 + ",MAXC14=" + s + ",MAXZ14=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc14,maxz14 FROM agence WHERE userid=" + text8;
                    break;

                case "17":
                    sql   = "UPDATE userhs SET W15=" + text3 + ",L15=" + text4 + ",MAXC15=" + s + ",MAXZ15=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc15,maxz15 FROM agence WHERE userid=" + text8;
                    break;

                case "18":
                    sql   = "UPDATE userhs SET W18=" + text3 + ",L18=" + text4 + ",MAXC18=" + s + ",MAXZ18=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc18,maxz18 FROM agence WHERE userid=" + text8;
                    break;

                case "19":
                    sql   = "UPDATE userhs SET W19=" + text3 + ",L19=" + text4 + ",MAXC19=" + s + ",MAXZ19=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc19,maxz19 FROM agence WHERE userid=" + text8;
                    break;

                case "20":
                    sql   = "UPDATE userhs SET W20=" + text3 + ",L20=" + text4 + ",MAXC20=" + s + ",MAXZ20=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc20,maxz20 FROM agence WHERE userid=" + text8;
                    break;

                case "21":
                    sql   = "UPDATE userhs SET W21=" + text3 + ",L21=" + text4 + ",MAXC21=" + s + ",MAXZ21=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc21,maxz21 FROM agence WHERE userid=" + text8;
                    break;

                case "22":
                    sql   = "UPDATE userhs SET W22=" + text3 + ",L22=" + text4 + ",MAXC22=" + s + ",MAXZ22=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc22,maxz22 FROM agence WHERE userid=" + text8;
                    break;

                case "23":
                    sql   = "UPDATE userhs SET W23=" + text3 + ",L23=" + text4 + ",MAXC23=" + s + ",MAXZ23=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc23,maxz23 FROM agence WHERE userid=" + text8;
                    break;

                case "24":
                    sql   = "UPDATE userhs SET W24=" + text3 + ",L24=" + text4 + ",MAXC24=" + s + ",MAXZ24=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc24,maxz24 FROM agence WHERE userid=" + text8;
                    break;

                case "28":
                    sql   = "UPDATE userhs SET W28=" + text3 + ",L28=" + text4 + ",MAXC28=" + s + ",MAXZ28=" + text6 + " WHERE userid=" + text7;
                    text2 = "SELECT Maxc28,maxz28 FROM agence WHERE userid=" + text8;
                    break;
                }
                if (sql != "")
                {
                    DataBase      base2  = new DataBase(MyFunc.GetConnStr(2));
                    int           num    = 0;
                    int           num2   = 0;
                    SqlDataReader reader = base2.ExecuteReader(text2);
                    if (reader.Read())
                    {
                        num  = int.Parse(reader[0].ToString().Trim());
                        num2 = int.Parse(reader[1].ToString().Trim());
                    }
                    reader.Close();
                    if ((num < ((int)float.Parse(s))) || (num2 < ((int)float.Parse(text6))))
                    {
                        base2.Dispose();
                        MyFunc.showmsg("单场限额或单注限额不能大于代理商的单场限额或单注限额");
                        base.Response.End();
                    }
                    else
                    {
                        SqlDataReader reader2 = base2.ExecuteReader("SELECT usemoney FROM member WHERE userid=" + text7);
                        if (!reader2.Read())
                        {
                            reader2.Close();
                            base2.Dispose();
                            MyFunc.showmsg("没有该会员");
                            base.Response.End();
                        }
                        else
                        {
                            int num3 = (int)float.Parse(reader2["usemoney"].ToString().Trim());
                            reader2.Close();
                            int num4 = (int)float.Parse(s);
                            int num5 = (int)float.Parse(text6);
                            if (num4 > num3)
                            {
                                base2.Dispose();
                                MyFunc.showmsg("单场限额不能大于信用额");
                                base.Response.End();
                            }
                            else if (num5 > num4)
                            {
                                base2.Dispose();
                                MyFunc.showmsg("单注限额不能大于单场限额");
                                base.Response.End();
                            }
                            else
                            {
                                base2.ExecuteNonQuery(sql);
                                base2.Dispose();
                                base.Response.Redirect("userset.aspx?id=" + text7 + "&did=" + text8);
                            }
                        }
                    }
                }
            }
        }