コード例 #1
0
        public WfClientUserOperationLog ServerToClient(UserOperationLog server, ref WfClientUserOperationLog client)
        {
            server.NullCheck("server");

            if (client == null)
            {
                client = new WfClientUserOperationLog();
            }

            client.ID                   = server.ID;
            client.Subject              = server.Subject;
            client.ResourceID           = server.ResourceID;
            client.ApplicationName      = server.ApplicationName;
            client.ProgramName          = server.ProgramName;
            client.ProcessID            = server.ProcessID;
            client.ActivityID           = server.ActivityID;
            client.ActivityName         = server.ActivityName;
            client.OperationName        = server.OperationName;
            client.OperationType        = server.OperationType.ToClientOperationType();
            client.OperationDescription = server.OperationDescription;
            client.OperationDateTime    = server.OperationDateTime;
            client.Operator             = (WfClientUser)server.Operator.ToClientOguObject();
            client.RealUser             = (WfClientUser)server.RealUser.ToClientOguObject();
            client.TopDepartment        = (WfClientOrganization)server.TopDepartment.ToClientOguObject();
            client.HttpContextString    = server.HttpContextString;
            client.CorrelationID        = server.CorrelationID;

            return(client);
        }
コード例 #2
0
        public UserOperationLog ClientToServer(WfClientUserOperationLog client, ref UserOperationLog server)
        {
            client.NullCheck("client");

            if (server == null)
                server = new UserOperationLog();

            server.ID = client.ID;
            server.Subject = client.Subject;
            server.ResourceID = client.ResourceID;
            server.ApplicationName = client.ApplicationName;
            server.ProgramName = client.ProgramName;
            server.ProcessID = client.ProcessID;
            server.ActivityID = client.ActivityID;
            server.ActivityName = client.ActivityName;
            server.OperationName = client.OperationName;
            server.OperationType = client.OperationType.ToOperationType();
            server.OperationDescription = client.OperationDescription;
            server.OperationDateTime = client.OperationDateTime;
            server.Operator = (IUser)client.Operator.ToOguObject();
            server.RealUser = (IUser)client.RealUser.ToOguObject();
            server.TopDepartment = (IOrganization)client.TopDepartment.ToOguObject();

            return server;
        }
コード例 #3
0
        protected override void OnPrepareUserOperationLog(WfExecutorDataContext dataContext)
        {
            if (OperatorActivity != null)
            {
                UserOperationLog log = UserOperationLog.FromActivity(OperatorActivity);

                log.OperationType = DataObjects.OperationType.Update;
                log.OperationName = EnumItemDescriptionAttribute.GetDescription(this.OperationType);

                dataContext.OperationLogs.Add(log);
            }

            FirePrepareUserOperationLog(dataContext, dataContext.OperationLogs);

            foreach (UserOperationLog log in dataContext.OperationLogs)
            {
                if (log.RealUser != null && string.IsNullOrEmpty(log.OperationDescription))
                {
                    string originalUserName = UsersToString(this.OriginalAssignees);

                    log.OperationDescription = string.Format("{0}:{1}->{2}>>'{3}' {4:yyyy-MM-dd HH:mm:ss}",
                                                             log.OperationName, log.RealUser.DisplayName, originalUserName, this.TargetAssigneesToString(), SNTPClient.AdjustedTime);
                }
            }
        }
コード例 #4
0
        public UserOperationLog ClientToServer(WfClientUserOperationLog client, ref UserOperationLog server)
        {
            client.NullCheck("client");

            if (server == null)
            {
                server = new UserOperationLog();
            }

            server.ID                   = client.ID;
            server.Subject              = client.Subject;
            server.ResourceID           = client.ResourceID;
            server.ApplicationName      = client.ApplicationName;
            server.ProgramName          = client.ProgramName;
            server.ProcessID            = client.ProcessID;
            server.ActivityID           = client.ActivityID;
            server.ActivityName         = client.ActivityName;
            server.OperationName        = client.OperationName;
            server.OperationType        = client.OperationType.ToOperationType();
            server.OperationDescription = client.OperationDescription;
            server.OperationDateTime    = client.OperationDateTime;
            server.Operator             = (IUser)client.Operator.ToOguObject();
            server.RealUser             = (IUser)client.RealUser.ToOguObject();
            server.TopDepartment        = (IOrganization)client.TopDepartment.ToOguObject();

            return(server);
        }
コード例 #5
0
        public void BasicEditActivityExecutorTest()
        {
            IWfProcess process = WfProcessTestCommon.StartupSimpleProcess();

            IWfActivity targetActivity = process.Activities.FindActivityByDescriptorKey("NormalActivity");

            const string targetName = "修改后的名称";

            targetActivity.Descriptor.Properties.SetValue("Name", targetName);

            WfEditActivityPropertiesExecutor executor = new WfEditActivityPropertiesExecutor(process.CurrentActivity, process, targetActivity.Descriptor, false);

            executor.Execute();

            process = WfRuntime.GetProcessByProcessID(process.ID);

            targetActivity = process.Activities.FindActivityByDescriptorKey("NormalActivity");

            Assert.AreEqual(targetName, targetActivity.Descriptor.Properties.GetValue("Name", string.Empty));

            UserOperationLog log = UserOperationLogAdapter.Instance.Load(builder => builder.AppendItem("ACTIVITY_ID", process.CurrentActivity.ID)).FirstOrDefault();

            Assert.IsNotNull(log);
            Console.WriteLine("{0}: {1}", log.OperationName, log.Subject);
        }
