// // GET: /Contract/Details/5 public ViewResult Details(int id) { ContractService service = new ContractService(); Contract model = service.GetContractByID(new Contract() { Id = id }); model.ActionOperationType = EActionOperationType.Details; return View("Create",model); }
public ActionResult DeleteConfirmed(int id) { ContractService service = new ContractService(); Contract model = service.GetContractByID(new Contract() { Id = id }); service.Remove(model); return RedirectToAction("Index"); }
static public void Approve(Guid workflowId, Guid objectId, string upn, string comment) { ContractService service = Runtime.GetService <ContractService>(); service.Approve(workflowId, objectId, upn, comment); RunWorkflowInScheduler(workflowId); }
static void Main(string[] args) { Console.WriteLine("Enter contract data"); Console.Write("Number: "); int contractNumber = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime contractDate = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Contract value: "); double contractValue = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter number of installments: "); int months = int.Parse(Console.ReadLine()); Contract myContract = new Contract(contractNumber, contractDate, contractValue); ContractService contractService = new ContractService(new PaypalService()); contractService.ProcessContract(myContract, months); Console.WriteLine("Installments:"); foreach (Installment installment in myContract.Installment) { Console.WriteLine(installment); } }
static public void Submit(Guid workflowId, Guid objectId, string upn) { ContractService service = Runtime.GetService <ContractService>(); service.Submit(workflowId, objectId, upn, ExportLogic.GetExportContractById(objectId)); RunWorkflowInScheduler(workflowId); }
static void Main(string[] args) { try{ Console.WriteLine("- Enter contract data -"); Console.Write("Contract number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Contract date (dd/MM/yyyy): "); DateTime date = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Contract value: "); double value = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Number os installments: "); int installments = int.Parse(Console.ReadLine()); Contract contract = new Contract(number, value, date); ContractService service = new ContractService(contract, installments, new PaypalService()); service.generateInstallments(); Console.WriteLine("\nInstallments:"); foreach (Installment installment in contract.installments) { Console.WriteLine(installment); } } catch (Exception exception) { Console.WriteLine("Error: " + exception.Message); } Console.ReadLine(); }
static void Main(string[] args) { try { Console.WriteLine("Enter contract data"); Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime date = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Contract value: "); double totalValue = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter number of installments: "); int numberInstallments = int.Parse(Console.ReadLine()); Contract contract = new Contract(number, date, totalValue); ContractService contractService = new ContractService(new PaypalService()); contractService.ProcessContract(contract, numberInstallments); Console.WriteLine(); Console.WriteLine("INSTALLMENTS: "); foreach (Installment installments in contract.Installments) { Console.WriteLine(installments); } } catch (Exception e) { Console.WriteLine(e.Message); } }
public async Task GetContractsTest() { var request = new ContractListRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret); var response = await ContractService.GetContractsAsync(request); Assert.IsTrue(response.Data.Count() > 0); }
public async Task <ActionResult> Index(HttpPostedFileBase file1, string privateKeyUpload) { string tranactionHash = ""; if (file1 != null) { byte[] imageData = null; using (var binaryReader = new BinaryReader(file1.InputStream)) { imageData = binaryReader.ReadBytes(file1.ContentLength); } MD5 md5 = new MD5CryptoServiceProvider(); byte[] hashenc = md5.ComputeHash(imageData); string result = ""; foreach (var b in hashenc) { result += b.ToString("x2"); } string id = User.Identity.GetUserId(); var owner = UserService.GetAddress(id); var contractService = new ContractService(owner[0], privateKeyUpload, result); tranactionHash = await contractService.SetFileHash(); ViewData["Message"] = "Transaction hash: " + tranactionHash; } else { ViewData["Message"] = "Please, Select a file."; } return(View("Index")); }
protected void btnVoid_Click(object sender, EventArgs e) { try { var list = ContractService.GetActiveInvoices(lblContractNo.Text).ToList(); string invoices = String.Empty; list.ForEach(inv => invoices += @"<li>" + inv.InvoiceNo + @"</li"); if (list.Any()) { WebFormHelper.SetLabelTextWithCssClass( lblMessageAddEdit, @"This contract has invoice already, please void invoice first: <ul>" + invoices + "</ul>", LabelStyleNames.ErrorMessage); } else { ContractService.VoidContract(lblContractNo.Text); mvwForm.SetActiveView(viwRead); WebFormHelper.SetLabelTextWithCssClass( lblMessage, @"Contract <b> " + lblContractNo.Text + "</b> has been processed as VOID", LabelStyleNames.AlternateMessage); btnVoid.Enabled = false; btnCloseContract.Enabled = false; } } catch (Exception ex) { mvwForm.SetActiveView(viwRead); WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage); LogService.ErrorException(GetType().FullName, ex); } }
static void Main(string[] args) { Console.WriteLine("Enter contract data:"); try { Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime date = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", null); Console.Write("Contract value: "); double value = double.Parse(Console.ReadLine()); Console.Write("\nEnter the number of installments: "); int numberOfInstallments = int.Parse(Console.ReadLine()); Contract contract = new Contract(number, date, value); ContractService contractService = new ContractService(new PaypalService()); contractService.ProcessContract(contract, numberOfInstallments); foreach (Installment installment in contract.installments) { Console.WriteLine(installment); } } catch (FormatException e) { Console.WriteLine("An error occured."); Console.WriteLine(e.Message); } }
static void Main(string[] args) { Console.WriteLine("Entre com os dados do contrato:"); Console.Write("Numero: "); int numero = int.Parse(Console.ReadLine()); Console.Write("Data(dd/mm/yyyy): "); DateTime data = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Valor do contrato: "); double valor = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Numero de parcelas: "); int numeroParcelas = int.Parse(Console.ReadLine()); Contract c = new Contract(numero, data, valor); ContractService servicoContrato = new ContractService(new PaypalService()); servicoContrato.ProcessarContrato(c, numeroParcelas); Console.WriteLine("\nParcelas:"); foreach (var parcela in c.Parcelas) { Console.WriteLine(parcela); } }
static void Main(string[] args) { Console.WriteLine("Enter contract data: "); Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime date = DateTime.Parse(Console.ReadLine()); Console.Write("Contract value: "); double value = double.Parse(Console.ReadLine()); Console.WriteLine("Enter number of installments: "); int month = int.Parse(Console.ReadLine()); Contract contract = new Contract(number, date, value); ContractService contractService = new ContractService(new PaypalServices()); contractService.ProcessContract(contract, month); Console.WriteLine("Installments: "); foreach (var item in contract.Installments) { Console.WriteLine($"{item.DueDate.ToString("dd/MM/yyyy")} - {item.Amount}"); } }
public void GenId_1() { var cs = new ContractService(); var r = cs.GenerateOptionContractCode(CoinRepo.Instance.CNY, Core.ContractType.货币, DateTime.Now, Core.OptionType.认购期权, ContractTimeSpanType.季); Assert.AreEqual("900000", r); }
public void GenName_2() { var c = new ContractService(); var r = c.GenerateOptionContractName(CoinRepo.Instance.BTC, new DateTime(2014, 12, 31), Core.OptionType.认沽期权, 3000); Assert.AreEqual("BTC20141231沽3000", r); }
static void Main(string[] args) { Console.WriteLine("Enter Contract Data: "); Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date: (dd/mm/yyyy) "); DateTime date = DateTime.Parse(Console.ReadLine()); Console.Write("Contract Value: "); double total = double.Parse(Console.ReadLine()); Console.Write("Enter Number Od Installments: "); int months = int.Parse(Console.ReadLine()); Contract contract = new Contract(number, date, total); ContractService myContract = new ContractService(new PaypalService()); myContract.ProcessContract(contract, months); Console.WriteLine("Instalments: "); foreach (Installment installment in contract.Installments) { Console.WriteLine(installment); } }
static void Main(string[] args) { Console.WriteLine("Enter contract data"); Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime date = DateTime.Parse(Console.ReadLine()); Console.Write("Contract value: "); double value = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter number of installments: "); int installments = int.Parse(Console.ReadLine()); ContractService contract = new ContractService(new Contract(number, date, value), installments, new PalpalService()); contract.ProcessContract(); Console.WriteLine(""); Console.WriteLine("Installments:"); foreach (Installment doc in contract.Compactar.Installments) { Console.WriteLine(doc.ToString()); } }
static void Main(string[] args) { Console.WriteLine("Entre com os dados do contrato"); Console.Write("Numero do contrato: "); int number = int.Parse(Console.ReadLine()); Console.Write("Data do contrato: "); DateTime date = DateTime.Parse(Console.ReadLine()); Console.Write("Valor do contrato: "); double value = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Contract contract = new Contract(number, date, value); Console.Write("Entre com o numero de parcelas: "); int month = int.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); ContractService contractService = new ContractService(new PayPolService()); contractService.ProcessContract(contract, month); Console.WriteLine( ); Console.WriteLine("Parcelamento"); foreach (Installment installment in contract.Installment) { Console.WriteLine(installment); } }
public WebApiResponse Versionlist() { try { LoanCaseVersionListApi api = new LoanCaseVersionListApi(); List <Contract> contractList = new ContractService().GetAllContract(); List <LoanCaseProjectDocumentApi> list = new List <LoanCaseProjectDocumentApi>(); foreach (Contract contract in contractList) { LoanCaseProjectDocumentApi ele = new LoanCaseProjectDocumentApi(); ele.Version = contract.VERSION; ele.DocumentHtml = contract.CONTENT; list.Add(ele); } api.VersionList = list; response.setResponse(api); } catch (Exception ex) { response.setErrorResponse(); if (testMode) { response.Message = ex.ToString(); } } return(response); }
private void LoadDGV() { try { _contractService = new ContractService(); List <ContractViewModel> contractVMs = _contractService.GetAllVMForList(); SortableBindingList <ContractViewModel> sbl = new SortableBindingList <ContractViewModel>(contractVMs); bs = new BindingSource(); bs.DataSource = sbl; adgv.DataSource = bs; adgv.Columns["Id"].Visible = false; adgv.Columns["ContractCode"].HeaderText = ADGVText.ContractCode; adgv.Columns["ContractCode"].Width = ControlsAttribute.GV_WIDTH_NORMAL; adgv.Columns["CustomerCode"].HeaderText = ADGVText.CustomerCode; adgv.Columns["CustomerCode"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; adgv.Columns["StartDate"].HeaderText = ADGVText.StartDate; adgv.Columns["StartDate"].Width = ControlsAttribute.GV_WIDTH_NORMAL; adgv.Columns["EndDate"].HeaderText = ADGVText.EndDate; adgv.Columns["EndDate"].Width = ControlsAttribute.GV_WIDTH_NORMAL; } catch (Exception ex) { throw; } finally { _contractService = null; } }
static public void Reject(Guid workflowId, Guid objectId, string upn, string rejectReason) { ContractService service = Runtime.GetService <ContractService>(); service.Reject(workflowId, objectId, upn, rejectReason); RunWorkflowInScheduler(workflowId); }
static void Main(string[] args) { var provider = "https://ropsten.infura.io/v3/'<PROJECT-ID>'"; var contractAddress = "0x6aB06024E4bc1841C7Aa82D6f0833D29343503a6"; var privateKey = "0x'<PRIVATE-KEY>'"; var abi = "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"newFact\",\"type\":\"string\"}],\"name\":\"add\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getFact\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"; ContractService contractService = new ContractService(provider, contractAddress, abi, privateKey); System.Console.WriteLine($"Stored facts in the contract: {contractService.GetTotalFacts()}"); System.Console.WriteLine("Press Any Key To Exit..."); System.Console.ReadLine(); var index = 0; System.Console.WriteLine(); System.Console.WriteLine($"Fact {index + 1}: {contractService.GetFact(index)}"); System.Console.WriteLine(); System.Console.WriteLine("Press Any Key To Exit..."); System.Console.WriteLine(); System.Console.ReadLine(); var fact = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; System.Console.WriteLine(); System.Console.WriteLine($"Transaction Hash: {contractService.AddFact(fact)}"); System.Console.WriteLine(); System.Console.WriteLine("Press Any Key To Exit..."); System.Console.WriteLine(); System.Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Enter contract data"); Console.Write("Number: "); int numero = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime data = DateTime.Parse(Console.ReadLine()); Console.Write("Contract value: "); double value = double.Parse(Console.ReadLine()); Contract contract = new Contract(numero, data, value); Console.WriteLine("Enter number of installments: "); int installments = int.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); ContractService contractService = new ContractService(new PaypalService()); contractService.ProcessContract(contract, installments); Console.WriteLine("Installments:"); foreach (Installment installment in contract.Installments) { Console.WriteLine(installment); } }
private ContractService CreateContractService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new ContractService(userId); return(service); }
static void Main(string[] args) { Console.WriteLine("Enter contract data"); Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime date = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Contract value: "); double value = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Contract contrato = new Contract(number, date, value); ContractService contractService = new ContractService(new PaypalService()); Console.Write("Enter number of installments: "); try { contractService.ProcessContract(contrato, int.Parse(Console.ReadLine())); } catch (Exception e) { Console.WriteLine("Erro: " + e.Message); } Console.WriteLine("Installments"); Console.WriteLine(contrato); }
static void Main(string[] args) { Console.WriteLine("Enter contract data: "); Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy):"); DateTime date = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Contract Value: "); double contractValue = double.Parse(Console.ReadLine()); Console.Write("Enter number of installments: "); int installments = int.Parse(Console.ReadLine()); Console.WriteLine("------------------------------------"); Contract contract = new Contract(number, date, contractValue); ContractService contractService = new ContractService(new PaypalService()); contractService.processContract(contract, installments); Console.WriteLine("Installments"); Console.WriteLine(contract); }
public async Task FinishContractTest() { var request = new FortnoxApiRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret); var response = ContractService.CreateContractAsync(request, new Contract { CustomerNumber = "1", InvoiceRows = new List <InvoiceRow>() { new InvoiceRow { ArticleNumber = "1", DeliveredQuantity = 1000, AccountNumber = 3001 } }, ContractDate = DateTime.Now, PeriodStart = DateTime.Now.AddDays(1), PeriodEnd = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1), }).GetAwaiter().GetResult(); Assert.AreEqual("1", response.CustomerNumber); var finishedContract = await ContractService.FinishContractAsync(request, response); Assert.IsNotNull(finishedContract); Assert.AreEqual(response.DocumentNumber, finishedContract.DocumentNumber); }
static void Main(string[] args) { Console.WriteLine("Enter contract data"); Console.Write("Number: "); int contractNumber = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime contractDate = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Contract value: "); double contractValue = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter number of installments: "); int months = int.Parse(Console.ReadLine()); Contract myContract = new Contract(contractNumber, contractDate, contractValue); // contstrutor do contrato ContractService contractService = new ContractService(new PaypalService()); /* aki a magica acontece, pois eu estou instancianod um ContratoService, indicando que o meio de pagamento utilizado * será o paypalservice, q é uma implementação da interface do IOnline PaymentService */ contractService.ProcessContract(myContract, months); Console.WriteLine("Parcelas:"); foreach (Installment installment in myContract.Installments) { Console.WriteLine(installment); } }
public void GetContractShouldReturnContractTest() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "Get_Contract") .Options; var job = new Job { Contract = new Contract { Name = "contract" }, }; Contract contract; using (var context = new ApplicationDbContext(options)) { context.Jobs.Add(job); context.SaveChanges(); IContractService service = new ContractService(context); contract = service.GetContract(job); } Assert.Equal(job.Contract, contract); }
static void Main(string[] args) { Console.WriteLine("Enter contract data"); Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime date = DateTime.Parse(Console.ReadLine()); Console.Write("Contract value: "); double value = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Enter the number of installments: "); int months = int.Parse(Console.ReadLine()); Contract contract = new Contract(number, date, value); ContractService contractService = new ContractService(new PaypalService()); contractService.ProcessContract(contract, months); Console.WriteLine("Installments:"); foreach (Installment installment in contract.Installments) { Console.WriteLine($"{installment.DueDate.ToString("dd/MM/yyyy")}" + $" - " + $"{installment.Amount.ToString("F2", CultureInfo.InvariantCulture)}"); } }
static void Main(string[] args) { Console.WriteLine("Enter contract data"); Console.Write("Number: "); int number = int.Parse(Console.ReadLine()); Console.Write("Date (dd/MM/yyyy): "); DateTime date = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Contract value: "); double valueContract = double.Parse(Console.ReadLine()); Console.Write("Enter number of installments: "); int numberParc = int.Parse(Console.ReadLine()); Contract contract = new Contract(number, date, valueContract); ContractService contractService = new ContractService(new PaymentService()); contractService.ProcessContract(contract, numberParc); Console.WriteLine("Installment: "); foreach (var installment in contract.Installment) { Console.WriteLine(installment); } Console.ReadKey(); }
static public void Cancel(Guid workflowId, Guid objectId, string upn) { ContractService service = Runtime.GetService <ContractService>(); service.Cancel(workflowId, objectId, upn); RunWorkflowInScheduler(workflowId); }
// // GET: /Contract/Edit/5 public ActionResult Edit(int id) { ContractService service = new ContractService(); Contract model = service.GetContractByID(new Contract() { Id = id }); model.ActionOperationType = EActionOperationType.Edit; this.LoadEditViewBag(model); return View("Create",model); }
public ActionResult Create(Contract model) { model.ActionOperationType = EActionOperationType.Create; if (ModelState.IsValid) { ContractService service = new ContractService(); service.Add(model); return RedirectToAction("Index"); } this.LoadEditViewBag(model); return View("Create",model); }
private PagedList<Contract> QueryListData(ContractSearch searchModel) { int recordCount = 0; int pageSize = ConstantManager.PageSize; ContractService service = new ContractService(); string Group = searchModel.IsAsc ? searchModel.SortBy : searchModel.SortBy + " Descending"; IList<Contract> allEntities = service.QueryByPage(this.GetSearchFilter(searchModel), Group, pageSize, searchModel.PageIndex + 1, out recordCount); var formCondition = "var condition=" + JsonConvert.SerializeObject(searchModel); return new PagedList<Contract>(allEntities, searchModel.PageIndex, pageSize, recordCount, "Id", "Id", formCondition); }
private void LoadEditViewBag(ProjectPlanCollection model) { ProjectPlanService projectplanService = new ProjectPlanService(); ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name",model.ProjectPlanId); ContractService contractService = new ContractService(); ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name",model.ContractId); OrgChartService orgchartService = new OrgChartService(); ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrgChartId); DataDictionaryService datadictionaryService = new DataDictionaryService(); ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name",model.BidTypeId); DepartmentService departmentService = new DepartmentService(); ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name",model.DepartmentId); EmployeeService employeeService = new EmployeeService(); ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.ResearchOwnerEmployeeId); ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.EngeerEmployeeId); ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.CostOwnerEmployeeId); ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.AuthorEmployeeId); ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrganizerEmployeeId); }
private void LoadSearchViewBag(ProjectPlanCollectionSearch searchModel) { #region sort ViewBag.IsAsc = !searchModel.IsAsc; ViewBag.SortBy = searchModel.SortBy; #endregion var projectplanService = new ProjectPlanService(); if (!searchModel.ProjectPlanId.HasValue) { ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ProjectPlanId); } var contractService = new ContractService(); if (!searchModel.ContractId.HasValue) { ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ContractId); } var orgchartService = new OrgChartService(); if (!searchModel.OrgChartId.HasValue) { ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrgChartId); } var datadictionaryService = new DataDictionaryService(); if (!searchModel.BidTypeId.HasValue) { ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.BidTypeId); } var departmentService = new DepartmentService(); if (!searchModel.DepartmentId.HasValue) { ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.DepartmentId); } var employeeService = new EmployeeService(); if (!searchModel.ResearchOwnerEmployeeId.HasValue) { ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ResearchOwnerEmployeeId); } if (!searchModel.EngeerEmployeeId.HasValue) { ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.EngeerEmployeeId); } if (!searchModel.CostOwnerEmployeeId.HasValue) { ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.CostOwnerEmployeeId); } if (!searchModel.AuthorEmployeeId.HasValue) { ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.AuthorEmployeeId); } if (!searchModel.OrganizerEmployeeId.HasValue) { ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name"); } else { ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrganizerEmployeeId); } }
public void MyTestInitialize() { _accountRepository = new Mock<IAccountRepository>(); _contactRepository = new Mock<IContactRepository>(); _contractRepository = new Mock<IContractRepository>(); _planRepository = new Mock<IPlanRepository>(); _generator = new Mock<INumberGeneratorService>(); _companyRepository = new Mock<ICompanyRepository>(); _agentRepository = new Mock<IAgentRepository>(); _customFeeRepository = new Mock<ICustomFeeRepository>(); _activityService = new Mock<IActivityLoggingService>(); _importManager = new Mock<Import.ICallDataImportManager>(); _dateTime = new Mock<IDateTimeFacade>(); _today = DateTime.Parse("2008-10-11"); _dateTime.ExpectGet(p => p.Today).Returns(_today); _service = new ContractService(_contractRepository.Object, _accountRepository.Object, _planRepository.Object, _contactRepository.Object, _companyRepository.Object, _agentRepository.Object, _activityService.Object, _generator.Object, _importManager.Object, _customFeeRepository.Object, _dateTime.Object); updateRequest = new UpdateContractRequest { ContractId = 1, PlanId = 1, ActivationDate = DateTime.Parse("12/11/2008"), EndDate = DateTime.Parse("12/11/2009"), UsedBy = "Michael", Pin = "6666", Puk = "6666", PhoneNumber1 = "012344394", PhoneNumber2 = "430493304", PhoneNumber3 = "324433344", PhoneNumber4 = "443343433", HomeAddress = GetAddress(), DeliveryAddress = GetAddress(), AccountName = "Test Account", AccountPassword = "" }; }
public void MyTestInitialize() { service = new ContractService(); updateRequest = new UpdateContractRequest() { ContractId = 1, PlanId = 2, ActivationDate = DateTime.Parse("12/11/2008"), EndDate = DateTime.Parse("12/11/2009"), UsedBy = "Michael", Pin = "6666", Puk = "6666", PhoneNumber1 = "012344394", PhoneNumber2 = "430493304", PhoneNumber3 = "324433344", PhoneNumber4 = "443343433", }; }
public ContractController() { _validationDictionary = new ModelStateWrapper(ModelState); _contractService = new ContractService(_validationDictionary); _userFasade = new UserFacade(_validationDictionary); }