Ejemplo n.º 1
0
        private void manager_record()
        {
            // Retrieve scientist's ID
            config.GetSingleResult("select ID from Scientist s, LoginInfo where s.ID = LoginInfo.ScientistID and LoginInfo.Username = '******' ");
            id = config.dt.Rows[0].Field <string>("ID");

            // Get profile picture
            config.GetImage("select ProfilePic from Scientist where ID = '" + id + "' ", id, profilepicBox, "ProfilePic");

            // Scientist information
            config.GetSingleResult("exec sp_ShowScientificInfo '" + id + "' ");
            sctidLabel.Text       = config.dt.Rows[0].Field <string>("ID");
            fnameLabel.Text       = config.dt.Rows[0].Field <string>("Name");
            fnameLabel2.Text      = config.dt.Rows[0].Field <string>("Name");
            sctposLabel.Text      = config.dt.Rows[0].Field <string>("Position");
            sctdepLabel.Text      = config.dt.Rows[0].Field <string>("Department");
            dobLabel.Text         = config.dt.Rows[0].Field <DateTime>("DoB").ToString("dd/MM/yyyy");
            genderLabel.Text      = config.dt.Rows[0].Field <string>("Gender");
            nationalityLabel.Text = config.dt.Rows[0].Field <string>("Nationality");
            cardLabel.Text        = config.dt.Rows[0].Field <long>("CreditCard").ToString();
            addressLabel.Text     = config.dt.Rows[0].Field <string>("Address");
            phoneLabel.Text       = config.dt.Rows[0].Field <string>("Phone");
            emailLabel.Text       = config.dt.Rows[0].Field <string>("Email");

            // Login information
            config.GetSingleResult("exec sp_ShowLoginInfo '" + id + "' ");
            usnLabel.Text  = config.dt.Rows[0].Field <string>("Username");
            passLabel.Text = config.dt.Rows[0].Field <string>("Password");
            roleLabel.Text = config.dt.Rows[0].Field <string>("Role");
        }
