Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WMS_Database.Goods_UnitModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Goods_Unit set ");
            strSql.Append("Goods_Unit_Name=@Goods_Unit_Name,");
            strSql.Append("Goods_Unit_Code=@Goods_Unit_Code,");
            strSql.Append("Goods_Unit_Remark=@Goods_Unit_Remark");
            strSql.Append(" where Goods_Unit_ID=@Goods_Unit_ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Goods_Unit_Name",   SqlDbType.NVarChar, 50),
                new SqlParameter("@Goods_Unit_Code",   SqlDbType.NVarChar, 50),
                new SqlParameter("@Goods_Unit_Remark", SqlDbType.NVarChar, 50),
                new SqlParameter("@Goods_Unit_ID",     SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.Goods_Unit_Name;
            parameters[1].Value = model.Goods_Unit_Code;
            parameters[2].Value = model.Goods_Unit_Remark;
            parameters[3].Value = model.Goods_Unit_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(WMS_Database.Goods_UnitModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Goods_Unit(");
            strSql.Append("Goods_Unit_ID,Goods_Unit_Name,Goods_Unit_Code,Goods_Unit_Remark)");
            strSql.Append(" values (");
            strSql.Append("@Goods_Unit_ID,@Goods_Unit_Name,@Goods_Unit_Code,@Goods_Unit_Remark)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Goods_Unit_ID",     SqlDbType.NVarChar, 50),
                new SqlParameter("@Goods_Unit_Name",   SqlDbType.NVarChar, 50),
                new SqlParameter("@Goods_Unit_Code",   SqlDbType.NVarChar, 50),
                new SqlParameter("@Goods_Unit_Remark", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.Goods_Unit_ID;
            parameters[1].Value = model.Goods_Unit_Name;
            parameters[2].Value = model.Goods_Unit_Code;
            parameters[3].Value = model.Goods_Unit_Remark;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WMS_Database.Goods_UnitModel DataRowToModel(DataRow row)
 {
     WMS_Database.Goods_UnitModel model = new WMS_Database.Goods_UnitModel();
     if (row != null)
     {
         if (row["Goods_Unit_ID"] != null)
         {
             model.Goods_Unit_ID = row["Goods_Unit_ID"].ToString();
         }
         if (row["Goods_Unit_Name"] != null)
         {
             model.Goods_Unit_Name = row["Goods_Unit_Name"].ToString();
         }
         if (row["Goods_Unit_Code"] != null)
         {
             model.Goods_Unit_Code = row["Goods_Unit_Code"].ToString();
         }
         if (row["Goods_Unit_Remark"] != null)
         {
             model.Goods_Unit_Remark = row["Goods_Unit_Remark"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WMS_Database.Goods_UnitModel GetModel(string Goods_Unit_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Goods_Unit_ID,Goods_Unit_Name,Goods_Unit_Code,Goods_Unit_Remark from Goods_Unit ");
            strSql.Append(" where Goods_Unit_ID=@Goods_Unit_ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Goods_Unit_ID", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = Goods_Unit_ID;

            WMS_Database.Goods_UnitModel model = new WMS_Database.Goods_UnitModel();
            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 bool Update(WMS_Database.Goods_UnitModel model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(WMS_Database.Goods_UnitModel model)
 {
     return(dal.Add(model));
 }