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); }
public override string GetOrderByPara(LogLoginPara mp) { if (!string.IsNullOrEmpty(mp.OrderBy)) { return(string.Format(" order by {0}", mp.OrderBy)); } return(""); }
public override LogLoginVO GetSingle(LogLoginPara mp) { var list = GetModels(mp); if (list.Count == 1) { return(list[0]); } return(null); }
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())); }
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; }
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); }
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()); }
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); }
public override string GetOtherConditionByPara(LogLoginPara mp) { return(""); }