예제 #1
0
        /// <summary>
        /// 删除员工数据
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string DelEmployee(HttpContext context)
        {
            var employeeBll = new EmployerBll();
            var id          = context.Request.Params["id"];

            try
            {
                employeeBll.DelEmployee(id);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(e.Message);
            }
            //操作日志
            if (null == context.Session[Constant.LoginUser])
            {
                return("2");
            }
            var oprlog = new OprLog
            {
                Operator   = ((Employer)(context.Session[Constant.LoginUser])).Name,
                OperResult = "成功",
                OprSrc     = "删除人员",
                LogDate    = DateTime.Now
            };

            _oprLogBll.Add(oprlog);
            return("true");
        }
예제 #2
0
파일: DTUDal.cs 프로젝트: xywwf/chargepile
        /// <summary>
        /// 获取运行日志
        /// </summary>
        /// <param name="begintime"></param>
        /// <param name="endtime"></param>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <param name="total"></param>
        /// <returns></returns>
        public List <OprLog> GetWorkLogList(DateTime begintime, DateTime endtime, int page, int rows, ref int total)
        {
            List <OprLog> loglist = new List <OprLog>();
            DataTable     dt1     = GetWorkLog(begintime, endtime, page, rows);
            DataTable     dt2     = GetWorkLogTotal(begintime, endtime);

            total = dt2.Rows.Count;
            if (dt1.Rows.Count > 0)
            {
                for (int i = 0; i < dt1.Rows.Count; i++)
                {
                    OprLog  bean = new OprLog();
                    DataRow dr   = dt1.Rows[i];
                    bean.Id = dr["ID"].ToString();
                    if (dr["logdate"].ToString() != "")
                    {
                        bean.LogDate = DateTime.Parse(dr["logdate"].ToString());
                    }
                    bean.Worknum  = dr["worknum"].ToString();
                    bean.Operator = dr["operator"].ToString();
                    bean.OprSrc   = dr["oprsrc"].ToString();
                    loglist.Add(bean);
                }
            }
            return(loglist);
        }
 public int AnimationSave(HomePagePopupAnimation model)
 {
     if (model.MovementType == -1)
     {
         return(0);
     }
     else
     {
         HomePageConfigManager config = new HomePageConfigManager();
         if (string.IsNullOrWhiteSpace(model.Creator))
         {
             model.Creator = HttpContext.User.Identity.Name;
         }
         var addedId = config.AnimationSave(model);
         if (addedId > 0)
         {
             var oprLog = new OprLog
             {
                 ObjectID   = model.PopupConfigId,
                 ObjectType = "HPPopup",
                 AfterValue =
                     "新建的弹窗动画配置的pkid:" + addedId + ", 图片链接:" + model.ImageUrl + ", 动作类型:" +
                     model.MovementType + ", 跳转链接:" + model.LinkUrl,
                 Author    = HttpContext.User.Identity.Name,
                 Operation = "新建弹窗动画"
             };
             new OprLogManager().AddOprLog(oprLog);
         }
         return(addedId);
     }
 }
        public JsonResult AddOrUpdate(BannerConfig model)
        {
            if (!string.IsNullOrWhiteSpace(model.Image))
            {
                model.Image = model.Image.Replace(WebConfigurationManager.AppSettings["DoMain_image"], "");
            }
            if (!string.IsNullOrWhiteSpace(model.StartVersion))
            {
                model.StartVersion = model.StartVersion.Trim();
            }
            if (!string.IsNullOrWhiteSpace(model.EndVersion))
            {
                model.EndVersion = model.EndVersion.Trim();
            }
            if (string.IsNullOrWhiteSpace(model.Creator))
            {
                model.Creator = string.Empty;
            }

            if (model.Id < 0)
            {
                var result = DownloadAppManager.InsertBannerConfig(model);
                if (result > 0)
                {
                    var oprLog = new OprLog
                    {
                        ObjectID   = result,
                        ObjectType = "BannerConfig",
                        AfterValue =
                            "位置: " + model.Location + ", 平台:" + model.Channel + ", 状态:" + model.Status + ", 目标群体:" +
                            (string.IsNullOrWhiteSpace(model.TargetGroups) ? "" : model.TargetGroups),
                        Author    = HttpContext.User.Identity.Name,
                        Operation = "新建Banner配置"
                    };
                    new OprLogManager().AddOprLog(oprLog);
                }
                return(Json(result));
            }
            else
            {
                var result = DownloadAppManager.UpdateBannerConfig(model);
                if (result > 0)
                {
                    var oprLog = new OprLog
                    {
                        ObjectID   = model.Id,
                        ObjectType = "BannerConfig",
                        AfterValue =
                            "位置: " + model.Location + ", 平台:" + model.Channel + ", 状态:" + model.Status + ", 目标群体:" +
                            (string.IsNullOrWhiteSpace(model.TargetGroups) ? "" : model.TargetGroups),
                        Author    = HttpContext.User.Identity.Name,
                        Operation = "更新Banner配置"
                    };
                    new OprLogManager().AddOprLog(oprLog);
                }
                return(Json(result));
            }
        }
예제 #5
0
        public void AddOprLog(ActivityPageConfig model, string opr)
        {
            OprLog oprModel = new OprLog();

            oprModel.Author         = User.Identity.Name;
            oprModel.ChangeDatetime = DateTime.Now;
            oprModel.HostName       = Request.UserHostName;
            oprModel.ObjectID       = model.Id;
            oprModel.ObjectType     = "RAPC";
            oprModel.Operation      = opr;
            OprLogManager.AddOprLog(oprModel);
        }
        public void AddPustMessageOprLog(OrderSharedPushMessageConfig model, string opr)
        {
            OprLog oprModel = new OprLog();

            oprModel.Author         = User.Identity.Name;
            oprModel.ChangeDatetime = DateTime.Now;
            oprModel.HostName       = Request.UserHostName;
            oprModel.ObjectID       = model.Id;
            oprModel.ObjectType     = "SEOSPM";
            oprModel.Operation      = opr;
            OprLogManager.AddOprLog(oprModel);
        }
예제 #7
0
        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string DelDepartment(HttpContext context)
        {
            var departmentBll = new DepartmentBLL();
            var employeeBll   = new EmployerBll();
            var id            = context.Request.Params["id"];
            var name          = context.Request.Params["name"];
            var employee      = new Employer
            {
                DeptId = id,
                Name   = name
            };

            try
            {
                var bdata = employeeBll.Exist(employee);

                switch (bdata)
                {
                case "1":
                    return("exist");

                case "0":
                    var bdata2 = departmentBll.Exist3(id);
                    switch (bdata2)
                    {
                    case "1":
                        return("exist2");
                    }
                    departmentBll.DelDepartment(id);
                    break;
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
                return("false");
            }
            //操作日志
            if (null == context.Session[Constant.LoginUser])
            {
                return("2");
            }
            var oprlog = new OprLog
            {
                Operator   = ((Employer)(context.Session[Constant.LoginUser])).Name,
                OperResult = "成功",
                OprSrc     = "删除部门",
                LogDate    = DateTime.Now
            };

            _oprLogBll.Add(oprlog);
            return("true");
        }
예제 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public StringBuilder DelRole(HttpContext context)
        {
            var menuPowerBll   = new MenuPowerBll();
            var roleBll        = new RoleBll();
            var userrolebll    = new UseRolesBll();
            var messageRespose = new MessageRespose();
            var sb             = new StringBuilder();
            var roleId         = context.Request.Params["nodeid"];
            var role           = new Role
            {
                RoleId = roleId
            };
            var userrole = new UseRoles
            {
                RoleId = roleId
            };
            var menuPowerDel = new MenuPower
            {
                PowerId = roleId
            };

            try
            {
                if (roleId == "role_admin")
                {
                    return(sb.Append(messageRespose.Success = "3"));
                }
                //联动删除
                roleBll.Del(role);
                userrolebll.Del2(userrole);
                menuPowerBll.Del(menuPowerDel);
                //操作日志
                if (null == context.Session[Constant.LoginUser])
                {
                    return(sb.Append(messageRespose.Success = "2"));
                }
                var oprlog = new OprLog
                {
                    Operator   = ((Employer)(context.Session[Constant.LoginUser])).Name,
                    OperResult = "成功",
                    OprSrc     = "删除角色",
                    LogDate    = DateTime.Now
                };
                _oprLogBll.Add(oprlog);
                return(sb.Append(messageRespose.Success = "删除成功!"));
            }
            catch (Exception e)
            {
                Log.Error("保存角色出错", e);
                throw;
            }
        }
예제 #9
0
        public void Add(string objType, int objId, string beforeValue, string afterValue, string operation)
        {
            var oprLog = new OprLog();

            oprLog.ObjectType  = objType;
            oprLog.ObjectID    = objId;
            oprLog.BeforeValue = beforeValue;
            oprLog.AfterValue  = afterValue;
            oprLog.Operation   = operation;
            oprLog.Author      = ThreadIdentity.Operator.Name;
            oprLog.IPAddress   = ThreadIdentity.Operator.IPAddress;

            Add(oprLog);
        }
예제 #10
0
        public void AddWarnOprLog(string ValueJson, string ObjectType, string Operation, string afterValue = null)
        {
            var oprLog = new OprLog
            {
                Author         = ThreadIdentity.Operator.Name,
                ChangeDatetime = DateTime.Now,
                BeforeValue    = ValueJson,
                AfterValue     = afterValue,
                ObjectType     = ObjectType,
                Operation      = Operation
            };

            new OprLogManager().AddOprLog(oprLog);
        }
예제 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public StringBuilder SaveMenuRole(HttpContext context)
        {
            var menuPowerBll   = new MenuPowerBll {
            };
            var messageRespose = new MessageRespose();
            var sb             = new StringBuilder();
            var roleid         = context.Request.Params["roleid"];
            var menuid         = context.Request.Params["menuid"].Split(',');
            var menuPowerDel   = new MenuPower
            {
                PowerId = roleid
            };

            menuPowerBll.Del(menuPowerDel);
            foreach (var s in menuid)
            {
                try
                {
                    var id        = Guid.NewGuid().ToString();
                    var menuPower = new MenuPower
                    {
                        Id      = id,
                        MenuId  = s,
                        PowerId = roleid
                    };
                    menuPowerBll.Add(menuPower);
                }
                catch (Exception e)
                {
                    Log.Error("保存菜单角色出错", e);
                    throw;
                }
            }
            //操作日志
            if (null == context.Session[Constant.LoginUser])
            {
                return(sb.Append(messageRespose.Success = "2"));
            }
            var oprlog = new OprLog
            {
                Operator   = ((Employer)(context.Session[Constant.LoginUser])).Name,
                OperResult = "成功",
                OprSrc     = "保存菜单角色",
                LogDate    = DateTime.Now
            };

            _oprLogBll.Add(oprlog);
            return(sb.Append(messageRespose.Success = "保存成功!"));
        }
예제 #12
0
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public int DelRole(int roleId)
        {
            var delResult = dbManager.Execute(conn => new DalPower().DelRole(conn, roleId));

            var oprLog = new OprLog();

            oprLog.Author         = ThreadIdentity.Operator.Name;
            oprLog.ChangeDatetime = DateTime.Now;
            oprLog.ObjectID       = roleId;
            oprLog.ObjectType     = "ROLE";
            oprLog.Operation      = "DelRole";
            new OprLogManager().AddOprLog(oprLog);

            return(delResult);
        }
예제 #13
0
        public void AddOprLog(int id, string after, string before, string type, string opr)
        {
            OprLogManager OprLogManager = new OprLogManager();
            OprLog        oprModel      = new OprLog();

            oprModel.AfterValue     = after;
            oprModel.BeforeValue    = before;
            oprModel.Author         = User.Identity.Name;
            oprModel.ChangeDatetime = DateTime.Now;
            oprModel.HostName       = Request.UserHostName;
            oprModel.ObjectID       = id;
            oprModel.ObjectType     = type;
            oprModel.Operation      = opr;
            OprLogManager.AddOprLog(oprModel);
        }
예제 #14
0
        public void AddOprLog <T>(string objType, int objId, string operation, T beforeValue, T afterValue)
            where T : class
        {
            ParameterChecker.CheckNullOrEmpty(objType, "objType");
            ParameterChecker.CheckNullOrEmpty(operation, "operation");

            var oprLog = new OprLog();

            oprLog.ObjectType     = objType;
            oprLog.ObjectID       = objId;
            oprLog.ChangeDatetime = DateTime.Now;
            oprLog.Operation      = operation;
            oprLog.Author         = ThreadIdentity.Operator.Name;
            oprLog.IPAddress      = ThreadIdentity.Operator.IPAddress;

            if (typeof(T) == typeof(string))
            {
                oprLog.BeforeValue = (string)(object)beforeValue;
                oprLog.AfterValue  = (string)(object)afterValue;
            }
            else
            {
                if (beforeValue != null)
                {
                    var valueBuilder = new StringBuilder();
                    foreach (var property in typeof(T).GetProperties())
                    {
                        var value = property.GetValue(beforeValue, null);
                        valueBuilder.AppendFormat("{0} = {1}", property.Name, value ?? "NULL").AppendLine();
                    }
                    oprLog.BeforeValue = valueBuilder.ToString();
                }
                if (afterValue != null)
                {
                    var valueBuilder = new StringBuilder();
                    foreach (var property in typeof(T).GetProperties())
                    {
                        var value = property.GetValue(afterValue, null);
                        valueBuilder.AppendFormat("{0} = {1}", property.Name, value ?? "NULL").AppendLine();
                    }
                    oprLog.AfterValue = valueBuilder.ToString();
                }
            }

            //dbManager.Execute(connection => DalOprLog.AddOprLog(connection, oprLog));

            Add(oprLog);
        }
예제 #15
0
        public static void AddOprLog(SqlTransaction tran, OprLog oprLog)
        {
            var parameters = new[]
            {
                new SqlParameter("@Author", oprLog.Author ?? string.Empty),
                new SqlParameter("@ObjectType", oprLog.ObjectType ?? string.Empty),
                new SqlParameter("@ObjectId", oprLog.ObjectID),
                new SqlParameter("@BeforeValue", oprLog.BeforeValue ?? string.Empty),
                new SqlParameter("@AfterValue", oprLog.AfterValue ?? string.Empty),
                new SqlParameter("@ChangeDatetime", oprLog.ChangeDatetime ?? DateTime.Now),
                new SqlParameter("@IpAddress", oprLog.IPAddress ?? string.Empty),
                new SqlParameter("@HostName", oprLog.HostName ?? string.Empty),
                new SqlParameter("@Operation", oprLog.Operation ?? string.Empty)
            };

            SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, "procOprLogInsert", parameters);
        }
