Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.V_ProductionRecords model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update V_ProductionRecords set ");
            strSql.Append("OrderID=@OrderID,");
            strSql.Append("Num=@Num,");
            strSql.Append("ProcessID=@ProcessID,");
            strSql.Append("ProcessName=@ProcessName,");
            strSql.Append("Qty=@Qty,");
            strSql.Append("Qty_NG=@Qty_NG,");
            strSql.Append("Qty_OK=@Qty_OK,");
            strSql.Append("PassRatio=@PassRatio,");
            strSql.Append("RejectRatio=@RejectRatio");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID",     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,  17),
                new SqlParameter("@Qty_NG",      SqlDbType.Decimal,  17),
                new SqlParameter("@Qty_OK",      SqlDbType.Decimal,  17),
                new SqlParameter("@PassRatio",   SqlDbType.VarChar,  42),
                new SqlParameter("@RejectRatio", SqlDbType.VarChar, 42)
            };
            parameters[0].Value = model.OrderID;
            parameters[1].Value = model.Num;
            parameters[2].Value = model.ProcessID;
            parameters[3].Value = model.ProcessName;
            parameters[4].Value = model.Qty;
            parameters[5].Value = model.Qty_NG;
            parameters[6].Value = model.Qty_OK;
            parameters[7].Value = model.PassRatio;
            parameters[8].Value = model.RejectRatio;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.V_ProductionRecords DataRowToModel(DataRow row)
 {
     Model.V_ProductionRecords model = new Model.V_ProductionRecords();
     if (row != null)
     {
         if (row["OrderID"] != null)
         {
             model.OrderID = row["OrderID"].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_NG"] != null && row["Qty_NG"].ToString() != "")
         {
             model.Qty_NG = decimal.Parse(row["Qty_NG"].ToString());
         }
         if (row["Qty_OK"] != null && row["Qty_OK"].ToString() != "")
         {
             model.Qty_OK = decimal.Parse(row["Qty_OK"].ToString());
         }
         if (row["PassRatio"] != null)
         {
             model.PassRatio = row["PassRatio"].ToString();
         }
         if (row["RejectRatio"] != null)
         {
             model.RejectRatio = row["RejectRatio"].ToString();
         }
     }
     return(model);
 }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.V_ProductionRecords model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into V_ProductionRecords(");
            strSql.Append("OrderID,Num,ProcessID,ProcessName,Qty,Qty_NG,Qty_OK,PassRatio,RejectRatio)");
            strSql.Append(" values (");
            strSql.Append("@OrderID,@Num,@ProcessID,@ProcessName,@Qty,@Qty_NG,@Qty_OK,@PassRatio,@RejectRatio)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID",     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,  17),
                new SqlParameter("@Qty_NG",      SqlDbType.Decimal,  17),
                new SqlParameter("@Qty_OK",      SqlDbType.Decimal,  17),
                new SqlParameter("@PassRatio",   SqlDbType.VarChar,  42),
                new SqlParameter("@RejectRatio", SqlDbType.VarChar, 42)
            };
            parameters[0].Value = model.OrderID;
            parameters[1].Value = model.Num;
            parameters[2].Value = model.ProcessID;
            parameters[3].Value = model.ProcessName;
            parameters[4].Value = model.Qty;
            parameters[5].Value = model.Qty_NG;
            parameters[6].Value = model.Qty_OK;
            parameters[7].Value = model.PassRatio;
            parameters[8].Value = model.RejectRatio;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.V_ProductionRecords GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 OrderID,Num,ProcessID,ProcessName,Qty,Qty_NG,Qty_OK,PassRatio,RejectRatio from V_ProductionRecords ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            Model.V_ProductionRecords model = new Model.V_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);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.V_ProductionRecords model)
 {
     return(dal.Update(model));
 }
Beispiel #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Model.V_ProductionRecords model)
 {
     return(dal.Add(model));
 }