Beispiel #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(TB_Tray_indexModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_Tray_index(");
            strSql.Append("Tf_TrayId,Tf_BatchID,Tf_Batchtype,Tf_CellCount,tf_CheckInTime)");
            strSql.Append(" values (");
            strSql.Append("@Tf_TrayId,@Tf_BatchID,@Tf_Batchtype,@Tf_CellCount,@tf_CheckInTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_TrayId",      SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_BatchID",     SqlDbType.VarChar, 32),
                new SqlParameter("@Tf_Batchtype",   SqlDbType.Int,      4),
                new SqlParameter("@Tf_CellCount",   SqlDbType.Int,      4),
                new SqlParameter("@tf_CheckInTime", SqlDbType.DateTime)
            };
            parameters[0].Value = model.Tf_TrayId;
            parameters[1].Value = model.Tf_BatchID;
            parameters[2].Value = model.Tf_Batchtype;
            parameters[3].Value = model.Tf_CellCount;
            parameters[4].Value = model.tf_CheckInTime;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TB_Tray_indexModel DataRowToModel(DataRow row)
        {
            TB_Tray_indexModel model = new TB_Tray_indexModel();

            if (row != null)
            {
                if (row["Tf_TrayId"] != null)
                {
                    model.Tf_TrayId = row["Tf_TrayId"].ToString();
                }
                if (row["Tf_BatchID"] != null)
                {
                    model.Tf_BatchID = row["Tf_BatchID"].ToString();
                }
                if (row["Tf_Batchtype"] != null && row["Tf_Batchtype"].ToString() != "")
                {
                    model.Tf_Batchtype = int.Parse(row["Tf_Batchtype"].ToString());
                }
                if (row["Tf_CellCount"] != null && row["Tf_CellCount"].ToString() != "")
                {
                    model.Tf_CellCount = int.Parse(row["Tf_CellCount"].ToString());
                }
                if (row["tf_CheckInTime"] != null && row["tf_CheckInTime"].ToString() != "")
                {
                    model.tf_CheckInTime = DateTime.Parse(row["tf_CheckInTime"].ToString());
                }
                if (row["tf_traystat"] != null && row["tf_traystat"].ToString() != "")
                {
                    model.tf_traystat = int.Parse(row["tf_traystat"].ToString());
                }
            }
            return(model);
        }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TB_Tray_indexModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_Tray_index set ");
            strSql.Append("Tf_BatchID=@Tf_BatchID,");
            strSql.Append("Tf_Batchtype=@Tf_Batchtype,");
            strSql.Append("Tf_CellCount=@Tf_CellCount,");
            strSql.Append("tf_CheckInTime=@tf_CheckInTime,");
            strSql.Append("tf_traystat=@tf_traystat");
            strSql.Append(" where Tf_TrayId=@Tf_TrayId and tf_traystat=1");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_BatchID",     SqlDbType.VarChar,   32),
                new SqlParameter("@Tf_Batchtype",   SqlDbType.Int,        4),
                new SqlParameter("@Tf_CellCount",   SqlDbType.Int,        4),
                new SqlParameter("@tf_CheckInTime", SqlDbType.DateTime),
                new SqlParameter("@Tf_TrayId",      SqlDbType.VarChar,   32),
                new SqlParameter("@tf_traystat",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Tf_BatchID;
            parameters[1].Value = model.Tf_Batchtype;
            parameters[2].Value = model.Tf_CellCount;
            parameters[3].Value = model.tf_CheckInTime;
            parameters[4].Value = model.Tf_TrayId;
            parameters[5].Value = model.tf_traystat;
            int rows = DbHelperSQL2.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TB_Tray_indexModel GetModel(string Tf_TrayId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Tf_TrayId,Tf_BatchID,Tf_Batchtype,Tf_CellCount,tf_CheckInTime,tf_traystat  from TB_Tray_index");
            strSql.Append(" where Tf_TrayId=@Tf_TrayId and tf_traystat=1");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tf_TrayId", SqlDbType.VarChar, 32)
            };
            parameters[0].Value = Tf_TrayId;

            TB_Tray_indexModel model = new TB_Tray_indexModel();
            DataSet            ds    = DbHelperSQL2.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TB_Tray_indexModel model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(TB_Tray_indexModel model)
 {
     model.tf_CheckInTime = (DateTime)DateTime.Parse(model.tf_CheckInTime.ToString("yyyy-MM-dd HH:mm:ss"));
     return(dal.Add(model));
 }