Esempio n. 1
0
    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 == "procedure"
                            select p).FirstOrDefault <Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        //
        if (Request.QueryString["ProcedureId"] != null)
        {
            procedureId = Int32.Parse(Request.QueryString["ProcedureId"]);
            proc        = CntAriCli.GetProcedure(procedureId, ctx);
            LoadData(proc);
        }
        // Allways read parameter
        parameter = CntAriCli.GetParameter(ctx);
    }
Esempio n. 2
0
    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 == "procedure"
                            select p).FirstOrDefault<Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // 
        if (Request.QueryString["ProcedureId"] != null)
        {
            procedureId = Int32.Parse(Request.QueryString["ProcedureId"]);
            proc = CntAriCli.GetProcedure(procedureId, ctx);
            LoadData(proc);
        }
        // Allways read parameter
        parameter = CntAriCli.GetParameter(ctx);
    }
Esempio n. 3
0
 protected void LoadData(AriCliModel.Parameter parameter)
 {
     if (parameter.PainPump != null)
     {
         txtServiceId.Text   = parameter.PainPump.ServiceId.ToString();
         txtServiceName.Text = parameter.PainPump.Name;
     }
     chkChecked.Checked = parameter.UseNomenclator;
 }
Esempio n. 4
0
 /// <summary>
 /// As its name suggest if there isn't an object
 /// it'll create it. If exists It modifies it.
 /// </summary>
 /// <returns></returns>
 protected bool CreateChange()
 {
     if (!DataOk())
     {
         return(false);
     }
     parameter = CntAriCli.GetParameter(ctx);
     UnloadData(parameter);
     ctx.SaveChanges();
     return(true);
 }
Esempio n. 5
0
    protected void UnloadData(AriCliModel.Parameter parameter)
    {
        Service ser = null;

        if (txtServiceId.Text != "")
        {
            ser = CntAriCli.GetService(int.Parse(txtServiceId.Text), ctx);
        }
        parameter.PainPump             = ser;
        parameter.UseNomenclator       = chkChecked.Checked;
        parameter.AppointmentExtension = chkAppointmentExtension.Checked;
    }
Esempio n. 6
0
 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 == "parameter"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
     }
     
     // There aren't query strings the object is read directly
     parameter = CntAriCli.GetParameter(ctx);
     LoadData(parameter);
 }
Esempio n. 7
0
    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 == "parameter"
                            select p).FirstOrDefault <Process>();
            per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
            btnAccept.Visible = per.Modify;
        }

        // There aren't query strings the object is read directly
        parameter = CntAriCli.GetParameter(ctx);
        LoadData(parameter);
    }
Esempio n. 8
0
        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");
            }
        }
Esempio n. 9
0
 /// <summary>
 /// As its name suggest if there isn't an object
 /// it'll create it. If exists It modifies it.
 /// </summary>
 /// <returns></returns>
 protected bool CreateChange()
 {
     if (!DataOk())
         return false;
     parameter = CntAriCli.GetParameter(ctx);
     UnloadData(parameter);
     ctx.SaveChanges();
     return true;
 }
Esempio n. 10
0
 public static Parameter GetParameter(AriClinicContext ctx)
 {
     Parameter par = (from p in ctx.Parameters
                      select p).FirstOrDefault<Parameter>();
     if (par == null)
     {
         par = new Parameter();
         ctx.Add(par);
         ctx.SaveChanges();
     }
     return par;
 }