Ejemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WechatBuilder.Model.wx_logs GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,wid,modelName,remark,logsType,logsTypeName,createDate,logsContent,logsTitle,funName,createPerson,extInt,extStr,extStr2,extStr3,flg,flg2,flg3,flgInt,flgDate from wx_logs ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            WechatBuilder.Model.wx_logs model = new WechatBuilder.Model.wx_logs();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WechatBuilder.Model.wx_logs DataRowToModel(DataRow row)
		{
			WechatBuilder.Model.wx_logs model=new WechatBuilder.Model.wx_logs();
			if (row != null)
			{
				if(row["id"]!=null && row["id"].ToString()!="")
				{
					model.id=int.Parse(row["id"].ToString());
				}
				if(row["wid"]!=null && row["wid"].ToString()!="")
				{
					model.wid=int.Parse(row["wid"].ToString());
				}
				if(row["modelName"]!=null)
				{
					model.modelName=row["modelName"].ToString();
				}
				if(row["remark"]!=null)
				{
					model.remark=row["remark"].ToString();
				}
				if(row["logsType"]!=null && row["logsType"].ToString()!="")
				{
					model.logsType=int.Parse(row["logsType"].ToString());
				}
				if(row["logsTypeName"]!=null)
				{
					model.logsTypeName=row["logsTypeName"].ToString();
				}
				if(row["createDate"]!=null && row["createDate"].ToString()!="")
				{
					model.createDate=DateTime.Parse(row["createDate"].ToString());
				}
				if(row["logsContent"]!=null)
				{
					model.logsContent=row["logsContent"].ToString();
				}
				if(row["logsTitle"]!=null)
				{
					model.logsTitle=row["logsTitle"].ToString();
				}
				if(row["funName"]!=null)
				{
					model.funName=row["funName"].ToString();
				}
				if(row["createPerson"]!=null)
				{
					model.createPerson=row["createPerson"].ToString();
				}
				if(row["extInt"]!=null && row["extInt"].ToString()!="")
				{
					model.extInt=int.Parse(row["extInt"].ToString());
				}
				if(row["extStr"]!=null)
				{
					model.extStr=row["extStr"].ToString();
				}
				if(row["extStr2"]!=null)
				{
					model.extStr2=row["extStr2"].ToString();
				}
				if(row["extStr3"]!=null)
				{
					model.extStr3=row["extStr3"].ToString();
				}
				if(row["flg"]!=null)
				{
					model.flg=row["flg"].ToString();
				}
				if(row["flg2"]!=null)
				{
					model.flg2=row["flg2"].ToString();
				}
				if(row["flg3"]!=null)
				{
					model.flg3=row["flg3"].ToString();
				}
				if(row["flgInt"]!=null && row["flgInt"].ToString()!="")
				{
					model.flgInt=int.Parse(row["flgInt"].ToString());
				}
				if(row["flgDate"]!=null && row["flgDate"].ToString()!="")
				{
					model.flgDate=DateTime.Parse(row["flgDate"].ToString());
				}
			}
			return model;
		}