コード例 #6
0
        public WfClientUserOperationLog ServerToClient(UserOperationLog server, ref WfClientUserOperationLog client)
        {
            server.NullCheck("server");

            if (client == null)
                client = new WfClientUserOperationLog();

            client.ID = server.ID;
            client.Subject = server.Subject;
            client.ResourceID = server.ResourceID;
            client.ApplicationName = server.ApplicationName;
            client.ProgramName = server.ProgramName;
            client.ProcessID = server.ProcessID;
            client.ActivityID = server.ActivityID;
            client.ActivityName = server.ActivityName;
            client.OperationName = server.OperationName;
            client.OperationType = server.OperationType.ToClientOperationType();
            client.OperationDescription = server.OperationDescription;
            client.OperationDateTime = server.OperationDateTime;
            client.Operator = (WfClientUser)server.Operator.ToClientOguObject();
            client.RealUser = (WfClientUser)server.RealUser.ToClientOguObject();
            client.TopDepartment = (WfClientOrganization)server.TopDepartment.ToClientOguObject();
            client.HttpContextString = server.HttpContextString;
            client.CorrelationID = server.CorrelationID;

            return client;
        }
コード例 #7
0
        private void saveWfProcess(IWfProcessDescriptor wfProcess)
        {
            try
            {
                using (TransactionScope scope = TransactionScopeFactory.Create())
                {
                    var pManager = WorkflowSettings.GetConfig().GetDescriptorManager();
                    pManager.SaveDescriptor(wfProcess);

                    //change import time
                    WfProcessDescriptorInfoAdapter.Instance.UpdateImportTime(wfProcess.Key, DeluxeIdentity.CurrentUser);

                    //write log
                    UserOperationLog log = new UserOperationLog()
                    {
                        ResourceID           = wfProcess.Key,
                        Operator             = DeluxeIdentity.CurrentUser,
                        OperationDateTime    = DateTime.Now,
                        Subject              = "导入流程模板",
                        OperationName        = "导入",
                        OperationDescription = "导入流程模板"
                    };
                    UserOperationLogAdapter.Instance.Update(log);

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        private void StartJob(JobBase job)
        {
            try
            {
                JobBase detailJobInfo = LoadDetailJobInfo(job.JobID, job.JobType);
                detailJobInfo.Start();
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception ex)
            {
                WriteJobException(job, this.Params.Log, "执行", ex);
            }
            finally
            {
                job.SetCurrentJobEndStatus();
                string logDetail = string.Format("定时任务[{0},{1}]在[{2}]时执行]", job.Name,
                                                 job.JobType.ToString(), DateTime.Now.ToString());

                UserOperationLog log = new UserOperationLog()
                {
                    ResourceID           = job.JobID,
                    OperationDateTime    = DateTime.Now,
                    Subject              = "定时任务执行",
                    OperationName        = job.Name,
                    OperationDescription = logDetail
                };
                UserOperationLogAdapter.Instance.Update(log);
            }
        }
コード例 #9
0
		private void StartJob(JobBase job)
		{
			try
			{
				JobBase detailJobInfo = LoadDetailJobInfo(job.JobID, job.JobType);
				detailJobInfo.Start();
			}
			catch (ThreadAbortException)
			{
			}
			catch (Exception ex)
			{
				WriteJobException(job, this.Params.Log, "执行", ex);
			}
			finally
			{
				job.SetCurrentJobEndStatus();
				string logDetail = string.Format("定时任务[{0},{1}]在[{2}]时执行]", job.Name,
					job.JobType.ToString(), DateTime.Now.ToString());

				UserOperationLog log = new UserOperationLog()
				{
					ResourceID = job.JobID,
					OperationDateTime = DateTime.Now,
					Subject = "定时任务执行",
					OperationName = job.Name,
					OperationDescription = logDetail
				};
				UserOperationLogAdapter.Instance.Update(log);
			}
		}
コード例 #10
0
		private void saveWfProcess(IWfProcessDescriptor wfProcess)
		{
			try
			{
				using (TransactionScope scope = TransactionScopeFactory.Create())
				{
					var pManager = WorkflowSettings.GetConfig().GetDescriptorManager();
					pManager.SaveDescriptor(wfProcess);

					//change import time
                    WfProcessDescriptorInfoAdapter.Instance.UpdateImportTime(wfProcess.Key, DeluxeIdentity.CurrentUser);

					//write log
					UserOperationLog log = new UserOperationLog()
					{
						ResourceID = wfProcess.Key,
						Operator = DeluxeIdentity.CurrentUser,
						OperationDateTime = DateTime.Now,
						Subject = "导入流程模板",
						OperationName = "导入",
						OperationDescription = "导入流程模板"
					};
					UserOperationLogAdapter.Instance.Update(log);

					scope.Complete();
				}
			}
			catch (Exception ex)
			{
				throw ex;
			}

		}
コード例 #11
0
        private UserOperationLog CreateImportLog(IWfProcessDescriptor processDesp)
        {
            UserOperationLog log = new UserOperationLog();

            log.ResourceID = processDesp.Key;
            log.Subject    = string.Format("{0}:{1}", this.OperationType.ToDescription(), processDesp.Key);

            return(log);
        }
コード例 #12
0
ファイル: DataHelper.cs プロジェクト: a6361117/HuaweiAMS
        public static UserOperationLog PrepareUserOperationLog(string resourceID)
        {
            UserOperationLog log = new UserOperationLog();

            log.ResourceID = resourceID;
            log.Subject    = "测试日志";

            return(log);
        }
コード例 #13
0
        private UserOperationLog CreateImportLog(IWfProcessDescriptor processDesp)
        {
            UserOperationLog log = new UserOperationLog();

            log.ResourceID = processDesp.Key;
            log.Subject = string.Format("{0}:{1}", this.OperationType.ToDescription(), processDesp.Key);

            return log;
        }
コード例 #14
0
ファイル: DataHelper.cs プロジェクト: zhshen/HuaweiAMS
        public static UserOperationLog PrepareUserOperationLog(string resourceID)
        {
            UserOperationLog log = new UserOperationLog();

            log.ResourceID = resourceID;
            log.Subject = "测试日志";

            return log;
        }
コード例 #15
0
        public WfClientUserOperationLog GetUserOperationLogByID(long logID)
        {
            UserOperationLog server = UserOperationLogAdapter.Instance.Load(logID);

            WfClientUserOperationLog client = null;

            WfClientUserOperationLogConverter.Instance.ServerToClient(server, ref client);

            return(client);
        }
コード例 #16
0
        protected override void PrepareOperationLog(AMSOperationContext context)
        {
            UserOperationLog log = new UserOperationLog();

            log.Subject = this.GetOperationDescription();
            log.ResourceID = this.EventID.ToString();

            log.FillHttpContext();

            context.Logs.Add(log);
        }
コード例 #17
0
        /// Duran 當初alan設計的架構是多一層,避免core被綁死,但起專案沒有比較快,需要起專案會有兩個方法:
        /// 1. 用原架構起,但與資料庫資料庫綁死,那不如寫死在這邊。
        /// 2. 不同的資料庫結構,這段一樣要重寫,加入不同資料庫後,在重新匯入改model,步驟繁瑣
        /// 目前直接綁資料庫與model,之後起下一個專案方便。
        /// TODO: 需要重購:將data access層抽出重寫?會自動產生資料庫架構?(需要在規劃與思考)。

        /// <summary>
        /// 傳入parse出來的ResourceOperation,方便在做處理
        /// 應該是用來記錄操作紀錄用的
        /// </summary>
        /// <param name="resourceOpertation">傳入的ResourceOperation</param>
        /// <param name="httpContext">The HTTP context.</param>
        protected virtual void ProcessResourceOperation(ResourceOperation resourceOpertation, HttpContextBase httpContext)
        {
            var currentIdentity = httpContext.User.Identity as ClaimsIdentity;

            if (currentIdentity.FindFirst(ClaimTypes.NameIdentifier) != null)
            {
                var routeData = httpContext.Request.RequestContext.RouteData;

                var area = routeData.Values.ContainsKey("area") == true?routeData.GetRequiredString("area") : string.Empty;

                var controller = routeData.GetRequiredString("controller");
                var action     = routeData.GetRequiredString("action");

                var operationLog = new UserOperationLog()
                {
                    Area          = area,
                    Action        = action,
                    Controller    = controller,
                    VisitDateTime = DateTime.Now,
                    RawUrl        = httpContext.Request.RawUrl,
                    UserId        = currentIdentity.FindFirst(ClaimTypes.NameIdentifier).Value,
                    IP            = httpContext.Request.ServerVariables["REMOTE_ADDR"]
                };

                if (resourceOpertation != null)
                {
                    operationLog.Operation    = resourceOpertation.Operation;
                    operationLog.Resource     = resourceOpertation.ResourceName;
                    operationLog.ResourceName = resourceOpertation.DisplayNameWithParent;
                }
                else
                {
                    var siteMap = SiteMaps.Current.RootNode.Descendants.Where(x =>
                                                                              x.Controller == controller && x.Area == area && x.Action == action).FirstOrDefault();

                    var resourceName = string.Empty;

                    if (siteMap != null)
                    {
                        resourceName = siteMap.Title;

                        if (siteMap.ParentNode != null)
                        {
                            resourceName = siteMap.ParentNode.Title + "/" + resourceName;
                        }
                    }

                    operationLog.ResourceName = resourceName;
                }

                DB.Repository <UserOperationLog>().Create(operationLog);
                DB.Save();
            }
        }
コード例 #18
0
        protected override void PrepareOperationLog(AMSOperationContext context)
        {
            UserOperationLog log = new UserOperationLog();

            log.Subject    = this.GetOperationDescription();
            log.ResourceID = this._Key.ToString();

            log.FillHttpContext();

            context.Logs.Add(log);
        }
コード例 #19
0
        protected override void OnPrepareUserOperationLog(WfDesignerExecutorDataContext dataContext, UserOperationLogCollection logs)
        {
            UserOperationLog log = new UserOperationLog();

            log.Subject = string.Format("{0}", this.OperationType.ToDescription());

            logs.Add(log);

            base.OnPrepareUserOperationLog(dataContext, logs);

            this.FillEnvironmentInfoToLogs(logs);
        }
コード例 #20
0
        /// <summary>
        /// 写打开表单的日志
        /// </summary>
        /// <param name="currentActivity"></param>
        /// <param name="logOpType"></param>
        private static void WriteOpenFormLog(IWfActivity currentActivity, MCS.Library.SOA.DataObjects.OperationType logOpType)
        {
            if (currentActivity != null)
            {
                UserOperationLog log = UserOperationLog.FromActivity(currentActivity);

                log.OperationType = logOpType;
                log.OperationName = EnumItemDescriptionAttribute.GetDescription(logOpType);

                UserOperationLogAdapter.Instance.Update(log);
            }
        }
コード例 #21
0
        public override bool TakeAction()
        {
            try
            {
                DESAlgorithmNew des = new DESAlgorithmNew();
                password = des.DecodePwd(password, GameEnvironment.Setting.ClientDesDeKey);
                if (password.Length > 12 || password.Length < 4)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    this.ErrorInfo = LanguageManager.GetLang().St1006_PasswordTooLong;
                    return(false);
                }
                Regex re = new Regex(@"^[\u4e00-\u9fa5\w]+$");
                if (!re.IsMatch(password))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1006_PasswordExceptional;
                    return(false);
                }
                password = CryptoHelper.DES_Encrypt(password, GameEnvironment.Setting.ProductDesEnKey);
                if (SnsManager.ChangePass(Uid, password) <= 0)
                {
                    this.ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo      = LanguageManager.GetLang().St1006_ChangePasswordError;
                    return(false);
                }
                else
                {
                    UserOperationLog userOperationLog = new UserOperationLog();
                    userOperationLog.UserID     = ContextUser.UserID;
                    userOperationLog.ActionID   = ActionIDDefine.Cst_Action1006;
                    userOperationLog.FunctionID = "更新密码";
                    userOperationLog.CreateDate = DateTime.Now;
                    userOperationLog.Num        = 0;

                    var sender = DataSyncManager.GetDataSender();
                    sender.Send(userOperationLog);
                }
            }
            catch (Exception ex)
            {
                this.SaveLog(ex.ToString());
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1006_PasswordError;
                return(false);
            }
            return(true);
        }
コード例 #22
0
        protected virtual void OnPrepareUserOperationLog(WfExecutorDataContext dataContext)
        {
            UserOperationLogCollection logs = dataContext.OperationLogs;

            if (OperatorActivity != null)
            {
                UserOperationLog log = UserOperationLog.FromActivity(OperatorActivity);

                log.OperationType = DataObjects.OperationType.Update;
                log.OperationName = EnumItemDescriptionAttribute.GetDescription(this.OperationType);

                logs.Add(log);
            }

            FirePrepareUserOperationLog(dataContext, logs);

            foreach (UserOperationLog log in logs)
            {
                OnPrepareUserOperationLogDescription(dataContext, log);
            }

            List <string> accomplishedUserTaskIDs = new List <string>();

            foreach (UserTask item in WfRuntime.ProcessContext.AccomplishedUserTasks)
            {
                accomplishedUserTaskIDs.Add(item.TaskID);
            }

            UserOperationTasksLogCollection userOperationlogs = new UserOperationTasksLogCollection();

            foreach (UserTask userTaskItem in WfRuntime.ProcessContext.MoveToUserTasks)
            {
                if (accomplishedUserTaskIDs.Exists(taskID => string.Equals(taskID, userTaskItem.TaskID)) == false)
                {
                    userOperationlogs.Add(UserOperationTasksLog.FromUserTask(userTaskItem));
                }
            }

            if (userOperationlogs.Count > 0)
            {
                dataContext.Add("USER_OPERATION_TASKSLOGS", userOperationlogs);
            }
            else
            {
                dataContext.Remove("USER_OPERATION_TASKSLOGS");
            }
        }
コード例 #23
0
        public void AddUserOperationLog()
        {
            string resourceID = UuidHelper.NewUuidString();

            UserOperationLog log = DataHelper.PrepareUserOperationLog(resourceID);

            long             logID     = UserOperationLogSqlAdapter.Instance.Add(log);
            UserOperationLog logLoaded = UserOperationLogSqlAdapter.Instance.LoadByID(logID);

            Assert.IsNotNull(logLoaded);
            log.AreEqual(logLoaded);

            logLoaded = UserOperationLogSqlAdapter.Instance.LoadByResourceID(log.ResourceID).SingleOrDefault();

            Assert.IsNotNull(logLoaded);
            log.AreEqual(logLoaded);
        }
コード例 #24
0
        public void WriteModuleLog(Module currentModule)
        {
            //如果是首页就不要记录了
            if (currentModule.Area.ToLower() == "admin" &&
                currentModule.Controller.ToLower() == "home" &&
                currentModule.Action.ToLower() == "index")
            {
                return;
            }
            IUserOperationLogService userOperationLogService = ServiceFactory.Create <IUserOperationLogService>();
            UserOperationLog         model = new UserOperationLog();

            model.UserID     = CurrentUser.ID;
            model.ModuleID   = currentModule.ID;
            model.CreateTime = DateTime.Now;
            userOperationLogService.AddEntity(model);
        }
コード例 #25
0
        public UserOperationLogCollection ClientToServer(IEnumerable <WfClientUserOperationLog> client)
        {
            client.NullCheck("client");

            UserOperationLogCollection server = new UserOperationLogCollection();

            foreach (WfClientUserOperationLog clientItem in client)
            {
                UserOperationLog serverItem = null;

                this.ClientToServer(clientItem, ref serverItem);

                server.Add(serverItem);
            }

            return(server);
        }
コード例 #26
0
        public void UserOperationLogAdapterTest()
        {
            int resId            = 3;
            int actId            = 3;
            UserOperationLog log = GetInstanceOfUserOperationLog(resId, actId);

            UserOperationLogAdapter.Instance.Update(log);


            UserOperationLogCollection log3 = UserOperationLogAdapter.Instance.LoadByResourceID("resource" + resId.ToString());

            UserOperationLog log2 = UserOperationLogAdapter.Instance.Load(log3[0].ID);

            Assert.AreEqual(log.ResourceID, log2.ResourceID);
            Assert.AreEqual(log.Operator.ID, log2.Operator.ID);

            UserOperationLogAdapter.Instance.Delete(log);
        }
コード例 #27
0
		/// <summary>
		/// 保存流程模板
		/// </summary>
		/// <param name="wfProcess"></param>
		public static void SaveWfProcess(IWfProcessDescriptor wfProcess)
		{
			var pManager = WorkflowSettings.GetConfig().GetDescriptorManager();
			pManager.SaveDescriptor(wfProcess);

			//change import time
            WfProcessDescriptorInfoAdapter.Instance.UpdateImportTime(wfProcess.Key, DeluxeIdentity.CurrentUser);

			//write log
			UserOperationLog log = new UserOperationLog()
			{
				ResourceID = wfProcess.Key,
				Operator = DeluxeIdentity.CurrentUser,
				OperationDateTime = DateTime.Now,
				Subject = "导入流程模板",
				OperationName = "导入",
				OperationDescription = "导入流程模板"
			};
			UserOperationLogAdapter.Instance.Update(log);
		}
コード例 #28
0
		protected override void OnPrepareUserOperationLogDescription(WfExecutorDataContext dataContext, UserOperationLog log)
		{
			log.Subject = Translator.Translate(Define.DefaultCulture, "启动分支流程");

			StringBuilder strB = new StringBuilder();

			foreach (IWfProcess process in this.StartedProcesses)
			{
				if (strB.Length > 0)
					strB.Append(",");

				strB.Append(process.ID);
			}

			log.OperationDescription = Translator.Translate(
				Define.DefaultCulture, 
				"根据模板{0},启动了{1}条流程,ID为:{2}",
				this.BranchTransferParams.Template.Key,
				this.StartedProcesses.Count,
				strB.ToString());
		}
コード例 #29
0
        /// <summary>
        /// 保存流程模板
        /// </summary>
        /// <param name="wfProcess"></param>
        public static void SaveWfProcess(IWfProcessDescriptor wfProcess)
        {
            var pManager = WorkflowSettings.GetConfig().GetDescriptorManager();

            pManager.SaveDescriptor(wfProcess);

            //change import time
            WfProcessDescriptorInfoAdapter.Instance.UpdateImportTime(wfProcess.Key, DeluxeIdentity.CurrentUser);

            //write log
            UserOperationLog log = new UserOperationLog()
            {
                ResourceID           = wfProcess.Key,
                Operator             = DeluxeIdentity.CurrentUser,
                OperationDateTime    = DateTime.Now,
                Subject              = "导入流程模板",
                OperationName        = "导入",
                OperationDescription = "导入流程模板"
            };

            UserOperationLogAdapter.Instance.Update(log);
        }
コード例 #30
0
        private static UserOperationLog GetInstanceOfUserOperationLog(int resId, int actId)
        {
            UserOperationLog log = new UserOperationLog();

            log.ResourceID      = "resource" + resId.ToString();
            log.Subject         = "subjectName";
            log.ApplicationName = "Seagull";
            log.ProgramName     = "program1";
            log.ProcessID       = "process1";
            log.ActivityID      = "activityId" + actId.ToString();
            log.ActivityName    = "add new activity";

            IUser user = (IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object;

            log.Operator          = user;
            log.TopDepartment     = user.Parent;
            log.OperationDateTime = DateTime.Now;

            log.RealUser             = user;
            log.OperationName        = "zl";
            log.OperationType        = OperationType.Add;
            log.OperationDescription = "add data";
            return(log);
        }
コード例 #31
0
 protected virtual void OnPrepareUserOperationLogDescription(WfExecutorDataContext dataContext, UserOperationLog log)
 {
     if (log.RealUser != null && log.OperationDescription.IsNullOrEmpty())
     {
         log.OperationDescription = string.Format("{0}:{1}->'{2}' {3:yyyy-MM-dd HH:mm:ss}",
                                                  log.OperationName, log.RealUser.DisplayName, log.Subject, SNTPClient.AdjustedTime);
     }
 }
コード例 #32
0
 public static bool Delete(this UserOperationLog model)
 {
     return(ServiceHelper.GetUserOperationLogService.DeleteEntity(model.ID));
 }
コード例 #33
0
 public static bool Update(this UserOperationLog model)
 {
     return(ServiceHelper.GetUserOperationLogService.UpdateEntity(model));
 }
コード例 #34
0
        //==================Stores拓展结束==================

        //==================UserOperationLog拓展开始==================
        public static UserOperationLog Add(this UserOperationLog model)
        {
            return(ServiceHelper.GetUserOperationLogService.AddEntity(model));
        }
コード例 #35
0
        private void RegisterZoneDefEvent()
        {
            Post["ZoneDef/{Action}/{UserID}"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                bool   isSuccess  = true;
                bool   allSuccess = true;
                string result     = string.Empty;
                string action     = p.Action.Value;
                string userid     = p.UserID.Value;
                string resultJson = string.Empty;
                string returnStr  = string.Empty;
                using (Stream stream = Request.Body)
                {
                    using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("UTF-8")))
                    {
                        resultJson = reader.ReadToEnd();
                    }
                }
                dynamic          d                = JsonConvert.DeserializeObject(resultJson);
                string           zone_id          = d.zone_id?.Value;
                UserOperationLog userOperationLog = new UserOperationLog()
                {
                    Action     = action,
                    UserID     = userid,
                    ActionTime = DateTime.Now,
                };
                try
                {
                    switch (action)
                    {
                    case "LowWaterUpdate":
                        int lowwater = (int)d.water?.Value;
                        isSuccess = scApp.ZoneDefBLL.updateLowWater(zone_id, lowwater);
                        result    = isSuccess ? "OK" : "Update Zone LowWater failed.";
                        break;

                    case "HighWaterUpdate":
                        int highwater = (int)d.water?.Value;
                        isSuccess = scApp.ZoneDefBLL.updateHighWater(zone_id, highwater);
                        result    = isSuccess ? "OK" : "Update Zone HighWater failed.";
                        break;

                    case "ColorUpdate":
                        string color = d.color?.Value;
                        isSuccess = scApp.ZoneDefBLL.updateColor(zone_id, color);
                        result    = isSuccess ? "OK" : "Update Zone Color failed.";
                        break;
                    }
                }
                catch (Exception ex)
                {
                    isSuccess = false;
                    result    = "Execption happend!";
                    logger.Error(ex, "Execption:");
                }
                SCUtility.UserOperationLog(userOperationLog);
                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };
        }
