예제 #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(MesWeb.Model.T_SpotDist model)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",               SqlDbType.Int,       4),
                new SqlParameter("@Url",              SqlDbType.NVarChar, 50),
                new SqlParameter("@Pixel",            SqlDbType.NVarChar, 50),
                new SqlParameter("@SpotDistEntityId", SqlDbType.Int,       4),
                new SqlParameter("@SpotDistTypeId",   SqlDbType.Int,       4),
                new SqlParameter("@Remark",           SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.Url;
            parameters[2].Value = model.Pixel;
            parameters[3].Value = model.SpotDistEntityId;
            parameters[4].Value = model.SpotDistTypeId;
            parameters[5].Value = model.Remark;

            DbHelperSQL.RunProcedure("T_SpotDist_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_SpotDist DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_SpotDist model = new MesWeb.Model.T_SpotDist();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["Url"] != null)
         {
             model.Url = row["Url"].ToString();
         }
         if (row["Pixel"] != null)
         {
             model.Pixel = row["Pixel"].ToString();
         }
         if (row["SpotDistEntityId"] != null && row["SpotDistEntityId"].ToString() != "")
         {
             model.SpotDistEntityId = int.Parse(row["SpotDistEntityId"].ToString());
         }
         if (row["SpotDistTypeId"] != null && row["SpotDistTypeId"].ToString() != "")
         {
             model.SpotDistTypeId = int.Parse(row["SpotDistTypeId"].ToString());
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return(model);
 }
예제 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_SpotDist GetModel(int Id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            MesWeb.Model.T_SpotDist model = new MesWeb.Model.T_SpotDist();
            DataSet ds = DbHelperSQL.RunProcedure("T_SpotDist_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #4
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_SpotDist model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",               SqlDbType.Int,       4),
                new SqlParameter("@Url",              SqlDbType.NVarChar, 50),
                new SqlParameter("@Pixel",            SqlDbType.NVarChar, 50),
                new SqlParameter("@SpotDistEntityId", SqlDbType.Int,       4),
                new SqlParameter("@SpotDistTypeId",   SqlDbType.Int,       4),
                new SqlParameter("@Remark",           SqlDbType.NVarChar, 50)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.Url;
            parameters[2].Value     = model.Pixel;
            parameters[3].Value     = model.SpotDistEntityId;
            parameters[4].Value     = model.SpotDistTypeId;
            parameters[5].Value     = model.Remark;

            DbHelperSQL.RunProcedure("T_SpotDist_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }