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

            strSql.Append("update OCVCheckInterface set ");
            strSql.Append("ProductFrameCode=@ProductFrameCode,");
            strSql.Append("CheckType=@CheckType,");
            strSql.Append("CorePosition=@CorePosition,");
            strSql.Append("HasCore=@HasCore,");
            strSql.Append("CoreStatus=@CoreStatus,");
            strSql.Append("ReportTime=@ReportTime,");
            strSql.Append("HandleStatus=@HandleStatus,");
            strSql.Append("Remarks=@Remarks");
            strSql.Append(" where CheckInterfaceID=@CheckInterfaceID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProductFrameCode", SqlDbType.NVarChar,   50),
                new SqlParameter("@CheckType",        SqlDbType.NVarChar,   50),
                new SqlParameter("@CorePosition",     SqlDbType.NVarChar,   50),
                new SqlParameter("@HasCore",          SqlDbType.Int,         4),
                new SqlParameter("@CoreStatus",       SqlDbType.Int,         4),
                new SqlParameter("@ReportTime",       SqlDbType.DateTime),
                new SqlParameter("@HandleStatus",     SqlDbType.Int,         4),
                new SqlParameter("@Remarks",          SqlDbType.NVarChar,  100),
                new SqlParameter("@CheckInterfaceID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ProductFrameCode;
            parameters[1].Value = model.CheckType;
            parameters[2].Value = model.CorePosition;
            parameters[3].Value = model.HasCore;
            parameters[4].Value = model.CoreStatus;
            parameters[5].Value = model.ReportTime;
            parameters[6].Value = model.HandleStatus;
            parameters[7].Value = model.Remarks;
            parameters[8].Value = model.CheckInterfaceID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECAMSDataAccess.OCVCheckInterfaceModel DataRowToModel(DataRow row)
 {
     ECAMSDataAccess.OCVCheckInterfaceModel model = new ECAMSDataAccess.OCVCheckInterfaceModel();
     if (row != null)
     {
         if (row["CheckInterfaceID"] != null && row["CheckInterfaceID"].ToString() != "")
         {
             model.CheckInterfaceID = int.Parse(row["CheckInterfaceID"].ToString());
         }
         if (row["ProductFrameCode"] != null)
         {
             model.ProductFrameCode = row["ProductFrameCode"].ToString();
         }
         if (row["CheckType"] != null)
         {
             model.CheckType = row["CheckType"].ToString();
         }
         if (row["CorePosition"] != null)
         {
             model.CorePosition = row["CorePosition"].ToString();
         }
         if (row["HasCore"] != null && row["HasCore"].ToString() != "")
         {
             model.HasCore = int.Parse(row["HasCore"].ToString());
         }
         if (row["CoreStatus"] != null && row["CoreStatus"].ToString() != "")
         {
             model.CoreStatus = int.Parse(row["CoreStatus"].ToString());
         }
         if (row["ReportTime"] != null && row["ReportTime"].ToString() != "")
         {
             model.ReportTime = DateTime.Parse(row["ReportTime"].ToString());
         }
         if (row["HandleStatus"] != null && row["HandleStatus"].ToString() != "")
         {
             model.HandleStatus = int.Parse(row["HandleStatus"].ToString());
         }
         if (row["Remarks"] != null)
         {
             model.Remarks = row["Remarks"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ECAMSDataAccess.OCVCheckInterfaceModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OCVCheckInterface(");
            strSql.Append("CheckInterfaceID,ProductFrameCode,CheckType,CorePosition,HasCore,CoreStatus,ReportTime,HandleStatus,Remarks)");
            strSql.Append(" values (");
            strSql.Append("@CheckInterfaceID,@ProductFrameCode,@CheckType,@CorePosition,@HasCore,@CoreStatus,@ReportTime,@HandleStatus,@Remarks)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CheckInterfaceID", SqlDbType.Int,        4),
                new SqlParameter("@ProductFrameCode", SqlDbType.NVarChar,  50),
                new SqlParameter("@CheckType",        SqlDbType.NVarChar,  50),
                new SqlParameter("@CorePosition",     SqlDbType.NVarChar,  50),
                new SqlParameter("@HasCore",          SqlDbType.Int,        4),
                new SqlParameter("@CoreStatus",       SqlDbType.Int,        4),
                new SqlParameter("@ReportTime",       SqlDbType.DateTime),
                new SqlParameter("@HandleStatus",     SqlDbType.Int,        4),
                new SqlParameter("@Remarks",          SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = model.CheckInterfaceID;
            parameters[1].Value = model.ProductFrameCode;
            parameters[2].Value = model.CheckType;
            parameters[3].Value = model.CorePosition;
            parameters[4].Value = model.HasCore;
            parameters[5].Value = model.CoreStatus;
            parameters[6].Value = model.ReportTime;
            parameters[7].Value = model.HandleStatus;
            parameters[8].Value = model.Remarks;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ECAMSDataAccess.OCVCheckInterfaceModel GetModel(int CheckInterfaceID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 CheckInterfaceID,ProductFrameCode,CheckType,CorePosition,HasCore,CoreStatus,ReportTime,HandleStatus,Remarks from OCVCheckInterface ");
            strSql.Append(" where CheckInterfaceID=@CheckInterfaceID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CheckInterfaceID", SqlDbType.Int, 4)
            };
            parameters[0].Value = CheckInterfaceID;

            ECAMSDataAccess.OCVCheckInterfaceModel model = new ECAMSDataAccess.OCVCheckInterfaceModel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

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