public void AllPlayersCanSetCardAndLobbyStafeIs3() { DeckSettings deckSettings = new DeckSettings(); var contractMapper = new ContractMapper(); ILobby lobby = new Lobby(4, GameType.Usual); string[] tokens = { "1", "2", "3", "4" }; foreach (var token in tokens) { lobby.Add(token, token); } var createdPlayers = lobby.Players; var secondPlayer = createdPlayers[1]; var thirdPlayer = createdPlayers[2]; var fourthPlayer = createdPlayers[3]; var mainPlayer = createdPlayers.SingleOrDefault(player => player.Token.Equals(lobby.MainPlayer)); lobby.SetCard(mainPlayer.Cards[0], "ok", mainPlayer.Token); foreach (var createdPlayer in createdPlayers) { contractMapper.MapToStageData(createdPlayer.Token, lobby); } lobby.SetCard(secondPlayer.Cards[0], secondPlayer.Token); lobby.SetCard(thirdPlayer.Cards[0], thirdPlayer.Token); lobby.SetCard(fourthPlayer.Cards[0], fourthPlayer.Token); Assert.IsTrue(lobby.Stage.Equals(3)); }
public void VoteResultTest() { DeckSettings deckSettings = new DeckSettings(); var contractMapper = new ContractMapper(); ILobby lobby = new Lobby(4, GameType.Usual); string[] tokens = { "1", "2", "3", "4" }; foreach (var token in tokens) { lobby.Add(token, token); } var createdPlayers = lobby.Players; var secondPlayer = createdPlayers[1]; var thirdPlayer = createdPlayers[2]; var fourthPlayer = createdPlayers[3]; var mainPlayer = createdPlayers.SingleOrDefault(player => player.Token.Equals(lobby.MainPlayer)); lobby.SetCard(mainPlayer.Cards[0], "ok", mainPlayer.Token); foreach (var createdPlayer in createdPlayers) { contractMapper.MapToStageData(createdPlayer.Token, lobby); } lobby.SetCard(secondPlayer.Cards[0], secondPlayer.Token); lobby.SetCard(thirdPlayer.Cards[0], thirdPlayer.Token); lobby.SetCard(fourthPlayer.Cards[0], fourthPlayer.Token); lobby.SetCard(lobby.Players[0].Card, secondPlayer.Token); lobby.SetCard(lobby.Players[1].Card, thirdPlayer.Token); lobby.SetCard(lobby.Players[2].Card, fourthPlayer.Token); Assert.IsTrue(lobby.VoteResults.Where(result => result.Count.Equals(1)).Count().Equals(3)); }
/// <see cref="Employees.Core.Employee.IEmployeeRepository.GetEmployee(int)" public async Task <ICollection <EmployeeTO> > GetEmployee(int?IdEmployee = null) { ContractMapper mapper = new ContractMapper(); //Get employees list from data source ICollection <EmployeeTO> employees = await EmployeeIntegrationDAO.GetAllEmployees(); //Find employe by id employees = (from emp in employees where IdEmployee == null ? emp.Id != null : emp.Id.Equals(IdEmployee) select emp).ToList(); List <EmployeeTO> EmployeesFactory = new List <EmployeeTO>(); // Method signature: Parallel.ForEach(IEnumerable<TSource> source, Action<TSource> body) Parallel.ForEach(employees, (currentEmployee) => { //select factory var Employee = new GeneralEmployeFactory().GetEmployee(NameSpaceFactoryUrl + currentEmployee.ContractTypeName); //init factory whit data Employee = mapper.MapRequestToExpected(Employee, currentEmployee, typeof(Employee)) as Employee; //calc AnnualSalary Employee.CalcAnnualSalary(); currentEmployee = mapper.MapResponseToExpected(Employee, typeof(Employee), typeof(EmployeeTO)) as EmployeeTO; EmployeesFactory.Add(currentEmployee); }); return(EmployeesFactory); }
public void SetCardWhenArgumentsAreOk() { DeckSettings deckSettings = new DeckSettings(); var contractMapper = new ContractMapper(); ILobby lobby = new Lobby(4, GameType.Usual); string[] tokens = { "1", "2", "3", "4" }; foreach (var token in tokens) { lobby.Add(token, token); } var createdPlayers = lobby.Players; var secondPlayer = createdPlayers[1]; var mainPlayer = createdPlayers.SingleOrDefault(player => player.Token.Equals(lobby.MainPlayer)); lobby.SetCard(mainPlayer.Cards[0], "ok", mainPlayer.Token); Assert.IsTrue(lobby.Text.Equals("ok") && mainPlayer.Ready.Equals(true)); foreach (var createdPlayer in createdPlayers) { contractMapper.MapToStageData(createdPlayer.Token, lobby); } lobby.SetCard(secondPlayer.Cards[0], secondPlayer.Token); Assert.IsTrue(lobby.Stage.Equals(2)); Assert.IsTrue(secondPlayer.Ready && !secondPlayer.Card.Equals(0) && !secondPlayer.Cards.Contains(secondPlayer.Card) && secondPlayer.Cards.Count.Equals(5)); }
public void CalculatePointsWhenAllPlayersChooseMainCard() { DeckSettings deckSettings = new DeckSettings(); var contractMapper = new ContractMapper(); ILobby lobby = new Lobby(4, GameType.Usual); string[] tokens = { "1", "2", "3", "4" }; foreach (var token in tokens) { lobby.Add(token, token); } var createdPlayers = lobby.Players; var secondPlayer = createdPlayers[1]; var thirdPlayer = createdPlayers[2]; var fourthPlayer = createdPlayers[3]; var mainPlayer = createdPlayers.SingleOrDefault(player => player.Token.Equals(lobby.MainPlayer)); lobby.SetCard(mainPlayer.Cards[0], "ok", mainPlayer.Token); foreach (var createdPlayer in createdPlayers) { contractMapper.MapToStageData(createdPlayer.Token, lobby); } lobby.SetCard(secondPlayer.Cards[0], secondPlayer.Token); lobby.SetCard(thirdPlayer.Cards[0], thirdPlayer.Token); lobby.SetCard(fourthPlayer.Cards[0], fourthPlayer.Token); lobby.SetCard(lobby.Players[0].Card, secondPlayer.Token); lobby.SetCard(lobby.Players[0].Card, thirdPlayer.Token); lobby.SetCard(lobby.Players[0].Card, fourthPlayer.Token); Thread.Sleep(1000); Assert.IsTrue(lobby.Scores.All(score => score.Points.Equals(0))); }
public string GetCode() { var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(Request.Form["code"]); var mapper = new ContractMapper(); Contract c; try { c = mapper.MapXmlDocumentToContract(xmlDocument); if (c == null) { return("Contract was not found! Make sure you are using the Contract block as a root of your contract"); } } catch (Exception e) { return("Error ocurred during deserialization your workspace\n" + e.Message); } try { return(c.GenerateCode(new Indentation())); } catch (Exception e) { return("Error ocurred during generating code of your contract\n" + e.Message); } }
public void SutIsContractMapper(ContractMapper sut) { // Fixture setup // Exercise system // Verify outcome Assert.IsAssignableFrom<IContractMapper>(sut); // Teardown }
public void SutIsContractMapper(ContractMapper sut) { // Fixture setup // Exercise system // Verify outcome Assert.IsAssignableFrom <IContractMapper>(sut); // Teardown }
public void MapNullProductsWillThrow(ContractMapper sut) { // Fixture setup // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.Map((IEnumerable <Product>)null).ToList()); // Teardown }
public void MapNullProductWillThrow(ContractMapper sut) { // Fixture setup // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => sut.Map((Product)null)); // Teardown }
public void MapNullMoneyContractWillThrow(ContractMapper sut) { // Fixture setup // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.Map((MoneyContract)null)); // Teardown }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["employeeId"] != null && Request.QueryString["type"] != null) { string content = ""; string strings = Convert.ToString(Request.QueryString["employeeId"]); List<string> list = strings.Split(',').ToList(); if (Request.QueryString["type"] == "newContract") { foreach (string s in list) { if (!s.StartsWith("0")) { ContractEntity ent = new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = Convert.ToInt32(s) }); foreach (ContractContentEntity cce in new ContractMapper().ListLastContractsContents(ent)) { content += cce.Content; content += "<p style='page-break-before: always'>"; } } } Response.Write(content); } else if (Request.QueryString["type"] == "newAmandament") { foreach (string s in list) { if (!s.StartsWith("0")) { content += new AmandamentMapper() .GetLastAmandament ( new AmandamentEntity() { ContractNumber = new ContractMapper() .GetLastContract(new ContractEntity() { EmployeeId = Convert.ToInt32(s) }).ContractNumber } ).Content.Content; content += "<p style='page-break-before: always'>"; } } content = content.Replace("/ckfinder/userfiles/images/", "/HRM/ckfinder/userfiles/images/"); Response.Write(content); } else { Response.Redirect("List.aspx"); } } else { Response.Redirect("List.aspx"); } }
public bool Update(ContractModel contractModel) { return(LogIfOperationFailed(() => { Contract contract = ContractMapper.ConvertModelToEntity(contractModel); _unitOfWork.ContractRepository.InsertOrUpdate(contract); _unitOfWork.Commit(); return true; }, Resources.ExceptionGetForAllProviders, "Provider")); }
public void MapMoneyWillReturnCorrectResult(Money money, ContractMapper sut) { // Fixture setup var expectedContract = money.AsSource().OfLikeness<MoneyContract>(); // Exercise system MoneyContract result = sut.Map(money); // Verify outcome Assert.True(expectedContract.Equals(result)); // Teardown }
public void MapMoneyContractWillReturnCorrectResult(MoneyContract contract, ContractMapper sut) { // Fixture setup var expectedMoney = new Money(contract.Amount, contract.CurrencyCode); // Exercise system Money result = sut.Map(contract); // Verify outcome Assert.Equal(expectedMoney, result); // Teardown }
public void MapProductWillReturnCorrectResult(Product product, ContractMapper sut) { // Fixture setup var expectedContract = product.AsSource().OfLikeness<ProductContract>() .With(d => d.UnitPrice).EqualsWhen((s, d) => s.UnitPrice.AsSource().OfLikeness<MoneyContract>().Equals(d.UnitPrice)); // Exercise system ProductContract result = sut.Map(product); // Verify outcome Assert.True(expectedContract.Equals(result)); // Teardown }
public void MapMoneyWillReturnCorrectResult(Money money, ContractMapper sut) { // Fixture setup var expectedContract = money.AsSource().OfLikeness <MoneyContract>(); // Exercise system MoneyContract result = sut.Map(money); // Verify outcome Assert.True(expectedContract.Equals(result)); // Teardown }
public void MapProductWillReturnCorrectResult(Product product, ContractMapper sut) { // Fixture setup var expectedContract = product.AsSource().OfLikeness <ProductContract>() .With(d => d.UnitPrice).EqualsWhen((s, d) => s.UnitPrice.AsSource().OfLikeness <MoneyContract>().Equals(d.UnitPrice)); // Exercise system ProductContract result = sut.Map(product); // Verify outcome Assert.True(expectedContract.Equals(result)); // Teardown }
public async Task Poll(string exchangeName, TimeSpan timeout) { var tokenSource = new CancellationTokenSource(timeout); var watch = new Stopwatch(); var requestDuration = 0; Exception exception = null; ExchangeHealthControlReportType type; //request positions state try { watch.Start(); var requestResult = await _exchangeConnectorService.GetOpenedPositionAsync(exchangeName, tokenSource.Token); requestDuration = (int)watch.ElapsedMilliseconds; type = requestResult == null ? ExchangeHealthControlReportType.NoPositionData : ExchangeHealthControlReportType.Ok; } catch (OperationCanceledException ex) { exception = ex; type = ExchangeHealthControlReportType.ExceptionRased; } catch (Exception ex) { exception = ex; type = ExchangeHealthControlReportType.ExceptionRased; if (!_warningCache.TryGetValue(exchangeName, out var lastWarning) || DateTime.UtcNow.Subtract(lastWarning).TotalSeconds > _failMessageThrottlingPeriodSec) { _warningCache.AddOrUpdate(exchangeName, DateTime.UtcNow, (e, t) => DateTime.UtcNow); await _log.WriteWarningAsync(nameof(ExchangeHealthControlService), nameof(Poll), $"Exception occured while polling {exchangeName}.", ex, DateTime.UtcNow); } } var report = new ExchangeHealthControlResult( exchangeName, requestDuration, type.ToString(), exception, type == ExchangeHealthControlReportType.Ok); //push result to the rabbit (to be consumed by Hedging) await _exchangeHealthControlReportPublisher.Publish(ContractMapper.Map <ExchangeHealthControlReport>(report)); //write statistic to table await _exchangeHealthControlResultRepository.InsertOrUpdateAsync(report); }
public List <ContractModel> GetAllContracts() { return(LogIfOperationFailed(() => { var contractEntity = _unitOfWork.ContractRepository.GetAll; var ContractModelList = new List <ContractModel>(); // ToDo:Need to implement Automapper contractEntity.ToList().ForEach(m => { ContractModelList.Add(ContractMapper.ConvertEntityToModel(m)); }); return ContractModelList; }, Resources.ExceptionGetForAllProviders, "Provider")); }
public ContractModel GetContract(int id) { return(LogIfOperationFailed(() => { var contractEntity = _unitOfWork.ContractRepository.Find(id); //ToDo:Need to implement Automapper ContractModel contractModel = ContractMapper.ConvertEntityToModel(contractEntity); return contractModel; }, Resources.ExceptionGetProvider, id)); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ContractNumber"] != null) { if (!IsPostBack) { CKEditor1.config.toolbar = new object[] { new object[] { "Print" } }; Entities.ContractEntity contract = new ContractMapper().GetByLanguageId(new Entities.ContractEntity() { ContractNumber = Convert.ToString(Server.HtmlDecode(Request.QueryString["ContractNumber"])) }, 1); CKEditor1.Text = contract.Content.Content; ContractNumberLabel.InnerText = contract.ContractNumber; ContractTypeLabel.InnerText = contract.ContractTemplateTitle; OrganizationaUnitLabel.InnerText = contract.OrganizationalUnitTitle; JobCodeLabel.InnerText = contract.JobCode; JobTitleLabel.InnerText = contract.JobTitle; GradeIdLabel.InnerText = contract.GradeId; GradeKCBLabel.InnerText = contract.GradeKCB.ToString("0.00"); GradeEntryLabel.InnerText = contract.GradeEntry.ToString("0.00"); StepLabel.InnerText = contract.StepId; StepEntryLabel.InnerText = contract.StepEntry.ToString("0.00"); GrossValueLabel.InnerText = contract.GrossValue.ToString("0.00"); StartDateLabel.InnerText = contract.StartDate.ToString("dd.MM.yyyy"); if (contract.EndDate != null) { EndDateLabel.InnerText = ((DateTime)contract.EndDate).ToString("dd.MM.yyyy"); } OfficiallyApprovedDateLabel.InnerText = contract.OfficiallyApprovedDate.ToString("dd.MM.yyyy"); ContractStatusLabel.InnerText = contract.Status.ToString(); } } else { Response.Redirect("List.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ContractNumber"] != null) { if (!IsPostBack) { CKEditor1.config.toolbar = new object[] { new object[] { "Print"} }; Entities.ContractEntity contract = new ContractMapper().GetByLanguageId(new Entities.ContractEntity(){ ContractNumber = Convert.ToString(Server.HtmlDecode(Request.QueryString["ContractNumber"]))}, 1); CKEditor1.Text = contract.Content.Content; ContractNumberLabel.InnerText = contract.ContractNumber; ContractTypeLabel.InnerText = contract.ContractTemplateTitle; OrganizationaUnitLabel.InnerText = contract.OrganizationalUnitTitle; JobCodeLabel.InnerText = contract.JobCode; JobTitleLabel.InnerText = contract.JobTitle; GradeIdLabel.InnerText = contract.GradeId; GradeKCBLabel.InnerText = contract.GradeKCB.ToString("0.00"); GradeEntryLabel.InnerText = contract.GradeEntry.ToString("0.00"); StepLabel.InnerText = contract.StepId; StepEntryLabel.InnerText = contract.StepEntry.ToString("0.00"); GrossValueLabel.InnerText = contract.GrossValue.ToString("0.00"); StartDateLabel.InnerText = contract.StartDate.ToString("dd.MM.yyyy"); if (contract.EndDate != null) { EndDateLabel.InnerText = ((DateTime)contract.EndDate).ToString("dd.MM.yyyy"); } OfficiallyApprovedDateLabel.InnerText = contract.OfficiallyApprovedDate.ToString("dd.MM.yyyy"); ContractStatusLabel.InnerText = contract.Status.ToString(); } } else { Response.Redirect("List.aspx"); } }
protected void ProceedButton_Click(object sender, EventArgs e) { string strings = jsfields.Value; StringBuilder stb = new StringBuilder(); stb.Append("employeeId="); stb.Append(strings); List <string> list = strings.Split(',').ToList(); foreach (string s in list) { if (!s.StartsWith("0")) { int i = Convert.ToInt32(s); EmployeeView employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(s) }); ContractEntity lastContract = new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = employeeView.Id }); #warning change the 1 value parameter of getContentById ContractTemplateEntity cte = new ContractTemplateMapper().GetContentById(Convert.ToInt32(ContractTemplateDropDownList.SelectedValue), 1); JobDetailsSessionView jsv = new JobDetailsSessionView(); CurrentJobDetailsEntity cjde = new CurrentJobDetailsMapper().Get(new CurrentJobDetailsEntity() { EmployeeId = employeeView.Id, ContractNumber = (employeeView.Id + " / " + cte.Preffix) }); jsv.FunctionalLevel.Id = cjde.FunctionalLevelId; jsv.FunctionalLevel.Title = cjde.FunctionalLevelTitle; jsv.Grade.Id = cjde.GradeId; jsv.Grade = new GradeMapper().Get(jsv.Grade); jsv.Job.Code = cjde.JobCode; jsv.Job.Title = cjde.JobTitle; jsv.OrganisationalUnit.Id = cjde.OrganizationalUnitId; jsv.OrganisationalUnit.Title = cjde.OrganizationalUnitTitle; jsv.Step.Id = cjde.StepId; #warning changed review and edit //jsv.Step.Entry = cjde.StepEntry; if (RadioButtonList1.SelectedItem.Value != "1") { AmandamentTemplateEntity amte = new AmandamentTemplateMapper().GetContentById(Convert.ToInt32(RadioButtonList1.SelectedValue), null); AmandamentEntity am = new AmandamentEntity(cjde); am.Status = StatusEnum.Active; am.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(amte.Content, jsv, employeeView); am.ContractNumber = cjde.ContractNumber; am.Content.Content = am.Content.Content.Replace(@"{#ContractNumber}", am.ContractNumber); new AmandamentMapper().Insert(am, employeeView.Id); } else { ContractEntity ct = new ContractEntity(cjde, employeeView); ct.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(cte.Content, jsv, employeeView); string dt = DateTime.Now.ToString("dd.MM.yyyy"); dt = dt.Replace(".", ""); ct.ContractNumber = (employeeView.EmployeeNo.Replace("AKP", "") + " / " + cte.Preffix + " / " + dt); ct.Status = StatusEnum.Active; ct.ContractStatus = ContractStatus.Aproved; ct.OfficiallyApprovedDate = DateTime.Now; ct.ContractTemplateTitle = cte.Preffix; ct.Content.Content = ct.Content.Content.Replace(@"{#ContractNumber}", ct.ContractNumber); new ContractMapper().Insert(ct); new ContractMapper().UpdatePreviousContract(new ContractEntity() { ContractNumber = lastContract.ContractNumber, NextContractNumber = ct.ContractNumber, ContractStatus = Entities.ContractStatus.Changed }); } } } if (RadioButtonList1.SelectedItem.Value != "1") { Response.Redirect("Print.aspx?" + stb + "&type=newAmandament"); } else { Response.Redirect("Print.aspx?" + stb + "&type=newContract"); } }
private void ConfigureMapping() { ContractMapper.Configure(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["employeeId"] != null && Request.QueryString["type"] != null) { string content = ""; string strings = Convert.ToString(Request.QueryString["employeeId"]); List <string> list = strings.Split(',').ToList(); if (Request.QueryString["type"] == "newContract") { foreach (string s in list) { if (!s.StartsWith("0")) { ContractEntity ent = new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = Convert.ToInt32(s) }); foreach (ContractContentEntity cce in new ContractMapper().ListLastContractsContents(ent)) { content += cce.Content; content += "<p style='page-break-before: always'>"; } } } Response.Write(content); } else if (Request.QueryString["type"] == "newAmandament") { foreach (string s in list) { if (!s.StartsWith("0")) { content += new AmandamentMapper() .GetLastAmandament ( new AmandamentEntity() { ContractNumber = new ContractMapper() .GetLastContract(new ContractEntity() { EmployeeId = Convert.ToInt32(s) }).ContractNumber } ).Content.Content; content += "<p style='page-break-before: always'>"; } } content = content.Replace("/ckfinder/userfiles/images/", "/HRM/ckfinder/userfiles/images/"); Response.Write(content); } else { Response.Redirect("List.aspx"); } } else { Response.Redirect("List.aspx"); } }
protected void ProceedButton_Click(object sender, EventArgs e) { string strings = jsfields.Value; StringBuilder stb = new StringBuilder(); stb.Append("employeeId="); stb.Append(strings); List<string> list = strings.Split(',').ToList(); foreach (string s in list) { if (!s.StartsWith("0")) { int i = Convert.ToInt32(s); EmployeeView employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(s) }); ContractEntity lastContract = new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = employeeView.Id }); #warning change the 1 value parameter of getContentById ContractTemplateEntity cte = new ContractTemplateMapper().GetContentById(Convert.ToInt32(ContractTemplateDropDownList.SelectedValue), 1); JobDetailsSessionView jsv = new JobDetailsSessionView(); CurrentJobDetailsEntity cjde = new CurrentJobDetailsMapper().Get(new CurrentJobDetailsEntity() { EmployeeId = employeeView.Id, ContractNumber = (employeeView.Id + " / " + cte.Preffix) }); jsv.FunctionalLevel.Id = cjde.FunctionalLevelId; jsv.FunctionalLevel.Title = cjde.FunctionalLevelTitle; jsv.Grade.Id = cjde.GradeId; jsv.Grade = new GradeMapper().Get(jsv.Grade); jsv.Job.Code = cjde.JobCode; jsv.Job.Title = cjde.JobTitle; jsv.OrganisationalUnit.Id = cjde.OrganizationalUnitId; jsv.OrganisationalUnit.Title = cjde.OrganizationalUnitTitle; jsv.Step.Id = cjde.StepId; #warning changed review and edit //jsv.Step.Entry = cjde.StepEntry; if (RadioButtonList1.SelectedItem.Value != "1") { AmandamentTemplateEntity amte = new AmandamentTemplateMapper().GetContentById(Convert.ToInt32(RadioButtonList1.SelectedValue), null); AmandamentEntity am = new AmandamentEntity(cjde); am.Status = StatusEnum.Active; am.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(amte.Content, jsv, employeeView); am.ContractNumber = cjde.ContractNumber; am.Content.Content = am.Content.Content.Replace(@"{#ContractNumber}", am.ContractNumber); new AmandamentMapper().Insert(am, employeeView.Id); } else { ContractEntity ct = new ContractEntity(cjde, employeeView); ct.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(cte.Content, jsv, employeeView); string dt = DateTime.Now.ToString("dd.MM.yyyy"); dt = dt.Replace(".", ""); ct.ContractNumber = (employeeView.EmployeeNo.Replace("AKP", "") + " / " + cte.Preffix + " / " + dt); ct.Status = StatusEnum.Active; ct.ContractStatus = ContractStatus.Aproved; ct.OfficiallyApprovedDate = DateTime.Now; ct.ContractTemplateTitle = cte.Preffix; ct.Content.Content = ct.Content.Content.Replace(@"{#ContractNumber}", ct.ContractNumber); new ContractMapper().Insert(ct); new ContractMapper().UpdatePreviousContract(new ContractEntity() { ContractNumber = lastContract.ContractNumber, NextContractNumber = ct.ContractNumber, ContractStatus = Entities.ContractStatus.Changed }); } } } if (RadioButtonList1.SelectedItem.Value != "1") { Response.Redirect("Print.aspx?" + stb + "&type=newAmandament"); } else { Response.Redirect("Print.aspx?" + stb + "&type=newContract"); } }
protected void ProceedButton_Click(object sender, EventArgs e) { string strings = jsfields.Value; StringBuilder stb = new StringBuilder(); stb.Append("employeeId="); stb.Append(strings); List <string> list = strings.Split(',').ToList(); DateTime startdt; DateTime enddt; DateTime.TryParseExact(StartDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out startdt); DateTime.TryParseExact(EndDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out enddt); foreach (string s in list) { if (!s.StartsWith("0")) { int i = Convert.ToInt32(s); EmployeeView employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(s) }); ContractEntity lastContract = new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = employeeView.Id }); #warning change the 1 value parameter of getContentById ContractTemplateEntity cte = new ContractTemplateMapper().GetContentById(Convert.ToInt32(ContractTemplateDropDownList.SelectedValue), 1); JobDetailsSessionView jsv = new JobDetailsSessionView(); CurrentJobDetailsEntity cjde = new CurrentJobDetailsMapper().Get(new CurrentJobDetailsEntity() { EmployeeId = employeeView.Id, ContractNumber = (employeeView.Id + " / " + cte.Preffix) }); jsv.FunctionalLevel.Id = cjde.FunctionalLevelId; jsv.FunctionalLevel.Title = cjde.FunctionalLevelTitle; jsv.Grade.Id = cjde.GradeId; jsv.Grade = new GradeMapper().Get(jsv.Grade); jsv.Job.Code = cjde.JobCode; jsv.Job.Title = cjde.JobTitle; jsv.OrganisationalUnit.Id = cjde.OrganizationalUnitId; jsv.OrganisationalUnit.Title = cjde.OrganizationalUnitTitle; #warning changed review and edit jsv.Step.Id = cjde.StepId; //jsv.Step.Entry = cjde.StepEntry; if (RadioButtonList1.SelectedItem.Value != "1") { AmandamentTemplateEntity amte = new AmandamentTemplateMapper().GetContentById(Convert.ToInt32(RadioButtonList1.SelectedValue), null); AmandamentEntity am = new AmandamentEntity(cjde); am.Status = StatusEnum.Active; am.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(amte.Content, jsv, employeeView); am.ContractNumber = cjde.ContractNumber; am.Content.Content = am.Content.Content.Replace(@"{#ContractNumber}", am.ContractNumber); am.StartDate = startdt; #warning check for contract type Probation if this is first contract it is probation and also check if it is special contract if (enddt != null) { am.EndDate = enddt; am.Type = ContractType.Limited; TimeSpan span = am.EndDate.Value.Subtract(am.StartDate); double years = span.TotalDays / 365; if (years > 10) { StringBuilder sb = new StringBuilder(); sb.Append("<script language='javascript'>displayNoty('The amandment that is not for idifinite period cannot be for more than 10 years.');</script>"); // if the script is not already registered if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup")) { ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString()); } return; } } else { am.Type = ContractType.Permanent; } new AmandamentMapper().Insert(am, employeeView.Id); } else { ContractEntity ct = new ContractEntity(cjde, employeeView); ct.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(cte.Content, jsv, employeeView); string dt = DateTime.Now.ToString("dd.MM.yyyy"); dt = dt.Replace(".", ""); ct.ContractNumber = (employeeView.EmployeeNo.Replace("AKP", "") + " / " + cte.Preffix + " / " + dt); ct.Status = StatusEnum.Active; ct.ContractStatus = ContractStatus.Aproved; ct.OfficiallyApprovedDate = DateTime.Now; ct.ContractTemplateTitle = cte.Preffix; ct.Content.Content = ct.Content.Content.Replace(@"{#ContractNumber}", ct.ContractNumber); ct.StartDate = startdt; if (enddt != null) { ct.EndDate = enddt; ct.Type = ContractType.Limited; TimeSpan span = ct.EndDate.Value.Subtract(ct.StartDate); double years = span.TotalDays / 365; if (years > 10) { StringBuilder sb = new StringBuilder(); sb.Append("<script language='javascript'>displayNoty('The contract that is not for idifinite period cannot be for more than 10 years.');</script>"); // if the script is not already registered if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup")) { ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString()); } return; } } else { ct.Type = ContractType.Permanent; } #warning bug please check //new ContractMapper().Insert(ct); #warning this dosent exists why //new ContractMapper().UpdatePreviousContract(new ContractEntity() { ContractNumber = lastContract.ContractNumber, NextContractNumber = ct.ContractNumber, ContractStatus = Entities.ContractStatus.Changed, Status = StatusEnum.Pasive }); } } } if (RadioButtonList1.SelectedItem.Value != "1") { Response.Redirect("Print.aspx?" + stb + "&type=newAmandament"); } else { Response.Redirect("Print.aspx?" + stb + "&type=newContract"); } }
public LobbyController(ILobbyManager lobbyManager, ContractMapper contractMapper) { _lobbyManager = lobbyManager; _contractMapper = contractMapper; }
protected void ProceedButton_Click(object sender, EventArgs e) { string strings = jsfields.Value; StringBuilder stb = new StringBuilder(); stb.Append("employeeId="); stb.Append(strings); List<string> list = strings.Split(',').ToList(); DateTime startdt; DateTime enddt; DateTime.TryParseExact(StartDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out startdt); DateTime.TryParseExact(EndDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out enddt); foreach (string s in list) { if (!s.StartsWith("0")) { int i = Convert.ToInt32(s); EmployeeView employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(s) }); ContractEntity lastContract = new ContractMapper().GetLastContract(new ContractEntity() { EmployeeId = employeeView.Id }); #warning change the 1 value parameter of getContentById ContractTemplateEntity cte = new ContractTemplateMapper().GetContentById(Convert.ToInt32(ContractTemplateDropDownList.SelectedValue), 1); JobDetailsSessionView jsv = new JobDetailsSessionView(); CurrentJobDetailsEntity cjde = new CurrentJobDetailsMapper().Get(new CurrentJobDetailsEntity() { EmployeeId = employeeView.Id, ContractNumber = (employeeView.Id + " / " + cte.Preffix) }); jsv.FunctionalLevel.Id = cjde.FunctionalLevelId; jsv.FunctionalLevel.Title = cjde.FunctionalLevelTitle; jsv.Grade.Id = cjde.GradeId; jsv.Grade = new GradeMapper().Get(jsv.Grade); jsv.Job.Code = cjde.JobCode; jsv.Job.Title = cjde.JobTitle; jsv.OrganisationalUnit.Id = cjde.OrganizationalUnitId; jsv.OrganisationalUnit.Title = cjde.OrganizationalUnitTitle; #warning changed review and edit jsv.Step.Id = cjde.StepId; //jsv.Step.Entry = cjde.StepEntry; if (RadioButtonList1.SelectedItem.Value != "1") { AmandamentTemplateEntity amte = new AmandamentTemplateMapper().GetContentById(Convert.ToInt32(RadioButtonList1.SelectedValue), null); AmandamentEntity am = new AmandamentEntity(cjde); am.Status = StatusEnum.Active; am.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(amte.Content, jsv, employeeView); am.ContractNumber = cjde.ContractNumber; am.Content.Content = am.Content.Content.Replace(@"{#ContractNumber}", am.ContractNumber); am.StartDate = startdt; #warning check for contract type Probation if this is first contract it is probation and also check if it is special contract if (enddt != null) { am.EndDate = enddt; am.Type = ContractType.Limited; TimeSpan span = am.EndDate.Value.Subtract(am.StartDate); double years = span.TotalDays / 365; if (years > 10) { StringBuilder sb = new StringBuilder(); sb.Append("<script language='javascript'>displayNoty('The amandment that is not for idifinite period cannot be for more than 10 years.');</script>"); // if the script is not already registered if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup")) ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString()); return; } } else { am.Type = ContractType.Permanent; } new AmandamentMapper().Insert(am, employeeView.Id); } else { ContractEntity ct = new ContractEntity(cjde, employeeView); ct.Content.Content = new GUIHelper().ReplaceTemplateContractWithConcreteContract(cte.Content, jsv, employeeView); string dt = DateTime.Now.ToString("dd.MM.yyyy"); dt = dt.Replace(".", ""); ct.ContractNumber = (employeeView.EmployeeNo.Replace("AKP", "") + " / " + cte.Preffix + " / " + dt); ct.Status = StatusEnum.Active; ct.ContractStatus = ContractStatus.Aproved; ct.OfficiallyApprovedDate = DateTime.Now; ct.ContractTemplateTitle = cte.Preffix; ct.Content.Content = ct.Content.Content.Replace(@"{#ContractNumber}", ct.ContractNumber); ct.StartDate = startdt; if (enddt != null) { ct.EndDate = enddt; ct.Type = ContractType.Limited; TimeSpan span = ct.EndDate.Value.Subtract(ct.StartDate); double years = span.TotalDays / 365; if (years > 10) { StringBuilder sb = new StringBuilder(); sb.Append("<script language='javascript'>displayNoty('The contract that is not for idifinite period cannot be for more than 10 years.');</script>"); // if the script is not already registered if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "HeyPopup")) ClientScript.RegisterClientScriptBlock(Page.GetType(), "HeyPopup", sb.ToString()); return; } } else { ct.Type = ContractType.Permanent; } #warning bug please check //new ContractMapper().Insert(ct); #warning this dosent exists why //new ContractMapper().UpdatePreviousContract(new ContractEntity() { ContractNumber = lastContract.ContractNumber, NextContractNumber = ct.ContractNumber, ContractStatus = Entities.ContractStatus.Changed, Status = StatusEnum.Pasive }); } } } if (RadioButtonList1.SelectedItem.Value != "1") { Response.Redirect("Print.aspx?" + stb + "&type=newAmandament"); } else { Response.Redirect("Print.aspx?" + stb + "&type=newContract"); } }
public MappingTest() { ContractMapper.Configure(); }