Esempio n. 1
0
        public override List <LogLoginVO> GetModels(ref LogLoginPara 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 <LogLoginVO> list = new List <LogLoginVO>();

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

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

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

            return("");
        }
Esempio n. 3
0
        public override LogLoginVO GetSingle(LogLoginPara mp)
        {
            var list = GetModels(mp);

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

            return(null);
        }
Esempio n. 4
0
        public override int GetRecords(LogLoginPara 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()));
        }
Esempio n. 5
0
        private void Bind(int pageIndex = 1)
        {
            LogLoginPara cip = new LogLoginPara();

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

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

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

            apPager.RecordCount = cip.Recount.Value;
        }
Esempio n. 6
0
        public override bool Delete(LogLoginPara 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);
        }
Esempio n. 7
0
        public override string GetConditionByPara(LogLoginPara mp)
        {
            StringBuilder sb = new StringBuilder();

            if (mp.Id.HasValue)
            {
                sb.AppendFormat(" AND [Id]='{0}' ", mp.Id);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.LoginName)))
            {
                sb.AppendFormat(" AND [LoginName]='{0}' ", mp.LoginName);
            }
            if (mp.LoginState.HasValue)
            {
                sb.AppendFormat(" AND [LoginState]='{0}' ", mp.LoginState);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.LoginDesc)))
            {
                sb.AppendFormat(" AND [LoginDesc]='{0}' ", mp.LoginDesc);
            }
            if (mp.LoginDate.HasValue)
            {
                sb.AppendFormat(" AND [LoginDate]='{0}' ", mp.LoginDate);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.ClientIp)))
            {
                sb.AppendFormat(" AND [ClientIp]='{0}' ", mp.ClientIp);
            }
            if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.BrowseType)))
            {
                sb.AppendFormat(" AND [BrowseType]='{0}' ", mp.BrowseType);
            }
            if (mp.LoginType.HasValue)
            {
                sb.AppendFormat(" AND [LoginType]='{0}' ", mp.LoginType);
            }


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

            return(sb.ToString());
        }
Esempio n. 8
0
        public override List <LogLoginVO> GetModels(LogLoginPara 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 <LogLoginVO> list = new List <LogLoginVO>();

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

            return(list);
        }
Esempio n. 9
0
 public override string GetOtherConditionByPara(LogLoginPara mp)
 {
     return("");
 }