예제 #1
0
        //KeyDown Event...

        private void Add_Comment_KeyDown(object sender, KeyEventArgs e)
        {
            if (pbAddComment.Visible == true)
            {
                //Execute Update...

tryagainUpdate:
                try
                {
                    ExecuteUpdate(txtComments.Text, ID);
                }
                catch
                {
                    goto tryagainUpdate;
                }

                //Done..

                MessageBox.Show("Comments were successfully added to " + comboBox1.Text + "'s profile!");

                Signin_and_Select_Task nf = new Signin_and_Select_Task();
                nf.Show();

                Close();
            }
        }
예제 #2
0
        private void pbAddCommentM_Click(object sender, EventArgs e)
        {
            MessageBoxContent = "Are you sure you want to save these details?";

            DialogResult dialogResult = MessageBox.Show(MessageBoxContent, MessageBoxTitle, MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                //Execute Update...

tryagainUpdate:
                try
                {
                    ExecuteUpdate(txtComments.Text, ID);
                }
                catch
                {
                    goto tryagainUpdate;
                }

                //Done..

                MessageBox.Show("Comments were successfully added to " + comboBox1.Text + "'s profile!");

                Signin_and_Select_Task nf = new Signin_and_Select_Task();
                nf.Show();

                Close();
            }
            else if (dialogResult == DialogResult.No)
            {
            }
        }
예제 #3
0
        //Switch to link...

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Signin_and_Select_Task nf = new Signin_and_Select_Task();

            nf.Show();

            Close();
        }
예제 #4
0
        //Timer1...

        private void timer1_Tick(object sender, EventArgs e)
        {
            Close();

            Signin_and_Select_Task nf = new Signin_and_Select_Task();

            nf.Show();
        }
예제 #5
0
        //Switch to link...

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            MessageBoxContent = "You haven't registered any employee. Are you sure you want to exit?";

            DialogResult dialogResult = MessageBox.Show(MessageBoxContent, MessageBoxTitle, MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                Close();

                Signin_and_Select_Task nf = new Signin_and_Select_Task();
                nf.Show();
            }
            else if (dialogResult == DialogResult.No)
            {
            }
        }
예제 #6
0
        //KeyDown Event...

        private void Register_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (txtFullName.Text != "")
                {
                    //Get Date & Time of Registration...

                    RegDate = DateTime.Now.ToString();

                    if (filepath == "No Path")
                    {
                        //if no Photo...

tryagain1:
                        try
                        {
                            connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database1.mdf;Integrated Security=True;User Instance=True";
                            cnn = new SqlConnection(connectionString);

                            cnn.Open();

                            SqlCommand cmd = new SqlCommand("insert into tbl_EmployeeData (FullName, NICNo, DOB, Address, HomePhone, MobilePhone, Comments, RegisteredOn) values (@FullName, @NICNo, @DOB, @Address, @HomePhone, @MobilePhone, @Comments, @RegisteredOn)", cnn);
                            cmd.Parameters.AddWithValue("@FullName", txtFullName.Text);
                            cmd.Parameters.AddWithValue("@NICNo", txtNICNo.Text);
                            cmd.Parameters.AddWithValue("@DOB", dtpDOB.Value);
                            cmd.Parameters.AddWithValue("@Address", txtAddress.Text);
                            cmd.Parameters.AddWithValue("@HomePhone", txtHomePhone.Text);
                            cmd.Parameters.AddWithValue("@MobilePhone", txtMobilePhone.Text);
                            cmd.Parameters.AddWithValue("@Comments", txtComments.Text);
                            cmd.Parameters.AddWithValue("@RegisteredOn", RegDate);
                            cmd.ExecuteNonQuery();

                            cnn.Close();
                        }
                        catch
                        {
                            goto tryagain1;
                        }

                        //Done...

                        MessageBox.Show(txtFullName.Text + " was registered successfully at " + RegDate + "!");

                        Signin_and_Select_Task nf = new Signin_and_Select_Task();
                        nf.Show();

                        Close();
                    }
                    else
                    {
                        //Check Photo...

                        if (File.Exists(filepath))
                        {
tryagain2:
                            try
                            {
                                connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database1.mdf;Integrated Security=True;User Instance=True";
                                cnn = new SqlConnection(connectionString);

                                byte[] content = ImageToStream(filepath);
                                cnn.Open();

                                SqlCommand cmd = new SqlCommand("insert into tbl_EmployeeData (Photo, FullName, NICNo, DOB, Address, HomePhone, MobilePhone, Comments, RegisteredOn) values (@Photo, @FullName, @NICNo, @DOB, @Address, @HomePhone, @MobilePhone, @Comments, @RegisteredOn)", cnn);
                                cmd.Parameters.AddWithValue("@Photo", content);
                                cmd.Parameters.AddWithValue("@FullName", txtFullName.Text);
                                cmd.Parameters.AddWithValue("@NICNo", txtNICNo.Text);
                                cmd.Parameters.AddWithValue("@DOB", dtpDOB.Value);
                                cmd.Parameters.AddWithValue("@Address", txtAddress.Text);
                                cmd.Parameters.AddWithValue("@HomePhone", txtHomePhone.Text);
                                cmd.Parameters.AddWithValue("@MobilePhone", txtMobilePhone.Text);
                                cmd.Parameters.AddWithValue("@Comments", txtComments.Text);
                                cmd.Parameters.AddWithValue("@RegisteredOn", RegDate);
                                cmd.ExecuteNonQuery();

                                cnn.Close();
                            }
                            catch
                            {
                                goto tryagain2;
                            }

                            //Done...

                            MessageBox.Show(txtFullName.Text + " was registered successfully at " + RegDate + "!");

                            Signin_and_Select_Task nf = new Signin_and_Select_Task();
                            nf.Show();

                            Close();
                        }
                        else
                        {
                            MessageBox.Show("Photo can't be found.");

                            Register nf = new Register();
                            nf.Show();

                            Close();
                        }
                    }
                }
            }
        }
예제 #7
0
        private void pbRegisterM_Click(object sender, EventArgs e)
        {
            string         connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database1.mdf;Integrated Security=True;User Instance=True";
            string         sql         = "SELECT * FROM tbl_EmployeeData WHERE FullName = '" + txtFullName.Text + "'";
            SqlConnection  connection  = new SqlConnection(connectionString);
            SqlDataAdapter dataadapter = new SqlDataAdapter(sql, connection);
            DataSet        ds          = new DataSet();

            connection.Open();
            dataadapter.Fill(ds, "Table1");
            connection.Close();

            if (ds.Tables[0].Rows.Count == 0)
            {
                MessageBoxContent = "Are you sure you want to save these details?";

                DialogResult dialogResult = MessageBox.Show(MessageBoxContent, MessageBoxTitle, MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    //Get Date & Time of Registration...

                    RegDate = DateTime.Now.ToString();

                    if (filepath == "No Path")
                    {
                        //if no Photo...

tryagain1:
                        try
                        {
                            connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database1.mdf;Integrated Security=True;User Instance=True";
                            cnn = new SqlConnection(connectionString);

                            cnn.Open();

                            SqlCommand cmd = new SqlCommand("insert into tbl_EmployeeData (FullName, NICNo, DOB, Address, HomePhone, MobilePhone, Comments, RegisteredOn) values (@FullName, @NICNo, @DOB, @Address, @HomePhone, @MobilePhone, @Comments, @RegisteredOn)", cnn);
                            cmd.Parameters.AddWithValue("@FullName", txtFullName.Text);
                            cmd.Parameters.AddWithValue("@NICNo", txtNICNo.Text);
                            cmd.Parameters.AddWithValue("@DOB", dtpDOB.Value);
                            cmd.Parameters.AddWithValue("@Address", txtAddress.Text);
                            cmd.Parameters.AddWithValue("@HomePhone", txtHomePhone.Text);
                            cmd.Parameters.AddWithValue("@MobilePhone", txtMobilePhone.Text);
                            cmd.Parameters.AddWithValue("@Comments", txtComments.Text);
                            cmd.Parameters.AddWithValue("@RegisteredOn", RegDate);
                            cmd.ExecuteNonQuery();

                            cnn.Close();
                        }
                        catch (Exception ex)
                        {
                            goto tryagain1;
                        }

                        //Done...

                        MessageBox.Show(txtFullName.Text + " was registered successfully at " + RegDate + "!");

                        Close();

                        Signin_and_Select_Task nf = new Signin_and_Select_Task();
                        nf.Show();
                    }
                    else
                    {
                        //Check Photo...

                        if (File.Exists(filepath))
                        {
tryagain2:
                            try
                            {
                                connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database1.mdf;Integrated Security=True;User Instance=True";
                                cnn = new SqlConnection(connectionString);

                                byte[] content = ImageToStream(filepath);
                                cnn.Open();

                                SqlCommand cmd = new SqlCommand("insert into tbl_EmployeeData (Photo, FullName, NICNo, DOB, Address, HomePhone, MobilePhone, Comments, RegisteredOn) values (@Photo, @FullName, @NICNo, @DOB, @Address, @HomePhone, @MobilePhone, @Comments, @RegisteredOn)", cnn);
                                cmd.Parameters.AddWithValue("@Photo", content);
                                cmd.Parameters.AddWithValue("@FullName", txtFullName.Text);
                                cmd.Parameters.AddWithValue("@NICNo", txtNICNo.Text);
                                cmd.Parameters.AddWithValue("@DOB", dtpDOB.Value);
                                cmd.Parameters.AddWithValue("@Address", txtAddress.Text);
                                cmd.Parameters.AddWithValue("@HomePhone", txtHomePhone.Text);
                                cmd.Parameters.AddWithValue("@MobilePhone", txtMobilePhone.Text);
                                cmd.Parameters.AddWithValue("@Comments", txtComments.Text);
                                cmd.Parameters.AddWithValue("@RegisteredOn", RegDate);
                                cmd.ExecuteNonQuery();

                                cnn.Close();
                            }
                            catch
                            {
                                goto tryagain2;
                            }

                            //Done...

                            MessageBox.Show(txtFullName.Text + " was registered successfully at " + RegDate + "!");

                            Signin_and_Select_Task nf = new Signin_and_Select_Task();
                            nf.Show();

                            Close();
                        }
                        else
                        {
                            MessageBox.Show("Photo can't be found.");

                            Close();

                            Register nf = new Register();
                            nf.Show();
                        }
                    }
                }
                else if (dialogResult == DialogResult.No)
                {
                }
            }
            else
            {
                MessageBox.Show("An employee with the name " + txtFullName.Text + " is allready registered. Please check the fullname and try again");
            }
        }