コード例 #36
0
        public void RegisterShelfManagementEvent()
        {
            Post["ShelfDef/{Action}/{UserID}"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                bool   isSuccess  = true;
                bool   allSuccess = true;
                string result     = string.Empty;
                string action     = p.Action.Value;
                string userid     = p.UserID.Value;
                string resultJson = string.Empty;
                using (Stream stream = Request.Body)
                {
                    using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("UTF-8")))
                    {
                        resultJson = reader.ReadToEnd();
                    }
                }
                dynamic          d                = JsonConvert.DeserializeObject(resultJson);
                string           shelf_id         = d.shelf_id?.Value;
                UserOperationLog userOperationLog = new UserOperationLog()
                {
                    Action     = action,
                    UserID     = userid,
                    ActionTime = DateTime.Now,
                };
                try
                {
                    switch (action)
                    {
                    case "EnableUpdate":
                        bool   enable = d.enable?.Value;
                        string s      = scApp.TransferService.Manual_ShelfEnable(shelf_id, enable);
                        isSuccess = s == "OK" ? true : false;
                        result    = isSuccess ? "OK" : "Update Shlef Enable failed.";
                        break;

                    case "PriorityUpdate":
                        int priority = (int)d.priority?.Value;
                        isSuccess = scApp.ShelfService.doUpdatePriority(shelf_id, priority);
                        result    = isSuccess ? "OK" : "Update Shlef Priority failed.";
                        break;

                    case "MultiEnableUpdate":
                        var enableJson = JsonConvert.DeserializeObject <List <ShelfDef> >(resultJson);
                        result = "Update these Shlef Enable failed.\n";
                        enableJson.ForEach(x =>
                        {
                            string enableStr = scApp.TransferService.Manual_ShelfEnable(x.ShelfID, true);
                            isSuccess        = enableStr == "OK" ? true : false;

                            if (!isSuccess)
                            {
                                result    += $"{x.ShelfID}   ";
                                allSuccess = false;
                            }
                        });
                        if (allSuccess == true)
                        {
                            result = "OK";
                        }
                        break;

                    case "MultiDisableUpdate":
                        var disableJson = JsonConvert.DeserializeObject <List <ShelfDef> >(resultJson);
                        result = "Update these Shlef Disable failed.\n";
                        disableJson.ForEach(x =>
                        {
                            string ss = scApp.TransferService.Manual_ShelfEnable(x.ShelfID, false);
                            isSuccess = ss == "OK" ? true : false;

                            if (!isSuccess)
                            {
                                result    += $"{x.ShelfID}   ";
                                allSuccess = false;
                            }
                        });
                        if (allSuccess == true)
                        {
                            result = "OK";
                        }
                        break;

                    case "StateUpdate":
                        string state = d.state?.Value;
                        isSuccess = scApp.ShelfService.doUpdateState(shelf_id, state);
                        result    = isSuccess ? "OK" : "Update Shlef State failed.";
                        break;

                    case "RemarkUpdate":
                        string remark = d.remark?.Value;
                        isSuccess = scApp.ShelfService.doUpdateRemark(shelf_id, remark);
                        result    = isSuccess ? "OK" : "Update Shlef Remark failed.";
                        break;
                    }
                }
                catch (Exception ex)
                {
                    isSuccess = false;
                    result    = "Execption happend!";
                    logger.Error(ex, "Execption:");
                }
                SCUtility.UserOperationLog(userOperationLog);
                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };
        }
