Example #1
0
 public void UpdateAdminLog(AdminLogInfo adminLog)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@action", SqlDbType.NVarChar) };
     pt[0].Value = adminLog.ID;
     pt[1].Value = adminLog.Action;
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "UpdateAdminLog", pt);
 }
Example #2
0
        /// <summary>
        /// 添加AdminLogInfo
        /// </summary>
        /// <param name="adminlog"></param>
        /// <returns></returns>
        public static int AddAdminLog(AdminLogInfo adminlog)
        {
            string sql = @"INSERT INTO [AdminLog]
			([UserId],[Controllers],[Action],[Parameter],[ActionId],[Ip],[Url],[InTime],[Method],[IsAjax],[UserAgent],[ControllersDsc],[ActionDsc])
			VALUES
			(@UserId,@Controllers,@Action,@Parameter,@ActionId,@Ip,@Url,@InTime,@Method,@IsAjax,@UserAgent,@ControllersDsc,@ActionDsc) 
			SELECT SCOPE_IDENTITY()
			"            ;
            var    par = new DynamicParameters();

            par.Add("@UserId", adminlog.UserId, DbType.Int64);
            par.Add("@Controllers", adminlog.Controllers, DbType.AnsiString);
            par.Add("@Action", adminlog.Action, DbType.AnsiString);
            par.Add("@Parameter", adminlog.Parameter, DbType.AnsiString);
            par.Add("@ActionId", adminlog.ActionId, DbType.AnsiString);
            par.Add("@Ip", adminlog.Ip, DbType.AnsiString);
            par.Add("@Url", adminlog.Url, DbType.AnsiString);
            par.Add("@InTime", adminlog.InTime, DbType.DateTime);
            par.Add("@Method", adminlog.Method, DbType.AnsiString);
            par.Add("@IsAjax", adminlog.IsAjax, DbType.Int32);
            par.Add("@UserAgent", adminlog.UserAgent, DbType.AnsiString);
            par.Add("@ControllersDsc", adminlog.ControllersDsc, DbType.String);
            par.Add("@ActionDsc", adminlog.ActionDsc, DbType.String);
            return(DapWrapper.InnerQueryScalarSql <int>(DbConfig.ArticleManagerConnString, sql, par));
        }
Example #3
0
        /// <summary>
        /// 修改AdminLogInfo
        /// </summary>
        /// <param name="adminlog"></param>
        /// <returns></returns>
        public static int UpdateAdminLog(AdminLogInfo adminlog)
        {
            string sql = @"UPDATE  [AdminLog] SET 
						UserId=@UserId,
						Controllers=@Controllers,
						Action=@Action,
						Parameter=@Parameter,
						ActionId=@ActionId,
						Ip=@Ip,
						Url=@Url,
						InTime=@InTime,
						Method=@Method,
						IsAjax=@IsAjax,
						UserAgent=@UserAgent,
						ControllersDsc=@ControllersDsc,
						ActionDsc=@ActionDsc
 WHERE Id=@Id";
            var    par = new DynamicParameters();

            par.Add("@Id", adminlog.Id, DbType.Int32);
            par.Add("@UserId", adminlog.UserId, DbType.Int64);
            par.Add("@Controllers", adminlog.Controllers, DbType.AnsiString);
            par.Add("@Action", adminlog.Action, DbType.AnsiString);
            par.Add("@Parameter", adminlog.Parameter, DbType.AnsiString);
            par.Add("@ActionId", adminlog.ActionId, DbType.AnsiString);
            par.Add("@Ip", adminlog.Ip, DbType.AnsiString);
            par.Add("@Url", adminlog.Url, DbType.AnsiString);
            par.Add("@InTime", adminlog.InTime, DbType.DateTime);
            par.Add("@Method", adminlog.Method, DbType.AnsiString);
            par.Add("@IsAjax", adminlog.IsAjax, DbType.Int32);
            par.Add("@UserAgent", adminlog.UserAgent, DbType.AnsiString);
            par.Add("@ControllersDsc", adminlog.ControllersDsc, DbType.String);
            par.Add("@ActionDsc", adminlog.ActionDsc, DbType.String);
            return(DapWrapper.InnerExecuteSql(DbConfig.ArticleManagerConnString, sql, par));
        }
Example #4
0
        public void Update(AdminLogInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"UPDATE AdminLog SET GroupId = @GroupId, Action = @Action, IP = @IP, AddDate = @AddDate, AdminId = @AdminId, AdminName = @AdminName
                            where Id=@Id";

                conn.Execute(sql, entity);
            }
        }
Example #5
0
        public int Add(AdminLogInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"INSERT INTO AdminLog( GroupId,Action,IP,AddDate,AdminId,AdminName) VALUES(@GroupId,@Action,@IP,@AddDate,@AdminId,@AdminName);
                            select SCOPE_IDENTITY()";

                return(conn.Query <int>(sql, entity).Single());
            }
        }
Example #6
0
 public void AddAdminLog(AdminLogInfo adminLog)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@groupID", SqlDbType.Int), new SqlParameter("@action", SqlDbType.NVarChar), new SqlParameter("@iP", SqlDbType.NVarChar), new SqlParameter("@addDate", SqlDbType.DateTime), new SqlParameter("@adminID", SqlDbType.Int), new SqlParameter("@adminName", SqlDbType.NVarChar) };
     pt[0].Value = adminLog.GroupID;
     pt[1].Value = adminLog.Action;
     pt[2].Value = adminLog.IP;
     pt[3].Value = adminLog.AddDate;
     pt[4].Value = adminLog.AdminID;
     pt[5].Value = adminLog.AdminName;
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "AddAdminLog", pt);
 }
