protected void Page_Load(object sender, EventArgs e) { // First control the type of parent page if (Request.QueryString["HcId"] != null) { hcId = Int32.Parse(Request.QueryString["HcId"]); hc = CntAriCli.GetHealthCompany(ctx); caller = "hccom"; // Called by a Healthcare Company } if (Request.QueryString["ClinicId"] != null) { clinicId = Int32.Parse(Request.QueryString["ClinicId"]); cl = CntAriCli.GetClinic(clinicId, ctx); caller = "clinic"; // Called by a Healthcare Company } if (Request.QueryString["PatientId"] != null) { patientId = Int32.Parse(Request.QueryString["PatientId"]); pat = CntAriCli.GetPatient(patientId, ctx); caller = "patient"; } if (Request.QueryString["CustomerId"] != null) { customerId = Int32.Parse(Request.QueryString["CustomerId"]); cus = CntAriCli.GetCustomer(customerId, ctx); caller = "customer"; } if (Request.QueryString["ProfessionalId"] != null) { professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]); prof = CntAriCli.GetProfessional(professionalId, ctx); caller = "professional"; } }
protected void SetSessionValues() { // First check if a user is logged if (Session["User"] == null) { Response.Redirect("Default.aspx"); } user = CntAriCli.GetUser((Session["User"] as User).UserId, ctx); lblUser.Text = user.Name; // Clinic if (Session["Clinic"] != null) { cl = CntAriCli.GetClinic((Session["Clinic"] as Clinic).ClinicId, ctx); lblUser.Text = String.Format("{0} ({1})", user.Name, cl.Name); } // Assign general skin if (Session["Skin"] != null) { RadSkinManager1.Skin = (string)Session["Skin"]; } // Show company and user values if (Session["Company"] != null) { hc = CntAriCli.GetHealthCompany(ctx); lblHealthcareCompany.Text = hc.Name; } }
protected void UnloadData(Ticket tck) { tck.TicketDate = (DateTime)rddpTicketDate.SelectedDate; policyId = Int32.Parse(rdcbPolicy.SelectedValue); tck.Policy = CntAriCli.GetPolicy(policyId, ctx); insuranceServiceId = Int32.Parse(txtInsuranceServiceId.Text); tck.InsuranceService = CntAriCli.GetInsuranceService(insuranceServiceId, ctx); if (rdcbClinic.SelectedValue != "") { clinicId = Int32.Parse(rdcbClinic.SelectedValue); tck.Clinic = CntAriCli.GetClinic(clinicId, ctx); } tck.User = CntAriCli.GetUser(user.UserId, ctx); tck.Description = txtDescription.Text; tck.Price = Decimal.Parse(txtPrice.Text); tck.Discount = Decimal.Parse(txtDiscount.Text); tck.Amount = Decimal.Parse(txtAmount.Text); tck.Checked = chkChecked.Checked; if (txtProfessionalId.Text != "") { professionalId = Int32.Parse(txtProfessionalId.Text); tck.Professional = CntAriCli.GetProfessional(professionalId, ctx); } else { tck.Professional = null; } tck.Comments = txtComments.Text; // Is there a service note? if (sn != null) { tck.ServiceNote = sn; } }
protected void UnloadData(Patient pat) { pat.Name = txtName.Text; pat.Surname1 = txtSurname1.Text; pat.Surname2 = txtSurname2.Text; pat.FullName = String.Format("{0} {1}, {2}", pat.Surname1, pat.Surname2, pat.Name); pat.Sex = rdcbSex.SelectedValue; if (rdcbProcedencia.SelectedValue != "") { pat.Source = CntAriCli.GetSource(int.Parse(rdcbProcedencia.SelectedValue), ctx); } if (rdcbClinic.SelectedValue != "") { pat.Clinic = CntAriCli.GetClinic(int.Parse(rdcbClinic.SelectedValue), ctx); } if (rddpBornDate.SelectedDate != null) { pat.BornDate = (DateTime)rddpBornDate.SelectedDate; } if (pat.Customer == null) { CreateAssociatedCustomer(pat, ctx); } pat.InsuranceInformation = CntAriCli.GetInsuranceInformation(pat, ctx); txtInsuranceInformation.Text = pat.InsuranceInformation; pat.Customer.VATIN = txtVATIN.Text; pat.Comments = txtComments.Text; CntAriCli.UpdateCustomerRelatedData(pat, ctx); pat.OftId = int.Parse(txtFrn.Text); if (rdtOpenDate.SelectedDate != null) { pat.OpenDate = (DateTime)rdtOpenDate.SelectedDate; } //pat.LastUpdate = DateTime.Now; }
protected void DoPayments() { ArrayList selectedItems = (ArrayList)Session["selectedItems"]; PaymentMethod pm = CntAriCli.GetPaymentMethod(Int32.Parse(rdcbPayementForm.SelectedValue), ctx); cl = CntAriCli.GetClinic(Int32.Parse(rdcbClinic.SelectedValue), ctx); DateTime pd = (DateTime)rddpPayDate.SelectedDate; //foreach(GridDataItem item in RadGrid1.SelectedItems) //{ // int id = Int32.Parse(item["TicketId"].Text); foreach (string item in selectedItems) { int id = int.Parse(item); Ticket tck = CntAriCli.GetTicket(id, ctx); // Delete previous payments ctx.Delete(tck.Payments); Payment p = new Payment(); p.PaymentDate = pd; p.Clinic = cl; p.PaymentMethod = pm; p.Ticket = tck; p.Amount = tck.Amount; p.User = CntAriCli.GetUser(user.UserId, ctx); tck.Paid = p.Amount; ctx.Add(p); ctx.SaveChanges(); } lblMessage.Text = Resources.GeneralResource.PaymentsDone; Session["selectedItems"] = new ArrayList(); RadGrid1.Rebind(); }
protected void UnloadData(AnestheticServiceNote asn) { asn.ServiceNoteDate = (DateTime)rddpServiceNoteDate.SelectedDate; clinicId = Int32.Parse(rdcbClinic.SelectedValue); asn.Clinic = CntAriCli.GetClinic(clinicId, ctx); asn.User = CntAriCli.GetUser(user.UserId, ctx); // decimal tt = 0; decimal.TryParse(txtTotal.Text, out tt); asn.Total = tt; // asn.Chk1 = chkChecked.Checked; asn.Chk2 = chkCkecked2.Checked; asn.Chk3 = chkChecked3.Checked; //customerId = Int32.Parse(txtCustomerId.Text); asn.Customer = CntAriCli.GetCustomer(int.Parse(rdcComercialName.SelectedValue), ctx); if (rdcProfessionalName.SelectedValue != "") { professionalId = Int32.Parse(rdcProfessionalName.SelectedValue); asn.Professional = CntAriCli.GetProfessional(professionalId, ctx); } else { asn.Professional = null; } if (rdcSurgeonName.SelectedValue != "") { surgeonId = Int32.Parse(rdcSurgeonName.SelectedValue); asn.Surgeon = CntAriCli.GetProfessional(surgeonId, ctx); } else { asn.Surgeon = null; } asn.Procedures.Clear(); ctx.SaveChanges(); //ctx.Delete(asn.Procedures); if (rdcProcedureName1.SelectedValue != "") { procedureId = Int32.Parse(rdcProcedureName1.SelectedValue); asn.Procedures.Add(CntAriCli.GetProcedure(procedureId, ctx)); } if (rdcProcedureName2.SelectedValue != "") { procedureId = Int32.Parse(rdcProcedureName2.SelectedValue); asn.Procedures.Add(CntAriCli.GetProcedure(procedureId, ctx)); } if (rdcProcedureName3.SelectedValue != "") { procedureId = Int32.Parse(rdcProcedureName3.SelectedValue); asn.Procedures.Add(CntAriCli.GetProcedure(procedureId, ctx)); } }
protected void UnloadData(AnestheticTicket tck) { tck.TicketDate = (DateTime)rddpTicketDate.SelectedDate; policyId = Int32.Parse(rdcbPolicy.SelectedValue); tck.Policy = CntAriCli.GetPolicy(policyId, ctx); insuranceServiceId = Int32.Parse(txtInsuranceServiceId.Text); tck.InsuranceService = CntAriCli.GetInsuranceService(insuranceServiceId, ctx); clinicId = Int32.Parse(rdcbClinic.SelectedValue); tck.Clinic = CntAriCli.GetClinic(clinicId, ctx); tck.User = CntAriCli.GetUser(user.UserId, ctx); tck.Description = txtDescription.Text; tck.Amount = Decimal.Parse(txtAmount.Text); tck.Checked = chkChecked.Checked; if (txtProfessionalId.Text != "") { professionalId = Int32.Parse(txtProfessionalId.Text); tck.Professional = CntAriCli.GetProfessional(professionalId, ctx); } else { tck.Professional = null; } if (txtSurgeonId.Text != "") { surgeonId = Int32.Parse(txtSurgeonId.Text); tck.Surgeon = CntAriCli.GetProfessional(surgeonId, ctx); } else { tck.Surgeon = null; } if (txtProcedureId.Text != "") { procedureId = Int32.Parse(txtProcedureId.Text); tck.Procedure = CntAriCli.GetProcedure(procedureId, ctx); } else { tck.Procedure = null; } tck.Comments = txtComments.Text; // assign anesthetic note if any. if (asn != null) { asn = CntAriCli.GetAnestheticServiceNote(asn.AnestheticServiceNoteId, ctx); tck.AnestheticServiceNote = asn; } }
protected void UnloadData(GeneralPayment pay) { if (pay != null) { serviceNote = pay.ServiceNote; CntAriCli.GeneralPaymentDelete(pay, ctx); } Clinic clinic = CntAriCli.GetClinic(int.Parse(rdcbClinic.SelectedValue), ctx); PaymentMethod payMethod = CntAriCli.GetPaymentMethod(int.Parse(rdcbPaymentMethod.SelectedValue), ctx); DateTime payDate = (DateTime)rddpGeneralPaymentDate.SelectedDate; Decimal amount = (decimal)txtAmount.Value; string description = txtComments.Text; pay = CntAriCli.GeneralPaymentNew(clinic, serviceNote, amount, payMethod, payDate, description, ctx); }
protected void UnloadData(Request chn) { req.RequestDateTime = (DateTime)rdtRequestDateTime.SelectedDate; req.Status = txtStatus.Text; if (rdcCampaign.SelectedValue != "") { req.Campaign = CntAriCli.GetCampaign(int.Parse(rdcCampaign.SelectedValue), ctx); } if (rdcChannel.SelectedValue != "") { req.Channel = CntAriCli.GetChannel(int.Parse(rdcChannel.SelectedValue), ctx); } if (rdcSource.SelectedValue != "") { req.Source = CntAriCli.GetSource(int.Parse(rdcSource.SelectedValue), ctx); } if (rdcPatient.SelectedValue != "") { req.Patient = CntAriCli.GetPatient(int.Parse(rdcPatient.SelectedValue), ctx); } if (rdcClinic.SelectedValue != "") { req.Clinic = CntAriCli.GetClinic(int.Parse(rdcClinic.SelectedValue), ctx); } req.Surname1 = txtSurname1.Text; req.Surname2 = txtSurname2.Text; req.Name = txtName.Text; req.Sex = rdcbSex.SelectedValue; if (rdtBornDate.SelectedDate != null) { req.BornDate = (DateTime)rdtBornDate.SelectedDate; } req.PostalCode = txtCodPostal.Text; req.Dni = txtDni.Text; req.Email = txtEmail.Text; req.Telephone = txtTelephone.Text; if (rdcService.SelectedValue != "") { req.Service = CntAriCli.GetService(int.Parse(rdcService.SelectedValue), ctx); } req.Comments = txtComments.Text; req.FullName = String.Format("{0} {1}, {2}", req.Surname1, req.Surname2, req.Name); req.User = user; }
protected void UnloadData(ServiceNote sn) { sn.ServiceNoteDate = (DateTime)rddpServiceNoteDate.SelectedDate; clinicId = Int32.Parse(rdcbClinic.SelectedValue); sn.Clinic = CntAriCli.GetClinic(clinicId, ctx); sn.User = CntAriCli.GetUser(user.UserId, ctx); // sn.Total = sn.Tickets.Sum(t => t.Amount); sn.Paid = sn.GeneralPayments.Sum(gp => gp.Amount); // customerId = Int32.Parse(rdcComercialName.SelectedValue); sn.Customer = CntAriCli.GetCustomer(customerId, ctx); if (rdcProfessionalName.SelectedValue != "") { professionalId = Int32.Parse(rdcProfessionalName.SelectedValue); sn.Professional = CntAriCli.GetProfessional(professionalId, ctx); } else { sn.Professional = null; } }
protected void btnAccept_Click(object sender, EventArgs e) { User user = CntAriCli.Login(txtPassword.Text, txtLogin.Text, ctx); if (user == null) { // Bad login string command = String.Format("showDialog('Error','{0}','error',null,0,0)", Resources.GeneralResource.BadLogin); RadAjaxManager.GetCurrent(Page).ResponseScripts.Add(command); //lblMessage.Text = Resources.GeneralResource.BadLogin; return; } Session["User"] = user; // stores user in a ssesion variable. Clinic cl = CntAriCli.GetClinic(Int32.Parse(rdcbClinic.SelectedValue), ctx); Session["Clinic"] = cl; if (user.Professionals.Count > 0) { Session["Professional"] = user.Professionals[0]; } // Write log CntAriCli.WriteLog(user, DateTime.Now, Request.ServerVariables["REMOTE_ADDR"], "Default.aspx", "Login", ctx); Response.Redirect("MainMenu.aspx"); }