예제 #1
0
파일: T_Log.cs 프로젝트: icprog/MesCable
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MesWeb.Model.T_Log DataRowToModel(DataRow row)
 {
     MesWeb.Model.T_Log model = new MesWeb.Model.T_Log();
     if (row != null)
     {
         if (row["LogID"] != null && row["LogID"].ToString() != "")
         {
             model.LogID = int.Parse(row["LogID"].ToString());
         }
         if (row["UserID"] != null && row["UserID"].ToString() != "")
         {
             model.UserID = int.Parse(row["UserID"].ToString());
         }
         if (row["LogTypeID"] != null && row["LogTypeID"].ToString() != "")
         {
             model.LogTypeID = int.Parse(row["LogTypeID"].ToString());
         }
         if (row["LogDetailID"] != null && row["LogDetailID"].ToString() != "")
         {
             model.LogDetailID = int.Parse(row["LogDetailID"].ToString());
         }
         if (row["LoginTime"] != null && row["LoginTime"].ToString() != "")
         {
             model.LoginTime = DateTime.Parse(row["LoginTime"].ToString());
         }
         if (row["LoginIP"] != null)
         {
             model.LoginIP = row["LoginIP"].ToString();
         }
     }
     return(model);
 }
예제 #2
0
파일: T_Log.cs 프로젝트: icprog/MesCable
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public MesWeb.Model.T_Log ReaderBind(IDataReader dataReader)
        {
            MesWeb.Model.T_Log model = new MesWeb.Model.T_Log();
            object             ojb;

            ojb = dataReader["LogID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LogID = (int)ojb;
            }
            ojb = dataReader["UserID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UserID = (int)ojb;
            }
            ojb = dataReader["LogTypeID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LogTypeID = (int)ojb;
            }
            ojb = dataReader["LogDetailID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LogDetailID = (int)ojb;
            }
            ojb = dataReader["LoginTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoginTime = (DateTime)ojb;
            }
            model.LoginIP = dataReader["LoginIP"].ToString();
            return(model);
        }
예제 #3
0
파일: T_Log.cs 프로젝트: icprog/MesCable
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(MesWeb.Model.T_Log model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_Log_Update");

            db.AddInParameter(dbCommand, "LogID", DbType.Int32, model.LogID);
            db.AddInParameter(dbCommand, "UserID", DbType.Int32, model.UserID);
            db.AddInParameter(dbCommand, "LogTypeID", DbType.Int32, model.LogTypeID);
            db.AddInParameter(dbCommand, "LogDetailID", DbType.Int32, model.LogDetailID);
            db.AddInParameter(dbCommand, "LoginTime", DbType.DateTime, model.LoginTime);
            db.AddInParameter(dbCommand, "LoginIP", DbType.String, model.LoginIP);
            db.ExecuteNonQuery(dbCommand);
        }
예제 #4
0
파일: T_Log.cs 프로젝트: icprog/MesCable
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(MesWeb.Model.T_Log model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_Log_ADD");

            db.AddOutParameter(dbCommand, "LogID", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "UserID", DbType.Int32, model.UserID);
            db.AddInParameter(dbCommand, "LogTypeID", DbType.Int32, model.LogTypeID);
            db.AddInParameter(dbCommand, "LogDetailID", DbType.Int32, model.LogDetailID);
            db.AddInParameter(dbCommand, "LoginTime", DbType.DateTime, model.LoginTime);
            db.AddInParameter(dbCommand, "LoginIP", DbType.String, model.LoginIP);
            db.ExecuteNonQuery(dbCommand);
            return((int)db.GetParameterValue(dbCommand, "LogID"));
        }
예제 #5
0
파일: T_Log.cs 프로젝트: icprog/MesCable
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MesWeb.Model.T_Log GetModel(int LogID)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("T_Log_GetModel");

            db.AddInParameter(dbCommand, "LogID", DbType.Int32, LogID);

            MesWeb.Model.T_Log model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }