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); } }
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); }