Example #1
0
        public int UpdateMessageIsRead(string Id)
        {
            int result;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "Id=@Id";
                dbOperHandler.AddConditionParameter("@Id", Id);
                dbOperHandler.AddFieldItem("IsRead", "1");
                result = dbOperHandler.Update("N_UserMessage");
            }
            return(result);
        }
Example #2
0
        public int ReadedUserReceive(string UserId)
        {
            int result;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "ReceiveId=@UserId";
                dbOperHandler.AddConditionParameter("@UserId", UserId);
                dbOperHandler.AddFieldItem("IsRead", "1");
                result = dbOperHandler.Update("N_UserEmail");
            }
            return(result);
        }
Example #3
0
        public int DeletesByUserSend(string UserId)
        {
            int result;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "UserId=@UserId";
                dbOperHandler.AddConditionParameter("@SendId", UserId);
                dbOperHandler.AddFieldItem("IsDelSend", "1");
                result = dbOperHandler.Update("N_UserEmail");
            }
            return(result);
        }
Example #4
0
        public int DeletesReceive(string _id)
        {
            int result;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "id=@id";
                dbOperHandler.AddConditionParameter("@id", _id);
                dbOperHandler.AddFieldItem("IsDelReceive", "1");
                result = dbOperHandler.Update("N_UserEmail");
            }
            return(result);
        }
Example #5
0
 public string SaveContractState(string UserId)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = "UserId=@UserId";
         dbOperHandler.AddConditionParameter("@UserId", UserId);
         dbOperHandler.AddFieldItem("IsUsed", 0);
         if (dbOperHandler.Update("Act_UserFHDetail") > 0)
         {
             return(base.GetJsonResult(1, "契约签订成功!"));
         }
     }
     return(base.GetJsonResult(0, "契约签订失败!"));
 }
Example #6
0
        public string UserTranAcc(string Type, string UserId, string ToUserId, string Money, string PassWord)
        {
            if (Convert.ToDecimal(Money) < 0m)
            {
                return(base.GetJsonResult(0, "转账金额不正确!"));
            }
            string jsonResult;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "id=@id";
                dbOperHandler.AddConditionParameter("@id", UserId);
                object[] fields = dbOperHandler.GetFields("N_User", "Money,PayPass");
                if (fields.Length > 0)
                {
                    if (Convert.ToDecimal(Money) > Convert.ToDecimal(fields[0]))
                    {
                        jsonResult = base.GetJsonResult(0, "您的可用余额不足");
                    }
                    else if (!MD5.Last64(MD5.Lower32(PassWord)).Equals(fields[1].ToString()))
                    {
                        jsonResult = base.GetJsonResult(0, "您的取款密码错误");
                    }
                    else if (new UserChargeDAL().SaveUpCharge(Type, UserId, ToUserId, Convert.ToDecimal(Money)) > 0)
                    {
                        new LogSysDAL().Save("会员管理", string.Concat(new string[]
                        {
                            "Id为",
                            UserId,
                            "的会员转账给Id为",
                            ToUserId,
                            "的会员!"
                        }));
                        jsonResult = base.GetJsonResult(1, "转账成功!");
                    }
                    else
                    {
                        jsonResult = base.GetJsonResult(0, "转账失败!");
                    }
                }
                else
                {
                    jsonResult = base.GetJsonResult(0, "账号出现问题,请您重新登陆!");
                }
            }
            return(jsonResult);
        }
Example #7
0
 public string ClearUserPassword(string _userid, string Password)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = "id=@id";
         dbOperHandler.AddConditionParameter("@id", (object)_userid);
         dbOperHandler.AddFieldItem("PassWord", (object)MD5.Last64(MD5.Lower32(Password)));
         dbOperHandler.AddFieldItem("IP", (object)Const.GetUserIp);
         if (dbOperHandler.Update("N_User") > 0)
         {
             return(this.GetJsonResult(1, "重置密码成功!"));
         }
         return(this.GetJsonResult(0, "重置密码失败!"));
     }
 }
