/// <summary> /// 更新一条数据 /// </summary> public bool Update(MES.Server.Model.OQC_OrderPrintConfig model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update OQC_OrderPrintConfig set "); strSql.Append("PackLot=@PackLot,"); strSql.Append("PrintType=@PrintType,"); strSql.Append("TriggerCount=@TriggerCount,"); strSql.Append("LabName=@LabName,"); strSql.Append("LabPath=@LabPath,"); strSql.Append("LabID=@LabID"); strSql.Append(" where OrderID=@OrderID "); SqlParameter[] parameters = { new SqlParameter("@PackLot", SqlDbType.VarChar, 50), new SqlParameter("@PrintType", SqlDbType.VarChar, 50), new SqlParameter("@TriggerCount", SqlDbType.Int, 4), new SqlParameter("@LabName", SqlDbType.VarChar, 200), new SqlParameter("@LabPath", SqlDbType.VarChar, 200), new SqlParameter("@LabID", SqlDbType.Int, 4), new SqlParameter("@OrderID", SqlDbType.VarChar, 50) }; parameters[0].Value = model.PackLot; parameters[1].Value = model.PrintType; parameters[2].Value = model.TriggerCount; parameters[3].Value = model.LabName; parameters[4].Value = model.LabPath; parameters[5].Value = model.LabID; parameters[6].Value = model.OrderID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(MES.Server.Model.OQC_OrderPrintConfig model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into OQC_OrderPrintConfig("); strSql.Append("OrderID,PackLot,PrintType,TriggerCount,LabName,LabPath,LabID)"); strSql.Append(" values ("); strSql.Append("@OrderID,@PackLot,@PrintType,@TriggerCount,@LabName,@LabPath,@LabID)"); SqlParameter[] parameters = { new SqlParameter("@OrderID", SqlDbType.VarChar, 50), new SqlParameter("@PackLot", SqlDbType.VarChar, 50), new SqlParameter("@PrintType", SqlDbType.VarChar, 50), new SqlParameter("@TriggerCount", SqlDbType.Int, 4), new SqlParameter("@LabName", SqlDbType.VarChar, 200), new SqlParameter("@LabPath", SqlDbType.VarChar, 200), new SqlParameter("@LabID", SqlDbType.Int, 4) }; parameters[0].Value = model.OrderID; parameters[1].Value = model.PackLot; parameters[2].Value = model.PrintType; parameters[3].Value = model.TriggerCount; parameters[4].Value = model.LabName; parameters[5].Value = model.LabPath; parameters[6].Value = model.LabID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public MES.Server.Model.OQC_OrderPrintConfig DataRowToModel(DataRow row) { MES.Server.Model.OQC_OrderPrintConfig model = new MES.Server.Model.OQC_OrderPrintConfig(); if (row != null) { if (row["OrderID"] != null) { model.OrderID = row["OrderID"].ToString(); } if (row["PackLot"] != null) { model.PackLot = row["PackLot"].ToString(); } if (row["PrintType"] != null) { model.PrintType = row["PrintType"].ToString(); } if (row["TriggerCount"] != null && row["TriggerCount"].ToString() != "") { model.TriggerCount = int.Parse(row["TriggerCount"].ToString()); } if (row["LabName"] != null) { model.LabName = row["LabName"].ToString(); } if (row["LabPath"] != null) { model.LabPath = row["LabPath"].ToString(); } if (row["LabID"] != null && row["LabID"].ToString() != "") { model.LabID = int.Parse(row["LabID"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public MES.Server.Model.OQC_OrderPrintConfig GetModel(string OrderID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 OrderID,PackLot,PrintType,TriggerCount,LabName,LabPath,LabID from OQC_OrderPrintConfig "); strSql.Append(" where OrderID=@OrderID "); SqlParameter[] parameters = { new SqlParameter("@OrderID", SqlDbType.VarChar, 50) }; parameters[0].Value = OrderID; MES.Server.Model.OQC_OrderPrintConfig model = new MES.Server.Model.OQC_OrderPrintConfig(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }