Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.MoveStore_Receive model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_MoveStore_Receive set ");
            strSql.Append("OrderID=@OrderID,");
            strSql.Append("Ste_ID=@Ste_ID,");
            strSql.Append("Count=@Count,");
            strSql.Append("JobNum=@JobNum,");
            strSql.Append("Wk_ID=@Wk_ID,");
            strSql.Append("Or_ID=@Or_ID,");
            strSql.Append("DateTime=@DateTime,");
            strSql.Append("Mse_ID=@Mse_ID");
            strSql.Append(" where Mre_ID=@Mre_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID",  SqlDbType.VarChar,   20),
                new SqlParameter("@Ste_ID",   SqlDbType.Decimal,    9),
                new SqlParameter("@Count",    SqlDbType.Int,        4),
                new SqlParameter("@JobNum",   SqlDbType.VarChar,   20),
                new SqlParameter("@Wk_ID",    SqlDbType.VarChar,   20),
                new SqlParameter("@Or_ID",    SqlDbType.Decimal,    9),
                new SqlParameter("@DateTime", SqlDbType.DateTime),
                new SqlParameter("@Mse_ID",   SqlDbType.Decimal,    9),
                new SqlParameter("@Mre_ID",   SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.OrderID;
            parameters[1].Value = model.Ste_ID;
            parameters[2].Value = model.Count;
            parameters[3].Value = model.JobNum;
            parameters[4].Value = model.Wk_ID;
            parameters[5].Value = model.Or_ID;
            parameters[6].Value = model.DateTime;
            parameters[7].Value = model.Mse_ID;
            parameters[8].Value = model.Mre_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.MoveStore_Receive DataRowToModel(DataRow row)
 {
     Maticsoft.Model.MoveStore_Receive model = new Maticsoft.Model.MoveStore_Receive();
     if (row != null)
     {
         if (row["Mre_ID"] != null && row["Mre_ID"].ToString() != "")
         {
             model.Mre_ID = decimal.Parse(row["Mre_ID"].ToString());
         }
         if (row["OrderID"] != null)
         {
             model.OrderID = row["OrderID"].ToString();
         }
         if (row["Ste_ID"] != null && row["Ste_ID"].ToString() != "")
         {
             model.Ste_ID = decimal.Parse(row["Ste_ID"].ToString());
         }
         if (row["Count"] != null && row["Count"].ToString() != "")
         {
             model.Count = int.Parse(row["Count"].ToString());
         }
         if (row["JobNum"] != null)
         {
             model.JobNum = row["JobNum"].ToString();
         }
         if (row["Wk_ID"] != null)
         {
             model.Wk_ID = row["Wk_ID"].ToString();
         }
         if (row["Or_ID"] != null && row["Or_ID"].ToString() != "")
         {
             model.Or_ID = decimal.Parse(row["Or_ID"].ToString());
         }
         if (row["DateTime"] != null && row["DateTime"].ToString() != "")
         {
             model.DateTime = DateTime.Parse(row["DateTime"].ToString());
         }
         if (row["Mse_ID"] != null && row["Mse_ID"].ToString() != "")
         {
             model.Mse_ID = decimal.Parse(row["Mse_ID"].ToString());
         }
     }
     return(model);
 }
Пример #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(Maticsoft.Model.MoveStore_Receive model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_MoveStore_Receive(");
            strSql.Append("OrderID,Ste_ID,Count,JobNum,Wk_ID,Or_ID,DateTime,Mse_ID)");
            strSql.Append(" values (");
            strSql.Append("@OrderID,@Ste_ID,@Count,@JobNum,@Wk_ID,@Or_ID,@DateTime,@Mse_ID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID",  SqlDbType.VarChar,   20),
                new SqlParameter("@Ste_ID",   SqlDbType.Decimal,    9),
                new SqlParameter("@Count",    SqlDbType.Int,        4),
                new SqlParameter("@JobNum",   SqlDbType.VarChar,   20),
                new SqlParameter("@Wk_ID",    SqlDbType.VarChar,   20),
                new SqlParameter("@Or_ID",    SqlDbType.Decimal,    9),
                new SqlParameter("@DateTime", SqlDbType.DateTime),
                new SqlParameter("@Mse_ID",   SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.OrderID;
            parameters[1].Value = model.Ste_ID;
            parameters[2].Value = model.Count;
            parameters[3].Value = model.JobNum;
            parameters[4].Value = model.Wk_ID;
            parameters[5].Value = model.Or_ID;
            parameters[6].Value = model.DateTime;
            parameters[7].Value = model.Mse_ID;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.MoveStore_Receive GetModel(decimal Mre_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Mre_ID,OrderID,Ste_ID,Count,JobNum,Wk_ID,Or_ID,DateTime,Mse_ID from tb_MoveStore_Receive ");
            strSql.Append(" where Mre_ID=@Mre_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Mre_ID", SqlDbType.Decimal)
            };
            parameters[0].Value = Mre_ID;

            Maticsoft.Model.MoveStore_Receive model = new Maticsoft.Model.MoveStore_Receive();
            DataSet ds = dbs.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }