コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MxWeiXinPF.Model.wx_fc_panorama model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_fc_panorama(");
            strSql.Append("wid,fid,pri_front,pic_right,pic_behind,pic_left,pic_top,pic_bottom,pic_yulan,remark,seq,createDate,jdname)");
            strSql.Append(" values (");
            strSql.Append("@wid,@fid,@pri_front,@pic_right,@pic_behind,@pic_left,@pic_top,@pic_bottom,@pic_yulan,@remark,@seq,@createDate,@jdname)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@fid",        SqlDbType.Int,          4),
                new SqlParameter("@pri_front",  SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_right",  SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_behind", SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_left",   SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_top",    SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_bottom", SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_yulan",  SqlDbType.VarChar,   1000),
                new SqlParameter("@remark",     SqlDbType.VarChar,   2000),
                new SqlParameter("@seq",        SqlDbType.Int,          4),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@jdname",     SqlDbType.VarChar, 800)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.fid;
            parameters[2].Value  = model.pri_front;
            parameters[3].Value  = model.pic_right;
            parameters[4].Value  = model.pic_behind;
            parameters[5].Value  = model.pic_left;
            parameters[6].Value  = model.pic_top;
            parameters[7].Value  = model.pic_bottom;
            parameters[8].Value  = model.pic_yulan;
            parameters[9].Value  = model.remark;
            parameters[10].Value = model.seq;
            parameters[11].Value = model.createDate;
            parameters[12].Value = model.jdname;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_fc_panorama GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,wid,fid,pri_front,pic_right,pic_behind,pic_left,pic_top,pic_bottom,pic_yulan,remark,seq,createDate,jdname from wx_fc_panorama ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_fc_panorama DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_fc_panorama model = new MxWeiXinPF.Model.wx_fc_panorama();
     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["fid"] != null && row["fid"].ToString() != "")
         {
             model.fid = int.Parse(row["fid"].ToString());
         }
         if (row["pri_front"] != null)
         {
             model.pri_front = row["pri_front"].ToString();
         }
         if (row["pic_right"] != null)
         {
             model.pic_right = row["pic_right"].ToString();
         }
         if (row["pic_behind"] != null)
         {
             model.pic_behind = row["pic_behind"].ToString();
         }
         if (row["pic_left"] != null)
         {
             model.pic_left = row["pic_left"].ToString();
         }
         if (row["pic_top"] != null)
         {
             model.pic_top = row["pic_top"].ToString();
         }
         if (row["pic_bottom"] != null)
         {
             model.pic_bottom = row["pic_bottom"].ToString();
         }
         if (row["pic_yulan"] != null)
         {
             model.pic_yulan = row["pic_yulan"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["seq"] != null && row["seq"].ToString() != "")
         {
             model.seq = int.Parse(row["seq"].ToString());
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["jdname"] != null)
         {
             model.jdname = row["jdname"].ToString();
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MxWeiXinPF.Model.wx_fc_panorama model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_fc_panorama set ");
            strSql.Append("wid=@wid,");
            strSql.Append("fid=@fid,");
            strSql.Append("pri_front=@pri_front,");
            strSql.Append("pic_right=@pic_right,");
            strSql.Append("pic_behind=@pic_behind,");
            strSql.Append("pic_left=@pic_left,");
            strSql.Append("pic_top=@pic_top,");
            strSql.Append("pic_bottom=@pic_bottom,");
            strSql.Append("pic_yulan=@pic_yulan,");
            strSql.Append("remark=@remark,");
            strSql.Append("seq=@seq,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("jdname=@jdname");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@fid",        SqlDbType.Int,          4),
                new SqlParameter("@pri_front",  SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_right",  SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_behind", SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_left",   SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_top",    SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_bottom", SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_yulan",  SqlDbType.VarChar,   1000),
                new SqlParameter("@remark",     SqlDbType.VarChar,   2000),
                new SqlParameter("@seq",        SqlDbType.Int,          4),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@jdname",     SqlDbType.VarChar,    800),
                new SqlParameter("@Id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.fid;
            parameters[2].Value  = model.pri_front;
            parameters[3].Value  = model.pic_right;
            parameters[4].Value  = model.pic_behind;
            parameters[5].Value  = model.pic_left;
            parameters[6].Value  = model.pic_top;
            parameters[7].Value  = model.pic_bottom;
            parameters[8].Value  = model.pic_yulan;
            parameters[9].Value  = model.remark;
            parameters[10].Value = model.seq;
            parameters[11].Value = model.createDate;
            parameters[12].Value = model.jdname;
            parameters[13].Value = model.Id;

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

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