コード例 #37
0
 protected virtual void OnPrepareUserOperationLogDescription(WfExecutorDataContext dataContext, UserOperationLog log)
 {
     if (log.RealUser != null && log.OperationDescription.IsNullOrEmpty())
     {
         log.OperationDescription = string.Format("{0}:{1}->'{2}' {3:yyyy-MM-dd HH:mm:ss}",
                     log.OperationName, log.RealUser.DisplayName, log.Subject, DateTime.Now);
     }
 }
コード例 #38
0
ファイル: AssertHelper.cs プロジェクト: zhshen/HuaweiAMS
 public static void AreEqual(this UserOperationLog expected, UserOperationLog actual)
 {
     Assert.AreEqual(expected.ResourceID, actual.ResourceID);
     Assert.AreEqual(expected.Subject, actual.Subject);
 }
コード例 #39
0
        private void RegisterCassetteEvent()
        {
            Post["CassetteData/{Action}/{UserID}"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                bool   isSuccess  = true;
                bool   allSuccess = true;
                string result     = string.Empty;
                string action     = p.Action.Value;
                string userid     = p.UserID.Value;
                string resultJson = string.Empty;
                using (Stream stream = Request.Body)
                {
                    using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("UTF-8")))
                    {
                        resultJson = reader.ReadToEnd();
                    }
                }
                dynamic          d                = JsonConvert.DeserializeObject(resultJson);
                string           box_id           = d.box_id?.Value;
                string           cst_id           = d.cst_id?.Value;
                string           cst_loc          = d.cst_loc?.Value;
                UserOperationLog userOperationLog = new UserOperationLog()
                {
                    Action       = action,
                    UserID       = userid,
                    OldCarrierID = cst_id ?? string.Empty,
                    CarrierLoc   = cst_loc ?? string.Empty,
                    BOXID        = box_id ?? string.Empty,
                    ActionTime   = DateTime.Now,
                };
                try
                {
                    switch (action)
                    {
                    case "StateUpdate":
                        int state = (int)d.state?.Value;
                        isSuccess = scApp.CassetteDataBLL.UpdateCSTState(box_id, state);
                        result    = isSuccess ? "OK" : "Update Cassette State failed.";
                        break;

                    case "LocationUpdate":
                        string s  = scApp.TransferService.Manual_DeleteCst(cst_id, box_id);
                        string ss = scApp.TransferService.Manual_InsertCassette(cst_id, box_id, cst_loc);
                        if (s != "OK" || ss != "OK")
                        {
                            isSuccess = false;
                        }
                        result = isSuccess ? "OK" : "Update Cassette Location failed.";

                        break;

                    case "InstallCST_BOX":
                        CassetteData cassette = scApp.CassetteDataBLL.loadCassetteDataByCSTID(cst_id);
                        result = scApp.TransferService.Manual_InsertCassette(cst_id, box_id, cst_loc);
                        break;

                    case "RemoveCST_BOX":
                        string sss = scApp.TransferService.Manual_DeleteCst(cst_id, box_id);
                        isSuccess = sss == "OK" ? true : false;
                        result    = isSuccess ? "OK" : "Remove Cassette failed.";
                        break;

                    case "ScanCST_BOX":
                        string ssss = scApp.TransferService.SetScanCmd(cst_id, box_id, cst_loc);
                        isSuccess = ssss == "OK" ? true : false;
                        result    = isSuccess ? "OK" : "Remove Cassette failed.";
                        break;
                    }
                    ;
                }
                catch (Exception ex)
                {
                    isSuccess = false;
                    result    = "Execption happend!";
                    logger.Error(ex, "Execption:");
                }

                SCUtility.UserOperationLog(userOperationLog);
                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };
        }
