Ejemplo n.º 1
0
 public string ChangePayPassword(string _userid, string _oldPassword, string _newPassword)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = "id=@id";
         dbOperHandler.AddConditionParameter("@id", (object)_userid);
         object field = dbOperHandler.GetField("N_User", "PayPass");
         if (field == null)
         {
             return(this.GetJsonResult(0, "原取款密码错误!"));
         }
         if (!(field.ToString().ToLower() == MD5.Last64(MD5.Lower32(_oldPassword))))
         {
             return(this.GetJsonResult(0, "原取款密码错误!"));
         }
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = "id=@id";
         dbOperHandler.AddConditionParameter("@id", (object)_userid);
         dbOperHandler.AddFieldItem("PayPass", (object)MD5.Last64(MD5.Lower32(_newPassword)));
         dbOperHandler.AddFieldItem("IP", (object)Const.GetUserIp);
         if (dbOperHandler.Update("N_User") > 0)
         {
             return(this.GetJsonResult(1, "取款密码修改成功!"));
         }
         return(this.GetJsonResult(0, "取款密码修改失败!"));
     }
 }
Ejemplo n.º 2
0
 public void getUserUpPointListJson(string UserId, string MinPoint, ref string _jsonstr)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = "id=@id";
         dbOperHandler.AddConditionParameter("@id", (object)UserId);
         object field = dbOperHandler.GetField("N_User", "Point");
         dbOperHandler.SqlCmd  = "SELECT point,Convert(varchar(10),cast(round([Point]/10.0,2) as numeric(5,2)))+'%' as title FROM [N_UserLevel] where point<" + field + " and point>=" + (object)(Convert.ToDouble(MinPoint.Replace("%", "")) * 10.0);
         dbOperHandler.SqlCmd += " ORDER BY Bonus asc";
         DataTable dataTable = dbOperHandler.GetDataTable();
         _jsonstr = this.ConverTableToJSON(dataTable);
         dataTable.Clear();
         dataTable.Dispose();
     }
 }
Ejemplo n.º 3
0
 public void GetListOnlineJSON(int page, int PSize, string whereStr, string UserId, ref string _jsonstr)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = whereStr + " and UserCode like '%," + UserId + ",%'";
         int    num  = dbOperHandler.Count("N_User");
         string sql0 = SqlHelp.GetSql0(num.ToString() + " as totalcount,ID,UserName,UserCode,Money,LastTime", "N_User", "Id", PSize, page, "asc", whereStr + " and UserCode like '%," + UserId + ",%'");
         dbOperHandler.Reset();
         dbOperHandler.SqlCmd = sql0;
         DataTable dataTable = dbOperHandler.GetDataTable();
         string    str1      = "";
         if (dataTable.Rows.Count > 0)
         {
             for (int index1 = 0; index1 < dataTable.Rows.Count; ++index1)
             {
                 string   str2     = string.Empty;
                 string   str3     = dataTable.Rows[index1]["UserCode"].ToString().Replace(",,", "_").Replace(",", "");
                 string[] strArray = str3.Substring(str3.IndexOf(UserId)).Split('_');
                 if (strArray.Length > 0)
                 {
                     for (int index2 = 0; index2 < strArray.Length; ++index2)
                     {
                         if (!string.IsNullOrEmpty(strArray[index2]))
                         {
                             dbOperHandler.Reset();
                             dbOperHandler.ConditionExpress = "Id=" + strArray[index2];
                             str2 = str2 + dbOperHandler.GetField("N_User", "UserName") + ">";
                         }
                     }
                     string str4 = str2.Substring(0, str2.Length - 1);
                     if (index1 != 0)
                     {
                         str1 += " union all ";
                     }
                     str1 = str1 + " select  " + (object)num + " as totalcount,row_number() over (order by Id asc) as rowid,ID,UserName,UserCode,Money,'" + str4 + "' as CodeName,LastTime from N_User  where  Id=" + dataTable.Rows[index1]["Id"];
                 }
             }
             dbOperHandler.Reset();
             dbOperHandler.SqlCmd = str1;
             dataTable            = dbOperHandler.GetDataTable();
         }
         _jsonstr = this.ConverTableToJSON(dataTable);
         dataTable.Clear();
         dataTable.Dispose();
     }
 }
Ejemplo n.º 4
0
 public void getUserPointListJson(string UserId, ref string _jsonstr)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = "id=@id";
         dbOperHandler.AddConditionParameter("@id", UserId);
         object field = dbOperHandler.GetField("N_User", "Point");
         dbOperHandler.SqlCmd = "SELECT point,Convert(varchar(10),cast(round([Point]/10.0,2) as numeric(5,2)))+'%' as title FROM [N_UserLevel] where point>=100 and point<" + field;
         DbOperHandler expr_4B = dbOperHandler;
         expr_4B.SqlCmd += " ORDER BY Bonus desc";
         DataTable dataTable = dbOperHandler.GetDataTable();
         _jsonstr = base.ConverTableToJSON(dataTable);
         dataTable.Clear();
         dataTable.Dispose();
     }
 }
Ejemplo n.º 5
0
        public string Save(string userId, string PayMethod, string PayBank, string PayBankAddress, string PayAccount, string PayName, string strPwd)
        {
            if (this.Exists(" PayAccount='" + PayAccount + "'"))
            {
                return(base.GetJsonResult(0, "绑定失败,一张银行卡只能绑一个帐户!"));
            }
            if (this.Exists(" UserId=" + userId) && !this.Exists(" PayName='" + PayName + "' and UserId=" + userId))
            {
                return(base.GetJsonResult(0, "绑定失败,同一账户下只能绑定相同的开户名卡号!"));
            }
            string jsonResult;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "id=@id";
                dbOperHandler.AddConditionParameter("@id", userId);
                object field = dbOperHandler.GetField("N_User", "PayPass");
                if (!MD5.Last64(strPwd).Equals(field.ToString()))
                {
                    jsonResult = base.GetJsonResult(0, "绑定失败,您的提现密码错误!");
                }
                else
                {
                    dbOperHandler.Reset();
                    dbOperHandler.AddFieldItem("UserId", userId);
                    dbOperHandler.AddFieldItem("PayMethod", PayMethod);
                    dbOperHandler.AddFieldItem("PayBank", PayBank);
                    dbOperHandler.AddFieldItem("PayBankAddress", PayBankAddress);
                    dbOperHandler.AddFieldItem("PayAccount", PayAccount);
                    dbOperHandler.AddFieldItem("PayName", PayName);
                    dbOperHandler.AddFieldItem("AddTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    dbOperHandler.AddFieldItem("IsLock", 1);
                    if (dbOperHandler.Insert("N_UserBank") > 0)
                    {
                        jsonResult = base.GetJsonResult(1, "银行资料绑定成功!");
                    }
                    else
                    {
                        jsonResult = base.GetJsonResult(0, "银行资料绑定失败!");
                    }
                }
            }
            return(jsonResult);
        }
Ejemplo n.º 6
0
        public string Register(string _ParentId, string _UserGroup, string _UserName, string _Password, string _Point)
        {
            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "SELECT Id FROM [N_User] WHERE [UserName]='" + _UserName.ToLower() + "'";
                if (dbOperHandler.GetDataTable().Rows.Count > 0)
                {
                    return(this.GetJsonResult(0, "账号已存在,请更换一个账号!"));
                }
                string str = MD5.Last64(MD5.Lower32(_Password));

                object[,] _vFields1 = new object[2, 6] {
                    { "ParentId", "UserGroup", "UserName", "Password", "Point", "PayPass" },
                    { _ParentId, _UserGroup, _UserName.ToLower(), str, _Point, MD5.Last64(MD5.Lower32("123456")) }
                };

                dbOperHandler.Reset();
                dbOperHandler.AddFieldItems(_vFields1);
                int num = dbOperHandler.Insert("N_User");
                if (num <= 0)
                {
                    return(this.GetJsonResult(0, "添加会员失败!"));
                }

                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "id=@id";
                dbOperHandler.AddConditionParameter("@id", (object)_ParentId);
                object field = dbOperHandler.GetField("N_User", "UserCode");

                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "id=" + (object)num;
                dbOperHandler.AddFieldItem("UserCode", (object)(field.ToString() + Strings.PadLeft(num.ToString())));
                dbOperHandler.Update("N_User");

                object[,] _vFields2 = new object[2, 2] {
                    { "UserId", "Change" }, { num, 0 }
                };
                dbOperHandler.Reset();
                dbOperHandler.AddFieldItems(_vFields2);
                dbOperHandler.Insert("N_UserMoneyStatAll");

                return(this.GetJsonResult(1, "添加会员成功!"));
            }
        }