예제 #16
0
        public JsonResult Delete(int id)
        {
            bool result = DownloadAppManager.DeleteFriendLink(id);

            if (result)
            {
                var oprLog = new OprLog
                {
                    ObjectID   = id,
                    ObjectType = "Friendlink",
                    AfterValue = "id是" + id + "的友链被删除",
                    Author     = HttpContext.User.Identity.Name,
                    Operation  = "删除友情链接"
                };
                new OprLogManager().AddOprLog(oprLog);
            }
            return(Json(result));
        }
예제 #17
0
        public void AddOprLogAsync(OprLog oprLog)
        {
            try
            {
                this.handler.AddAsync(oprLog);
            }
            catch (TuhuBizException)
            {
                throw;
            }
            catch (Exception innerEx)
            {
                var exception = new OprLogException(BizErrorCode.SystemError, "添加操作日志出错", innerEx);
                logger.Log(Level.Error, exception, "Error occurred in adding opr log.");

                throw exception;
            }
        }
예제 #18
0
        public JsonResult Insert(FriendLink model)
        {
            int result = DownloadAppManager.InsertFriendLink(model);

            if (result > 0)
            {
                var oprLog = new OprLog
                {
                    ObjectID   = result,
                    ObjectType = "Friendlink",
                    AfterValue = model.FriendLinkName + ", " + model.Link,
                    Author     = HttpContext.User.Identity.Name,
                    Operation  = "插入友情链接"
                };
                new OprLogManager().AddOprLog(oprLog);
            }
            return(Json(result));
        }
