static Program() { _telegramBot = new TelegramBotClient(EnvironmentVariables.BotToken); _insuranceService = new InsuranceService(); _navigationService = new NavigationService(); _currentUser = new DTOs.User(); }
protected void Page_Init(object sender, EventArgs e) { ctx = new AriClinicContext("AriClinicContext"); // security control, it must be a user logged if (Session["User"] == null) { Response.Redirect("Default.aspx"); } else { user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx); Process proc = (from p in ctx.Processes where p.Code == "ser" select p).FirstOrDefault <Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } // if (Request.QueryString["InsuranceId"] != null) { insuranceId = Int32.Parse(Request.QueryString["InsuranceId"]); ins = CntAriCli.GetInsurance(insuranceId, ctx); txtInsurance.Text = ins.Name; } // if (Request.QueryString["InsuranceServiceId"] != null) { insuranceServiceId = Int32.Parse(Request.QueryString["InsuranceServiceId"]); inser = CntAriCli.GetInsuranceService(insuranceServiceId, ctx); LoadData(inser); } }
protected void UnloadData(InsuranceService inser) { serviceId = Int32.Parse(txtServiceId.Text); inser.Insurance = ins; inser.Service = CntAriCli.GetService(serviceId, ctx); inser.Price = Decimal.Parse(txtPrice.Text); }
public static void Test13() { InsuranceService myService = new InsuranceService(); double result = myService.CalcPremium(5, "other"); Assert.That(result, Is.EqualTo(0)); }
public void TestCalcInsuranceHouse() { var insuranceService = new InsuranceService(); var result = insuranceService.CalcInsuranceHouse(100); Assert.AreEqual((decimal)2, result); }
public static void Test6() { InsuranceService myService = new InsuranceService(); double result = myService.CalcPremium(49, "rural"); Assert.That(result, Is.EqualTo(50)); }
protected void txtInsuranceServiceId_TextChanged(object sender, EventArgs e) { // check before go to search thats a policy selected if (rdcbPolicy.SelectedValue == "") { string command = string.Format("dialogShow('{0}','{1}','warning',null,0,0);" , Resources.GeneralResource.Warning , Resources.GeneralResource.PolicyNeeded); RadAjaxManager1.ResponseScripts.Add(command); return; } // insurance selected policyId = Int32.Parse(rdcbPolicy.SelectedValue); pol = CntAriCli.GetPolicy(policyId, ctx); insurance = pol.Insurance; // serach for Insurance Service insuranceServiceId = Int32.Parse(txtInsuranceServiceId.Text); insuranceService = CntAriCli.GetInsuranceService(insuranceServiceId, insurance, ctx); if (insuranceService != null) { txtInsuranceServiceId.Text = insuranceService.InsuranceServiceId.ToString(); txtInsuranceServiceName.Text = insuranceService.Service.Name; txtDescription.Text = insuranceService.Service.Name; //txtAmount.Text = String.Format("{0:###,##0.00}", insuranceService.Price); txtAmount.Text = insuranceService.Price.ToString(); } else { txtInsuranceServiceId.Text = ""; txtInsuranceServiceName.Text = Resources.GeneralResource.InsuranceServiceDoesNotExists; } }
public static void Test10() { InsuranceService myService = new InsuranceService(); double result = myService.CalcPremium(31, "urban"); Assert.That(result, Is.EqualTo(2.5)); }
public async Task UpdateAsync(InsuranceService insuranceService) { _dbContext.InsuranceServices.Attach(insuranceService); _dbContext.Entry(insuranceService).State = EntityState.Modified; await _dbContext.SaveChangesAsync(); }
protected void LoadData(InsuranceService inser) { txtInsuranceServiceId.Text = inser.InsuranceServiceId.ToString(); txtInsurance.Text = inser.Insurance.Name; txtServiceId.Text = inser.Service.ServiceId.ToString(); txtServiceName.Text = inser.Service.Name; txtPrice.Text = String.Format("{0:C}", inser.Price); }
public void TestCalcInsuranceFarm() { var insuranceService = new InsuranceService(); var result = insuranceService.CalcInsuranceFarm(100, 100); Assert.AreEqual((decimal)0.20, result); }
public void TestCalcInsuranceCar() { var insuranceService = new InsuranceService(); insuranceService.setCurrentYear(2000); var result = insuranceService.CalcInsuranceCar(100, 1998); Assert.AreEqual((decimal)6.6, result); }
public void TestCalcInsuranceMotorcycleOlderThanTwentyYear() { var insuranceService = new InsuranceService(); insuranceService.setCurrentYear(2000); var result = insuranceService.CalcInsuranceMotorcycle(100, 1975); Assert.AreEqual((decimal)25, result); }
public ActionResult Index(InsuranceViewModel model) { InsuranceService service = new InsuranceService(); ViewBag.age = model.age; ViewBag.gender = model.gender; ViewBag.premium = service.CalcPremium(model.age, model.gender); return(View()); }
public void Test3() { //51 AND URBAN //arrange InsuranceService p1 = new InsuranceService(); //act double actualResult = p1.CalcPremium(51, "urban"); //assert Assert.That(actualResult, Is.EqualTo(30)); }
public void Test8() { //18 AND FDEGHWJHEEDHJEGR (INVALID LOCATION) //arrange InsuranceService p1 = new InsuranceService(); //act double actualResult = p1.CalcPremium(18, "FDEGHWJHEEDHJEGR"); //assert Assert.That(actualResult, Is.EqualTo(0)); }
public static void MyTest7() { //Arrange InsuranceService obj = new InsuranceService(); //Act var result = obj.CalcPremium(0, "rural"); //Assert Assert.That(result, Is.EqualTo(0)); }
public static void Test2() { // arange InsuranceService myService = new InsuranceService(); // act double result = myService.CalcPremium(40, "urban"); // assert Assert.That(result, Is.EqualTo(35.0)); }
public static void Test7() { // arange InsuranceService myService = new InsuranceService(); // act double result = myService.CalcPremium(60, "other"); // assert Assert.That(result, Is.EqualTo(50.0)); }
public void Test7() { //17 (UNDERAGE) AND RURAL //arrange InsuranceService p1 = new InsuranceService(); //act double actualResult = p1.CalcPremium(17, "urban"); //assert Assert.That(actualResult, Is.EqualTo(0)); }
public void Test6() { //51 AND RURAL //arrange InsuranceService p1 = new InsuranceService(); //act double actualResult = p1.CalcPremium(51, "rural"); //assert Assert.That(actualResult, Is.EqualTo(25)); }
public static void MyTest3() { //Arrange InsuranceService obj = new InsuranceService(); //Act var result = obj.CalcPremium(50, "urban"); //Assert Assert.That(result, Is.EqualTo(12.5)); }
public static void Test1() { // arange InsuranceService myService = new InsuranceService(); // act double result = myService.CalcPremium(18, "rural"); // assert Assert.That(result, Is.EqualTo(60)); }
protected void rdcInsuranceService_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { if (rdcInsuranceService.SelectedValue != "") { InsuranceService inss = CntAriCli.GetInsuranceService(int.Parse(rdcInsuranceService.SelectedValue), ctx); if (inss != null) { txtAmount.Value = (double)inss.Price; txtDiscount.Text = "0"; txtTotal.Value = (double)inss.Price; txtDescription.Text = inss.Service.Name; } } }
private void RenderReplyMessages(JObject message) { JArray replies = message.Value <JArray>("replies"); if (replies == null) { return; } List <InsuranceService> options = new List <InsuranceService>(); foreach (JValue reply in replies) { InsuranceService option = new InsuranceService(); option.Type = reply.ToString(); options.Add(option); } ItemPickerContext insurancePickerContext = new ItemPickerContext(); insurancePickerContext.ItemsSource = options; PickerItem insurancePickerItem = new PickerItem() { Context = insurancePickerContext }; insurancePickerContext.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(ItemPickerContext.SelectedItem)) { if (insurancePickerContext.SelectedItem != null) { this.chat.Items.Remove(insurancePickerItem); string insuranceServiceType = ((InsuranceService)insurancePickerContext.SelectedItem).Type; this.chat.Items.Add(new TextMessage() { Author = this.chat.Author, Text = insuranceServiceType }); } } }; this.chat.Items.Add(insurancePickerItem); }
public static void LoadTicketsAndServiceNotes(RdcModel ctxRid, AriClinicContext ctx) { int numr = ctxRid.Acto_medico_asgs.Count(); int r = 0; DateTime fechaAnt = new DateTime(1, 1, 1); int idHistoriaAnt = 0; ServiceNote sn = null; foreach (Acto_medico_asg asg in (from ams in ctxRid.Acto_medico_asgs orderby ams.Fecha, ams.Id_historia select ams)) { Console.WriteLine("Tickest & Service notes -> {1:000000}/{2:000000} {0:dd/MM/yyyy} ", asg.Fecha, ++r, numr); Patient patient = (from p in ctx.Patients where p.OftId == asg.Id_historia select p).FirstOrDefault <Patient>(); if (asg.Fecha != fechaAnt || asg.Id_historia != idHistoriaAnt) { // al cambiar la fecha o el paciente creamos una nueva nota de servicio sn = new ServiceNote(); sn.Customer = patient.Customer; sn.ServiceNoteDate = asg.Fecha; ctx.Add(sn); ctx.SaveChanges(); fechaAnt = asg.Fecha; idHistoriaAnt = (int)asg.Id_historia; } // montamos el ticket de hoy Ticket tck = new Ticket(); tck.ServiceNote = sn; InsuranceService isrv = (from ins in ctx.InsuranceServices where ins.OftId == asg.Id_acto_medico_asc select ins).FirstOrDefault <InsuranceService>(); tck.InsuranceService = isrv; tck.TicketDate = asg.Fecha; tck.Policy = patient.Customer.Policies.FirstOrDefault <Policy>(); tck.Amount = 1; tck.Comments = asg.Observaciones; tck.Description = isrv.Service.Name; tck.Checked = asg.Comunicado; ctx.Add(tck); ctx.SaveChanges(); } }
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { try { // we only process commands with a datasource (our image buttons) if (e.CommandSource == null) { return; } string typeOfControl = e.CommandSource.GetType().ToString(); if (typeOfControl.Equals("System.Web.UI.WebControls.ImageButton")) { int id = 0; ImageButton imgb = (ImageButton)e.CommandSource; if (imgb.ID != "New" && imgb.ID != "Exit") { id = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][e.Item.OwnerTableView.DataKeyNames[0]]; } switch (imgb.ID) { case "Select": break; case "Edit": break; case "Delete": InsuranceService inser = (from insr in ctx.InsuranceServices where insr.InsuranceServiceId == id select insr).FirstOrDefault <InsuranceService>(); ctx.Delete(inser); ctx.SaveChanges(); RefreshGrid(true); break; } } } catch (Exception ex) { Label lbl = (Label)this.Parent.FindControl("lblMessage"); lbl.Text = ex.Message; } }
public UnitTest1() { _insuranceCoder = new InsuranceCoder(); var externalInsurances = new List <ExternalInsurance>() { CreateExternalInsurance("1X", 1000.00M), CreateExternalInsurance("X12", 1000.00M), CreateExternalInsurance("X12", 100.00M), }; var internalInsurances = new List <InternalInsurance>() { CreateInternalInsurance("1", "1", isProtected: true), CreateInternalInsurance("1", "2", isProtected: true), CreateInternalInsurance("2", "1", isProtected: true), CreateInternalInsurance("2", "2", isProtected: true), }; _insuranceService = new InsuranceService(_insuranceCoder, internalInsurances, externalInsurances); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } InsuranceService = await _context.InsuranceServices.FirstOrDefaultAsync(m => m.Id == id); if (InsuranceService == null) { return(NotFound()); } ViewData["CurrencyTypeId"] = new SelectList(_context.CurrencyTypes.AsNoTracking(), "Id", "Name"); ViewData["InsuranceCompanyId"] = new SelectList(_context.InsuranceCompanies.AsNoTracking(), "Id", "Name"); ViewData["InsuranceTypeId"] = new SelectList(_context.InsuranceTypes.AsNoTracking(), "Id", "Name"); return(Page()); }
protected void txtInsuranceServiceId_TextChanged(object sender, EventArgs e) { // check before go to search thats a policy selected if (rdcbPolicy.SelectedValue == "") { lblMessage.Text = Resources.GeneralResource.PolicyNeeded; return; } // insurance selected policyId = Int32.Parse(rdcbPolicy.SelectedValue); pol = CntAriCli.GetPolicy(policyId, ctx); insurance = pol.Insurance; // serach for Insurance Service insuranceServiceId = Int32.Parse(txtInsuranceServiceId.Text); insuranceService = CntAriCli.GetInsuranceService(insuranceServiceId, insurance, ctx); if (insuranceService != null) { txtInsuranceServiceId.Text = insuranceService.InsuranceServiceId.ToString(); txtInsuranceServiceName.Text = insuranceService.Service.Name; // Solo cambiamos la descripción si no había algo previamente if (txtDescription.Text == "") { txtDescription.Text = insuranceService.Service.Name; } //txtAmount.Text = String.Format("{0:0.00}", insuranceService.Price); if (txtAmount.Text == "") { txtAmount.Text = insuranceService.Price.ToString(); } // loading prices, discount is zero by default. txtPrice.Text = insuranceService.Price.ToString(); txtDiscount.Text = "0"; } else { txtInsuranceServiceId.Text = ""; txtInsuranceServiceName.Text = Resources.GeneralResource.InsuranceServiceDoesNotExists; txtPrice.Text = "0"; txtDiscount.Text = "0"; txtAmount.Text = "0"; } }