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

            strSql.Append("update GENERAL_INSTRUCTION set ");
            strSql.Append("PID=:PID,");
            strSql.Append("CLIENT_NO=:CLIENT_NO,");
            strSql.Append("RECEIVED=:RECEIVED,");
            strSql.Append("RECEIVED_BY=:RECEIVED_BY,");
            strSql.Append("RELATES_TO=:RELATES_TO,");
            strSql.Append("CONTENT_CN=:CONTENT_CN,");
            strSql.Append("CONTENT_ORIGIN=:CONTENT_ORIGIN,");
            strSql.Append("INSTRUCTOR=:INSTRUCTOR,");
            strSql.Append("STATUS=:STATUS,");
            strSql.Append("EXPIRE_DATE=:EXPIRE_DATE,");
            strSql.Append("COMMENTS=:COMMENTS");
            strSql.Append(" where PID=:PID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":PID",            OracleType.VarChar,     40),
                new OracleParameter(":CLIENT_NO",      OracleType.VarChar,     10),
                new OracleParameter(":RECEIVED",       OracleType.DateTime),
                new OracleParameter(":RECEIVED_BY",    OracleType.VarChar,     20),
                new OracleParameter(":RELATES_TO",     OracleType.VarChar,     30),
                new OracleParameter(":CONTENT_CN",     OracleType.VarChar,   2000),
                new OracleParameter(":CONTENT_ORIGIN", OracleType.VarChar,   2000),
                new OracleParameter(":INSTRUCTOR",     OracleType.VarChar,    300),
                new OracleParameter(":STATUS",         OracleType.VarChar,     20),
                new OracleParameter(":EXPIRE_DATE",    OracleType.DateTime),
                new OracleParameter(":COMMENTS",       OracleType.VarChar, 4000)
            };
            parameters[0].Value  = model.PID;
            parameters[1].Value  = model.CLIENT_NO;
            parameters[2].Value  = model.RECEIVED;
            parameters[3].Value  = model.RECEIVED_BY;
            parameters[4].Value  = model.RELATES_TO;
            parameters[5].Value  = model.CONTENT_CN;
            parameters[6].Value  = model.CONTENT_ORIGIN;
            parameters[7].Value  = model.INSTRUCTOR;
            parameters[8].Value  = model.STATUS;
            parameters[9].Value  = model.EXPIRE_DATE;
            parameters[10].Value = model.COMMENTS;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.GENERAL_INSTRUCTION DataRowToModel(DataRow row)
 {
     Model.GENERAL_INSTRUCTION model = new Model.GENERAL_INSTRUCTION();
     if (row != null)
     {
         if (row["PID"] != null)
         {
             model.PID = row["PID"].ToString();
         }
         if (row["CLIENT_NO"] != null)
         {
             model.CLIENT_NO = row["CLIENT_NO"].ToString();
         }
         if (row["RECEIVED"] != null && row["RECEIVED"].ToString() != "")
         {
             model.RECEIVED = DateTime.Parse(row["RECEIVED"].ToString());
         }
         if (row["RECEIVED_BY"] != null)
         {
             model.RECEIVED_BY = row["RECEIVED_BY"].ToString();
         }
         if (row["RELATES_TO"] != null)
         {
             model.RELATES_TO = row["RELATES_TO"].ToString();
         }
         if (row["CONTENT_CN"] != null)
         {
             model.CONTENT_CN = row["CONTENT_CN"].ToString();
         }
         if (row["CONTENT_ORIGIN"] != null)
         {
             model.CONTENT_ORIGIN = row["CONTENT_ORIGIN"].ToString();
         }
         if (row["INSTRUCTOR"] != null)
         {
             model.INSTRUCTOR = row["INSTRUCTOR"].ToString();
         }
         if (row["STATUS"] != null)
         {
             model.STATUS = row["STATUS"].ToString();
         }
         if (row["EXPIRE_DATE"] != null && row["EXPIRE_DATE"].ToString() != "")
         {
             model.EXPIRE_DATE = DateTime.Parse(row["EXPIRE_DATE"].ToString());
         }
         if (row["COMMENTS"] != null)
         {
             model.COMMENTS = row["COMMENTS"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.GENERAL_INSTRUCTION model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into GENERAL_INSTRUCTION(");
            strSql.Append("PID,CLIENT_NO,RECEIVED,RECEIVED_BY,RELATES_TO,CONTENT_CN,CONTENT_ORIGIN,INSTRUCTOR,STATUS,EXPIRE_DATE,COMMENTS)");
            strSql.Append(" values (");
            strSql.Append(":PID,:CLIENT_NO,:RECEIVED,:RECEIVED_BY,:RELATES_TO,:CONTENT_CN,:CONTENT_ORIGIN,:INSTRUCTOR,:STATUS,:EXPIRE_DATE,:COMMENTS)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":PID",            OracleType.VarChar,     40),
                new OracleParameter(":CLIENT_NO",      OracleType.VarChar,     10),
                new OracleParameter(":RECEIVED",       OracleType.DateTime),
                new OracleParameter(":RECEIVED_BY",    OracleType.VarChar,     20),
                new OracleParameter(":RELATES_TO",     OracleType.VarChar,     30),
                new OracleParameter(":CONTENT_CN",     OracleType.VarChar,   2000),
                new OracleParameter(":CONTENT_ORIGIN", OracleType.VarChar,   2000),
                new OracleParameter(":INSTRUCTOR",     OracleType.VarChar,    300),
                new OracleParameter(":STATUS",         OracleType.VarChar,     20),
                new OracleParameter(":EXPIRE_DATE",    OracleType.DateTime),
                new OracleParameter(":COMMENTS",       OracleType.VarChar, 4000)
            };
            parameters[0].Value  = model.PID;
            parameters[1].Value  = model.CLIENT_NO;
            parameters[2].Value  = model.RECEIVED;
            parameters[3].Value  = model.RECEIVED_BY;
            parameters[4].Value  = model.RELATES_TO;
            parameters[5].Value  = model.CONTENT_CN;
            parameters[6].Value  = model.CONTENT_ORIGIN;
            parameters[7].Value  = model.INSTRUCTOR;
            parameters[8].Value  = model.STATUS;
            parameters[9].Value  = model.EXPIRE_DATE;
            parameters[10].Value = model.COMMENTS;

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

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

            strSql.Append("select PID,CLIENT_NO,RECEIVED,RECEIVED_BY,RELATES_TO,CONTENT_CN,CONTENT_ORIGIN,INSTRUCTOR,STATUS,EXPIRE_DATE,COMMENTS from GENERAL_INSTRUCTION ");
            strSql.Append(" where PID=:PID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":PID", OracleType.VarChar, 40)
            };
            parameters[0].Value = PID;

            Model.GENERAL_INSTRUCTION model = new Model.GENERAL_INSTRUCTION();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.GENERAL_INSTRUCTION model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Model.GENERAL_INSTRUCTION model)
 {
     return(dal.Add(model));
 }