Exemple #1
0
        protected override void GetModelsForOperationOptions <TObject, TModelForGet>(ref TObject modelParam, TModelForGet modelForGet)
        {
            AddDebtModel model = modelParam as AddDebtModel;
            ModelsForDebtOperationModel operModel = modelForGet as ModelsForDebtOperationModel;

            if (model != null && operModel != null)
            {
                operModel.AgentModel = _agentsManager.GetAgentWithCurrentName(model.AgentName);
            }
        }
Exemple #2
0
        public override bool addNewOperation <TObject>(TObject modelParam, string userName)
        {
            AddDebtModel model = modelParam as AddDebtModel;

            if (model != null && model != null && ValidationManager.modelIsValid(model))
            {
                DebtTypeEnum operationType = model.DebtType;

                ModelsForDebtOperationModel modelForOperation = new ModelsForDebtOperationModel
                {
                    AgentModel = new NameIdClassModel()
                };
                GetModelsForOperationOptions(ref model, modelForOperation);

                debt_DebtOperations newOperation = new debt_DebtOperations()
                {
                    StartDate    = model.StartDate,
                    EndDate      = model.EndDate,
                    StartSum     = model.StartSum,
                    RewardSum    = model.RewardSum,
                    Comment      = model.Commentary,
                    CurrencyId   = model.CurrencyId,
                    IsInProgress = true
                };
                DebtForeignKeyForSetModels fKModel = new DebtForeignKeyForSetModels
                {
                    AgentModel = modelForOperation.AgentModel,
                    UserId     = userName,
                    DebtType   = operationType
                };
                SetIdForForeignKeys(fKModel, DIManager.UnitOfWork, ref newOperation);


                return(AddOperationToDB(newOperation));
            }
            return(false);
        }
 public void AddOperation(AddDebtModel debtModel)
 {
     _addOperationProcessor.addNewOperation(debtModel, User.Identity.Name);
 }