示例#1
0
        /// <summary>Создаем новое действие для пользователя</summary>
        public static MFPlannerAction MFPlannerCreateAction(MFWorkerActionType type, int workerId, int projectId, DateTime bTime, int days, string comment)
        {
            if (!CreateClient())
            {
                return(null);
            }

            try
            {
                int id        = service.MFPlannerCreateAction(type, workerId, projectId, bTime, days);
                var newAction = new MFPlannerAction(type, id, workerId, projectId)
                {
                    TimeBegin = bTime,
                    Days      = days,
                    Comment   = comment
                };
                return(newAction);
            }
            catch (Exception ex)
            {
                LogManager.LogError(unit, string.Format("Ошибка создания действия"), ex);

                CloseClient();

                return(null);
            }
        }
        static Project GetProject(MFPlannerAction a)
        {
            if (a == null || a.Type != MFWorkerActionType.Project)
            {
                return(null);
            }

            return(ServiceManager.LoadProject(a.TargetId));
        }
示例#3
0
        /// <summary>Удаляем действие</summary>
        public static bool RemoveAction(MFPlannerAction action)
        {
            if (action != null && ServiceManager.MFPlannerRemoveAction(action.Id))
            {
                return(true);
            }

            return(false);
        }
示例#4
0
        /// <summary>Меняет описание работника</summary>
        public static bool MFPlannerChangeAction(MFPlannerAction action)
        {
            if (ServiceManager.MFPlannerChangeAction(action))
            {
                return(true);
            }

            return(false);
        }
示例#5
0
 /// <summary>Меняем действие для пользователя</summary>
 public bool MFPlannerChangeAction(MFPlannerAction action)
 {
     lock (Db.Ds)
     {
         LogManager.LogInfo(IpClient(), "Меняем действие для пользователя " + action.Id);
         AgrDataSet.ActionRow drAction = Db.Ds.Action.FindById(action.Id);
         if (drAction == null)
         {
             return(false);
         }
         drAction.Comment   = action.Comment;
         drAction.Days      = action.Days;
         drAction.Type      = (int)action.Type;
         drAction.TimeBegin = action.TimeBegin;
         //drAction.TargetId = action.TargetId;
         return(Db.SavePlanners());
     }
 }
示例#6
0
        /// <summary>Меняем действие для пользователя</summary>
        public static bool MFPlannerChangeAction(MFPlannerAction action)
        {
            if (!CreateClient())
            {
                return(false);
            }

            try
            {
                return(service.MFPlannerChangeAction(action));
            }
            catch (Exception ex)
            {
                LogManager.LogError(unit, string.Format("Ошибка изменения действия: [{0}]", action.Id), ex);

                CloseClient();

                return(false);
            }
        }
示例#7
0
        public static void CreateNewAction(MFWorkerActionType type, int workerId, int projectId, DateTime bTime, int workTime, string comment = "")
        {
            int             actionId  = -1;
            MFPlannerAction newAction = null;

            lock (actions)
                newAction = ServiceManager.MFPlannerCreateAction(type, workerId, projectId, bTime, workTime, comment);

            if (newAction != null)
            {
                actionId = newAction.Id;
                lock (actions)
                {
                    if (!actions.Any(x => x.Id == newAction.Id))
                    {
                        actions.Add(newAction);
                    }
                }

                EventMessages.Insert(0, new EventMessage(DateTime.Now, actionId, "Добавлено новое действие"));
                DoActionsChanged();
            }
        }