Exemple #1
0
 public Form2()
 {
     InitializeComponent();
     dbr                  = new DBRetrieve();
     labPatient           = new LabPatient();
     labappmnt            = new LabAppointment();
     manipulateLabAppmnt  = new LabAppointment();
     manipulateLabPatient = new LabPatient();
 }
Exemple #2
0
        private UserType checkUserType(string username)
        {
            UserType type = UserType.UNKNOWN;

            DBRetrieve retrieve = new DBRetrieve();

            type = retrieve.GetUserType(username);

            return(type);
        }
Exemple #3
0
        private void UserMainForm_Load(object sender, EventArgs e)
        {
            DataSet    ds       = new DataSet();
            DBRetrieve retrieve = new DBRetrieve();

            ds = retrieve.GetWorkingHoursForCurrentMonth(user);
            List <Project> list = retrieve.GetAllProjects();

            LoadHoursForCurrentUser();

            cmbProjects.DataSource    = list;
            cmbProjects.DisplayMember = "name";
        }
Exemple #4
0
        private void LoadHoursForCurrentUser()
        {
            DBRetrieve         retreive = new DBRetrieve();
            List <CustomEvent> events   = retreive.GetWorkingHoursForLoggedUser(user, Convert.ToInt32(DateTime.Now.Month));

            foreach (CustomEvent custom in events)
            {
                calendar.AddEvent(custom);
            }

            calendar.CalendarView       = CalendarViews.Month;
            calendar.AllowEditingEvents = true;



            calendar.IsAccessible = true;
            calendar.Enabled      = true;
        }
Exemple #5
0
        public TestDetailsEntry()
        {
            InitializeComponent();
            labpatient = new LabPatient();
            dbr        = new DBRetrieve();
            validation = new Validation();
            bloodtest  = new BloodTest();
            labtest    = new LabTest();

            txt_Panel1 = new Dictionary <string, string> {
                { "Field", "" }, { "DType", "" }, { "Error_lbl", "" }, { "Value", "" }
            };
            txt_Panel2 = new Dictionary <string, string> {
                { "Field", "" }, { "DType", "" }, { "Error_lbl", "" }, { "Value", "" }
            };
            txt_Panel3 = new Dictionary <string, string> {
                { "Field", "" }, { "DType", "" }, { "Error_lbl", "" }, { "Value", "" }
            };

            //updatingTest = new Dictionary<string, string> { { "field_num", "" } };
        }
Exemple #6
0
        private void DisplayAllProjects()
        {
            this.dataGridViewProjects.DataSource = null;
            this.dataGridViewProjects.Rows.Clear();
            this.dataGridViewProjects.Columns.Clear();

            List <Project> list = new List <Project>();

            try
            {
                DBRetrieve retrieve = new DBRetrieve();
                list = retrieve.GetAllProjects();

                BindingSource Source = new BindingSource();

                for (int i = 0; i < list.Count; i++)
                {
                    Source.Add(list.ElementAt(i));
                }
                ;

                BindingSource bindingSource = new BindingSource();
                bindingSource.DataSource = list;

                dataGridViewProjects.AutoGenerateColumns = false;
                dataGridViewProjects.AutoSize            = true;

                dataGridViewProjects.ReadOnly   = true;
                dataGridViewProjects.DataSource = bindingSource;

                DataGridViewColumn column = new DataGridViewTextBoxColumn();
                column.DataPropertyName = "name";
                column.Name             = "Name";
                dataGridViewProjects.Columns.Add(column);

                column = new DataGridViewTextBoxColumn();
                column.DataPropertyName = "code";
                column.Name             = "Code";
                dataGridViewProjects.Columns.Add(column);

                column = new DataGridViewTextBoxColumn();
                column.DataPropertyName = "description";
                column.Name             = "Description";
                dataGridViewProjects.Columns.Add(column);

                column = new DataGridViewTextBoxColumn();
                column.DataPropertyName = "active";
                column.Name             = "Active";
                dataGridViewProjects.Columns.Add(column);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            foreach (DataGridViewColumn column in dataGridViewProjects.Columns)
            {
                if (column.HeaderText == "Id")
                {
                    column.Visible = false;
                }
            }
        }
Exemple #7
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.username = tbUsername.Text;
            Properties.Settings.Default.password = tbPassword.Text;

            Properties.Settings.Default.Save();

            MySqlConnection connection;

            Common.CommonSettings.connectionString = ConfigurationManager.ConnectionStrings["MySqlConnection"].ConnectionString;

            using (connection = new MySqlConnection(connectionString))
            {
                try
                {
                    connection.Open();

                    DBRetrieve retrieve = new DBRetrieve();

                    bool UserExist = retrieve.DoesUserExist(tbUsername.Text, tbPassword.Text);

                    if (UserExist)
                    {
                        userType             = checkUserType(tbUsername.Text);
                        user                 = retrieve.GetEmployeeByUsername(tbUsername.Text);
                        SessionSettings.user = user;

                        switch (userType)
                        {
                        case UserType.UNKNOWN:
                            MessageBox.Show("User unknown!", "Connection unsuccesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.Show();
                            return;

                        case UserType.Administrator:
                            //MessageBox.Show("Succesfully connected to database!", "Connection succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            AdminMainForm a = new AdminMainForm(user);
                            a.Show();
                            this.Hide();
                            break;

                        case UserType.RegularUser:
                            //MessageBox.Show("Succesfully connected to database!", "Connection succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            UserMainForm u = new UserMainForm(user);
                            u.Show();
                            //this.Close();
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid username/password. Please try again.", "Connection unsuccesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Show();
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }