public SaveSolution Update(SaveSolution obj) { SaveSolutionBO savesolutionBO = new SaveSolutionBO(obj); savesolutionDao.Update(savesolutionBO); return(obj); }
public SolutionAggregate(SaveSolution cmd) { State = new SolutionState { Id = cmd.AggregateId, Score = new SolutionScore { Soft = cmd.Score.Soft, Medium = cmd.Score.Medium, Hard = cmd.Score.Hard }, Date = cmd.Date, Name = cmd.Name, PlanningId = cmd.PlanningId }; State.PlannedFlights = cmd.PlannedFlights.Select(x => new PlannedFlightState() { Solution = State, Id = x.Id, DayOfWeek = x.DayOfWeek, Seats = x.Seats, MarineUnitId = x.MarineUnitId, AircraftContractId = x.AircraftContractId, Start = x.Start, End = x.End }).ToList(); }
public SaveSolution ToSaveSolutionCommand() { var cmd = new SaveSolution { ClientConnectionId = ClientConnectionId, AggregateId = Guid.NewGuid(), Score = new SolutionScore { Soft = Score.Soft, Medium = Score.Medium, Hard = Score.Hard }, PlanningId = PlanningId, Name = Name, Date = DateTime.UtcNow, PlannedFlights = PlannedFlights.Select(x => new PlannedFlight { Id = Guid.NewGuid(), DayOfWeek = x.DayOfWeek, Seats = x.Seats, Start = TimeSpan.FromMinutes(x.Start), End = TimeSpan.FromMinutes(x.End), MarineUnitId = x.MarineUnit.Id, AircraftContractId = x.AircraftContract.Id }).ToList() }; return(cmd); }
protected void rptResultTKNL_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.Equals("delete")) { LinkButton btnDelete = (LinkButton)e.CommandSource; btnDelete.Visible = AllowEdit; SaveSolution rpt = new SaveSolution(); SaveSolutionService rptbso = new SaveSolutionService(); if (rptbso.Delete(int.Parse(((LinkButton)e.CommandSource).CommandArgument)) > 0) { BindResultTKNL(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Không xóa được. Vui lòng thử lại.');", true); } } else if (e.CommandName.Equals("edit")) { LinkButton btnEdit = (LinkButton)e.CommandSource; btnEdit.Visible = AllowEdit; SaveSolution rpt = new SaveSolution(); SaveSolutionService rptbso = new SaveSolutionService(); rpt = rptbso.FindByKey(int.Parse(((LinkButton)e.CommandSource).CommandArgument)); hdnId.Value = rpt.Id.ToString(); if (rpt.Budget > 0) { txtBudget.Text = rpt.Budget.ToString(); } if (rpt.Quantity > 0) { txtQuantity.Text = rpt.Quantity.ToString(); } if (rpt.TimeExecuted > 0) { txtTimeExecuted.Text = rpt.TimeExecuted.ToString(); } if (rpt.FuelId > 0) { ddlFuelType.SelectedValue = rpt.FuelId.ToString(); BindMeasurement(); if (rpt.MeasurementFuelId > 0) { ddlMeasure.SelectedValue = rpt.MeasurementFuelId.ToString(); } } if (rpt.SolutionId > 0) { ddlSolution.SelectedValue = rpt.SolutionId.ToString(); } ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogSaveSolution();", true); } }
public void btnSaveAddPlan_Click(object sender, EventArgs e) { SaveSolutionService saveSolutionService = new SaveSolutionService(); SaveSolution plantknl = new SaveSolution(); plantknl.EnterpriseId = memVal.OrgId; if (ddlFuelType.SelectedIndex > 0) { plantknl.FuelId = Convert.ToInt32(ddlFuelType.SelectedValue); } if (ddlMeasure.SelectedIndex > 0) { plantknl.MeasurementFuelId = Convert.ToInt32(ddlMeasure.SelectedValue); } if (ddlSolution.SelectedIndex > 0) { plantknl.SolutionId = Convert.ToInt32(ddlSolution.SelectedValue); } plantknl.Quantity = Convert.ToDecimal(txtQuantity.Text.Trim()); plantknl.Budget = Convert.ToDecimal(txtBudget.Text.Trim()); plantknl.TimeExecuted = Convert.ToDecimal(txtTimeExecuted.Text.Trim()); plantknl.AuditReportId = ReportId; if (hdnId.Value != "" && Convert.ToInt32(hdnId.Value) > 0) { plantknl.Id = Convert.ToInt32(hdnId.Value); if (saveSolutionService.Update(plantknl) != null) { BindResultTKNL(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "message", "alert('Cập nhật không thành công. Vui lòng thử lại!');", true); ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogSaveSolution();", true); } } else { int i = saveSolutionService.Insert(plantknl); if (i > 0) { BindResultTKNL(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "message", "alert('Thêm mới kê hoạch không thành công. Vui lòng thử lại!');", true); ScriptManager.RegisterStartupScript(this, GetType(), "showgpkh", "ShowDialogAddSaveSolution();", true); } } }
public void EventLoop() { while (events.Count > 0) { LoadTests loader = new LoadTests(); List <Test> tests = new List <Test>(); List <Test> tests1 = new List <Test>(); tests = loader.Get("B:\\tests\\adunare", "adunare"); tests1 = loader.Get("B:\\tests\\ciurul", "ciurul"); GCC gcc = new GCC(@"C:\MinGW\bin\g++.exe"); CompilerFactory.RegisterCompiler("C++", gcc); CompilerFactory.RegisterCompiler("C++11", gcc); CompilerFactory.RegisterCompiler("C+11", gcc); CompilerFactory.RegisterCompiler("C++14", gcc); CompilerFactory.RegisterCompiler("C", gcc); tests.AddRange(tests1); Repository repository = new Repository(); repository.Tests = tests; Judge judge = new Judge("B:\\evaluare", "C++", repository); SubmissionJson submission = events.Dequeue().Submission; submission.Code = submission.Code.Replace("@", System.Environment.NewLine); SaveSolution saveSolution = new SaveSolution(submission.Code, @"B:\solutions", submission.ProblemName + submission.SubmissionAccountId, "cpp"); saveSolution.SaveFile(); Dictionary <int, string> submissionsPaths = new Dictionary <int, string>(); submissionsPaths[submission.Id] = saveSolution.GetCodePath(); judge.SetSubmissionPath(submissionsPaths); judge.Evaluate(submission); } }
public int Insert(SaveSolution obj) { SaveSolutionBO savesolutionBO = new SaveSolutionBO(obj); return(savesolutionDao.Insert(savesolutionBO)); }