예제 #1
0
        public bool Update(Model_SystemLog model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update SystemLog set ");
            builder.Append("SystemLog_ID=@SystemLog_ID,");
            builder.Append("SystemLog_Level=@SystemLog_Level,");
            builder.Append("SystemLog_Model=@SystemLog_Model,");
            builder.Append("SystemLog_DrugID=@SystemLog_DrugID,");
            builder.Append("SystemLog_TableName=@SystemLog_TableName,");
            builder.Append("SystemLog_TableDataID=@SystemLog_TableDataID,");
            builder.Append("SystemLog_Desc=@SystemLog_Desc,");
            builder.Append("SystemLog_LoginID=@SystemLog_LoginID,");
            builder.Append("SystemLog_CreateDate=@SystemLog_CreateDate,");
            builder.Append("SystemLog_IP=@SystemLog_IP,");
            builder.Append("SystemLog_Source=@SystemLog_Source,");
            builder.Append("SystemLog_Type=@SystemLog_Type,");
            builder.Append("SystemLog_Remark=@SystemLog_Remark");
            builder.Append(" where ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@SystemLog_ID", SqlDbType.Char, 0x24), new SqlParameter("@SystemLog_Level", SqlDbType.VarChar, -1), new SqlParameter("@SystemLog_Model", SqlDbType.NVarChar, 500), new SqlParameter("@SystemLog_DrugID", SqlDbType.Char, 0x24), new SqlParameter("@SystemLog_TableName", SqlDbType.VarChar, 0xff), new SqlParameter("@SystemLog_TableDataID", SqlDbType.Char, 0x24), new SqlParameter("@SystemLog_Desc", SqlDbType.NVarChar, -1), new SqlParameter("@SystemLog_LoginID", SqlDbType.Char, 0x24), new SqlParameter("@SystemLog_CreateDate", SqlDbType.DateTime), new SqlParameter("@SystemLog_IP", SqlDbType.VarChar, 50), new SqlParameter("@SystemLog_Source", SqlDbType.Int, 4), new SqlParameter("@SystemLog_Type", SqlDbType.Int, 4), new SqlParameter("@SystemLog_Remark", SqlDbType.NVarChar, 500) };
            cmdParms[0].Value  = model.SystemLog_ID;
            cmdParms[1].Value  = model.SystemLog_Level;
            cmdParms[2].Value  = model.SystemLog_Model;
            cmdParms[3].Value  = model.SystemLog_DrugID;
            cmdParms[4].Value  = model.SystemLog_TableName;
            cmdParms[5].Value  = model.SystemLog_TableDataID;
            cmdParms[6].Value  = model.SystemLog_Desc;
            cmdParms[7].Value  = model.SystemLog_LoginID;
            cmdParms[8].Value  = model.SystemLog_CreateDate;
            cmdParms[9].Value  = model.SystemLog_IP;
            cmdParms[10].Value = model.SystemLog_Source;
            cmdParms[11].Value = model.SystemLog_Type;
            cmdParms[12].Value = model.SystemLog_Remark;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
예제 #2
0
        internal int Update(DbTransaction tran, Model_SystemLog model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" UPDATE ");
            builder.Append(" SystemLog ");
            builder.Append(" SET ");
            builder.Append(" SystemLog_ID=@SystemLog_ID,SystemLog_Level=@SystemLog_Level,SystemLog_Model=@SystemLog_Model,SystemLog_TableName=@SystemLog_TableName,SystemLog_TableDataID=@SystemLog_TableDataID,SystemLog_Desc=@SystemLog_Desc,SystemLog_LoginID=@SystemLog_LoginID,SystemLog_CreateDate=@SystemLog_CreateDate,SystemLog_IP=@SystemLog_IP,SystemLog_Source=@SystemLog_Source,SystemLog_Type=@SystemLog_Type,SystemLog_Remark=@SystemLog_Remark ");
            builder.Append(" WHERE ");
            builder.Append(" SystemLog_ID=@SystemLog_ID ");
            return(this.CurrDB.ExecuteNonQuery(builder.ToString(), tran, new object[] { model.SystemLog_ID, model.SystemLog_Level, model.SystemLog_Model, model.SystemLog_TableName, model.SystemLog_TableDataID, model.SystemLog_Desc, model.SystemLog_LoginID, model.SystemLog_CreateDate, model.SystemLog_IP, model.SystemLog_Source, model.SystemLog_Type, model.SystemLog_Remark }));
        }
예제 #3
0
        public void SaveSystemLog(Model_SystemLog log)
        {
            Log _log = new Log();

            _log.LogDate        = DateTime.Now;
            _log.LogDescription = log.LogDescription;
            _log.LogTitle       = log.LogTitle;
            _log.PlantCode      = HttpContext.Current.Session["WBID"].ToString();
            _log.URL            = log.URL;
            _log.UserId         = Convert.ToInt32(HttpContext.Current.Session["UserName"].ToString());
            db.Logs.InsertOnSubmit(_log);
            db.SubmitChanges();
        }
예제 #4
0
        internal int Add(DbTransaction tran, Model_SystemLog model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" INSERT INTO ");
            builder.Append(" SystemLog( ");
            builder.Append(" SystemLog_ID,SystemLog_Level,SystemLog_Model,SystemLog_TableName,SystemLog_TableDataID,SystemLog_Desc,SystemLog_LoginID,SystemLog_CreateDate,SystemLog_IP,SystemLog_Source,SystemLog_Type,SystemLog_Remark ");
            builder.Append(" ) ");
            builder.Append(" values( ");
            builder.Append(" @SystemLog_ID,@SystemLog_Level,@SystemLog_Model,@SystemLog_TableName,@SystemLog_TableDataID,@SystemLog_Desc,@SystemLog_LoginID,@SystemLog_CreateDate,@SystemLog_IP,@SystemLog_Source,@SystemLog_Type,@SystemLog_Remark ");
            builder.Append(" ) ");
            return(this.CurrDB.ExecuteNonQuery(builder.ToString(), tran, new object[] { model.SystemLog_ID, model.SystemLog_Level, model.SystemLog_Model, model.SystemLog_TableName, model.SystemLog_TableDataID, model.SystemLog_Desc, model.SystemLog_LoginID, model.SystemLog_CreateDate, model.SystemLog_IP, model.SystemLog_Source, model.SystemLog_Type, model.SystemLog_Remark }));
        }
