public override void TaskRejected(Guid documentId, EXP_Tasks task) { var directionToPay = _context.EXP_DirectionToPays.FirstOrDefault(e => e.Id == documentId); if (directionToPay != null) { directionToPay.StatusId = DictionaryHelper.GetDicIdByCode(Dictionary.ExpDirectionToPayStatus.DicCode, Dictionary.ExpDirectionToPayStatus.OnСorrection); directionToPay.ModifyDate = directionToPay.ModifyDate = DateTime.Now;; var unit1 = UserHelper.GetDepartmentUpper(); bool isUpperCode = (unit1 != null && unit1.Code == "finance"); if (UserHelper.GetCurrentEmployee().Id == task.ExecutorId && (UserHelper.GetDepartment().Code == "finance" || isUpperCode)) { var expDrugDeclaration = directionToPay.EXP_DrugDeclaration.FirstOrDefault(); var expExpertiseStage = expDrugDeclaration?.EXP_ExpertiseStage.FirstOrDefault(es => es.EXP_DIC_Stage.Code == EXP_DIC_Stage.PrimaryExp); var expExpertiseStageExecutors = expExpertiseStage?.EXP_ExpertiseStageExecutors.FirstOrDefault(ex => ex.IsHead); if (expExpertiseStageExecutors != null) { var headId = expExpertiseStageExecutors.ExecutorId; new NotificationManager().SendNotification( string.Format("Направление на оплату №{0} отклонено", directionToPay.Number), ObjectType.Document, directionToPay.Id, headId); } } } _context.SaveChanges(); }
public override void TaskRejected(Guid documentId, EXP_Tasks task) { var contract = _context.Contracts.FirstOrDefault(e => e.Id == documentId); contract.StatusId = DictionaryHelper.GetDicIdByCode(Dictionary.ContractStatus.DicCode, Contract.StatusCorrected); _context.SaveChanges(); }
public override void TaskRejected(Guid documentId, EXP_Tasks task) { var contract = _context.Contracts.FirstOrDefault(e => e.Id == documentId); contract.StatusId = DictionaryHelper.GetDicIdByCode(Dictionary.ContractStatus.DicCode, Contract.StatusOnReWork); task.ExecutedDate = DateTime.Now; _context.SaveChanges(); }
public override void TaskExecuted(Guid documentId, EXP_Tasks task) { var directionToPay = _context.EXP_DirectionToPays.FirstOrDefault(e => e.Id == documentId); if (directionToPay != null && task.EXP_TasksChild == null) { directionToPay.StatusId = DictionaryHelper.GetDicIdByCode(Dictionary.ExpDirectionToPayStatus.DicCode, Dictionary.ExpDirectionToPayStatus.Agreed); directionToPay.ModifyDate = DateTime.Now; } _context.SaveChanges(); }
public override void TaskRepealed(Guid documentId, EXP_Tasks task) { var directionToPay = _context.EXP_DirectionToPays.FirstOrDefault(e => e.Id == documentId); if (directionToPay != null) { directionToPay.StatusId = DictionaryHelper.GetDicIdByCode(Dictionary.ExpDirectionToPayStatus.DicCode, Dictionary.ExpDirectionToPayStatus.Canceled); } _context.SaveChanges(); }
public override void TaskRejected(Guid documentId, EXP_Tasks task) { var coc = _context.EXP_CertificateOfCompletion.FirstOrDefault(e => e.Id == documentId); if (coc != null) { coc.StatusId = DictionaryHelper.GetDicIdByCode(Dictionary.CertificateOfCompletionStatusDic.DicCode, Dictionary.CertificateOfCompletionStatusDic.Rejected); } _context.SaveChanges(); }
public override void TaskExecuted(Guid documentId, EXP_Tasks task) { if (task.OrderNumber == 1) { var contract = _context.Contracts.FirstOrDefault(e => e.Id == documentId); var signer = _context.Employees.FirstOrDefault(e => e.Id == task.ExecutorId); contract.StatusId = DictionaryHelper.GetDicIdByCode(Dictionary.ContractStatus.DicCode, Contract.StatusOnSigning); _context.SaveChanges(); _notificationManager.SendNotification("Вам отправлен договор для подписания ЭЦП", ObjectType.Contract, documentId, signer.Id, signer.Email); } }
private AgreementTreeItemViewModel ConvertTaskToTreeItem(EXP_Tasks task) { AgreementTreeItemViewModel model = new AgreementTreeItemViewModel { Id = task.Id.ToString(), Executor = task.ExecutorEmployee.FullName, CreatedDatetime = task.CreatedDate.Value.ToString("dd.MM.yyyy"), ExecutedDatetime = task.ExecutedDate?.ToString("dd.MM.yyyy HH:mm:ss"), Comment = task.Comment, Status = task.StatusesDictionary.Name }; return(model); }
public override void TaskExecuted(Guid documentId, EXP_Tasks task) { var contract = _context.Contracts.FirstOrDefault(e => e.Id == documentId); contract.StatusId = DictionaryHelper.GetDicIdByCode(Dictionary.ContractStatus.DicCode, Contract.StatusApproved); _context.SaveChanges(); ContractRepository _contractRepository = new ContractRepository(false); //_contractRepository.SetNumberAndDate(contract.Id); if (contract.IsHasDigCert == true) { new ActivityManager().CreateActivity(contract.Id, Dictionary.ExpAgreedDocType.Contract, Dictionary.ExpActivityType.ContractSigningByApplicantAndCeo, contract.Number, contract.ContractDate); } else { _contractRepository.SendToCopySign(contract.Id); } }
public override void TaskRepealed(Guid documentId, EXP_Tasks task) { }
public override void TaskExecuted(Guid documentId, EXP_Tasks task) { }
/// <summary> /// отозван /// </summary> /// <param name="documentId"></param> /// <param name="task"></param> public abstract void TaskRepealed(Guid documentId, EXP_Tasks task);
/// <summary> /// завершена задача /// </summary> /// <param name="documentId"></param> /// <param name="task"></param> public abstract void TaskExecuted(Guid documentId, EXP_Tasks task);
public void CreateActivity(Guid documentId, Guid documentTypeId, Guid activityTypeId, string documentValue, string documentTypeValue, string activityTypeValue, string text, string docNumber, DateTime?docDate) { Func <ncelsEntities, DocumentAction> docActionInitizlizer; var documentType = _activityRepository.GetDocumentTypeById(documentTypeId); var activityType = _activityRepository.GetActivityTypeById(activityTypeId); _documentActions.TryGetValue(new DocumentActionTypeKey(documentType.Code, activityType.Code), out docActionInitizlizer); var documentAction = docActionInitizlizer != null?docActionInitizlizer(_context) : null; var settings = _activityRepository.GetSettings(documentTypeId); var status = _activityRepository.GetActivityStatusByCode(); EXP_Activities activity = new EXP_Activities() { Id = Guid.NewGuid(), Text = text ?? activityType.Name, AuthorId = UserHelper.GetCurrentEmployee().Id, AuthorValue = UserHelper.GetCurrentEmployee().DisplayName, CreatedDate = DateTime.Now, DocumentId = documentId, DocumentValue = documentValue, DocumentTypeId = documentTypeId, DocumentTypeValue = documentTypeValue, TypeId = activityTypeId, TypeValue = activityTypeValue, StatusId = status.Id, StatusValue = status.Code, DocDate = docDate, DocNumber = docNumber }; _activityRepository.Insert(activity); var activitySetting = settings.EXP_AgreementProcSettingsActivities.FirstOrDefault(a => a.ActivityTypeId == activityTypeId); if (activitySetting != null) { Guid?parentTaskId = null; foreach (var taskSetting in activitySetting.EXP_AgreementProcSettingsTasks.OrderBy(t => t.OrderNum)) { var executorId = taskSetting.ExecutorId; if (taskSetting.ExecutorId == null && documentAction != null) { executorId = documentAction.GetExecutor(documentId, activityTypeId, taskSetting.OrderNum); } var taskInWorkStatus = _activityRepository.GetTaskStatusByCode(Dictionary.ExpTaskStatus.InWork); var taskInQueueStatus = _activityRepository.GetTaskStatusByCode(Dictionary.ExpTaskStatus.InQueue); EXP_Tasks task = new EXP_Tasks() { Id = Guid.NewGuid(), Text = text, OrderNumber = taskSetting.OrderNum, Number = taskSetting.OrderNum.ToString(), TypeId = taskSetting.TaskTypeId, TypeValue = string.Empty, EXP_Activities = activity, AuthorId = activity.AuthorId, AuthorValue = activity.AuthorValue, CreatedDate = DateTime.Now, ExecutorId = executorId.Value, ExecutorValue = string.Empty, ParentTaskId = parentTaskId }; if (taskSetting.OrderNum == 1) { task.StatusId = taskInWorkStatus.Id; // очень важно чтобы так заполнялось. не менять !!!! task.StatusValue = taskInWorkStatus.Code; } else { task.StatusId = taskInQueueStatus.Id; // очень важно чтобы так заполнялось. не менять !!!! task.StatusValue = taskInQueueStatus.Code; } parentTaskId = task.Id; activity.EXP_Tasks.Add(task); } } _activityRepository.Save(); if (documentAction != null) { documentAction.ProcessStarted(documentId, activity); } }
/// <summary> /// Простая отправка на согласование списку исполнителей /// </summary> /// <param name="activityTypeCode"></param> /// <param name="docId"></param> /// <param name="docTypeCode"></param> /// <param name="docNumber"></param> /// <param name="docDate"></param> /// <param name="executors"></param> /// <returns></returns> public EXP_Activities SendToExecution(string activityTypeCode, Guid docId, string docTypeCode, string taskTypeCode, string docNumber, DateTime?docDate, params Guid[] executors) { Func <ncelsEntities, DocumentAction> docActionInitizlizer; var docTypeId = _activityRepository.GetDocumentTypeIdByCode(docTypeCode); var documentType = _activityRepository.GetDocumentTypeById(docTypeId.Value); var activityTypeId = _activityRepository.GetActivityTypeIdByCode(activityTypeCode); var activityType = _activityRepository.GetActivityTypeById(activityTypeId.Value); _documentActions.TryGetValue(new DocumentActionTypeKey(documentType.Code, activityType.Code), out docActionInitizlizer); var documentAction = docActionInitizlizer != null?docActionInitizlizer(_context) : null; var status = _activityRepository.GetActivityStatusByCode(); EXP_Activities activity = new EXP_Activities() { Id = Guid.NewGuid(), Text = activityType.Name, AuthorId = UserHelper.GetCurrentEmployee().Id, AuthorValue = UserHelper.GetCurrentEmployee().DisplayName, CreatedDate = DateTime.Now, DocumentId = docId, DocumentValue = "", DocumentTypeId = docTypeId.Value, DocumentTypeValue = "", TypeId = activityTypeId.Value, TypeValue = "", StatusId = status.Id, StatusValue = status.Code, DocDate = docDate, DocNumber = docNumber }; _activityRepository.Insert(activity); Guid?parentTaskId = null; int taskOrder = 1; var taskType = _activityRepository.GetTaskStatusByCode(taskTypeCode); foreach (var executorId in executors) { var taskInWorkStatus = _activityRepository.GetTaskStatusByCode(Dictionary.ExpTaskStatus.InWork); var taskInQueueStatus = _activityRepository.GetTaskStatusByCode(Dictionary.ExpTaskStatus.InQueue); EXP_Tasks task = new EXP_Tasks() { Id = Guid.NewGuid(), Text = taskType.Name, OrderNumber = taskOrder, Number = taskOrder.ToString(), TypeId = taskType.Id, TypeValue = string.Empty, EXP_Activities = activity, AuthorId = activity.AuthorId, AuthorValue = activity.AuthorValue, CreatedDate = DateTime.Now, ExecutorId = executorId, ExecutorValue = string.Empty, ParentTaskId = parentTaskId }; if (taskOrder == 1) { task.StatusId = taskInWorkStatus.Id; task.StatusValue = taskInWorkStatus.Code; } else { task.StatusId = taskInQueueStatus.Id; task.StatusValue = taskInQueueStatus.Code; } parentTaskId = task.Id; activity.EXP_Tasks.Add(task); taskOrder++; } _activityRepository.Save(); if (documentAction != null) { documentAction.ProcessStarted(docId, activity); } return(activity); }