Ejemplo n.º 7
0
        public string ChangeUserPassword(string _userid, string _oldPassword, string _newPassword)
        {
            string jsonResult;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "id=@id";
                dbOperHandler.AddConditionParameter("@id", _userid);
                object field = dbOperHandler.GetField("N_User", "PassWord");
                if (field != null)
                {
                    if (field.ToString().ToLower() == MD5.Last64(MD5.Lower32(_oldPassword)))
                    {
                        dbOperHandler.Reset();
                        dbOperHandler.ConditionExpress = "id=@id";
                        dbOperHandler.AddConditionParameter("@id", _userid);
                        dbOperHandler.AddFieldItem("PassWord", MD5.Last64(MD5.Lower32(_newPassword)));
                        dbOperHandler.AddFieldItem("IP", Const.GetUserIp);
                        if (dbOperHandler.Update("N_User") > 0)
                        {
                            jsonResult = base.GetJsonResult(1, "登录密码修改成功!");
                        }
                        else
                        {
                            jsonResult = base.GetJsonResult(0, "登录密码修改失败!");
                        }
                    }
                    else
                    {
                        jsonResult = base.GetJsonResult(0, "原登录密码错误!");
                    }
                }
                else
                {
                    jsonResult = base.GetJsonResult(0, "原登录密码错误!");
                }
            }
            return(jsonResult);
        }
Ejemplo n.º 8
0
        public string Save(string code, string SendId, string ReceiveId, string Title, string Contents)
        {
            string    str1      = "";
            ArrayList arrayList = new ArrayList();

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                if (!string.IsNullOrEmpty(ReceiveId))
                {
                    dbOperHandler.Reset();
                    dbOperHandler.ConditionExpress = "UserName=@UserName";
                    dbOperHandler.AddConditionParameter("@UserName", (object)ReceiveId);
                    ReceiveId = string.Concat(dbOperHandler.GetField("N_User", "Id"));
                    arrayList.Add((object)ReceiveId);
                }
                else
                {
                    switch (code)
                    {
                    case "0":
                        dbOperHandler.Reset();
                        dbOperHandler.ConditionExpress = "Id=@Id";
                        dbOperHandler.AddConditionParameter("@Id", (object)SendId);
                        string str2 = string.Concat(dbOperHandler.GetField("N_User", "ParentId"));
                        if (str2.Equals("0"))
                        {
                            str1 = "您没有上级不能发送!";
                            break;
                        }
                        arrayList.Add((object)str2);
                        break;

                    case "1":
                        dbOperHandler.Reset();
                        dbOperHandler.SqlCmd = string.Format("select Id from N_User where ParentId={0}", (object)SendId);
                        DataTable dataTable1 = dbOperHandler.GetDataTable();
                        if (dataTable1.Rows.Count < 1)
                        {
                            str1 = "您没有直属下级不能发送!";
                            break;
                        }
                        for (int index = 0; index < dataTable1.Rows.Count; ++index)
                        {
                            arrayList.Add((object)dataTable1.Rows[index]["Id"].ToString());
                        }
                        break;

                    case "2":
                        dbOperHandler.Reset();
                        dbOperHandler.SqlCmd = string.Format("select Id from N_User where UserCode like '%{0}%' and Id<>{0}", (object)Strings.PadLeft(SendId));
                        DataTable dataTable2 = dbOperHandler.GetDataTable();
                        if (dataTable2.Rows.Count < 1)
                        {
                            str1 = "您没有下级不能发送!";
                            break;
                        }
                        for (int index = 0; index < dataTable2.Rows.Count; ++index)
                        {
                            arrayList.Add((object)dataTable2.Rows[index]["Id"].ToString());
                        }
                        break;
                    }
                }
                foreach (string str3 in arrayList)
                {
                    dbOperHandler.Reset();
                    dbOperHandler.AddFieldItem("SendId", (object)SendId);
                    dbOperHandler.AddFieldItem("ReceiveId", (object)str3);
                    dbOperHandler.AddFieldItem("Title", (object)Title);
                    dbOperHandler.AddFieldItem("Contents", (object)Contents);
                    dbOperHandler.AddFieldItem("STime", (object)DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    dbOperHandler.AddFieldItem("IsRead", (object)"0");
                    str1 = dbOperHandler.Insert("N_UserEmail") <= 0 ? "发送失败!" : "发送成功!";
                }
                return(str1);
            }
        }
