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 == "profInvoice"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
     }
     // cheks if is call from another form
     if (Request.QueryString["Type"] != null)
         type = Request.QueryString["Type"];
     
     // read passed professional if any
     if (Request.QueryString["ProfessionalId"] != null)
     {
         professionalId = Int32.Parse(Request.QueryString["ProfessionalId"]);
         prof = CntAriCli.GetProfessional(professionalId, ctx);
     }
     // 
     if (type == "InTab")
     {
         HtmlControl tt = (HtmlControl)this.FindControl("TitleArea");
         tt.Attributes["class"] = "ghost";
         // hide patient column
         RadGrid1.Columns.FindByDataField("Professional.ComercialName").Visible = false;
     }
     // translate filters
     CntWeb.TranslateRadGridFilters(RadGrid1);
 }
 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 == "rtickets"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
     }
 }
 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 == "profInvoice"
                         select p).FirstOrDefault<Process>();
         per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
         btnAccept.Visible = per.Modify;
     }
     // 
     if (Request.QueryString["InvoiceId"] != null)
     {
         invoiceId = Int32.Parse(Request.QueryString["InvoiceId"]);
         inv = CntAriCli.GetProfessionalInvoice(invoiceId, ctx);
         LoadInvoiceData();
     }
     else
     {
         //TODO: What to do if there is not an invoice
     }
     if (Session["Clinic"] != null)
         cl = (Clinic)Session["Clinic"];
     // 
     if (Request.QueryString["InvoiceLineId"] != null)
     {
         invoiceLineId = Int32.Parse(Request.QueryString["InvoiceLineId"]);
         invl = CntAriCli.GetProfessionalInvoiceLine(invoiceLineId, ctx);
         LoadData(invl);
     }
     else
     {
         LoadTaxTypeCombo(null);
     }
 }
        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 == "profInvoice"
                                select p).FirstOrDefault<Process>();
                per = CntAriCli.GetPermission(user.UserGroup, proc, ctx);
                btnAccept.Visible = per.Modify;
            }
            hc = CntAriCli.GetHealthCompany(ctx);
            // 
            if (Request.QueryString["InvoiceId"] != null)
            {
                invoiceId = Int32.Parse(Request.QueryString["InvoiceId"]);
                inv = CntAriCli.GetProfessionalInvoice(invoiceId, ctx);
                LoadData(inv);
            }
            else
            {
                // deafault values
                rddpInvoiceDate.SelectedDate = DateTime.Now;
                txtYear.Text = DateTime.Now.Year.ToString();
            }
            //
            if (Request.QueryString["Caller"] != null)
                caller = Request.QueryString["Caller"];

            if (Session["Clinic"] != null)
                cl = (Clinic)Session["Clinic"];
            // always read Healt care company
        }
Exemple #5
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");
            }
        }
Exemple #6
0
 /// <summary>
 /// Encrypts a plain text in the password atribute
 /// </summary>
 /// <param name="user"> user to assing password</param>
 /// <param name="plain"> password in plain text</param>
 /// <returns> user with password assigned </returns>
 public static User EncryptPassword(User user, string plain)
 {
     user.Password = GetHashCode(plain);
     return user;
 }
Exemple #7
0
 /// <summary>
 /// Write the application log 
 /// </summary>
 /// <param name="user"> user that causes the log item</param>
 /// <param name="stamp"> event date and time</param>
 /// <param name="remoteAddress"> remote IP </param>
 /// <param name="page"> what page is implied </param>
 /// <param name="action"> what action has been done </param>
 /// <param name="ctx"> openaccess context </param>
 public static void WriteLog(User user, DateTime stamp, string remoteAddress, string page, string action, AriClinicContext ctx)
 {
     Log lg = new Log()
     {
         User = user,
         Stamp = stamp,
         RemoteAddress = remoteAddress,
         Page = page,
         Action = action
     };
     ctx.Add(lg);
     ctx.SaveChanges();
 }