コード例 #1
0
        protected void Label2_Click(object sender, EventArgs e)
        {
            var doctorName = (sender as LinkButton).Text;

            HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();
            var doc = context.Doctors.FirstOrDefault(d => d.FullName == doctorName);

            Response.Redirect($"Doctor.aspx?id={doc.Id}");
        }
コード例 #2
0
        protected void Label2_Click(object sender, EventArgs e)
        {
            string patientName = (sender as LinkButton).Text;

            HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();
            var pat = context.Pacients.FirstOrDefault(p => p.FullName == patientName);

            Response.Redirect($"Pacient.aspx?id={pat.Id}");
        }
コード例 #3
0
ファイル: Diseas.aspx.cs プロジェクト: GrigoryanArtem/ASPLabs
        protected void Page_Load(object sender, EventArgs e)
        {
            string name = Request.QueryString["name"];

            HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();
            var disease = context.Diseases.AsNoTracking().FirstOrDefault(d => d.Name == name);

            ctrNameL.Text = disease.Name;
            ctrDescL.Text = disease.Description;
        }
コード例 #4
0
ファイル: Site.Master.cs プロジェクト: GrigoryanArtem/ASPLabs
        private void GetUser()
        {
            HttpCookie name = Request.Cookies["name"];
            HttpCookie sign = Request.Cookies["sign"];

            HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();

            user = name is null || sign is null ? null : context.Users
                   .AsNoTracking()
                   .FirstOrDefault(u => u.Name == name.Value && u.Password == sign.Value);
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckUser();

            int id = Convert.ToInt32(Request.QueryString["id"]);
            HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();

            var doc = context.Doctors.FirstOrDefault(d => d.Id == id);

            if (doc != null)
            {
                ctrNameL.Text = doc.FullName;
                ctrSpecL.Text = doc.Specialization.Name;
            }
        }
コード例 #6
0
        private void CheckUser()
        {
            HttpCookie name = Request.Cookies["name"];
            HttpCookie sign = Request.Cookies["sign"];

            HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();

            User user = name is null || sign is null ? null : context.Users
                        .AsNoTracking()
                        .FirstOrDefault(u => u.Name == name.Value && u.Password == sign.Value);

            if (user is null)
            {
                Response.Redirect("/Login.aspx");
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckUser();

            HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();
            int id = Convert.ToInt32(Request.QueryString["id"]);

            Pacient pcnt = context.Pacients.FirstOrDefault(p => p.Id == id);

            if (pcnt != null)
            {
                ctrNameL.Text       = pcnt.FullName;
                ctrGenderL.Text     = pcnt.Gender.ToString();
                ctrPhoneNumber.Text = pcnt.PacientDetail.PhoneNumber;
                ctrDateOfBirth.Text = pcnt.PacientDetail.DateOfBirth.ToShortDateString();
            }
        }
コード例 #8
0
        protected void Create_Click(object sender, EventArgs e)
        {
            string name = ctrLoginTB.Text;

            string pass1 = ctrPassword1TB.Text;
            string pass2 = ctrPassword2TB.Text;



            if (pass1 == pass2)
            {
                HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();

                if (context.Users.AsNoTracking().FirstOrDefault(u => u.Name == name) is null)
                {
                    context.Users.Add(new User {
                        Name = name, Password = CryptoProvider.GetMD5Hash(pass1 + "31415")
                    });
                    context.SaveChanges();

                    Response.Redirect("Login.aspx");
                }
            }
        }
コード例 #9
0
ファイル: Login.aspx.cs プロジェクト: GrigoryanArtem/ASPLabs
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            string name = ctrLoginTB.Text;
            string pass = CryptoProvider.GetMD5Hash(ctrPasswordTB.Text + "31415");

            HospitalDataBaseEntities2 context = new HospitalDataBaseEntities2();

            context.Users.AsNoTracking().FirstOrDefault(u => u.Name == name && u.Password == pass);

            if (context.Users.AsNoTracking().FirstOrDefault(u => u.Name == name && u.Password == pass) != null)
            {
                HttpCookie cookieName = new HttpCookie("name", ctrLoginTB.Text);
                HttpCookie cookieSign = new HttpCookie("sign", CryptoProvider.GetMD5Hash(ctrPasswordTB.Text + "31415"));

                Response.Cookies.Add(cookieName);
                Response.Cookies.Add(cookieSign);

                Response.Redirect("Home.aspx");
            }
            else
            {
                ErrorLabel.Visible = true;
            }
        }