public override List <AccountInfoVO> GetModels(ref AccountInfoPara mp)
        {
            string where = GetConditionByPara(mp);

            int    pStart = mp.PageIndex.Value * mp.PageSize.Value;
            int    pEnd   = mp.PageSize.Value;
            string cmd    = QUERYPAGE
                            .Replace("@PAGESIZE", pEnd.ToString())
                            .Replace("@PTOP", pStart.ToString())
                            .Replace("@WHERE", where)
                            .Replace("@ORDER", GetOrderByPara(mp));

            CodeCommand command = new CodeCommand();

            command.CommandText = cmd;

            var table = DbProxyFactory.Instance.Proxy.ExecuteTable(command);

            List <AccountInfoVO> list = new List <AccountInfoVO>();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                list.Add(new AccountInfoVO(table.Rows[i]));
            }

            if (!mp.Recount.HasValue)
            {
                mp.Recount = GetRecords(mp);
            }

            return(list);
        }
        public override string GetOrderByPara(AccountInfoPara mp)
        {
            if (!string.IsNullOrEmpty(mp.OrderBy))
            {
                return(string.Format(" order by {0}", mp.OrderBy));
            }

            return("");
        }
        private void Bind()
        {
            AccountInfoPara up = new AccountInfoPara();

            up.Id = Account.UserId;

            var list = AccountInfoBLL.Instance.GetModels(up);

            rptTable.DataSource = list;
            rptTable.DataBind();
        }
        public override AccountInfoVO GetSingle(AccountInfoPara mp)
        {
            var list = GetModels(mp);

            if (list.Count == 1)
            {
                return(list[0]);
            }

            return(null);
        }
        public override int GetRecords(AccountInfoPara mp)
        {
            string where = GetConditionByPara(mp);

            CodeCommand command = new CodeCommand();

            command.CommandText = QUERYCOUNT + where;

            var result = DbProxyFactory.Instance.Proxy.ExecuteScalar(command);

            return(int.Parse(result.ToString()));
        }
Exemple #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public LoginResult Login(LoginInfo info)
        {
            LoginResult result = new LoginResult();
            result.Msg = "正在登录";

            AccountInfoPara ap = new AccountInfoPara();
            ap.UserName = info.UserName;

            var list = AccountInfoBLL.Instance.GetModels(ap);
            foreach (var item in list)
            {
                if (item.UserPwd == DN.Framework.Utility.EncryptHelper.GetMd5(info.UserPwd))
                {
                    if (item.IsLock == 0)
                    {
                        result.State = true;
                        result.Msg = "登录成功";
                        result.Data = item;
                    }
                    else
                    {
                        result.State = false;
                        result.Msg = "用户被锁定";
                        result.Data = item;
                    }
                }
            }

            if (list.Count == 0)
            {
                result.Msg = "用户名不存在。";
            }
            else if (list.Count != 0)
            {
                if (!result.State)
                {
                    result.Msg = "用户名或密码不正确,请重新输入。";
                }
            }

            LogLoginVO log = new LogLoginVO();

            log.BrowseType = DN.Framework.Utility.ClientHelper.GetBrowseInfo();
            log.ClientIp = DN.Framework.Utility.ClientHelper.ClientIP();
            log.LoginDate = DateTime.Now;
            log.LoginDesc = result.Msg;
            log.LoginName = info.UserName;
            log.LoginState = result.State ? 1 : 0;

            LogLoginBLL.Instance.Add(log);

            return result;
        }
Exemple #7
0
        private void Bind(int pageIndex = 1)
        {
            AccountInfoPara cip = new AccountInfoPara();

            cip.OrderBy  = " id desc ";
            cip.UserType = 1;

            var list = AccountInfoBLL.Instance.GetModels(cip);

            rptTable.DataSource = list;
            rptTable.DataBind();

            BindExitFile();
        }
Exemple #8
0
        private void Bind(int pageIndex = 1)
        {
            AccountInfoPara cip = new AccountInfoPara();

            cip.PageIndex = pageIndex - 1;
            cip.PageSize  = 10;
            cip.OrderBy   = " id desc ";
            cip.IsLock    = 0;

            var list = AccountInfoBLL.Instance.GetModels(ref cip);

            rptTable.DataSource = list;
            rptTable.DataBind();

            apPager.RecordCount = cip.Recount.Value;
        }
        public override bool Delete(AccountInfoPara mp)
        {
            string where = GetConditionByPara(mp);

            CodeCommand command = new CodeCommand();

            command.CommandText = DELETE + where;

            int result = DbProxyFactory.Instance.Proxy.ExecuteNonQuery(command);

            if (result >= 1)
            {
                return(true);
            }

            return(false);
        }
