Exemple #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TSM.Model.pms_Product_Indust model)
        {
            StringBuilder strSql = new StringBuilder();

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

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TSM.Model.pms_Product_Indust GetModel(int ProductIndustID)
        {
            StringBuilder strSql = new StringBuilder();

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

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ProductIndustID"].ToString() != "")
                {
                    model.ProductIndustID = int.Parse(ds.Tables[0].Rows[0]["ProductIndustID"].ToString());
                }
                model.ProductIndust = ds.Tables[0].Rows[0]["ProductIndust"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TSM.Model.pms_Product_Indust model)
        {
            StringBuilder strSql = new StringBuilder();

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

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
 private void SaveProductType()
 {
     TSM.Model.pms_Product_Indust modelpms_Product_Indust = new TSM.Model.pms_Product_Indust();
     modelpms_Product_Indust.ProductIndust = tbxName.Text.Trim();
     m_bllpms_Product_Indust.Add(modelpms_Product_Indust);
 }