コード例 #40
0
        private void RegisterPortDefEvent()
        {
            Post["PortDef/{Action}/{UserID}"] = (p) =>
            {
                var    scApp      = SCApplication.getInstance();
                bool   isSuccess  = true;
                bool   allSuccess = true;
                string result     = string.Empty;
                string action     = p.Action.Value;
                string userid     = p.UserID.Value;
                string resultJson = string.Empty;
                string returnStr  = string.Empty;
                using (Stream stream = Request.Body)
                {
                    using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("UTF-8")))
                    {
                        resultJson = reader.ReadToEnd();
                    }
                }
                dynamic          d                = JsonConvert.DeserializeObject(resultJson);
                string           port_id          = d.port_id?.Value;
                UserOperationLog userOperationLog = new UserOperationLog()
                {
                    Action     = action,
                    UserID     = userid,
                    ActionTime = DateTime.Now,
                };
                try
                {
                    switch (action)
                    {
                    case "PriorityUpdate":
                        int priority = (int)d.priority?.Value;
                        returnStr = scApp.TransferService.Manual_SetPortPriority(port_id, priority);
                        isSuccess = returnStr == "OK" ? true : false;
                        result    = isSuccess ? "OK" : "Update Port Priority failed.";
                        break;

                    case "PortTypeUpdate":
                        int porttype = (int)d.porttype?.Value;
                        returnStr = scApp.TransferService.Manual_PortTypeChange(port_id, (E_PortType)porttype);
                        isSuccess = returnStr == "OK" ? true : false;
                        result    = isSuccess ? "OK" : "Update Port Type failed.";
                        break;

                    case "PortService":
                        int service = (int)d.service?.Value;
                        returnStr = scApp.TransferService.Manual_SetPortStatus(port_id, (E_PORT_STATUS)service);
                        isSuccess = returnStr == "OK" ? true : false;
                        result    = isSuccess ? "OK" : "Update Port Serveice failed.";
                        break;

                    case "PortRun":
                        isSuccess = scApp.TransferService.SetPortRun(port_id);
                        result    = isSuccess ? "OK" : "Set Port Run failed.";
                        break;

                    case "PortStop":
                        isSuccess = scApp.TransferService.SetPortStop(port_id);
                        result    = isSuccess ? "OK" : "Set Port Stop failed.";
                        break;

                    case "PortAlarrmReset":
                        isSuccess = scApp.TransferService.PortAlarrmReset(port_id);
                        result    = isSuccess ? "OK" : "Port Alarrm Reset failed.";
                        break;

                    case "PortCommandingTrue":
                        isSuccess = scApp.TransferService.PortCommanding(port_id, true);
                        result    = isSuccess ? "OK" : "Set Port Commanding failed.";
                        break;

                    case "PortCommandingFalse":
                        isSuccess = scApp.TransferService.PortCommanding(port_id, false);
                        result    = isSuccess ? "OK" : "Cancel Port Commanding failed.";
                        break;

                    case "toAGVMode":
                        isSuccess = scApp.TransferService.toAGV_Mode(port_id);
                        result    = isSuccess ? "OK" : "Set AGV Mode failed.";
                        break;

                    case "toMGVMode":
                        isSuccess = scApp.TransferService.toMGV_Mode(port_id);
                        result    = isSuccess ? "OK" : "Set MGV Mode failed.";
                        break;

                    case "setAGVBcrRead":
                        isSuccess = scApp.TransferService.SetAGV_PortBCR_Read(port_id);
                        result    = isSuccess ? "OK" : "Set AGV BCR Read failed.";
                        break;

                    case "resetAGVBcrRead":
                        isSuccess = scApp.TransferService.RstAGV_PortBCR_Read(port_id);
                        result    = isSuccess ? "OK" : "Reset AGV BCR Read failed.";
                        break;

                    case "rereadBCR":
                        isSuccess = true;                                 // todo Reread BCR
                        result    = isSuccess ? "OK" : "Reread BCR failed.";
                        break;

                    case "AGVOpenBox":
                        isSuccess = scApp.TransferService.SetAGV_PortOpenBOX(port_id, "CSTBoxControl");
                        result    = isSuccess ? "OK" : "Open AGV Box failed.";
                        break;

                    case "TimeOutForAutoUDUpdate":
                        int timeOutForAutoUD = (int)d.timeOutForAutoUD?.Value;
                        isSuccess = scApp.TransferService.doUpdateTimeOutForAutoUD(port_id, timeOutForAutoUD);
                        result    = isSuccess ? "OK" : "Update Port TimeOutForAutoUD failed.";
                        break;

                    case "TimeOutForAutoInZoneUpdate":
                        string timeOutForAutoInZone = d.timeOutForAutoInZone?.Value;
                        isSuccess = scApp.TransferService.doUpdateTimeOutForAutoInZone(port_id, timeOutForAutoInZone);
                        result    = isSuccess ? "OK" : "Update Port TimeOutForAutoInZone failed.";
                        break;

                    case "BlockPort":
                        isSuccess = scApp.TransferService.UpdateIgnoreModeChange(port_id, "Y");
                        result    = isSuccess ? "OK" : "Block Port failed.";
                        break;

                    case "UnblockPort":
                        isSuccess = scApp.TransferService.UpdateIgnoreModeChange(port_id, "N");
                        result    = isSuccess ? "OK" : "Unblock Port failed.";
                        break;

                    case "ClearAlarmPort":
                        isSuccess = scApp.TransferService.PortAlarrmReset(port_id);
                        result    = isSuccess ? "OK" : "Clear Alarm Port failed.";
                        break;
                    }
                }
                catch (Exception ex)
                {
                    isSuccess = false;
                    result    = "Execption happend!";
                    logger.Error(ex, "Execption:");
                }
                SCUtility.UserOperationLog(userOperationLog);
                var response = (Response)result;
                response.ContentType = restfulContentType;
                return(response);
            };
        }
コード例 #41
0
 protected override void OnPrepareUserOperationLogDescription(WfExecutorDataContext dataContext, UserOperationLog log)
 {
     log.Subject = "异步作废流程";
 }
コード例 #42
0
		protected override void OnPrepareUserOperationLogDescription(WfExecutorDataContext dataContext, UserOperationLog log)
		{
			log.Subject = "退出运维模式";
		}