Exemplo n.º 1
0
		/// <summary>
		/// 获得数据List
		/// </summary>
		public Dat_WebLogList GetDataList(Dat_WebLogQueryCondition QueryCondition)
		{
			SqlParameter[] sqlParams;
			StringBuilder strSqlOption = new StringBuilder();
			QueryCondition.OutPut(out strSqlOption, out sqlParams);
			StringBuilder strSql = new StringBuilder();
			if (QueryCondition.page == 0)
			{
				strSql.Append("select * ");
				strSql.Append(" FROM VIEW_WebPlatForm_WebLog where 1=1 " + strSqlOption.ToString());
			}else
			{
				strSql.Append(@"select top "+QueryCondition.rows.ToString() + " * from VIEW_WebPlatForm_WebLog where 1 = 1 "+
				strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                " nID from VIEW_WebPlatForm_WebLog where  1=1 " + strSqlOption.ToString() + " order by dtPostTime desc) order by dtPostTime desc");
			}
			DataTable dt = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
			Dat_WebLogList list = new Dat_WebLogList();
			foreach (DataRow dr in dt.Rows)
			{
				Dat_WebLog _Dat_WebLog = new Dat_WebLog();
				DataRowToModel(_Dat_WebLog,dr);
				list.Add(_Dat_WebLog);
			}
			return list;
		}
Exemplo n.º 2
0
		/// <summary>
		/// 检查数据是否存在
		/// </summary>
		public bool Exists(Dat_WebLog _Dat_WebLog)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select count(*) from WebPlatForm_Dat_WebLog where strID=@strID");
			 SqlParameter[] parameters = {
					 new SqlParameter("strID",_Dat_WebLog.strID)};

			return Convert.ToInt32(SqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, strSql.ToString(), parameters)) > 0;
		}
Exemplo n.º 3
0
		/// <summary>
		/// 读取DataRow数据到Model中
		/// </summary>
		private void DataRowToModel(Dat_WebLog model,DataRow dr)
		{
			model.nID = ObjectConvertClass.static_ext_int(dr["nID"]);
            model.strID = ObjectConvertClass.static_ext_string(dr["strID"]);
            model.strTrianManNumber = ObjectConvertClass.static_ext_string(dr["strTrianManNumber"]);
			model.nType = ObjectConvertClass.static_ext_int(dr["nType"]);
			model.dtPostTime = ObjectConvertClass.static_ext_date(dr["dtPostTime"]);
            model.strPageUrl = ObjectConvertClass.static_ext_string(dr["strPageUrl"]);
            model.strPageName = ObjectConvertClass.static_ext_string(dr["strPageName"]);
            model.strClientIP = ObjectConvertClass.static_ext_string(dr["strClientIP"]);
		}
Exemplo n.º 4
0
		/// <summary>
		/// 添加数据
		/// </summary>
        public int Add(Dat_WebLog model)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into WebPlatForm_Dat_WebLog");
            strSql.Append("(strTrianManNumber,nType,dtPostTime,strPageUrl,strPageName,strClientIP)");
            strSql.Append("values(@strTrianManNumber,@nType,@dtPostTime,@strPageUrl,@strPageName,@strClientIP)");
			strSql.Append(";select @@IDENTITY");
			SqlParameter[] parameters = {
					new SqlParameter("@strTrianManNumber", model.strTrianManNumber),
					new SqlParameter("@nType", model.nType),
					new SqlParameter("@dtPostTime", model.dtPostTime),
					new SqlParameter("@strPageUrl", model.strPageUrl),
					new SqlParameter("@strPageName", model.strPageName),
					new SqlParameter("@strClientIP", model.strClientIP)};

			return Convert.ToInt32(SqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, strSql.ToString(), parameters));
		}
Exemplo n.º 5
0
		/// <summary>
		/// 获得一个实体对象
		/// </summary>
		public Dat_WebLog GetModel(Dat_WebLogQueryCondition QueryCondition)
		{
			SqlParameter[] sqlParams;
			StringBuilder strSqlOption = new StringBuilder();
			QueryCondition.OutPut(out strSqlOption, out sqlParams);
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select top 1 * ");
			strSql.Append(" FROM VIEW_WebPlatForm_WebLog where 1=1 " + strSqlOption.ToString());
			DataTable dt = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
			Dat_WebLog _Dat_WebLog = null;
			if (dt.Rows.Count > 0)
			{
				_Dat_WebLog = new Dat_WebLog();
				DataRowToModel(_Dat_WebLog,dt.Rows[0]);
			}
			return _Dat_WebLog;
		}
Exemplo n.º 6
0
 /// <summary>
 /// 保存日志
 /// </summary>
 public static void SaveLog(int nType, string strPageUrl, string strPageName)
 {
     try
     {
         Dat_WebLog model = new Dat_WebLog();
         model.strTrianManNumber = UserLogin.LoginUser.strNumber;
         model.dtPostTime        = DateTime.Now;
         model.nType             = nType;
         model.strPageUrl        = strPageUrl;
         model.strPageName       = strPageName;
         model.strClientIP       = System.Web.HttpContext.Current.Request.UserHostAddress;
         DBDat_WebLog dal = new DBDat_WebLog(ConData.WebSiteConnectionString);
         dal.Add(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 7
0
		/// <summary>
		/// 更新数据
		/// </summary>
		public bool Update(Dat_WebLog model)
		{
			StringBuilder strSql = new StringBuilder();
			strSql.Append("Update WebPlatForm_Dat_WebLog set ");
            strSql.Append(" strTrianManNumber = @strTrianManNumber, ");
			strSql.Append(" nType = @nType, ");
			strSql.Append(" dtPostTime = @dtPostTime, ");
            strSql.Append(" strPageUrl = @strPageUrl, ");
            strSql.Append(" strPageName = @strPageName,");
            strSql.Append(" strClientIP = @strClientIP");
			strSql.Append(" where strID = @strID ");

			SqlParameter[] parameters = {
					new SqlParameter("@strID", model.strID),
						new SqlParameter("@strTrianManNumber", model.strTrianManNumber),
					new SqlParameter("@nType", model.nType),
					new SqlParameter("@dtPostTime", model.dtPostTime),
					new SqlParameter("@strPageUrl", model.strPageUrl),
					new SqlParameter("@strPageName", model.strPageName),
					new SqlParameter("@strClientIP", model.strClientIP)};

			return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql.ToString(), parameters) > 0;
		}