예제 #19
0
        public JsonResult Update(FriendLink model)
        {
            bool result = DownloadAppManager.UpdateFriendLink(model);

            if (result)
            {
                var oprLog = new OprLog
                {
                    ObjectID   = model.Fid,
                    ObjectType = "Friendlink",
                    AfterValue = model.FriendLinkName + ", " + model.Link,
                    Author     = HttpContext.User.Identity.Name,
                    Operation  = "更改友情链接"
                };
                new OprLogManager().AddOprLog(oprLog);
            }
            return(Json(result));
        }
예제 #20
0
        /// <summary>
        /// 修改部门
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string EditDepartment(HttpContext context)
        {
            var departmentBll = new DepartmentBLL();
            var depid         = context.Request.Params["depid"];
            var depname       = context.Request.Params["depName"];
            var parId         = context.Request.Params["pId"];
            var department    = new Department {
                Id = depid, Name = depname, ParentDept = parId
            };

            try
            {
                var bdata = departmentBll.Exist2(department);
                switch (bdata)
                {
                case "1":
                    return("exist");

                case "0":
                    departmentBll.UpdateDepartment(department);
                    break;
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
                return("false");
            }
            //操作日志
            if (null == context.Session[Constant.LoginUser])
            {
                return("2");
            }
            var oprlog = new OprLog
            {
                Operator   = ((Employer)(context.Session[Constant.LoginUser])).Name,
                OperResult = "成功",
                OprSrc     = "编辑部门",
                LogDate    = DateTime.Now
            };

            _oprLogBll.Add(oprlog);
            return("true");
        }
예제 #21
0
        public void Add(OprLog oprLog)
        {
            ParameterChecker.CheckNull(oprLog, "oprLog");

            if (string.IsNullOrEmpty(oprLog.Author))
            {
                oprLog.Author = ThreadIdentity.Operator.Name;
            }
            if (string.IsNullOrEmpty(oprLog.IPAddress))
            {
                oprLog.IPAddress = ThreadIdentity.Operator.IPAddress;
            }

            OprLogModel opl = new OprLogModel();

            opl.ObjectId       = oprLog.ObjectID;
            opl.ObjectType     = oprLog.ObjectType;
            opl.Operation      = oprLog.Operation;
            opl.Author         = oprLog.Author;
            opl.BeforeValue    = oprLog.BeforeValue;
            opl.AfterValue     = oprLog.AfterValue;
            opl.HostName       = oprLog.HostName;
            opl.IpAddress      = oprLog.IPAddress;
            opl.ChangeDatetime = DateTime.Now;

            try
            {
                using (var client = new OprLogClient())
                {
                    var result2 = client.AddOprLog(opl);

                    bool EnablePower = false;
                    if (bool.TryParse(WebConfigurationManager.AppSettings["EnablePower"], out EnablePower) && EnablePower)
                    {
                        result2.ThrowIfException(true);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(Level.Error, ex, "AddOprLog");
                throw ex;
            }
        }
        public int AnimationDelete(int PKID, int configId)
        {
            HomePageConfigManager obj = new HomePageConfigManager();
            var affectedRows          = obj.AnimationDelete(PKID);

            if (affectedRows > 0)
            {
                var oprLog = new OprLog
                {
                    ObjectID    = configId,
                    ObjectType  = "HPPopup",
                    Author      = HttpContext.User.Identity.Name,
                    BeforeValue = "删除的弹窗动画配置的pkid:" + PKID,
                    Operation   = "删除弹窗动画"
                };
                new OprLogManager().AddOprLog(oprLog);
            }
            return(affectedRows);
        }
        public JsonResult DeleteCouponInPopup(int PKId, int animationId)
        {
            HomePageConfigManager config = new HomePageConfigManager();
            var affectedRows             = config.DeleteCouponInPopup(PKId);

            if (affectedRows > 0)
            {
                var oprLog = new OprLog
                {
                    ObjectID    = PKId,
                    ObjectType  = "CouponsInPopup",
                    Author      = HttpContext.User.Identity.Name,
                    BeforeValue = "删除的优惠券对应的弹窗动画Id:" + animationId,
                    Operation   = "更新弹窗中可领优惠券"
                };
                new OprLogManager().AddOprLog(oprLog);
            }
            return(Json(affectedRows));
        }
        public ActionResult DeleteBannerConfig(int Id)
        {
            var deleteResult = DownloadAppManager.DeleteBannerConfig(Id);

            if (!deleteResult)
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }

            var oprLog = new OprLog
            {
                ObjectID   = Id,
                ObjectType = "BannerConfig",
                Author     = HttpContext.User.Identity.Name,
                Operation  = "删除Banner配置"
            };

            new OprLogManager().AddOprLog(oprLog);
            return(Json(1, JsonRequestBehavior.AllowGet));
        }
예제 #25
0
        /// <summary>
        /// 记录操作日志
        /// </summary>
        /// <param name="author">操作人</param>
        /// <param name="objectType">类型  WebAct网站活动</param>
        /// <param name="objectID">活动ID</param>
        /// <param name="operation">操作名称</param>
        /// <returns></returns>
        public static bool InsertOplog(string author, string objectType, int objectID, string operation)
        {
            OprLogManager oprLog = new OprLogManager();
            OprLog        model  = new OprLog();

            model.Author     = author;
            model.ObjectID   = objectID;
            model.ObjectType = objectType;
            model.Operation  = operation;
            //int i =  DALLogger.InsertOprLog(objectType, objectID, operation, author);
            try
            {
                oprLog.AddOprLog(model);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #26
0
        private void WriteLog()
        {
            OprLog opLog = new OprLog();

            for (int i = 0; i < comboBox.SelectedIndex + 1; i++)
            {
                opLog.Sn         = "sn_" + i;
                opLog.Type       = i;
                opLog.Source     = i + 2;
                opLog.Updatetime = DateTime.UtcNow.AddHours(i);
                opLog.Content    = "content" + i;
                opLog.Condition  = "condition" + i;
                if (!_accessor.InsertOprLog(opLog))
                {
                    toolStripStatusLabel1.Text = "填写日志失败";
                    return;
                }
            }
            toolStripStatusLabel1.Text = "填写日志成功";
        }
        public JsonResult AddOrUpdateCoupon(CouponsInPopup model)
        {
            HomePageConfigManager config = new HomePageConfigManager();

            if (model.PKId < 0)
            {
                var result = config.InsertCouponInPopup(model);
                if (result > 0)
                {
                    var oprLog = new OprLog
                    {
                        ObjectID   = result,
                        ObjectType = "CouponsInPopup",
                        AfterValue =
                            "对应的弹窗动画Id: " + model.PopupAnimationId + ", 优惠券ID或GUID:" + model.CouponId,
                        Author    = HttpContext.User.Identity.Name,
                        Operation = "新建弹窗中可领优惠券"
                    };
                    new OprLogManager().AddOprLog(oprLog);
                }
                return(Json(result));
            }
            else
            {
                var result = config.UpdateCouponInPopup(model);
                if (result > 0)
                {
                    var oprLog = new OprLog
                    {
                        ObjectID   = model.PKId,
                        ObjectType = "CouponsInPopup",
                        AfterValue =
                            "对应的弹窗动画Id: " + model.PopupAnimationId + ", 优惠券ID或GUID:" + model.CouponId,
                        Author    = HttpContext.User.Identity.Name,
                        Operation = "更新弹窗中可领优惠券"
                    };
                    new OprLogManager().AddOprLog(oprLog);
                }
                return(Json(result));
            }
        }
예제 #28
0
        public string SaveChargPrice(HttpContext context)
        {
            var chargpricebll = new ChargPriceBll();
            var id            = context.Request.Params["id"];
            var beforePrice   = context.Request.Params["before_price"];
            var afterPrice    = context.Request.Params["after_price"];
            var rowname       = context.Request.Params["rowname"];
            var chargprice    = new ChargPrice
            {
                Id       = id,
                Price    = decimal.Parse(afterPrice) * 100,
                UpdateDT = DateTime.Now
            };

            try
            {
                chargpricebll.Modify(chargprice);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return("{\"status\":false}");;
            }

            //操作日志
            if (null == context.Session[Constant.LoginUser])
            {
                return("{\"total\":0,\"rows\":[],\"status\":\"2\",\"msg\":\"修改成功!\"}");
            }
            var oprlog = new OprLog
            {
                Operator   = ((Employer)(context.Session[Constant.LoginUser])).Name,
                OperResult = "成功",
                OprSrc     = rowname + "修改前价格:" + beforePrice +
                             "元," + rowname + "修改后价格:" + afterPrice + "元",
                LogDate = DateTime.Now
            };

            _oprLogBll.Add(oprlog);
            return("{\"status\":true}");
        }
        public bool AnimationUpdate(HomePagePopupAnimation model)
        {
            HomePageConfigManager config = new HomePageConfigManager();
            var hasUpdateSucceeded       = config.AnimationUpdate(model);

            if (hasUpdateSucceeded)
            {
                var oprLog = new OprLog
                {
                    ObjectID   = model.PopupConfigId,
                    ObjectType = "HPPopup",
                    AfterValue =
                        "更新的弹窗动画配置的pkid:" + model.PKId + ", 图片链接:" + model.ImageUrl + ", 动作类型:" +
                        model.MovementType + ", 跳转链接:" + model.LinkUrl,
                    Author    = HttpContext.User.Identity.Name,
                    Operation = "更新弹窗动画"
                };
                new OprLogManager().AddOprLog(oprLog);
            }
            return(hasUpdateSucceeded);
        }
예제 #30
0
        /// <summary>
        /// 添加序列化好的oprlog
        /// </summary>
        /// <param name="objType"></param>
        /// <param name="objID"></param>
        /// <param name="otype"></param>
        /// <param name="operation"></param>
        /// <param name="beforeValue"></param>
        /// <param name="afterValue"></param>
        //public static void AddSerializerOprLog(SqlConnection connection, string objType, int objID, Type otype, string operation, object beforeValue = null, object afterValue = null)
        //{
        //    var oprLog = new OprLog();
        //    oprLog.Author = ThreadIdentity.Operator.Name;

        //    DataContractSerializer dcs = new DataContractSerializer(otype);
        //    if (beforeValue != null)
        //    {
        //        if (beforeValue is string)
        //        {
        //            oprLog.BeforeValue = beforeValue.ToString();
        //        }
        //        else
        //        {
        //            StringBuilder builder = new StringBuilder();
        //            foreach (var property in beforeValue.GetType().GetProperties())
        //            {
        //                object value = property.GetValue(beforeValue, null);
        //                if (value != null)
        //                {
        //                    builder.Append(property.Name)
        //                    .Append(" = ")
        //                    .Append((value ?? "null"))
        //                    .AppendLine();
        //                }
        //            }
        //            oprLog.BeforeValue = builder.ToString();
        //        }
        //    }
        //    if (afterValue != null)
        //    {
        //        if (afterValue is string)
        //        {
        //            oprLog.AfterValue = afterValue.ToString();
        //        }
        //        else
        //        {
        //            StringBuilder builder = new StringBuilder();

        //            foreach (var property in afterValue.GetType().GetProperties())
        //            {

        //                object value = property.GetValue(afterValue, null);
        //                if (value != null)
        //                {
        //                    builder.Append(property.Name)
        //                    .Append(" = ")
        //                    .Append((value ?? "null"))
        //                    .AppendLine();
        //                }
        //            }
        //            oprLog.AfterValue = builder.ToString();
        //        }
        //    }

        //    oprLog.ChangeDatetime = DateTime.Now;
        //    oprLog.ObjectID = objID;
        //    oprLog.ObjectType = objType;
        //    oprLog.Operation = operation;
        //    AddOprLog(connection, oprLog);
        //}
        #region private method
        private static OprLog ReadData(SqlDataReader reader)
        {
            //O.[PKID],O.[Author],O.[ObjectType],O.[ObjectID],O.[BeforeValue],O.[AfterValue],
            //O.[ChangeDatetime],O.[IPAddress],O.[HostName],O.[Operation],H.EmployeeName
            OprLog log = new OprLog()
            {
                PKID           = reader.GetInt32(0),
                Author         = reader.IsDBNull(1) ? string.Empty : reader.GetString(1),
                ObjectType     = reader.IsDBNull(2) ? string.Empty : reader.GetString(2),
                ObjectID       = reader.IsDBNull(3) ? 0 : reader.GetInt32(3),
                BeforeValue    = reader.IsDBNull(4) ? string.Empty : reader.GetString(4),
                AfterValue     = reader.IsDBNull(5) ? string.Empty : reader.GetString(5),
                ChangeDatetime = reader.IsDBNull(6) ? null : (DateTime?)reader.GetDateTime(6),
                IPAddress      = reader.IsDBNull(7) ? string.Empty : reader.GetString(7),
                HostName       = reader.IsDBNull(8) ? string.Empty : reader.GetString(8),
                Operation      = reader.IsDBNull(9) ? string.Empty : reader.GetString(9),
                EmployeeName   = reader.IsDBNull(10) ? string.Empty : reader.GetString(10),
            };

            return(log);
        }