예제 #5
0
        public List <Model_SystemLog> DataTableToList(DataTable dt)
        {
            List <Model_SystemLog> list = new List <Model_SystemLog>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_SystemLog item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
예제 #6
0
 public bool Add(Model_SystemLog model)
 {
     return(this.dal.Add(model));
 }
예제 #7
0
 public bool Update(Model_SystemLog model)
 {
     return(this.dal.Update(model));
 }
예제 #8
0
        public Model_SystemLog DataRowToModel(DataRow row)
        {
            Model_SystemLog log = new Model_SystemLog();

            if (row != null)
            {
                if (row["SystemLog_ID"] != null)
                {
                    log.SystemLog_ID = row["SystemLog_ID"].ToString();
                }
                if (row["SystemLog_Level"] != null)
                {
                    log.SystemLog_Level = row["SystemLog_Level"].ToString();
                }
                if (row["SystemLog_Model"] != null)
                {
                    log.SystemLog_Model = row["SystemLog_Model"].ToString();
                }
                if (row["SystemLog_DrugID"] != null)
                {
                    log.SystemLog_DrugID = row["SystemLog_DrugID"].ToString();
                }
                if (row["SystemLog_TableName"] != null)
                {
                    log.SystemLog_TableName = row["SystemLog_TableName"].ToString();
                }
                if (row["SystemLog_TableDataID"] != null)
                {
                    log.SystemLog_TableDataID = row["SystemLog_TableDataID"].ToString();
                }
                if (row["SystemLog_Desc"] != null)
                {
                    log.SystemLog_Desc = row["SystemLog_Desc"].ToString();
                }
                if (row["SystemLog_LoginID"] != null)
                {
                    log.SystemLog_LoginID = row["SystemLog_LoginID"].ToString();
                }
                if ((row["SystemLog_CreateDate"] != null) && (row["SystemLog_CreateDate"].ToString() != ""))
                {
                    log.SystemLog_CreateDate = new DateTime?(DateTime.Parse(row["SystemLog_CreateDate"].ToString()));
                }
                if (row["SystemLog_IP"] != null)
                {
                    log.SystemLog_IP = row["SystemLog_IP"].ToString();
                }
                if ((row["SystemLog_Source"] != null) && (row["SystemLog_Source"].ToString() != ""))
                {
                    log.SystemLog_Source = new int?(int.Parse(row["SystemLog_Source"].ToString()));
                }
                if ((row["SystemLog_Type"] != null) && (row["SystemLog_Type"].ToString() != ""))
                {
                    log.SystemLog_Type = new int?(int.Parse(row["SystemLog_Type"].ToString()));
                }
                if (row["SystemLog_Remark"] != null)
                {
                    log.SystemLog_Remark = row["SystemLog_Remark"].ToString();
                }
            }
            return(log);
        }
예제 #9
0
 public int Update(Model_SystemLog model)
 {
     return(this.Update(null, model));
 }
예제 #10
0
        internal List <Model_SystemLog> GetModel_SystemLogListByPage(DbTransaction tran, int pageSize, int pageIndex, string orderColumn, string orderType, string strCondition, params object[] param)
        {
            if ((pageSize <= 0) || (pageIndex <= 0))
            {
                throw new Exception("分页参数错误,必须大于零");
            }
            if (string.IsNullOrEmpty(orderColumn))
            {
                throw new Exception("排序字段必须填写");
            }
            int           num     = ((pageIndex - 1) * pageSize) + 1;
            int           num2    = pageIndex * pageSize;
            StringBuilder builder = new StringBuilder();

            builder.Append(" SELECT * FROM (");
            builder.Append(string.Format(" SELECT (ROW_NUMBER() OVER(ORDER BY {0} {1})) as rownum,* FROM SystemLog", orderColumn, orderType));
            if (!string.IsNullOrWhiteSpace(strCondition))
            {
                builder.Append(" WHERE ");
                builder.Append(strCondition);
            }
            builder.Append(" ) t ");
            builder.Append(" WHERE rownum between ");
            builder.Append(string.Format(" {0} ", num));
            builder.Append(" AND ");
            builder.Append(string.Format(" {0} ", num2));
            DataSet set = this.CurrDB.ExecuteDataSet(builder.ToString(), tran, param);
            List <Model_SystemLog> list = new List <Model_SystemLog>();
            Model_SystemLog        item = null;

            foreach (DataRow row in set.Tables[0].Rows)
            {
                item = new Model_SystemLog();
                if (row["SystemLog_ID"] != null)
                {
                    item.SystemLog_ID = row["SystemLog_ID"].ToString();
                }
                if (row["SystemLog_Level"] != null)
                {
                    item.SystemLog_Level = row["SystemLog_Level"].ToString();
                }
                if (row["SystemLog_Model"] != null)
                {
                    item.SystemLog_Model = row["SystemLog_Model"].ToString();
                }
                if (row["SystemLog_TableName"] != null)
                {
                    item.SystemLog_TableName = row["SystemLog_TableName"].ToString();
                }
                if (row["SystemLog_TableDataID"] != null)
                {
                    item.SystemLog_TableDataID = row["SystemLog_TableDataID"].ToString();
                }
                if (row["SystemLog_Desc"] != null)
                {
                    item.SystemLog_Desc = row["SystemLog_Desc"].ToString();
                }
                if (row["SystemLog_LoginID"] != null)
                {
                    item.SystemLog_LoginID = row["SystemLog_LoginID"].ToString();
                }
                if (row["SystemLog_CreateDate"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_CreateDate"].ToString()))
                    {
                        item.SystemLog_CreateDate = null;
                    }
                    else
                    {
                        item.SystemLog_CreateDate = new DateTime?(DateTime.Parse(row["SystemLog_CreateDate"].ToString()));
                    }
                }
                if (row["SystemLog_IP"] != null)
                {
                    item.SystemLog_IP = row["SystemLog_IP"].ToString();
                }
                if (row["SystemLog_Source"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_Source"].ToString()))
                    {
                        item.SystemLog_Source = null;
                    }
                    else
                    {
                        item.SystemLog_Source = new int?(int.Parse(row["SystemLog_Source"].ToString()));
                    }
                }
                if (row["SystemLog_Type"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_Type"].ToString()))
                    {
                        item.SystemLog_Type = null;
                    }
                    else
                    {
                        item.SystemLog_Type = new int?(int.Parse(row["SystemLog_Type"].ToString()));
                    }
                }
                if (row["SystemLog_Remark"] != null)
                {
                    item.SystemLog_Remark = row["SystemLog_Remark"].ToString();
                }
                list.Add(item);
            }
            return(list);
        }
예제 #11
0
        internal List <Model_SystemLog> GetModel_SystemLogList(DbTransaction tran, int recordNum, string orderColumn, string orderType, string strCondition, params object[] param)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" SELECT ");
            if (recordNum > 0)
            {
                builder.Append(" TOP " + recordNum);
            }
            builder.Append(" * ");
            builder.Append(" FROM ");
            builder.Append(" SystemLog ");
            if (!string.IsNullOrEmpty(strCondition))
            {
                builder.Append(" WHERE ");
                builder.Append(strCondition);
            }
            if (!string.IsNullOrEmpty(orderColumn))
            {
                builder.Append(" ORDER BY ");
                builder.Append(orderColumn);
                if (!string.IsNullOrEmpty(orderType))
                {
                    builder.Append(" " + orderType);
                }
            }
            DataSet set = this.CurrDB.ExecuteDataSet(builder.ToString(), tran, param);
            List <Model_SystemLog> list = new List <Model_SystemLog>();
            Model_SystemLog        item = null;

            foreach (DataRow row in set.Tables[0].Rows)
            {
                item = new Model_SystemLog();
                if (row["SystemLog_ID"] != null)
                {
                    item.SystemLog_ID = row["SystemLog_ID"].ToString();
                }
                if (row["SystemLog_Level"] != null)
                {
                    item.SystemLog_Level = row["SystemLog_Level"].ToString();
                }
                if (row["SystemLog_Model"] != null)
                {
                    item.SystemLog_Model = row["SystemLog_Model"].ToString();
                }
                if (row["SystemLog_TableName"] != null)
                {
                    item.SystemLog_TableName = row["SystemLog_TableName"].ToString();
                }
                if (row["SystemLog_TableDataID"] != null)
                {
                    item.SystemLog_TableDataID = row["SystemLog_TableDataID"].ToString();
                }
                if (row["SystemLog_Desc"] != null)
                {
                    item.SystemLog_Desc = row["SystemLog_Desc"].ToString();
                }
                if (row["SystemLog_LoginID"] != null)
                {
                    item.SystemLog_LoginID = row["SystemLog_LoginID"].ToString();
                }
                if (row["SystemLog_CreateDate"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_CreateDate"].ToString()))
                    {
                        item.SystemLog_CreateDate = null;
                    }
                    else
                    {
                        item.SystemLog_CreateDate = new DateTime?(DateTime.Parse(row["SystemLog_CreateDate"].ToString()));
                    }
                }
                if (row["SystemLog_IP"] != null)
                {
                    item.SystemLog_IP = row["SystemLog_IP"].ToString();
                }
                if (row["SystemLog_Source"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_Source"].ToString()))
                    {
                        item.SystemLog_Source = null;
                    }
                    else
                    {
                        item.SystemLog_Source = new int?(int.Parse(row["SystemLog_Source"].ToString()));
                    }
                }
                if (row["SystemLog_Type"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_Type"].ToString()))
                    {
                        item.SystemLog_Type = null;
                    }
                    else
                    {
                        item.SystemLog_Type = new int?(int.Parse(row["SystemLog_Type"].ToString()));
                    }
                }
                if (row["SystemLog_Remark"] != null)
                {
                    item.SystemLog_Remark = row["SystemLog_Remark"].ToString();
                }
                list.Add(item);
            }
            return(list);
        }
예제 #12
0
 public int Add(Model_SystemLog model)
 {
     return(this.Add(null, model));
 }
예제 #13
0
        internal Model_SystemLog GetModel_SystemLogByPK(DbTransaction tran, string systemlog_id)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" SELECT ");
            builder.Append(" TOP 1 * ");
            builder.Append(" FROM ");
            builder.Append(" SystemLog ");
            builder.Append(" WHERE ");
            builder.Append(" SystemLog_ID=@SystemLog_ID ");
            DataSet         set = this.CurrDB.ExecuteDataSet(builder.ToString(), tran, new object[] { systemlog_id });
            Model_SystemLog log = null;

            if (set.Tables[0].Rows.Count > 0)
            {
                DataRow row = set.Tables[0].Rows[0];
                log = new Model_SystemLog();
                if (row["SystemLog_ID"] != null)
                {
                    log.SystemLog_ID = row["SystemLog_ID"].ToString();
                }
                if (row["SystemLog_Level"] != null)
                {
                    log.SystemLog_Level = row["SystemLog_Level"].ToString();
                }
                if (row["SystemLog_Model"] != null)
                {
                    log.SystemLog_Model = row["SystemLog_Model"].ToString();
                }
                if (row["SystemLog_TableName"] != null)
                {
                    log.SystemLog_TableName = row["SystemLog_TableName"].ToString();
                }
                if (row["SystemLog_TableDataID"] != null)
                {
                    log.SystemLog_TableDataID = row["SystemLog_TableDataID"].ToString();
                }
                if (row["SystemLog_Desc"] != null)
                {
                    log.SystemLog_Desc = row["SystemLog_Desc"].ToString();
                }
                if (row["SystemLog_LoginID"] != null)
                {
                    log.SystemLog_LoginID = row["SystemLog_LoginID"].ToString();
                }
                if (row["SystemLog_CreateDate"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_CreateDate"].ToString()))
                    {
                        log.SystemLog_CreateDate = null;
                    }
                    else
                    {
                        log.SystemLog_CreateDate = new DateTime?(DateTime.Parse(row["SystemLog_CreateDate"].ToString()));
                    }
                }
                if (row["SystemLog_IP"] != null)
                {
                    log.SystemLog_IP = row["SystemLog_IP"].ToString();
                }
                if (row["SystemLog_Source"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_Source"].ToString()))
                    {
                        log.SystemLog_Source = null;
                    }
                    else
                    {
                        log.SystemLog_Source = new int?(int.Parse(row["SystemLog_Source"].ToString()));
                    }
                }
                if (row["SystemLog_Type"] != null)
                {
                    if (string.IsNullOrWhiteSpace(row["SystemLog_Type"].ToString()))
                    {
                        log.SystemLog_Type = null;
                    }
                    else
                    {
                        log.SystemLog_Type = new int?(int.Parse(row["SystemLog_Type"].ToString()));
                    }
                }
                if (row["SystemLog_Remark"] != null)
                {
                    log.SystemLog_Remark = row["SystemLog_Remark"].ToString();
                }
            }
            return(log);
        }
예제 #14
0
 public int Update(Model_SystemLog model)
 {
     return(this.DAL.Update(model));
 }
예제 #15
0
 public int Add(Model_SystemLog model)
 {
     return(this.DAL.Add(model));
 }