public override List <LogIpInfoVO> GetModels(ref LogIpInfoPara 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 <LogIpInfoVO> list = new List <LogIpInfoVO>(); for (int i = 0; i < table.Rows.Count; i++) { list.Add(new LogIpInfoVO(table.Rows[i])); } if (!mp.Recount.HasValue) { mp.Recount = GetRecords(mp); } return(list); }
public override string GetOrderByPara(LogIpInfoPara mp) { if (!string.IsNullOrEmpty(mp.OrderBy)) { return(string.Format(" order by {0}", mp.OrderBy)); } return(""); }
public override LogIpInfoVO GetSingle(LogIpInfoPara mp) { var list = GetModels(mp); if (list.Count == 1) { return(list[0]); } return(null); }
public override int GetRecords(LogIpInfoPara 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())); }
public override bool Delete(LogIpInfoPara 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(LogIpInfoPara mp) { StringBuilder sb = new StringBuilder(); if (mp.Id.HasValue) { sb.AppendFormat(" AND [Id]='{0}' ", mp.Id); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.Ip))) { sb.AppendFormat(" AND [Ip]='{0}' ", mp.Ip); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.country))) { sb.AppendFormat(" AND [country]='{0}' ", mp.country); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.area))) { sb.AppendFormat(" AND [area]='{0}' ", mp.area); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.region))) { sb.AppendFormat(" AND [region]='{0}' ", mp.region); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.city))) { sb.AppendFormat(" AND [city]='{0}' ", mp.city); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.county))) { sb.AppendFormat(" AND [county]='{0}' ", mp.county); } if (!string.IsNullOrEmpty(SqlFilterHelper.CheckPropertyName(mp.isp))) { sb.AppendFormat(" AND [isp]='{0}' ", mp.isp); } if (mp.CreateDate.HasValue) { sb.AppendFormat(" AND [CreateDate]='{0}' ", mp.CreateDate); } sb.Insert(0, " WHERE 1=1 "); return(sb.ToString()); }
public override List <LogIpInfoVO> GetModels(LogIpInfoPara 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 <LogIpInfoVO> list = new List <LogIpInfoVO>(); for (int i = 0; i < table.Rows.Count; i++) { list.Add(new LogIpInfoVO(table.Rows[i])); } return(list); }
public override string GetOtherConditionByPara(LogIpInfoPara mp) { return(""); }