Beispiel #1
0
        protected void ButtonUpdateP_Click(object sender, EventArgs e)
        {
            string name  = TextBoxNameP.Text;
            string email = TextBoxEmailP.Text;
            string pass  = TextBoxPassP.Text;

            //string age = TextBoxAge.Text;

            Int32.TryParse(TextBoxAgeP.Text, out int age);
            Int32.TryParse(TextBoxSocialNrP.Text, out int socialnr);

            Patient pat = (Patient)Session["pat_log"];

            foreach (Patient p in patientslistdesr) //p is local variable
            {
                if (pat.Email == p.Email)
                {
                    p.Name     = name;
                    p.Email    = email;
                    p.Password = pass;
                    p.Age      = age;
                    p.SocialNr = socialnr;

                    LabelPatDash.Text = "Updated patient: " + p.Name;
                }
            }
            /*  */

            GridViewPatInfo.DataSource = patientslistdesr;
            GridViewPatInfo.DataBind();
        }
Beispiel #2
0
        //private string emp;

        protected void Page_Load(object sender, EventArgs e)
        {
            Patient emp = (Patient)Session["pat_log"];

            filename = Server.MapPath("~/App_Data/patientslistdata.ser");

            filenamed = Server.MapPath("~/App_Data/dentistslistdata.ser"); //decalring the path to the serializedfile

            LabelPatDash.Text = emp.Name;
            Deserialise();

            GridViewPatInfo.DataSource = patientslistdesr;
            GridViewPatInfo.DataBind();

            if (!Page.IsPostBack)
            {
                DeserialiseDent();

                List <string> dentistnamelist = new List <string>(); //making new list only with names
                foreach (Dentist d in dentistslistdesr)
                {
                    dentistnamelist.Add(d.Name);
                }

                GridViewDNames.DataSource = dentistnamelist;
                GridViewDNames.DataBind();

                // mygridallp.DataSource = patientslistdesr;
                // mygridallp.DataBind();
                //GridView1.Columns[0].Visible = false;
            }
        }
Beispiel #3
0
        protected void ButtonSaveToFile_Click(object sender, EventArgs e)
        {
            FileStream      fs = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None);
            BinaryFormatter bf = new BinaryFormatter();

            bf.Serialize(fs, patientslistdesr);
            fs.Close();

            GridViewPatInfo.DataSource = patientslistdesr;
            GridViewPatInfo.DataBind();

            LabelPatDash.Text = "Dentists list saved to file.";
        }