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 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 == "amendmentinvoice" select p).FirstOrDefault<Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } hc = CntAriCli.GetHealthCompany(ctx); // if (Request.QueryString["AmendmentInvoiceId"] != null) { amendmentInvoiceId = Int32.Parse(Request.QueryString["AmendmentInvoiceId"]); aInv = CntAriCli.GetAmendementInvoice(amendmentInvoiceId, ctx); LoadData(aInv); } else { // deafault values rddpInvoiceDate.SelectedDate = DateTime.Now; txtYear.Text = DateTime.Now.Year.ToString(); txtInvoiceSerial.Text = hc.InvoiceSerial; } // if (Request.QueryString["Caller"] != null) caller = Request.QueryString["Caller"]; if (Session["Clinic"] != null) cl = (Clinic)Session["Clinic"]; // always read Healt care company }
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); } // if (Request.QueryString["HcId"] != null) { hcId = Int32.Parse(Request.QueryString["HcId"]); hc = CntAriCli.GetHealthCompany(ctx); txtCaller.Text = hc.Name; } // if (Request.QueryString["ClinicId"] != null) { clinicId = Int32.Parse(Request.QueryString["ClinicId"]); cl = (from c in ctx.Clinics where c.ClinicId == clinicId select c).FirstOrDefault<Clinic>(); txtCaller.Text = cl.Name; } // if (Request.QueryString["PatientId"] != null) { patientId = Int32.Parse(Request.QueryString["PatientId"]); pat = CntAriCli.GetPatient(patientId, ctx); txtCaller.Text = pat.FullName; } // if (Request.QueryString["CustomerId"] != null) { customerId = Int32.Parse(Request.QueryString["CustomerId"]); cus = CntAriCli.GetCustomer(customerId, ctx); txtCaller.Text = cus.FullName; } // if (Request.QueryString["ProfessionalId"] != null) { professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]); prof = CntAriCli.GetProfessional(professionalId, ctx); txtCaller.Text = prof.FullName; } // if (Request.QueryString["EmailId"] != null) { emailId = Int32.Parse(Request.QueryString["EmailId"]); Email eml = (from t in ctx.Emails where t.EmailId == emailId select t).FirstOrDefault<Email>(); LoadData(eml); } else { LoadTypeCombo(null); } }
private static void CreateThings() { // Create a user using (AriClinicContext ctx = new AriClinicContext("AriClinicContext")) { Console.WriteLine("Deleting all records...."); ctx.Delete(ctx.Logs); ctx.Delete(ctx.Users); ctx.Delete(ctx.UserGroups); ctx.Delete(ctx.HealthcareCompanies); ctx.SaveChanges(); Console.WriteLine("Creating default group.."); UserGroup ug = new UserGroup(); ug.Name = "Reservado"; ctx.Add(ug); Console.WriteLine("Creating administrator user.."); User user = new User(); user.Name = "Superuser"; user.Login = "******"; user.UserGroup = ug; user = CntAriCli.EncryptPassword(user, "admin"); ctx.Add(user); HealthcareCompany hc = new HealthcareCompany(); hc.Name = "Ariadna Salud S.L."; ctx.Add(hc); Clinic clinic = new Clinic() { Name = "Clinica 1" }; ctx.Add(clinic); // parameters Console.WriteLine("Creating parameters..."); AriCliModel.Parameter parameter = new Parameter() { PainPump = null, UseNomenclator = false }; ctx.Add(parameter); // processes Console.WriteLine("Creating process..."); Process process = new Process() { Name = "Administración", Code = "admin", }; Process admin = process; ctx.Add(admin); process = new Process() { Name = "Procesos", Code = "process", ParentProcess = admin }; ctx.Add(process); process = new Process() { Name = "Permisos", Code = "permision", ParentProcess = admin }; ctx.Add(process); // permissions Console.WriteLine("Creating permissions..."); Permission permission = new Permission() { Process = admin, UserGroup = ug, View=true, Create=true, Modify=true, Execute=true, }; ctx.Add(permission); permission = new Permission() { Process = process, // must be permission process UserGroup = ug, View = true, Create = true, Modify = true, Execute = true, }; ctx.Add(permission); // import data ctx.SaveChanges(); Console.WriteLine("All jobs done"); } }
/// <summary> /// As its name suggest if there isn't an object /// it'll create it. It exists modify it. /// </summary> /// <returns></returns> protected bool CreateChange() { if (!DataOk()) return false; if (hcID == 0) { HealthcareCompany hc = new HealthcareCompany(); UnloadData(hc); ctx.Add(hc); } else { HealthcareCompany hc = CntAriCli.GetHealthCompany(ctx); UnloadData(hc); } ctx.SaveChanges(); return true; }
protected void UnloadData(HealthcareCompany hc) { hc.Name = txtName.Text; hc.VATIN = txtVATIN.Text; hc.InvoiceSerial = txtSERIAL.Text; }
protected void LoadData(HealthcareCompany hc) { txtHcId.Text = hc.HcId.ToString(); txtName.Text = hc.Name; txtVATIN.Text = hc.VATIN; txtSERIAL.Text = hc.InvoiceSerial; }
protected void Page_Init(object sender, EventArgs e) { ctx = new AriClinicContext("AriClinicContext"); // security control, it must be a user logged // 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 == "usergroup" select p).FirstOrDefault<Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } // if (Request.QueryString["HcId"] != null) { hcId = Int32.Parse(Request.QueryString["HcId"]); hc = CntAriCli.GetHealthCompany(ctx); txtCaller.Text = hc.Name; } // if (Request.QueryString["ClinicId"] != null) { clinicId = Int32.Parse(Request.QueryString["ClinicId"]); cl = (from c in ctx.Clinics where c.ClinicId == clinicId select c).FirstOrDefault<Clinic>(); txtCaller.Text = cl.Name; } // if (Request.QueryString["PatientId"] != null) { patientId = Int32.Parse(Request.QueryString["PatientId"]); pat = CntAriCli.GetPatient(patientId, ctx); txtCaller.Text = pat.FullName; } // if (Request.QueryString["CustomerId"] != null) { customerId = Int32.Parse(Request.QueryString["CustomerId"]); cus = CntAriCli.GetCustomer(customerId, ctx); txtCaller.Text = cus.FullName; } // if (Request.QueryString["ProfessionalId"] != null) { professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]); prof = CntAriCli.GetProfessional(professionalId, ctx); txtCaller.Text = prof.FullName; } // if (Request.QueryString["AddressId"] != null) { addressId = Int32.Parse(Request.QueryString["AddressId"]); Address adr = (from a in ctx.Addresses where a.AddressId == addressId select a).FirstOrDefault<Address>(); LoadData(adr); } else { LoadTypeCombo(null); } }