Beispiel #1
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            DocDataDataContext MDC = new DocDataDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\arbab\Downloads\UserHospital-20171213T080148Z-001\UserHospital\UserHospital\DB.mdf;Integrated Security=True;Connect Timeout=30");
            Doctor             a   = new Doctor();

            a.DregDate        = dRegDate.Value.Date.ToString();
            a.DName           = dName.Text;
            a.Dgender         = dGender.Text;
            a.Ddepartment     = dDepartment.Text;
            a.Ddob            = dDob.Value.Date.ToString();
            a.Dage            = dAge.Text;
            a.DbloodGroup     = dBloodGroup.Text;
            a.DmaritialStatus = dMaritialstatus.Text;
            a.Daddress        = dAddress.Text;
            a.Dcity           = dCity.Text;
            a.Dcountry        = dCountry.Text;
            a.DcontactNo      = dContactNo.Text;
            a.DpatientList    = DBNull.Value.ToString();
            a.DuserName       = dUsername.Text;
            a.Dpassword       = dPassword.Text;
            MDC.Doctors.InsertOnSubmit(a);
            MDC.SubmitChanges();
        }
Beispiel #2
0
        private void login_Click(object sender, EventArgs e)
        {
            //if (IsvalidUser(metroTextBox2.Text, metroTextBox3.Text))
            //{
            //    DashBoard u = new DashBoard();
            //    u.Show();
            //    this.Hide();
            //}

            if (metroComboBox1.Text == "OfficeUser")
            {
                officeUsersLoginDataContext mdb = new officeUsersLoginDataContext();
                var q = from a in mdb.UserTables
                        where a.userName == metroTextBox2.Text &&
                        a.password == metroTextBox3.Text
                        select a;

                if (q.Any())
                {
                    DashBoard u = new DashBoard();


                    u.Show();

                    this.Hide();
                }
                else
                {
                    metroLabel4.Text = "Invalid Information please use correct information";
                    //return false;
                }
            }
            if (metroComboBox1.Text == "Doctor")
            {
                DocDataDataContext mdb = new DocDataDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\arbab\Downloads\UserHospital-20171213T080148Z-001\UserHospital\UserHospital\DB.mdf;Integrated Security=True;Connect Timeout=30");
                var q = from a in mdb.Doctors
                        where a.DuserName == metroTextBox2.Text &&
                        a.Dpassword == metroTextBox3.Text
                        select a;
                if (q.Any())
                {
                    DocDash            u   = new DocDash();
                    DocDataDataContext mdt = new DocDataDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\arbab\Downloads\UserHospital-20171213T080148Z-001\UserHospital\UserHospital\DB.mdf;Integrated Security=True;Connect Timeout=30");
                    var c = from a in mdt.Doctors
                            where a.DuserName == metroTextBox2.Text
                            select a;

                    u.Show();
                    this.Hide();
                    u.DDage.Text            = c.First().Dage;
                    u.DDbloodgroup.Text     = c.First().DbloodGroup;
                    u.DDdepartment.Text     = c.First().Ddepartment;
                    u.DDdob.Text            = c.First().Ddob;
                    u.DDgender.Text         = c.First().Dgender;
                    u.DDname.Text           = c.First().DName;
                    u.DDregDate.Text        = c.First().DregDate;
                    u.DDmaritialSattus.Text = c.First().DmaritialStatus;

                    //this.Hide();
                }
                else
                {
                    metroLabel4.Text = "Invalid Information please use correct information";
                }
            }
        }