Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WechatBuilder.Model.wx_sjb_jcDetail DataRowToModel(DataRow row)
 {
     WechatBuilder.Model.wx_sjb_jcDetail model = new WechatBuilder.Model.wx_sjb_jcDetail();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["uid"] != null && row["uid"].ToString() != "")
         {
             model.uid = int.Parse(row["uid"].ToString());
         }
         if (row["rcId"] != null && row["rcId"].ToString() != "")
         {
             model.rcId = int.Parse(row["rcId"].ToString());
         }
         if (row["bsId"] != null && row["bsId"].ToString() != "")
         {
             model.bsId = int.Parse(row["bsId"].ToString());
         }
         if (row["jcRetType"] != null && row["jcRetType"].ToString() != "")
         {
             model.jcRetType = int.Parse(row["jcRetType"].ToString());
         }
         if (row["retIsRight"] != null && row["retIsRight"].ToString() != "")
         {
             if ((row["retIsRight"].ToString() == "1") || (row["retIsRight"].ToString().ToLower() == "true"))
             {
                 model.retIsRight = true;
             }
             else
             {
                 model.retIsRight = false;
             }
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WechatBuilder.Model.wx_sjb_jcDetail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_sjb_jcDetail set ");
            strSql.Append("uid=@uid,");
            strSql.Append("rcId=@rcId,");
            strSql.Append("bsId=@bsId,");
            strSql.Append("jcRetType=@jcRetType,");
            strSql.Append("retIsRight=@retIsRight,");
            strSql.Append("createDate=@createDate");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@uid",        SqlDbType.Int,       4),
                new SqlParameter("@rcId",       SqlDbType.Int,       4),
                new SqlParameter("@bsId",       SqlDbType.Int,       4),
                new SqlParameter("@jcRetType",  SqlDbType.Int,       4),
                new SqlParameter("@retIsRight", SqlDbType.Bit,       1),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.uid;
            parameters[1].Value = model.rcId;
            parameters[2].Value = model.bsId;
            parameters[3].Value = model.jcRetType;
            parameters[4].Value = model.retIsRight;
            parameters[5].Value = model.createDate;
            parameters[6].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WechatBuilder.Model.wx_sjb_jcDetail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_sjb_jcDetail(");
            strSql.Append("uid,rcId,bsId,jcRetType,retIsRight,createDate)");
            strSql.Append(" values (");
            strSql.Append("@uid,@rcId,@bsId,@jcRetType,@retIsRight,@createDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@uid",        SqlDbType.Int, 4),
                new SqlParameter("@rcId",       SqlDbType.Int, 4),
                new SqlParameter("@bsId",       SqlDbType.Int, 4),
                new SqlParameter("@jcRetType",  SqlDbType.Int, 4),
                new SqlParameter("@retIsRight", SqlDbType.Bit, 1),
                new SqlParameter("@createDate", SqlDbType.DateTime)
            };
            parameters[0].Value = model.uid;
            parameters[1].Value = model.rcId;
            parameters[2].Value = model.bsId;
            parameters[3].Value = model.jcRetType;
            parameters[4].Value = model.retIsRight;
            parameters[5].Value = model.createDate;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WechatBuilder.Model.wx_sjb_jcDetail GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,uid,rcId,bsId,jcRetType,retIsRight,createDate from wx_sjb_jcDetail ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WechatBuilder.Model.wx_sjb_jcDetail DataRowToModel(DataRow row)
		{
			WechatBuilder.Model.wx_sjb_jcDetail model=new WechatBuilder.Model.wx_sjb_jcDetail();
			if (row != null)
			{
				if(row["id"]!=null && row["id"].ToString()!="")
				{
					model.id=int.Parse(row["id"].ToString());
				}
				if(row["uid"]!=null && row["uid"].ToString()!="")
				{
					model.uid=int.Parse(row["uid"].ToString());
				}
				if(row["rcId"]!=null && row["rcId"].ToString()!="")
				{
					model.rcId=int.Parse(row["rcId"].ToString());
				}
				if(row["bsId"]!=null && row["bsId"].ToString()!="")
				{
					model.bsId=int.Parse(row["bsId"].ToString());
				}
				if(row["jcRetType"]!=null && row["jcRetType"].ToString()!="")
				{
					model.jcRetType=int.Parse(row["jcRetType"].ToString());
				}
				if(row["retIsRight"]!=null && row["retIsRight"].ToString()!="")
				{
					if((row["retIsRight"].ToString()=="1")||(row["retIsRight"].ToString().ToLower()=="true"))
					{
						model.retIsRight=true;
					}
					else
					{
						model.retIsRight=false;
					}
				}
				if(row["createDate"]!=null && row["createDate"].ToString()!="")
				{
					model.createDate=DateTime.Parse(row["createDate"].ToString());
				}
			}
			return model;
		}
Exemplo n.º 6
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WechatBuilder.Model.wx_sjb_jcDetail GetModel(int id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 id,uid,rcId,bsId,jcRetType,retIsRight,createDate from wx_sjb_jcDetail ");
			strSql.Append(" where id=@id");
			SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
			parameters[0].Value = id;

			WechatBuilder.Model.wx_sjb_jcDetail model=new WechatBuilder.Model.wx_sjb_jcDetail();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}