Ejemplo n.º 9
0
        public string Save(string code, string SendId, string ReceiveId, string Title, string Contents)
        {
            string    text      = "";
            ArrayList arrayList = new ArrayList();
            string    result;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                if (!string.IsNullOrEmpty(ReceiveId))
                {
                    dbOperHandler.Reset();
                    dbOperHandler.ConditionExpress = "UserName=@UserName";
                    dbOperHandler.AddConditionParameter("@UserName", ReceiveId);
                    ReceiveId = string.Concat(dbOperHandler.GetField("N_User", "Id"));
                    arrayList.Add(ReceiveId);
                }
                else if (code != null)
                {
                    if (!(code == "0"))
                    {
                        if (!(code == "1"))
                        {
                            if (code == "2")
                            {
                                dbOperHandler.Reset();
                                dbOperHandler.SqlCmd = string.Format("select Id from N_User where UserCode like '%{0}%' and Id<>{0}", Strings.PadLeft(SendId));
                                DataTable dataTable = dbOperHandler.GetDataTable();
                                if (dataTable.Rows.Count < 1)
                                {
                                    text = "您没有下级不能发送!";
                                }
                                else
                                {
                                    for (int i = 0; i < dataTable.Rows.Count; i++)
                                    {
                                        arrayList.Add(dataTable.Rows[i]["Id"].ToString());
                                    }
                                }
                            }
                        }
                        else
                        {
                            dbOperHandler.Reset();
                            dbOperHandler.SqlCmd = string.Format("select Id from N_User where ParentId={0}", SendId);
                            DataTable dataTable2 = dbOperHandler.GetDataTable();
                            if (dataTable2.Rows.Count < 1)
                            {
                                text = "您没有直属下级不能发送!";
                            }
                            else
                            {
                                for (int j = 0; j < dataTable2.Rows.Count; j++)
                                {
                                    arrayList.Add(dataTable2.Rows[j]["Id"].ToString());
                                }
                            }
                        }
                    }
                    else
                    {
                        dbOperHandler.Reset();
                        dbOperHandler.ConditionExpress = "Id=@Id";
                        dbOperHandler.AddConditionParameter("@Id", SendId);
                        string text2 = string.Concat(dbOperHandler.GetField("N_User", "ParentId"));
                        if (text2.Equals("0"))
                        {
                            text = "您没有上级不能发送!";
                        }
                        else
                        {
                            arrayList.Add(text2);
                        }
                    }
                }
                foreach (string fieldValue in arrayList)
                {
                    dbOperHandler.Reset();
                    dbOperHandler.AddFieldItem("SendId", SendId);
                    dbOperHandler.AddFieldItem("ReceiveId", fieldValue);
                    dbOperHandler.AddFieldItem("Title", Title);
                    dbOperHandler.AddFieldItem("Contents", Contents);
                    dbOperHandler.AddFieldItem("STime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    dbOperHandler.AddFieldItem("IsRead", "0");
                    if (dbOperHandler.Insert("N_UserEmail") > 0)
                    {
                        text = "发送成功!";
                    }
                    else
                    {
                        text = "发送失败!";
                    }
                }
                result = text;
            }
            return(result);
        }
