Exemple #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TSM.Model.pms_Product_Struc GetModel(int ProductStrucID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ProductStrucID,ProductStruc from pms_Product_Struc ");
            strSql.Append(" where ProductStrucID=@ProductStrucID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProductStrucID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ProductStrucID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ProductStrucID"].ToString() != "")
                {
                    model.ProductStrucID = int.Parse(ds.Tables[0].Rows[0]["ProductStrucID"].ToString());
                }
                model.ProductStruc = ds.Tables[0].Rows[0]["ProductStruc"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TSM.Model.pms_Product_Struc model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into pms_Product_Struc(");
            strSql.Append("ProductStruc)");
            strSql.Append(" values (");
            strSql.Append("@ProductStruc)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProductStruc", SqlDbType.VarChar, 64)
            };
            parameters[0].Value = model.ProductStruc;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TSM.Model.pms_Product_Struc model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update pms_Product_Struc set ");
            strSql.Append("ProductStruc=@ProductStruc");
            strSql.Append(" where ProductStrucID=@ProductStrucID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProductStrucID", SqlDbType.Int,     4),
                new SqlParameter("@ProductStruc",   SqlDbType.VarChar, 64)
            };
            parameters[0].Value = model.ProductStrucID;
            parameters[1].Value = model.ProductStruc;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
 private void SaveProductType()
 {
     TSM.Model.pms_Product_Struc modelpms_Product_Struc = new TSM.Model.pms_Product_Struc();
     modelpms_Product_Struc.ProductStruc = tbxName.Text.Trim();
     m_bllpms_Product_Struc.Add(modelpms_Product_Struc);
 }