Example #8
0
 public string UpdateContractState(string UserId, string state)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.ConditionExpress = "Type=1 and UserId=@UserId";
         dbOperHandler.AddConditionParameter("@UserId", (object)UserId);
         dbOperHandler.AddFieldItem("IsUsed", (object)state);
         dbOperHandler.AddFieldItem("STime2", (object)DateTime.Now);
         if (dbOperHandler.Update("N_UserContract") > 0)
         {
             return(this.JsonResult(1, "契约签订成功!"));
         }
     }
     return(this.JsonResult(0, "契约签订失败!"));
 }
Example #9
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();
     }
 }
Example #10
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();
     }
 }
Example #11
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, "添加会员成功!"));
            }
        }
Example #12
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);
        }
Example #13
0
 public void GetMsgJSON(string UserId, ref string _jsonstr)
 {
     using (DbOperHandler dbOperHandler = new ComData().Doh())
     {
         dbOperHandler.Reset();
         dbOperHandler.SqlCmd = "select top 1 Id,title,Msg from N_UserMessage with(nolock) where IsRead=0 and UserId=" + UserId + " order by Id desc";
         DataTable dataTable = dbOperHandler.GetDataTable();
         if (dataTable.Rows.Count > 0)
         {
             dbOperHandler.Reset();
             dbOperHandler.ConditionExpress = "Id=@Id";
             dbOperHandler.AddConditionParameter("@Id", (object)dataTable.Rows[0]["Id"].ToString());
             dbOperHandler.AddFieldItem("IsRead", (object)"1");
             dbOperHandler.Update("N_UserMessage");
             _jsonstr = this.ConverTableToJSON(dataTable);
         }
         else
         {
             _jsonstr = "[{\"title\":\"0\",\"msg\":\"0\"}]";
         }
         dataTable.Clear();
         dataTable.Dispose();
     }
 }
Example #14
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);
        }
Example #15
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);
        }
        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);
            }
        }