Ejemplo n.º 3
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WechatBuilder.Model.wx_logs GetModel(int id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 id,wid,modelName,remark,logsType,logsTypeName,createDate,logsContent,logsTitle,funName,createPerson,extInt,extStr,extStr2,extStr3,flg,flg2,flg3,flgInt,flgDate from wx_logs ");
			strSql.Append(" where id=@id");
			SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
			parameters[0].Value = id;

			WechatBuilder.Model.wx_logs model=new WechatBuilder.Model.wx_logs();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WechatBuilder.Model.wx_logs model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_logs(");
            strSql.Append("wid,modelName,remark,logsType,logsTypeName,createDate,logsContent,logsTitle,funName,createPerson,extInt,extStr,extStr2,extStr3,flg,flg2,flg3,flgInt,flgDate)");
            strSql.Append(" values (");
            strSql.Append("@wid,@modelName,@remark,@logsType,@logsTypeName,@createDate,@logsContent,@logsTitle,@funName,@createPerson,@extInt,@extStr,@extStr2,@extStr3,@flg,@flg2,@flg3,@flgInt,@flgDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",          SqlDbType.Int,          4),
                new SqlParameter("@modelName",    SqlDbType.VarChar,    300),
                new SqlParameter("@remark",       SqlDbType.VarChar,   2000),
                new SqlParameter("@logsType",     SqlDbType.Int,          4),
                new SqlParameter("@logsTypeName", SqlDbType.VarChar,    100),
                new SqlParameter("@createDate",   SqlDbType.DateTime),
                new SqlParameter("@logsContent",  SqlDbType.Text),
                new SqlParameter("@logsTitle",    SqlDbType.VarChar,    200),
                new SqlParameter("@funName",      SqlDbType.VarChar,    300),
                new SqlParameter("@createPerson", SqlDbType.VarChar,    200),
                new SqlParameter("@extInt",       SqlDbType.Int,          4),
                new SqlParameter("@extStr",       SqlDbType.VarChar,    500),
                new SqlParameter("@extStr2",      SqlDbType.VarChar,    800),
                new SqlParameter("@extStr3",      SqlDbType.VarChar,   1500),
                new SqlParameter("@flg",          SqlDbType.VarChar,    500),
                new SqlParameter("@flg2",         SqlDbType.VarChar,   1000),
                new SqlParameter("@flg3",         SqlDbType.VarChar,   1000),
                new SqlParameter("@flgInt",       SqlDbType.Int,          4),
                new SqlParameter("@flgDate",      SqlDbType.DateTime)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.modelName;
            parameters[2].Value  = model.remark;
            parameters[3].Value  = model.logsType;
            parameters[4].Value  = model.logsTypeName;
            parameters[5].Value  = model.createDate;
            parameters[6].Value  = model.logsContent;
            parameters[7].Value  = model.logsTitle;
            parameters[8].Value  = model.funName;
            parameters[9].Value  = model.createPerson;
            parameters[10].Value = model.extInt;
            parameters[11].Value = model.extStr;
            parameters[12].Value = model.extStr2;
            parameters[13].Value = model.extStr3;
            parameters[14].Value = model.flg;
            parameters[15].Value = model.flg2;
            parameters[16].Value = model.flg3;
            parameters[17].Value = model.flgInt;
            parameters[18].Value = model.flgDate;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WechatBuilder.Model.wx_logs DataRowToModel(DataRow row)
 {
     WechatBuilder.Model.wx_logs model = new WechatBuilder.Model.wx_logs();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["modelName"] != null)
         {
             model.modelName = row["modelName"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["logsType"] != null && row["logsType"].ToString() != "")
         {
             model.logsType = int.Parse(row["logsType"].ToString());
         }
         if (row["logsTypeName"] != null)
         {
             model.logsTypeName = row["logsTypeName"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["logsContent"] != null)
         {
             model.logsContent = row["logsContent"].ToString();
         }
         if (row["logsTitle"] != null)
         {
             model.logsTitle = row["logsTitle"].ToString();
         }
         if (row["funName"] != null)
         {
             model.funName = row["funName"].ToString();
         }
         if (row["createPerson"] != null)
         {
             model.createPerson = row["createPerson"].ToString();
         }
         if (row["extInt"] != null && row["extInt"].ToString() != "")
         {
             model.extInt = int.Parse(row["extInt"].ToString());
         }
         if (row["extStr"] != null)
         {
             model.extStr = row["extStr"].ToString();
         }
         if (row["extStr2"] != null)
         {
             model.extStr2 = row["extStr2"].ToString();
         }
         if (row["extStr3"] != null)
         {
             model.extStr3 = row["extStr3"].ToString();
         }
         if (row["flg"] != null)
         {
             model.flg = row["flg"].ToString();
         }
         if (row["flg2"] != null)
         {
             model.flg2 = row["flg2"].ToString();
         }
         if (row["flg3"] != null)
         {
             model.flg3 = row["flg3"].ToString();
         }
         if (row["flgInt"] != null && row["flgInt"].ToString() != "")
         {
             model.flgInt = int.Parse(row["flgInt"].ToString());
         }
         if (row["flgDate"] != null && row["flgDate"].ToString() != "")
         {
             model.flgDate = DateTime.Parse(row["flgDate"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WechatBuilder.Model.wx_logs model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_logs set ");
            strSql.Append("wid=@wid,");
            strSql.Append("modelName=@modelName,");
            strSql.Append("remark=@remark,");
            strSql.Append("logsType=@logsType,");
            strSql.Append("logsTypeName=@logsTypeName,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("logsContent=@logsContent,");
            strSql.Append("logsTitle=@logsTitle,");
            strSql.Append("funName=@funName,");
            strSql.Append("createPerson=@createPerson,");
            strSql.Append("extInt=@extInt,");
            strSql.Append("extStr=@extStr,");
            strSql.Append("extStr2=@extStr2,");
            strSql.Append("extStr3=@extStr3,");
            strSql.Append("flg=@flg,");
            strSql.Append("flg2=@flg2,");
            strSql.Append("flg3=@flg3,");
            strSql.Append("flgInt=@flgInt,");
            strSql.Append("flgDate=@flgDate");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",          SqlDbType.Int,          4),
                new SqlParameter("@modelName",    SqlDbType.VarChar,    300),
                new SqlParameter("@remark",       SqlDbType.VarChar,   2000),
                new SqlParameter("@logsType",     SqlDbType.Int,          4),
                new SqlParameter("@logsTypeName", SqlDbType.VarChar,    100),
                new SqlParameter("@createDate",   SqlDbType.DateTime),
                new SqlParameter("@logsContent",  SqlDbType.Text),
                new SqlParameter("@logsTitle",    SqlDbType.VarChar,    200),
                new SqlParameter("@funName",      SqlDbType.VarChar,    300),
                new SqlParameter("@createPerson", SqlDbType.VarChar,    200),
                new SqlParameter("@extInt",       SqlDbType.Int,          4),
                new SqlParameter("@extStr",       SqlDbType.VarChar,    500),
                new SqlParameter("@extStr2",      SqlDbType.VarChar,    800),
                new SqlParameter("@extStr3",      SqlDbType.VarChar,   1500),
                new SqlParameter("@flg",          SqlDbType.VarChar,    500),
                new SqlParameter("@flg2",         SqlDbType.VarChar,   1000),
                new SqlParameter("@flg3",         SqlDbType.VarChar,   1000),
                new SqlParameter("@flgInt",       SqlDbType.Int,          4),
                new SqlParameter("@flgDate",      SqlDbType.DateTime),
                new SqlParameter("@id",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.modelName;
            parameters[2].Value  = model.remark;
            parameters[3].Value  = model.logsType;
            parameters[4].Value  = model.logsTypeName;
            parameters[5].Value  = model.createDate;
            parameters[6].Value  = model.logsContent;
            parameters[7].Value  = model.logsTitle;
            parameters[8].Value  = model.funName;
            parameters[9].Value  = model.createPerson;
            parameters[10].Value = model.extInt;
            parameters[11].Value = model.extStr;
            parameters[12].Value = model.extStr2;
            parameters[13].Value = model.extStr3;
            parameters[14].Value = model.flg;
            parameters[15].Value = model.flg2;
            parameters[16].Value = model.flg3;
            parameters[17].Value = model.flgInt;
            parameters[18].Value = model.flgDate;
            parameters[19].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }