Exemplo n.º 1
0
        protected void btnCalculate_Click(object sender, EventArgs e)
        {
            var request = new ResistorCalculationRequest {
                ColorBandA = ddlBandA.SelectedValue, ColorBandB = ddlBandB.SelectedValue, ColorBandC = ddlBandC.SelectedValue, ColorBandD = ddlBandD.SelectedValue
            };

            request.CalculatedValue = _resistorService.GetResistance(request.ColorBandA, request.ColorBandB, request.ColorBandC, request.ColorBandD);
            request.RequestDateUtc  = DateTime.UtcNow;
            _resistorService.SaveRequest(request);
            lblResult.Text        = request.CalculatedValue.ToString(ResistanceFormat);
            grdHistory.DataSource = _resistorService.GetTopRequests(5);
            grdHistory.DataBind();
        }
Exemplo n.º 2
0
        private ResistorCalculationRequest GetRequest(string bandA, string bandB, string bandC, string bandD)
        {
            var req = new ResistorCalculationRequest
            {
                ColorBandA      = bandA,
                ColorBandB      = bandB,
                ColorBandC      = bandC,
                ColorBandD      = bandD,
                RequestDateUtc  = DateTime.UtcNow,
                CalculatedValue = _srvc.GetResistance(bandA, bandB, bandC, bandD)
            };

            return(req);
        }
Exemplo n.º 3
0
 public void SaveRequest(ResistorCalculationRequest request)
 {
     _data.SaveCalculateRequest(request);
 }
Exemplo n.º 4
0
 public int SaveCalculateRequest(ResistorCalculationRequest request)
 {
     return(Save(request));
 }