Ejemplo n.º 10
0
 public void GetListOnlineJSON(int page, int PSize, string whereStr, string UserId, ref string _jsonstr)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = whereStr + " and UserCode like '%," + UserId + ",%'";
         int    num = dbOperHandler.Count("N_User");
         string sql = SqlHelp.GetSql0(num + " as totalcount,ID,UserName,UserCode,Money,LastTime", "N_User", "Id", PSize, page, "asc", whereStr + " and UserCode like '%," + UserId + ",%'");
         dbOperHandler.Reset();
         dbOperHandler.SqlCmd = sql;
         DataTable dataTable = dbOperHandler.GetDataTable();
         string    text      = "";
         if (dataTable.Rows.Count > 0)
         {
             for (int i = 0; i < dataTable.Rows.Count; i++)
             {
                 string text2 = string.Empty;
                 string text3 = dataTable.Rows[i]["UserCode"].ToString().Replace(",,", "_").Replace(",", "");
                 text3 = text3.Substring(text3.IndexOf(UserId));
                 string[] array = text3.Split(new char[]
                 {
                     '_'
                 });
                 if (array.Length > 0)
                 {
                     for (int j = 0; j < array.Length; j++)
                     {
                         if (!string.IsNullOrEmpty(array[j]))
                         {
                             dbOperHandler.Reset();
                             dbOperHandler.ConditionExpress = "Id=" + array[j];
                             text2 = text2 + dbOperHandler.GetField("N_User", "UserName") + ">";
                         }
                     }
                     text2 = text2.Substring(0, text2.Length - 1);
                     if (i != 0)
                     {
                         text += " union all ";
                     }
                     object obj = text;
                     text = string.Concat(new object[]
                     {
                         obj,
                         " select  ",
                         num,
                         " as totalcount,row_number() over (order by Id asc) as rowid,ID,UserName,UserCode,Money,'",
                         text2,
                         "' as CodeName,LastTime from N_User  where  Id=",
                         dataTable.Rows[i]["Id"]
                     });
                 }
             }
             dbOperHandler.Reset();
             dbOperHandler.SqlCmd = text;
             dataTable            = dbOperHandler.GetDataTable();
         }
         _jsonstr = base.ConverTableToJSON(dataTable);
         dataTable.Clear();
         dataTable.Dispose();
     }
 }
Ejemplo n.º 11
0
        public string Register(string _ParentId, string _UserGroup, string _UserName, string _Password, string _Point)
        {
            string jsonResult;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "SELECT Id FROM [N_User] WHERE [UserName]='" + _UserName.ToLower() + "'";
                if (dbOperHandler.GetDataTable().Rows.Count > 0)
                {
                    jsonResult = base.GetJsonResult(0, "账号已存在,请更换一个账号!");
                }
                else
                {
                    string text = MD5.Last64(MD5.Lower32(_Password));
                    object[,] array   = new object[2, 6];
                    array[0, 0]       = "ParentId";
                    array[0, 1]       = "UserGroup";
                    array[0, 2]       = "UserName";
                    array[0, 3]       = "Password";
                    array[0, 4]       = "Point";
                    array[0, 5]       = "PayPass";
                    array[1, 0]       = _ParentId;
                    array[1, 1]       = _UserGroup;
                    array[1, 2]       = _UserName.ToLower();
                    array[1, 3]       = text;
                    array[1, 4]       = _Point;
                    array[1, 5]       = MD5.Last64(MD5.Lower32("123456"));
                    object[,] vFields = array;
                    dbOperHandler.Reset();
                    dbOperHandler.AddFieldItems(vFields);
                    int num = dbOperHandler.Insert("N_User");
                    if (num > 0)
                    {
                        dbOperHandler.Reset();
                        dbOperHandler.ConditionExpress = "id=@id";
                        dbOperHandler.AddConditionParameter("@id", _ParentId);
                        object field = dbOperHandler.GetField("N_User", "UserCode");
                        dbOperHandler.Reset();
                        dbOperHandler.ConditionExpress = "id=" + num;
                        dbOperHandler.AddFieldItem("UserCode", field + Strings.PadLeft(num.ToString()));
                        dbOperHandler.Update("N_User");
                        object[,] array2   = new object[2, 2];
                        array2[0, 0]       = "UserId";
                        array2[0, 1]       = "Change";
                        array2[1, 0]       = num;
                        array2[1, 1]       = 0;
                        object[,] vFields2 = array2;
                        dbOperHandler.Reset();
                        dbOperHandler.AddFieldItems(vFields2);
                        dbOperHandler.Insert("N_UserMoneyStatAll");
                        jsonResult = base.GetJsonResult(1, "添加会员成功!");
                    }
                    else
                    {
                        jsonResult = base.GetJsonResult(0, "添加会员失败!");
                    }
                }
            }
            return(jsonResult);
        }