Exemple #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            AccountInfoVO info = new AccountInfoVO();

            info.AccountType      = 0;
            info.ConsumptionMoney = 0;
            info.Email            = txtEmail.Value;
            info.LastLoginDate    = DateTime.Now;
            info.LastMoneyDate    = DateTime.Now;
            info.Money            = 0;
            info.MoneyCount       = 0;
            info.MoneyFree        = 0;
            info.NickName         = txtUserName.Value;
            info.Phone            = txtPhone.Value;
            info.RegDate          = DateTime.Now;
            info.RegIp            = DN.Framework.Utility.ClientHelper.ClientIP();
            info.UserImg          = "";
            info.UserName         = txtUserName.Value;
            info.UserType         = int.Parse(ddlUserType.SelectedValue);
            info.UserPwd          = DN.Framework.Utility.EncryptHelper.GetMd5(txtPwd.Value);
            info.IsLock           = chkIsLock.Checked ? 1 : 0;

            AccountInfoPara ap = new AccountInfoPara();

            ap.UserName = info.UserName;

            var list = AccountInfoBLL.Instance.GetModels(ap);

            if (list.Count == 0)
            {
                AccountInfoBLL.Instance.Add(info);
                Response.Redirect("/Admin/Users/UserList.aspx");
            }
            else
            {
                lblMsg.Text = "【登录名称】登录名称己经存在,请重新输入。";
            }
        }
Exemple #11
0
        public static string GetConditionByPara(AccountInfoPara mp)
        {
            StringBuilder sb = new StringBuilder();

            if (mp.UserTypes != null && mp.UserTypes.Count != 0)
            {
                sb.AppendFormat(" AND UserType IN ({0})", string.Join(",", mp.UserTypes));
            }

            if (mp.IsNotAdmin.HasValue)
            {
                if (mp.IsNotAdmin.Value)
                {
                    sb.AppendFormat(" AND UserType <> 100 ");
                }
                else
                {
                    sb.AppendFormat(" AND UserType  = 100 ");
                }
            }

            return(sb.ToString());
        }
        public override List <AccountInfoVO> GetModels(AccountInfoPara mp)
        {
            string where = GetConditionByPara(mp);

            CodeCommand command = new CodeCommand();

            string cmd = LOAD
                         .Replace("@WHERE", where)
                         .Replace("@ORDER", GetOrderByPara(mp));

            command.CommandText = cmd;

            var table = DbProxyFactory.Instance.Proxy.ExecuteTable(command);

            List <AccountInfoVO> list = new List <AccountInfoVO>();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                list.Add(new AccountInfoVO(table.Rows[i]));
            }

            return(list);
        }
 public override string GetOtherConditionByPara(AccountInfoPara mp)
 {
     return("");
 }
        public override string GetConditionByPara(AccountInfoPara mp)
        {
            StringBuilder sb = new StringBuilder();

            if (mp.Id.HasValue)
            {
                sb.AppendFormat(" AND [Id]='{0}' ", mp.Id);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.UserName)))
            {
                sb.AppendFormat(" AND [UserName]='{0}' ", mp.UserName);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.NickName)))
            {
                sb.AppendFormat(" AND [NickName]='{0}' ", mp.NickName);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Email)))
            {
                sb.AppendFormat(" AND [Email]='{0}' ", mp.Email);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Phone)))
            {
                sb.AppendFormat(" AND [Phone]='{0}' ", mp.Phone);
            }
            if (mp.UserType.HasValue)
            {
                sb.AppendFormat(" AND [UserType]='{0}' ", mp.UserType);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.UserPwd)))
            {
                sb.AppendFormat(" AND [UserPwd]='{0}' ", mp.UserPwd);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.UserImg)))
            {
                sb.AppendFormat(" AND [UserImg]='{0}' ", mp.UserImg);
            }
            if (mp.RegDate.HasValue)
            {
                sb.AppendFormat(" AND [RegDate]='{0}' ", mp.RegDate);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.RegIp)))
            {
                sb.AppendFormat(" AND [RegIp]='{0}' ", mp.RegIp);
            }
            if (mp.IsLock.HasValue)
            {
                sb.AppendFormat(" AND [IsLock]='{0}' ", mp.IsLock);
            }
            if (mp.LastLoginDate.HasValue)
            {
                sb.AppendFormat(" AND [LastLoginDate]='{0}' ", mp.LastLoginDate);
            }
            if (mp.AccountType.HasValue)
            {
                sb.AppendFormat(" AND [AccountType]='{0}' ", mp.AccountType);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.OpenId)))
            {
                sb.AppendFormat(" AND [OpenId]='{0}' ", mp.OpenId);
            }
            if (mp.ConsumptionMoney.HasValue)
            {
                sb.AppendFormat(" AND [ConsumptionMoney]='{0}' ", mp.ConsumptionMoney);
            }
            if (mp.Money.HasValue)
            {
                sb.AppendFormat(" AND [Money]='{0}' ", mp.Money);
            }
            if (mp.MoneyFree.HasValue)
            {
                sb.AppendFormat(" AND [MoneyFree]='{0}' ", mp.MoneyFree);
            }
            if (mp.MoneyCount.HasValue)
            {
                sb.AppendFormat(" AND [MoneyCount]='{0}' ", mp.MoneyCount);
            }
            if (mp.LastMoneyDate.HasValue)
            {
                sb.AppendFormat(" AND [LastMoneyDate]='{0}' ", mp.LastMoneyDate);
            }

            sb.AppendLine(AccountInfoAccessOther.GetConditionByPara(mp));

            sb.Insert(0, " WHERE 1=1 ");

            return(sb.ToString());
        }