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

            strSql.Append("update BPM_ProductionRecords set ");
            strSql.Append("OrderID=@OrderID,");
            strSql.Append("FlowCardNum=@FlowCardNum,");
            strSql.Append("Num=@Num,");
            strSql.Append("ProcessID=@ProcessID,");
            strSql.Append("ProcessName=@ProcessName,");
            strSql.Append("Qty=@Qty,");
            strSql.Append("Qty_OK=@Qty_OK,");
            strSql.Append("Qty_NG=@Qty_NG,");
            strSql.Append("UserID=@UserID,");
            strSql.Append("UserName=@UserName,");
            strSql.Append("DateTime=@DateTime");
            strSql.Append(" where ID_Key=@ID_Key");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID",     SqlDbType.VarChar,    50),
                new SqlParameter("@FlowCardNum", SqlDbType.VarChar,    50),
                new SqlParameter("@Num",         SqlDbType.Int,         4),
                new SqlParameter("@ProcessID",   SqlDbType.VarChar,    50),
                new SqlParameter("@ProcessName", SqlDbType.VarChar,   100),
                new SqlParameter("@Qty",         SqlDbType.Decimal,     9),
                new SqlParameter("@Qty_OK",      SqlDbType.Decimal,     9),
                new SqlParameter("@Qty_NG",      SqlDbType.Decimal,     9),
                new SqlParameter("@UserID",      SqlDbType.VarChar,    50),
                new SqlParameter("@UserName",    SqlDbType.NChar,      10),
                new SqlParameter("@DateTime",    SqlDbType.DateTime),
                new SqlParameter("@ID_Key",      SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.OrderID;
            parameters[1].Value  = model.FlowCardNum;
            parameters[2].Value  = model.Num;
            parameters[3].Value  = model.ProcessID;
            parameters[4].Value  = model.ProcessName;
            parameters[5].Value  = model.Qty;
            parameters[6].Value  = model.Qty_OK;
            parameters[7].Value  = model.Qty_NG;
            parameters[8].Value  = model.UserID;
            parameters[9].Value  = model.UserName;
            parameters[10].Value = model.DateTime;
            parameters[11].Value = model.ID_Key;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.BPM_ProductionRecords DataRowToModel(DataRow row)
 {
     Model.BPM_ProductionRecords model = new Model.BPM_ProductionRecords();
     if (row != null)
     {
         if (row["OrderID"] != null)
         {
             model.OrderID = row["OrderID"].ToString();
         }
         if (row["FlowCardNum"] != null)
         {
             model.FlowCardNum = row["FlowCardNum"].ToString();
         }
         if (row["Num"] != null && row["Num"].ToString() != "")
         {
             model.Num = int.Parse(row["Num"].ToString());
         }
         if (row["ProcessID"] != null)
         {
             model.ProcessID = row["ProcessID"].ToString();
         }
         if (row["ProcessName"] != null)
         {
             model.ProcessName = row["ProcessName"].ToString();
         }
         if (row["Qty"] != null && row["Qty"].ToString() != "")
         {
             model.Qty = decimal.Parse(row["Qty"].ToString());
         }
         if (row["Qty_OK"] != null && row["Qty_OK"].ToString() != "")
         {
             model.Qty_OK = decimal.Parse(row["Qty_OK"].ToString());
         }
         if (row["Qty_NG"] != null && row["Qty_NG"].ToString() != "")
         {
             model.Qty_NG = decimal.Parse(row["Qty_NG"].ToString());
         }
         if (row["UserID"] != null)
         {
             model.UserID = row["UserID"].ToString();
         }
         if (row["UserName"] != null)
         {
             model.UserName = row["UserName"].ToString();
         }
         if (row["DateTime"] != null && row["DateTime"].ToString() != "")
         {
             model.DateTime = DateTime.Parse(row["DateTime"].ToString());
         }
         if (row["ID_Key"] != null && row["ID_Key"].ToString() != "")
         {
             model.ID_Key = decimal.Parse(row["ID_Key"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(Model.BPM_ProductionRecords model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BPM_ProductionRecords(");
            strSql.Append("OrderID,FlowCardNum,Num,ProcessID,ProcessName,Qty,Qty_OK,Qty_NG,UserID,UserName,DateTime)");
            strSql.Append(" values (");
            strSql.Append("@OrderID,@FlowCardNum,@Num,@ProcessID,@ProcessName,@Qty,@Qty_OK,@Qty_NG,@UserID,@UserName,@DateTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID",     SqlDbType.VarChar,  50),
                new SqlParameter("@FlowCardNum", SqlDbType.VarChar,  50),
                new SqlParameter("@Num",         SqlDbType.Int,       4),
                new SqlParameter("@ProcessID",   SqlDbType.VarChar,  50),
                new SqlParameter("@ProcessName", SqlDbType.VarChar, 100),
                new SqlParameter("@Qty",         SqlDbType.Decimal,   9),
                new SqlParameter("@Qty_OK",      SqlDbType.Decimal,   9),
                new SqlParameter("@Qty_NG",      SqlDbType.Decimal,   9),
                new SqlParameter("@UserID",      SqlDbType.VarChar,  50),
                new SqlParameter("@UserName",    SqlDbType.NChar,    10),
                new SqlParameter("@DateTime",    SqlDbType.DateTime)
            };
            parameters[0].Value  = model.OrderID;
            parameters[1].Value  = model.FlowCardNum;
            parameters[2].Value  = model.Num;
            parameters[3].Value  = model.ProcessID;
            parameters[4].Value  = model.ProcessName;
            parameters[5].Value  = model.Qty;
            parameters[6].Value  = model.Qty_OK;
            parameters[7].Value  = model.Qty_NG;
            parameters[8].Value  = model.UserID;
            parameters[9].Value  = model.UserName;
            parameters[10].Value = model.DateTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.BPM_ProductionRecords GetModel(decimal ID_Key)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 OrderID,FlowCardNum,Num,ProcessID,ProcessName,Qty,Qty_OK,Qty_NG,UserID,UserName,DateTime,ID_Key from BPM_ProductionRecords ");
            strSql.Append(" where ID_Key=@ID_Key");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID_Key", SqlDbType.Decimal)
            };
            parameters[0].Value = ID_Key;

            Model.BPM_ProductionRecords model = new Model.BPM_ProductionRecords();
            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(Model.BPM_ProductionRecords model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public decimal Add(Model.BPM_ProductionRecords model)
 {
     model.DateTime = MES.Common.GetDATime.GetTime();
     return(dal.Add(model));
 }