Example #17
0
        public string UserGetCash(string UserId, string UserBankId, string BankId, string Money, string PassWord)
        {
            string result;

            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "select top 1 * from Sys_Bank where id=" + BankId;
                DataTable dataTable = dbOperHandler.GetDataTable();
                if (Convert.ToInt32(dataTable.Rows[0]["IsUsed"]) == 1)
                {
                    result = "取款失败,当前银行禁止取款!";
                }
                else
                {
                    dbOperHandler.Reset();
                    dbOperHandler.ConditionExpress = "id=@id";
                    dbOperHandler.AddConditionParameter("@id", UserId);
                    object[] fields = dbOperHandler.GetFields("N_User", "Money,PayPass,IsGetCash,EnableSeason,UserGroup");
                    if (fields.Length > 0)
                    {
                        int num = Convert.ToInt32(fields[2]);
                        fields[3].ToString();
                        if (num != 0)
                        {
                            result = "取款失败,您的帐号禁止取款!";
                        }
                        else if (Convert.ToDecimal(Money) > Convert.ToDecimal(fields[0]))
                        {
                            result = "您的可用余额不足";
                        }
                        else if (!MD5.Last64(MD5.Lower32(PassWord)).Equals(fields[1].ToString()))
                        {
                            result = "您的提现密码错误";
                        }
                        else
                        {
                            dbOperHandler.Reset();
                            dbOperHandler.SqlCmd = string.Format("select STime from Act_ActiveRecord where UserId={0} and ActiveType='Charge' and Convert(varchar(10),STime,120)=Convert(varchar(10),Getdate(),120)", UserId);
                            DataTable dataTable2 = dbOperHandler.GetDataTable();
                            if (dataTable2.Rows.Count > 0)
                            {
                                if (Convert.ToDecimal(fields[0]) - Convert.ToDecimal(Money) < 50m)
                                {
                                    dbOperHandler.Reset();
                                    dbOperHandler.SqlCmd = string.Format("SELECT cast(round(isnull(Sum(Total*Times),0),4) as numeric(20,4)) as bet FROM [N_UserBet]\r\n                                                                where UserId={0} and (state=2 or state=3) and STime>'{1}' ", UserId, dataTable2.Rows[0]["STime"].ToString());
                                    dataTable2           = dbOperHandler.GetDataTable();
                                    if (dataTable2.Rows.Count > 0 && Convert.ToDecimal(dataTable2.Rows[0]["bet"]) < 800m)
                                    {
                                        result = "首充佣金50元不能体现,您的消费未满800元!";
                                        return(result);
                                    }
                                }
                            }
                            else if (Convert.ToInt32(fields[4].ToString()) < 2)
                            {
                                dbOperHandler.Reset();
                                dbOperHandler.SqlCmd = "SELECT (isnull(sum(Bet),0)-isnull(sum(Cancellation),0)) as bet,isnull(sum(charge),0) as charge FROM [N_UserMoneyStatAll] with(nolock) where userId=" + UserId;
                                DataTable dataTable3 = dbOperHandler.GetDataTable();
                                double    num2       = Convert.ToDouble(dataTable3.Rows[0]["bet"].ToString());
                                double    num3       = Convert.ToDouble(dataTable3.Rows[0]["charge"].ToString());
                                if (num3 > 0.0 && num2 * 100.0 / num3 < Convert.ToDouble(dataTable.Rows[0]["BetPerCheck"]))
                                {
                                    result = "对不起,您未消费到充值的" + dataTable.Rows[0]["BetPerCheck"] + "%,不能提现!";
                                    return(result);
                                }
                            }
                            if (Convert.ToDecimal(Money) < Convert.ToDecimal(dataTable.Rows[0]["MinCharge"]))
                            {
                                result = "提现金额不能小于单笔最小金额";
                            }
                            else if (Convert.ToDecimal(Money) > Convert.ToDecimal(dataTable.Rows[0]["MaxCharge"]))
                            {
                                result = "提现金额不能大于单笔最大金额";
                            }
                            else
                            {
                                DateTime t   = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + dataTable.Rows[0]["StartTime"]);
                                DateTime t2  = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + dataTable.Rows[0]["EndTime"]);
                                DateTime now = DateTime.Now;
                                if (t.Hour >= t2.Hour)
                                {
                                    if (now < t && now > t2)
                                    {
                                        result = string.Concat(new object[]
                                        {
                                            "提现时间为",
                                            dataTable.Rows[0]["StartTime"],
                                            "至",
                                            dataTable.Rows[0]["EndTime"]
                                        });
                                        return(result);
                                    }
                                }
                                else if (now < t || now > t2)
                                {
                                    result = string.Concat(new object[]
                                    {
                                        "提现时间为",
                                        dataTable.Rows[0]["StartTime"],
                                        "至",
                                        dataTable.Rows[0]["EndTime"]
                                    });
                                    return(result);
                                }
                                string value = "0";
                                dbOperHandler.Reset();
                                dbOperHandler.SqlCmd = "select count(*) as txcs,isnull(sum(Money),0) as txje from N_UserGetCash where userId=" + UserId + " and datediff(d,STime,getdate())=0 and State<>2";
                                DataTable dataTable4 = dbOperHandler.GetDataTable();
                                if (dataTable4.Rows.Count > 0)
                                {
                                    value = dataTable4.Rows[0]["txcs"].ToString();
                                    dataTable4.Rows[0]["txje"].ToString();
                                }
                                if (Convert.ToDecimal(value) > Convert.ToDecimal(dataTable.Rows[0]["MaxGetCash"]))
                                {
                                    result = "今日提现已得到最大提现次数";
                                }
                                else
                                {
                                    dbOperHandler.Reset();
                                    dbOperHandler.SqlCmd = "SELECT [PayBank],[PayAccount],[PayName] FROM [N_UserBank] where UserId=" + UserId + " and Id=" + UserBankId;
                                    dataTable4           = dbOperHandler.GetDataTable();
                                    if (dataTable4.Rows.Count > 0)
                                    {
                                        if (this.Save(UserId, UserBankId, dataTable4.Rows[0]["PayBank"].ToString(), dataTable4.Rows[0]["PayAccount"].ToString(), dataTable4.Rows[0]["PayName"].ToString(), Convert.ToDecimal(Money)) > 0)
                                        {
                                            new LogSysDAL().Save("会员管理", "Id为" + UserId + "的会员申请提现!");
                                            result = "申请提现成功!";
                                        }
                                        else
                                        {
                                            result = "申请提现失败!";
                                        }
                                    }
                                    else
                                    {
                                        result = "申请提现失败!";
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        result = "账号出现问题,请您重新登陆!";
                    }
                }
            }
            return(result);
        }
Example #18
0
        public string UserGetCash(string UserId, string UserBankId, string BankId, string Money, string PassWord)
        {
            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "select top 1 * from Sys_Bank where id=" + BankId;
                DataTable dataTable1 = dbOperHandler.GetDataTable();

                //每日最大提款金额
                decimal minCharge = Convert.ToDecimal(dataTable1.Rows[0]["MinCharge"]);
                decimal maxCharge = Convert.ToDecimal(dataTable1.Rows[0]["MaxCharge"]);
                maxCharge = maxCharge > 20000M ? 20000M : maxCharge;

                if (Convert.ToDecimal(Money) > maxCharge || Convert.ToDecimal(Money) < minCharge)
                {
                    return(string.Format("提款金额最大{0}元,最小{0}元", maxCharge, minCharge));
                }

                //每日最大提现次数
                int maxCashCount = Convert.ToInt32(dataTable1.Rows[0]["MaxGetCash"]);
                maxCashCount = maxCashCount > 5 ? 5 : maxCashCount;

                //充值消费额度
                double betPerCheck = Convert.ToDouble(dataTable1.Rows[0]["BetPerCheck"]);
                betPerCheck = betPerCheck < 50.0 ? 50.0 : betPerCheck;

                //绑卡时间提现期限, 至少绑定24小时,才能提现
                int bindTime = Convert.ToInt32(dataTable1.Rows[0]["BindTime"]);
                bindTime = bindTime < 24 ? 24 : bindTime;

                //是否允许银行卡提现
                if (Convert.ToInt32(dataTable1.Rows[0]["IsUsed"]) == 1)
                {
                    return("取款失败,当前银行禁止取款!");
                }

                //会员信息
                dbOperHandler.Reset();
                dbOperHandler.ConditionExpress = "id=@id";
                dbOperHandler.AddConditionParameter("@id", (object)UserId);
                object[] fields = dbOperHandler.GetFields("N_User", "Money,PayPass,IsGetCash,EnableSeason,UserGroup");
                if (fields.Length <= 0)
                {
                    return("账号出现问题,请您重新登陆!");
                }

                //会员是否允许提现
                int int32 = Convert.ToInt32(fields[2]); //IsGetCash
                if (int32 != 0)
                {
                    return("取款失败,您的帐号禁止取款!");
                }

                //提款金额是否大于会员余额
                if (Convert.ToDecimal(Money) > Convert.ToDecimal(fields[0]))
                {
                    return("您的可用余额不足");
                }

                //提款密码是否正确
                if (!MD5.Last64(MD5.Lower32(PassWord)).Equals(fields[1].ToString()))
                {
                    return("您的提现密码错误");
                }

                //会员银行卡信息
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "SELECT [PayBank],[PayAccount],[PayName], AddTime FROM [N_UserBank] where UserId=" + UserId + " and Id=" + UserBankId;
                DataTable dataTable5 = dbOperHandler.GetDataTable();
                if (dataTable5.Rows.Count <= 0)
                {
                    return("您的银行卡无效");
                }

                //检查绑定时间
                DateTime addTime = Convert.ToDateTime(dataTable5.Rows[0]["AddTime"]);
                if ((DateTime.Now - addTime).TotalHours <= bindTime)
                {
                    return(string.Format("您的银行卡绑定还未满{0}小时", bindTime));
                }

                //今天的充值记录
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = string.Format(@"select STime from Act_ActiveRecord where UserId={0} 
                                and ActiveType='Charge' and Convert(varchar(10),STime,120)=Convert(varchar(10),Getdate(),120)", (object)UserId);
                DataTable dataTable2 = dbOperHandler.GetDataTable();
                if (dataTable2.Rows.Count > 0)
                {
                    if (Convert.ToDecimal(fields[0]) - Convert.ToDecimal(Money) < new Decimal(50))
                    {
                        dbOperHandler.Reset();
                        dbOperHandler.SqlCmd = string.Format("SELECT cast(round(isnull(Sum(Total*Times),0),4) as numeric(20,4)) as bet FROM [N_UserBet]\r\n                                                                where UserId={0} and (state=2 or state=3) and STime>'{1}' ", (object)UserId, (object)dataTable2.Rows[0]["STime"].ToString());
                        DataTable dataTable3 = dbOperHandler.GetDataTable();
                        if (dataTable3.Rows.Count > 0 && Convert.ToDecimal(dataTable3.Rows[0]["bet"]) < new Decimal(800))
                        {
                            return("首充佣金50元不能体现,您的消费未满800元!");
                        }
                    }
                }
                else if (Convert.ToInt32(fields[4].ToString()) < 2)
                {
                    dbOperHandler.Reset();
                    dbOperHandler.SqlCmd = "SELECT (isnull(sum(Bet),0)-isnull(sum(Cancellation),0)) as bet,isnull(sum(charge),0) as charge FROM [N_UserMoneyStatAll] with(nolock) where userId=" + UserId;
                    DataTable dataTable3 = dbOperHandler.GetDataTable();
                    double    num1       = Convert.ToDouble(dataTable3.Rows[0]["bet"].ToString());    //消费金额, 下注金额
                    double    num2       = Convert.ToDouble(dataTable3.Rows[0]["charge"].ToString()); //充值金额总数
                    if (num2 > 0.0 && num1 * 100.0 / num2 < betPerCheck)
                    {
                        return("对不起,您未消费到充值的" + betPerCheck + "%,不能提现!");
                    }
                }
                if (Convert.ToDecimal(Money) < Convert.ToDecimal(dataTable1.Rows[0]["MinCharge"]))
                {
                    return("提现金额不能小于单笔最小金额");
                }
                if (Convert.ToDecimal(Money) > Convert.ToDecimal(dataTable1.Rows[0]["MaxCharge"]))
                {
                    return("提现金额不能大于单笔最大金额");
                }
                DateTime dateTime1 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + dataTable1.Rows[0]["StartTime"]);
                DateTime dateTime2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + dataTable1.Rows[0]["EndTime"]);
                DateTime now       = DateTime.Now;
                if (dateTime1.Hour >= dateTime2.Hour)
                {
                    if (now < dateTime1 && now > dateTime2)
                    {
                        return("提现时间为" + dataTable1.Rows[0]["StartTime"] + "至" + dataTable1.Rows[0]["EndTime"]);
                    }
                }
                else if (now < dateTime1 || now > dateTime2)
                {
                    return("提现时间为" + dataTable1.Rows[0]["StartTime"] + "至" + dataTable1.Rows[0]["EndTime"]);
                }

                int cashCount = 0; //已提现次数
                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "select count(*) as txcs,isnull(sum(Money),0) as txje from N_UserGetCash where userId=" + UserId + " and datediff(d,STime,getdate())=0 and State<>2";
                DataTable dataTable4 = dbOperHandler.GetDataTable();
                if (dataTable4.Rows.Count > 0)
                {
                    cashCount = Convert.ToInt32(dataTable4.Rows[0]["txcs"]);
                    dataTable4.Rows[0]["txje"].ToString();
                }

                if (cashCount > maxCashCount)
                {
                    return(string.Format("今日提现已得到最大提现次数{0}次", maxCashCount));
                }

                if (dataTable5.Rows.Count <= 0 || this.Save(UserId, UserBankId, dataTable5.Rows[0]["PayBank"].ToString(), dataTable5.Rows[0]["PayAccount"].ToString(), dataTable5.Rows[0]["PayName"].ToString(), Convert.ToDecimal(Money)) <= 0)
                {
                    return("申请提现失败!");
                }
                new LogSysDAL().Save("会员管理", "Id为" + UserId + "的会员申请提现!");
                return("申请提现成功!");
            }
        }