Ejemplo n.º 2
0
        private void login()
        {
            string username = usnTxtBox.Text;
            string password = passTxtBox.Text;

            query = "select * from LoginInfo where Username = N'" + username + "' and Password = N'" + password + "' ";

            config.GetSingleResult(query);
            config.GetRole(query);

            if (config.dt.Rows.Count > 0)
            {
                if (config.role == "manager")
                {
                    MainPage_Manager a = new MainPage_Manager(usnTxtBox.Text);
                    this.Hide();
                    a.ShowDialog();
                    this.Show();
                }
                else if (config.role == "scientist")
                {
                    MainPage_Scientist b = new MainPage_Scientist(usnTxtBox.Text);
                    this.Hide();
                    b.ShowDialog();
                    this.Show();
                }
            }
            else
            {
                MessageBox.Show("Account does not exist! Please contact administrator.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        private void load_department_members()
        {
            config.Load_DTG("exec sp_ShowScientistInDep cmt123", cmtmemGridview);
            config.Load_DTG("exec sp_ShowScientistInDep ctl789", ctlmemGridview);
            config.Load_DTG("exec sp_ShowScientistInDep hmt567", hmtmemGridview);
            config.Load_DTG("exec sp_ShowScientistInDep mcb345", mcbmemGridview);

            config.GetSingleResult("exec sp_NumOfMemInDep cmt123");
            numofmemLabel.Text = config.dt.Rows[0].Field <int>("Members").ToString();

            config.GetSingleResult("exec sp_NumOfMemInDep ctl789");
            numofmemLabel1.Text = config.dt.Rows[0].Field <int>("Members").ToString();

            config.GetSingleResult("exec sp_NumOfMemInDep hmt567");
            numofmemLabel2.Text = config.dt.Rows[0].Field <int>("Members").ToString();

            config.GetSingleResult("exec sp_NumOfMemInDep mcb345");
            numofmemLabel3.Text = config.dt.Rows[0].Field <int>("Members").ToString();
        }
Ejemplo n.º 4
0
        private void apparatusGridview_Click(object sender, EventArgs e)
        {
            selected_id = apparatusGridview.CurrentRow.Cells["ID"].Value.ToString();

            config.GetSingleResult("select * from Equipment where ID = '" + selected_id + "' ");
            if (config.dt.Rows.Count > 0)
            {
                config.GetImage("select Image from Equipment where ID = '" + selected_id + "' ", selected_id, apparatuspicBox, "Image");
                apparatusidLabel.Text         = config.dt.Rows[0].Field <int>("ID").ToString();
                apparatusnameLabel.Text       = config.dt.Rows[0].Field <string>("Name");
                apparatusdescriptTextbox.Text = config.dt.Rows[0].Field <string>("Description");
                apparatusQuantity.Text        = config.dt.Rows[0].Field <int>("Quantity").ToString();
            }
        }
Ejemplo n.º 5
0
        private void reportGridview_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            get_author = reportGridview.CurrentRow.Cells["Author"].Value.ToString();
            dateTime   = (DateTime)reportGridview.CurrentRow.Cells[0].Value;
            string r = dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff");

            config.GetSingleResult("select ReportFile from Report where ExpID = '" + exp_id + "' and Author = '" + get_author + "' and ReportTime = '" + r + "' ");
            byte[] bytes = config.dt.Rows[0].Field <byte[]>("ReportFile");

            tmpFile = GetTempReportFilePathWithExtension("docx");

            File.WriteAllBytes(tmpFile, bytes);
            functions.ImportReport(tmpFile, showreportRTextbox);
        }
        private void load_current_selected_participant()
        {
            config.GetSingleResult("exec sp_ShowScientificInfo '" + cur + "'");
            if (config.dt.Rows.Count > 0)
            {
                config.GetImage("select ProfilePic from Scientist where ID = '" + cur + "' ", cur, profilepicBox, "ProfilePic");

                sctidLabel.Text       = config.dt.Rows[0].Field <string>("ID");
                fnameLabel.Text       = config.dt.Rows[0].Field <string>("Name");
                sctposLabel.Text      = config.dt.Rows[0].Field <string>("Position");
                sctdepLabel.Text      = config.dt.Rows[0].Field <string>("Department");
                genderLabel.Text      = config.dt.Rows[0].Field <string>("Gender");
                nationalityLabel.Text = config.dt.Rows[0].Field <string>("Nationality");
                phoneLabel.Text       = config.dt.Rows[0].Field <string>("Phone");
                emailLabel.Text       = config.dt.Rows[0].Field <string>("Email");
            }
        }
Ejemplo n.º 7
0
        private void scientistGridview_Click(object sender, EventArgs e)
        {
            selected_id = scientistGridview.CurrentRow.Cells["ID"].Value.ToString();
            query       = "select a.* from openquery([" + config.SERVERNAME + "], 'exec Laboratory.dbo.sp_ListOfScientist') as a where a.ID = '" + selected_id + "' ";
            config.GetSingleResult(query);
            if (config.dt.Rows.Count > 0)
            {
                config.GetImage("select ProfilePic from Scientist where ID = '" + selected_id + "' ", selected_id, profilepicBox, "ProfilePic");

                sctidLabel.Text       = config.dt.Rows[0].Field <string>("ID");
                fnameLabel.Text       = config.dt.Rows[0].Field <string>("Name");
                sctposLabel.Text      = config.dt.Rows[0].Field <string>("Position");
                sctdepLabel.Text      = config.dt.Rows[0].Field <string>("Department");
                genderLabel.Text      = config.dt.Rows[0].Field <string>("Gender");
                nationalityLabel.Text = config.dt.Rows[0].Field <string>("Nationality");
                phoneLabel.Text       = config.dt.Rows[0].Field <string>("Phone");
                emailLabel.Text       = config.dt.Rows[0].Field <string>("Email");
            }
        }