예제 #1
0
        private void SendNotificationToApplicantRegistered(EMP_Contract contract)
        {
            var message = string.Format("Договор зарегистрирован. № {0}, дата начала действия {1}. Необходимо произвести оплату работ по предоставленному счету на оплату",
                                        contract.Number, contract.StartDate?.ToString("dd.MM.yyyy"));

            new NotificationManager().SendNotification(message, ObjectType.ObkContract, contract.Id, contract.EmployeeId.Value);
        }
예제 #2
0
 public IEnumerable <SelectListItem> GetSignerList(EMP_Contract contract)
 {
     string[] signerCodes = { "ncels_deputyceo", "ncels_ceo" };
     return(_uow.GetQueryable <Employee>().Where(e => signerCodes.Contains(e.Position.Code)).Select(x => new SelectListItem
     {
         Value = x.Id.ToString(),
         Text = x.Position.ShortName + " " + x.ShortName,
         Selected = x.Id == contract.Signer
     }));
 }
예제 #3
0
        private void SendNotificationToExecutorWork(Guid executorId, EMP_Contract contract)
        {
            string organizationForm = "";

            if (contract.OBK_Declarant.OrganizationFormId != null)
            {
                var orgForm = _uow.GetQueryable <Dictionary>().FirstOrDefault(x => x.Id == contract.OBK_Declarant.OrganizationFormId.Value);
                if (orgForm != null)
                {
                    organizationForm = orgForm.Name;
                }
            }
            var orgName = contract.OBK_Declarant?.NameRu;
            var message = string.Format("Поступил новый договор от {0} \"{1}\"", organizationForm, orgName);

            new NotificationManager().SendNotification(message, ObjectType.EmpContract, contract.Id, executorId);
        }
예제 #4
0
        private bool IsRejectedInOtherStages(EMP_Contract contract)
        {
            var skipOtherStages = contract.EMP_ContractHistory.Any(x =>
                                                                   x.OBK_Ref_ContractHistoryStatus.Code == OBK_Ref_ContractHistoryStatus.Returned);

            if (skipOtherStages)
            {
                return(false);
            }

            var validationGroupStage = contract.EMP_ContractStage.First(x =>
                                                                        x.EMP_Ref_Stage.Code == CodeConstManager.EmpContractStage.ValidationGroup);
            var defStage = contract.EMP_ContractStage.First(x =>
                                                            x.EMP_Ref_Stage.Code == CodeConstManager.EmpContractStage.Def);

            var codes = new[] { validationGroupStage.EMP_Ref_StageStatus.Code, defStage.EMP_Ref_StageStatus.Code };

            return(codes.Contains(CodeConstManager.EmpContractStageStatus.NotApproved));
        }
예제 #5
0
        private void SavePayments(EMP_Contract contract)
        {
            var pay = new EMP_DirectionToPayments
            {
                Id                   = Guid.NewGuid(),
                CreateDate           = DateTime.Now,
                ContractId           = contract.Id,
                CreateEmployeeId     = UserHelper.GetCurrentEmployee().Id,
                CreateEmployeeValues = UserHelper.GetCurrentEmployee().DisplayName,
                DirectionDate        = DateTime.Now,
                Number               = contract.Number,
                PayerId              = contract.OBK_Declarant.Id,
                PayerValue           = contract.OBK_Declarant.NameRu,
                IsDeleted            = false,
                TotalPrice           = contract.EMP_CostWorks.Sum(e =>
                                                                  Math.Round(Convert.ToDecimal(TaxHelper.GetCalculationTax(e.Price.Value) * e.Count), 2)),
                StatusId = _uow.GetQueryable <OBK_Ref_PaymentStatus>()
                           .Where(e => e.Code == OBK_Ref_PaymentStatus.OnFormation).Select(x => x.Id).FirstOrDefault()
            };

            _uow.Insert(pay);
            _uow.Save();
        }