Example #7
0
 public static void AddAdminLog(string action, string fileName)
 {
     if (action.IndexOf("$FileName") > -1)
     {
         action = action.Replace("$FileName", fileName);
     }
     AdminLogInfo adminLog = new AdminLogInfo();
     adminLog.Action = action;
     adminLog.AddDate = RequestHelper.DateNow;
     adminLog.IP = ClientHelper.IP;
     adminLog.AdminID = Cookies.Admin.GetAdminID(false);
     adminLog.AdminName = Cookies.Admin.GetAdminName(false);
     AddAdminLog(adminLog);
 }
Example #8
0
 public void PrepareAdminLogModel(SqlDataReader dr, List <AdminLogInfo> adminLogList)
 {
     while (dr.Read())
     {
         AdminLogInfo item = new AdminLogInfo();
         item.ID        = dr.GetInt32(0);
         item.GroupID   = dr.GetInt32(1);
         item.Action    = dr[2].ToString();
         item.IP        = dr[3].ToString();
         item.AddDate   = dr.GetDateTime(4);
         item.AdminID   = dr.GetInt32(5);
         item.AdminName = dr[6].ToString();
         adminLogList.Add(item);
     }
 }
Example #9
0
        public static void Add(string action, string tableName, string strId)
        {
            if (action.IndexOf("$TableName") > -1)
            {
                action = action.Replace("$TableName", tableName);
            }
            if (action.IndexOf("$ID") > -1)
            {
                action = action.Replace("$ID", strId);
            }
            AdminLogInfo AdminLog = new AdminLogInfo();

            AdminLog.Action    = action;
            AdminLog.AddDate   = RequestHelper.DateNow;
            AdminLog.IP        = ClientHelper.IP;
            AdminLog.AdminId   = Cookies.Admin.GetAdminID(false);
            AdminLog.AdminName = Cookies.Admin.GetAdminName(false);
            Add(AdminLog);
        }
Example #10
0
        public AdminLogInfo ReadAdminLog(int id, int adminID)
        {
            SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.NVarChar), new SqlParameter("@adminID", SqlDbType.Int) };
            pt[0].Value = id;
            pt[1].Value = adminID;
            AdminLogInfo info = new AdminLogInfo();

            using (SqlDataReader reader = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "ReadAdminLog", pt))
            {
                if (reader.Read())
                {
                    info.ID        = reader.GetInt32(0);
                    info.GroupID   = reader.GetInt32(1);
                    info.Action    = reader[2].ToString();
                    info.IP        = reader[3].ToString();
                    info.AddDate   = reader.GetDateTime(4);
                    info.AdminID   = reader.GetInt32(5);
                    info.AdminName = reader[6].ToString();
                }
            }
            return(info);
        }
Example #11
0
 /// <summary>
 /// DataModel 转 ViewModel
 /// </summary>
 /// <param name="adminlogInfo"></param>
 /// <returns></returns>
 public static AdminLogVModel AdminLogInfoToVModel(AdminLogInfo adminlogInfo)
 {
     if (adminlogInfo == null)
     {
         return(new AdminLogVModel());
     }
     return(new AdminLogVModel
     {
         Id = adminlogInfo.Id,
         UserId = adminlogInfo.UserId,
         Controllers = adminlogInfo.Controllers,
         Action = adminlogInfo.Action,
         Parameter = adminlogInfo.Parameter,
         ActionId = adminlogInfo.ActionId,
         Ip = adminlogInfo.Ip,
         Url = adminlogInfo.Url,
         InTime = adminlogInfo.InTime,
         Method = adminlogInfo.Method,
         IsAjax = adminlogInfo.IsAjax,
         UserAgent = adminlogInfo.UserAgent,
         ControllersDsc = adminlogInfo.ControllersDsc,
         ActionDsc = adminlogInfo.ActionDsc
     });
 }
Example #12
0
 public static void UpdateAdminLog(AdminLogInfo entity)
 {
     dal.Update(entity);
 }
Example #13
0
 private static void Add(AdminLogInfo entity)
 {
     dal.Add(entity);
 }
Example #14
0
 private static void AddAdminLog(AdminLogInfo adminLog)
 {
     dal.AddAdminLog(adminLog);
 }
Example #15
0
 /// <summary>
 /// 添加AdminLogInfo
 /// </summary>
 /// <param name="adminlog"></param>
 /// <returns></returns>
 public static async Task <int> AddAdminLog(AdminLogInfo adminlog)
 {
     return(await Task.Run(() => DataProvider.AdminLogs.AddAdminLog(adminlog)));
 }
Example #16
0
 public static void UpdateAdminLog(AdminLogInfo adminLog)
 {
     dal.UpdateAdminLog(adminLog);
 }
Example #17
0
 /// <summary>
 /// 修改AdminLogInfo
 /// </summary>
 /// <param name="adminlog"></param>
 /// <returns></returns>
 public static int UpdateAdminLog(AdminLogInfo adminlog)
 {
     return(DataProvider.AdminLogs.UpdateAdminLog(adminlog));
 }
Example #18
0
 /// <summary>
 /// 添加AdminLogInfo
 /// </summary>
 /// <param name="adminlog"></param>
 /// <returns></returns>
 public static int AddAdminLog(AdminLogInfo adminlog)
 {
     return(DataProvider.AdminLogs.AddAdminLog(adminlog));
 }