コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.BPM_OrderRelevance model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BPM_OrderRelevance set ");
            strSql.Append("MainOrder=@MainOrder,");
            strSql.Append("ProductName=@ProductName,");
            strSql.Append("Spec=@Spec,");
            strSql.Append("Qty=@Qty");
            strSql.Append(" where AdditionalOrder=@AdditionalOrder ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MainOrder",       SqlDbType.VarChar,  20),
                new SqlParameter("@ProductName",     SqlDbType.VarChar, 100),
                new SqlParameter("@Spec",            SqlDbType.VarChar, 100),
                new SqlParameter("@Qty",             SqlDbType.Float,     8),
                new SqlParameter("@AdditionalOrder", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = model.MainOrder;
            parameters[1].Value = model.ProductName;
            parameters[2].Value = model.Spec;
            parameters[3].Value = model.Qty;
            parameters[4].Value = model.AdditionalOrder;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.BPM_OrderRelevance model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BPM_OrderRelevance(");
            strSql.Append("MainOrder,AdditionalOrder,ProductName,Spec,Qty)");
            strSql.Append(" values (");
            strSql.Append("@MainOrder,@AdditionalOrder,@ProductName,@Spec,@Qty)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MainOrder",       SqlDbType.VarChar,  20),
                new SqlParameter("@AdditionalOrder", SqlDbType.VarChar,  20),
                new SqlParameter("@ProductName",     SqlDbType.VarChar, 100),
                new SqlParameter("@Spec",            SqlDbType.VarChar, 100),
                new SqlParameter("@Qty",             SqlDbType.Float, 8)
            };
            parameters[0].Value = model.MainOrder;
            parameters[1].Value = model.AdditionalOrder;
            parameters[2].Value = model.ProductName;
            parameters[3].Value = model.Spec;
            parameters[4].Value = model.Qty;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.BPM_OrderRelevance DataRowToModel(DataRow row)
 {
     Model.BPM_OrderRelevance model = new Model.BPM_OrderRelevance();
     if (row != null)
     {
         if (row["MainOrder"] != null)
         {
             model.MainOrder = row["MainOrder"].ToString();
         }
         if (row["AdditionalOrder"] != null)
         {
             model.AdditionalOrder = row["AdditionalOrder"].ToString();
         }
         if (row["ProductName"] != null)
         {
             model.ProductName = row["ProductName"].ToString();
         }
         if (row["Spec"] != null)
         {
             model.Spec = row["Spec"].ToString();
         }
         if (row["Qty"] != null && row["Qty"].ToString() != "")
         {
             model.Qty = decimal.Parse(row["Qty"].ToString());
         }
     }
     return(model);
 }
コード例 #4
0
ファイル: BPM_OrderRelevance.cs プロジェクト: radtek/EicMes
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Model.BPM_OrderRelevance model)
 {
     if (Exists(model.AdditionalOrder))
     {
         return(Update(model));
     }
     else
     {
         return(dal.Add(model));
     }
 }
コード例 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.BPM_OrderRelevance GetModel(string AdditionalOrder)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MainOrder,AdditionalOrder,ProductName,Spec,Qty from BPM_OrderRelevance ");
            strSql.Append(" where AdditionalOrder=@AdditionalOrder ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AdditionalOrder", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = AdditionalOrder;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
ファイル: BPM_OrderRelevance.cs プロジェクト: radtek/EicMes
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.BPM_OrderRelevance model)
 {
     return(dal.Update(model));
 }