Beispiel #1
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            if (txtSearch.Text != "")
            {
                string query2;
                string hq;
                // syta
                hq     = "%" + txtSearch.Text + "%";
                query2 = "SELECT * FROM Users WHERE User_ID like '" + hq + "'";

                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query2, cn.connect);

                    MySqlDataReader Datareader = cmd.ExecuteReader();
                    if (Datareader.Read())
                    {
                        txtUserID.Text      = Datareader["User_ID"].ToString();
                        txtUserName.Text    = Datareader["User_Name"].ToString();
                        txtPassword.Text    = Datareader["Password"].ToString();
                        cboPriveledges.Text = Datareader["Priveledges"].ToString();
                        chckStatus.Text     = Datareader["Status"].ToString();
                        // dtpicDoR.Value = Convert.ToDateTime(Datareader["Reg_Date"].ToString());

                        //  dtpicDoR.Value = Convert.ToDateTime(Datareader["DoR"].ToString());

                        if (Datareader["Status"].ToString() == "True")
                        {
                            chckStatus.CheckState = CheckState.Checked;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            if (txtSearch.Text != "")
            {
                string query;
                string hq;
                // syta
                hq    = "%" + txtSearch.Text + "%";
                query = "SELECT * FROM Check_in WHERE Client_ID like '" + hq + "'";

                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query, cn.connect);

                    MySqlDataReader Datareader = cmd.ExecuteReader();
                    if (Datareader.Read())
                    {
                        cboClientID.Text  = Datareader["Client_ID"].ToString();
                        cboVehicleID.Text = Datareader["Vehicle_ID"].ToString();
                        // dtReturn.Value = Convert.ToDateTime(Datareader["Return_Date"].ToString());
                        txtExtracost.Text = Datareader["Extra_Cost"].ToString();
                    }
                }
            }
        }
Beispiel #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (cboClientID.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                cboClientID.Focus();
            }
            else if (cboVehicleID.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                cboVehicleID.Focus();
            }
            else if (dtHire.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                dtHire.Focus();
            }
            else if (txtDuration.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtDuration.Focus();
            }
            else if (txtDescription.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtDescription.Focus();
            }
            else if (txtAmountPaid.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtAmountPaid.Focus();
            }
            else
            {
                string query;
                query = "DELETE FROM Check_out WHERE Client_ID   LIKE '" + cboClientID.Text + "'";
                conn cn = new conn();

                if (cn.OpenConnection() == true)
                {
                    if (MessageBox.Show("Are you sure you want to make this changes?", "Kunis messaging system", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                        cmd.ExecuteNonQuery();
                        cleanData();
                        txtSearch.Text = "";
                        MessageBox.Show("Record deleted", "Kunis messaging system", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        txtSearch.Focus();
                    }
                    else
                    {
                        cleanData();
                        txtSearch.Text = "";
                        MessageBox.Show("Record not deleted", "Kunis messaging system", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtSearch.Focus();
                    }
                }
            }
        }
Beispiel #4
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (cboClientID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboClientID.Focus();
            }
            else if (cboVehicleID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboVehicleID.Focus();
            }
            else if (dtReturn.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtReturn.Focus();
            }

            else if (txtExtracost.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtExtracost.Focus();
            }

            /**  else
             * {
             *    if (FindRecord(txtClientID.Text) == true)
             *    {
             *        MessageBox.Show(txtClientID.Text + " already exists!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             *        txtVehicleID.Focus();
             *    }**/

            string query;

            query = "INSERT INTO Check_in VALUES('" + cboClientID.Text + "','" + cboVehicleID.Text + "','" + dtReturn.Text + "','" + txtExtracost.Text + "')";
            conn cn = new conn();

            if (cn.OpenConnection() == true)
            {
                if (MessageBox.Show("Are you sure you want to save record?", "KUNIS Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                    cmd.ExecuteNonQuery();

                    cleanData();
                    MessageBox.Show("Records Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Records not Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cboClientID.Focus();
                }
            }
            cn.CloseConnection();
        }
Beispiel #5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (cboClientID.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                cboClientID.Focus();
            }
            else if (cboVehicleID.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                cboVehicleID.Focus();
            }
            else if (dtReturn.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                dtReturn.Focus();
            }
            else if (txtExtracost.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtExtracost.Focus();
            }
            else if (txtSearch.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtSearch.Focus();
            }
            else
            {
                string query;
                query = "UPDATE Check_in SET Client_ID ='" + cboClientID.Text + "',Vehicle_ID='" + cboVehicleID.Text + "',Return_Date= '" + dtReturn.Text + "',Extra_Cost = '" + txtExtracost.Text + "' WHERE Client_ID LIKE '" + cboClientID.Text + "'";
                conn cn = new conn();

                if (cn.OpenConnection() == true)
                {
                    if (MessageBox.Show("Are you sure you want to make this changes?", "Kunis messaging system", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                        cmd.ExecuteNonQuery();
                        cleanData();
                        txtSearch.Text = "";
                        MessageBox.Show("Record saved", "Kunis messaging system", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        txtSearch.Focus();
                    }
                    else
                    {
                        cleanData();
                        txtSearch.Text = "";
                        MessageBox.Show("Record not saved", "Kunis messaging system", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtSearch.Focus();
                    }
                }
            }
        }
Beispiel #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (txtEmployeeID.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtEmployeeID.Focus();
            }
            else if (txtEmployeeName.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtEmployeeName.Focus();
            }
            else if (txtMobileNo.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtMobileNo.Focus();
            }

            else if (txtSearch.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtSearch.Focus();
            }
            else
            {
                string query;
                query = "DELETE FROM Employee WHERE Employee_ID   LIKE '" + txtEmployeeID.Text + "'";
                conn cn = new conn();

                if (cn.OpenConnection() == true)
                {
                    if (MessageBox.Show("Are you sure you want to make this changes?", "Kunis messaging system", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                        cmd.ExecuteNonQuery();
                        cleanData();
                        txtSearch.Text = "";
                        MessageBox.Show("Record deleted", "Kunis messaging system", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        txtSearch.Focus();
                    }
                    else
                    {
                        cleanData();
                        txtSearch.Text = "";
                        MessageBox.Show("Record not deleted", "Kunis messaging system", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtSearch.Focus();
                    }
                }
            }
        }
Beispiel #7
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (txtEmployeeID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmployeeID.Focus();
            }
            else if (txtEmployeeName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmployeeName.Focus();
            }
            else if (txtMobileNo.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMobileNo.Focus();
            }


            else
            {
                if (FindRecord(txtEmployeeID.Text) == true)
                {
                    MessageBox.Show(txtEmployeeID.Text + " already exists!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtEmployeeID.Focus();
                }

                string query;
                query = "INSERT INTO Employee VALUES('" + txtEmployeeID.Text + "','" + txtEmployeeName.Text + "','" + txtMobileNo.Text + "')";
                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    if (MessageBox.Show("Are you sure you want to save record?", "KUNIS Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                        cmd.ExecuteNonQuery();

                        cleanData();
                        MessageBox.Show("Records Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Records not Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtEmployeeID.Focus();
                    }
                }
                cn.CloseConnection();
            }
        }
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            if (txtVehicleID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "Vehicle Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtVehicleID.Focus();
            }
            else if (txtMake.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "Vehicle Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMake.Focus();
            }
            else if (txtModel.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "Vehicle Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtModel.Focus();
            }

            else if (txtSearch.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "Vehicle Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtSearch.Focus();
            }
            else
            {
                query = "DELETE FROM Vehicle WHERE Vehicle_ID='" + txtSearch.Text + "'";
                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    if (MessageBox.Show("Are you sure you want to delete record?", "Vehicle Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                        cmd.ExecuteNonQuery();

                        cleanData();
                        MessageBox.Show("Record deleted!", "Vehicle Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Record failed to delete!", "Vehicle Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtVehicleID.Focus();
                    }
                }

                cn.CloseConnection();
            }
        }
Beispiel #9
0
        private void txtSearch_TextChanged_1(object sender, EventArgs e)
        {
            if (txtSearch.Text != "")
            {
                string query2;
                string hq;
                // syta
                hq     = "%" + txtSearch.Text + "%";
                query2 = "SELECT * FROM Owner WHERE Owner_ID like '" + hq + "'";

                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query2, cn.connect);

                    MySqlDataReader Datareader = cmd.ExecuteReader();
                    if (Datareader.Read())
                    {
                        txtOwnerID.Text   = Datareader["Owner_ID"].ToString();
                        txtOwnerName.Text = Datareader["Owner_Name"].ToString();
                        txtMobileNo.Text  = Datareader["Mobile_No"].ToString();
                        chckStatus.Text   = Datareader["Status"].ToString();


                        /**  dtpicDoR.Value = Convert.ToDateTime(Datareader["DoR"].ToString());
                         * cboOwnerID.Text = Datareader["Owner_ID"].ToString();
                         * txtPic.Text = Datareader["Photo"].ToString().Replace("__", "\\");
                         * if (txtPic.Text != "")
                         * {
                         *  pic.Image = Image.FromFile(txtPic.Text);
                         * }
                         * else
                         * {
                         *  pic.Image = null;
                         * }**/
                        if (Datareader["Status"].ToString() == "True")
                        {
                            chckStatus.CheckState = CheckState.Checked;
                        }
                    }
                }
            }
        }
        private void txtSearch_TextChanged_1(object sender, EventArgs e)
        {
            if (txtSearch.Text != "")
            {
                string query2;
                string hq;
                // syta
                hq     = "%" + txtSearch.Text + "%";
                query2 = "SELECT * FROM Vehicle WHERE Vehicle_ID like '" + hq + "'";

                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query2, cn.connect);

                    MySqlDataReader Datareader = cmd.ExecuteReader();
                    if (Datareader.Read())
                    {
                        txtVehicleID.Text = Datareader["Vehicle_ID"].ToString();
                        txtMake.Text      = Datareader["Make"].ToString();
                        txtModel.Text     = Datareader["Model"].ToString();
                        txtRate.Text      = Datareader["Rate"].ToString();
                        chckStatus.Text   = Datareader["Status"].ToString();
                        // dtpicDoR.Value = Convert.ToDateTime(Datareader["Reg_Date"].ToString());

                        cboOwnerID.Text = Datareader["Owner_ID"].ToString();
                        txtPic.Text     = Datareader["Photo"].ToString().Replace("__", "\\");
                        if (txtPic.Text != "")
                        {
                            pic.Image = Image.FromFile(txtPic.Text);
                        }
                        else
                        {
                            pic.Image = null;
                        }
                        if (Datareader["Status"].ToString() == "True")
                        {
                            chckStatus.CheckState = CheckState.Checked;
                        }
                    }
                }
            }
        }
        private void addOwner()
        {
            query = "SELECT * FROM Owner ORDER BY Owner_ID ASC";
            conn cn = new conn();

            if (cn.OpenConnection() == true)
            {
                MySqlCommand    cmd        = new MySqlCommand(query, cn.connect);
                MySqlDataReader dataReader = cmd.ExecuteReader();
                this.cboOwnerID.Items.Clear();
                while (dataReader.Read())
                {
                    if (dataReader["Owner_ID"].ToString().Replace(" ", "") != "")
                    {
                        this.cboOwnerID.Items.Add(dataReader["Owner_ID"].ToString());
                    }
                }
            }
        }
Beispiel #12
0
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            if (txtSearch.Text != "")
            {
                string query;
                string hq;
                // syta
                hq    = "%" + txtSearch.Text + "%";
                query = "SELECT * FROM Check_out WHERE Client_ID like '" + hq + "'";

                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query, cn.connect);

                    MySqlDataReader Datareader = cmd.ExecuteReader();
                    if (Datareader.Read())
                    {
                        cboClientID.Text  = Datareader["Client_ID"].ToString();
                        cboVehicleID.Text = Datareader["Vehicle_ID"].ToString();
                        // dtHire.Text = Datareader["Date"].ToString();


                        txtDuration.Text    = Datareader["Duration"].ToString();
                        txtDescription.Text = Datareader["Description"].ToString();

                        chckStatus.Text    = Datareader["Status"].ToString();
                        txtAmountPaid.Text = Datareader["Amount_Paid"].ToString();

                        if (Datareader["Status"].ToString() == "True")
                        {
                            chckStatus.CheckState = CheckState.Checked;
                        }
                    }
                }
            }
        }
Beispiel #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtClientID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtClientID.Focus();
            }
            else if (txtClientName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtClientName.Focus();
            }
            else if (txtMobileNo.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMobileNo.Focus();
            }

            /** else if (!IsValidEmail(txtEmail.Text.Replace(" ", "").ToString()))
             * {
             *   MessageBox.Show("Invalid Email", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             *   txtEmail.Focus();
             * }*/
            else if (txtCountry.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCountry.Focus();
            }

            /** else if (txtOwnerID.Text == "")
             * {
             *   MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *   txtOwnerID.Focus();
             * }
             * else if (!long.TryParse(phn, out phone))
             * {
             *    MessageBox.Show("Invalid Phone Number!", "Looptech International Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             *    txtPhoneNo.Focus();
             * }
             * else if (!txtPhoneNo.Text.Contains("+"))
             * {
             *    MessageBox.Show("Invalid Phone Number!", "Looptech International Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             *    txtPhoneNo.Focus();
             * }*/
            else
            {
                if (FindRecord(txtClientID.Text) == true)
                {
                    MessageBox.Show(txtClientID.Text + " already exists!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtClientID.Focus();
                }
                else
                {
                    int sts;
                    //string gnder;
                    if (chckStatus.CheckState == CheckState.Checked)
                    {
                        sts = 1;
                    }
                    else
                    {
                        sts = 0;
                    }

                    /** if (rbtnFemale.Checked == true)
                     * {
                     *   gnder = "Female";
                     * }
                     * else
                     * {
                     *   gnder = "Male";
                     * }*/
                    string query;
                    //  pic = txtPic.Text.Replace("\\", "__");
                    query = "INSERT INTO Client VALUES('" + txtClientID.Text + "','" + txtClientName.Text + "','" + txtMobileNo.Text + "','" + txtCountry.Text + "','" + sts + "')";
                    conn cn = new conn();
                    if (cn.OpenConnection() == true)
                    {
                        if (MessageBox.Show("Are you sure you want to save record?", "KUNIS Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            MySqlCommand cmd = new MySqlCommand(query, cn.connect);

                            cmd.ExecuteNonQuery();

                            cleanData();
                            MessageBox.Show("Records Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Records not Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            txtClientID.Focus();
                        }
                    }
                    cn.CloseConnection();
                }
            }
        }
Beispiel #14
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (cboClientID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboClientID.Focus();
            }
            else if (cboVehicleID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboVehicleID.Focus();
            }
            else if (dtHire.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtHire.Focus();
            }

            /** else if (!IsValidEmail(txtEmail.Text.Replace(" ", "").ToString()))
             * {
             *   MessageBox.Show("Invalid Email", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             *   txtEmail.Focus();
             * }*/
            else if (txtDuration.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtDuration.Focus();
            }
            else if (txtDuration.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtDuration.Focus();
            }
            else if (txtAmountPaid.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAmountPaid.Focus();
            }

            else
            {
                if (FindRecord(cboClientID.Text) == true)
                {
                    MessageBox.Show(cboClientID.Text + " already exists!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cboClientID.Focus();
                }
                else
                {
                    int sts;
                    if (chckStatus.CheckState == CheckState.Checked)
                    {
                        sts = 1;
                    }
                    else
                    {
                        sts = 0;
                    }

                    string query;
                    query = "INSERT INTO Check_out VALUES('" + cboClientID.Text + "','" + cboVehicleID.Text + "','" + dtHire.Value.ToString("yyyy-MM-dd") + "','" + txtDuration.Text + "','" + txtDescription.Text + "','" + sts + "','" + txtAmountPaid.Text + "')";
                    conn cn = new conn();
                    if (cn.OpenConnection() == true)
                    {
                        if (MessageBox.Show("Are you sure you want to save record?", "KUNIS Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                            cmd.ExecuteNonQuery();

                            cleanData();
                            MessageBox.Show("Records Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Records not Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            cboClientID.Focus();
                        }
                    }
                    cn.CloseConnection();
                }
            }
        }
Beispiel #15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtUserID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserID.Focus();
            }
            else if (txtUserName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserName.Focus();
            }
            else if (txtPassword.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPassword.Focus();
            }

            else if (cboPriveledges.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboPriveledges.Focus();
            }

            else
            {
                if (FindRecord(txtUserID.Text) == true)
                {
                    MessageBox.Show(txtUserID.Text + " already exists!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtUserID.Focus();
                }
                else
                {
                    int sts;
                    if (chckStatus.CheckState == CheckState.Checked)
                    {
                        sts = 1;
                    }
                    else
                    {
                        sts = 0;
                    }

                    string query;
                    query = "INSERT INTO Users VALUES('" + txtUserID.Text + "','" + txtUserName.Text + "','" + txtPassword.Text + "','" + cboPriveledges.Text + "','" + sts + "')";
                    conn cn = new conn();
                    if (cn.OpenConnection() == true)
                    {
                        if (MessageBox.Show("Are you sure you want to save record?", "KUNIS Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                            cmd.ExecuteNonQuery();

                            cleanData();
                            MessageBox.Show("Records Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Records not Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            txtUserID.Focus();
                        }
                    }
                    cn.CloseConnection();
                }
            }
        }
Beispiel #16
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtUserID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserID.Focus();
            }
            else if (txtUserName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserName.Focus();
            }
            else if (txtPassword.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPassword.Focus();
            }

            else if (cboPriveledges.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboPriveledges.Focus();
            }


            else
            {
                int sts;
                // string gnder;
                if (chckStatus.CheckState == CheckState.Checked)
                {
                    sts = 1;
                }
                else
                {
                    sts = 0;
                }

                string query;
                //pic = txtPic.Text.Replace("\\", "__");
                query = "UPDATE Users SET User_ID='" + txtUserID.Text + "',User_Name='" + txtUserName.Text + "',Password='******',Priveledges='" + cboPriveledges.Text + "',Status='" + sts + "' WHERE User_ID='" + txtUserID.Text + "'";
                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    if (MessageBox.Show("Are you sure you want to save changes?", "KUNIS Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                        cmd.ExecuteNonQuery();

                        cleanData();
                        MessageBox.Show("Records Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Records not Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtUserID.Focus();
                    }
                }
                cn.CloseConnection();
            }
        }
Beispiel #17
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtLoginName.Text.Replace(" ", "") == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtLoginName.Focus();
            }
            else if (txtPassword.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtPassword.Focus();
            }
            else
            {
                conn   connect = new conn();
                string query   = "SELECT * FROM  Users WHERE User_Name='" + txtLoginName.Text.ToString() + "' AND Password='******' AND Status=1";

                //open connection
                if (connect.OpenConnection() == true)
                {
                    //create command and assign the query and connection from the constructor
                    MySqlCommand    cmd        = new MySqlCommand(query, connect.connect);
                    MySqlDataReader dataReader = cmd.ExecuteReader();

                    //Read the data and store them in the list
                    if (dataReader.Read())
                    {
                        //list[0].Add(dataReader["id"] + "");
                        //list[1].Add(dataReader["name"] + "");
                        if (dataReader["User_Name"].ToString() == txtLoginName.Text && dataReader["Password"].ToString() == txtPassword.Text)
                        {
                            Sessions.username  = dataReader["User_Name"].ToString();
                            Sessions.prev      = dataReader["Priveledges"].ToString();
                            Sessions.userID    = dataReader["User_ID"].ToString();
                            Sessions.loginTime = DateTime.Now.ToString();
                            MDI mdi = new MDI();
                            mdi.Visible = true;
                            this.Dispose();
                        }
                        else
                        {
                            MessageBox.Show("Username/Password Mismatch!\nPlease Try again!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            txtLoginName.Text = "";
                            txtPassword.Text  = "";
                            txtLoginName.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Username/Password Mismatch!\nPlease Try again!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtLoginName.Text = "";
                        txtPassword.Text  = "";
                        txtLoginName.Focus();
                    }

                    //close Data Reader
                    dataReader.Close();


                    //close connection
                    connect.CloseConnection();
                }
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtVehicleID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtVehicleID.Focus();
            }
            else if (txtMake.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMake.Focus();
            }
            else if (txtModel.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtModel.Focus();
            }

            else if (txtRate.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRate.Focus();
            }
            else if (cboOwnerID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboOwnerID.Focus();
            }

            else
            {
                if (FindRecord(txtVehicleID.Text) == true)
                {
                    MessageBox.Show(txtVehicleID.Text + " already exists!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtVehicleID.Focus();
                }
                else
                {
                    int sts;
                    //string gnder;
                    if (chckStatus.CheckState == CheckState.Checked)
                    {
                        sts = 1;
                    }
                    else
                    {
                        sts = 0;
                    }

                    string pic;
                    pic   = txtPic.Text.Replace("\\", "__");
                    query = "INSERT INTO Vehicle VALUES('" + txtVehicleID.Text + "','" + txtMake.Text + "','" + txtModel.Text + "','" + dtpicDoR.Value.ToString("yyyy-MM-dd") + "','" + txtRate.Text + "','" + cboOwnerID.Text + "', '" + sts + "','" + pic + "')";
                    conn cn = new conn();
                    if (cn.OpenConnection() == true)
                    {
                        if (MessageBox.Show("Are you sure you want to save record?", "KUNIS Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                            cmd.ExecuteNonQuery();

                            cleanData();
                            MessageBox.Show("Records Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Records not Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            txtVehicleID.Focus();
                        }
                    }
                    cn.CloseConnection();
                }
            }
        }
Beispiel #19
0
        private void btnEdit_Click_1(object sender, EventArgs e)
        {
            if (txtClientID.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtClientID.Focus();
            }
            else if (txtClientName.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtClientName.Focus();
            }
            else if (txtMobileNo.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtMobileNo.Focus();
            }
            else if (txtCountry.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtCountry.Focus();
            }
            else if (txtSearch.Text == "")
            {
                MessageBox.Show("Ensure all field are filled", "Warning Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                txtSearch.Focus();
            }
            else
            {
                int sts;
                // string gnder;
                if (chckStatus.CheckState == CheckState.Checked)
                {
                    sts = 1;
                }
                else
                {
                    sts = 0;
                }
                string query;
                query = "UPDATE Client SET Client_ID ='" + txtClientID.Text + "',Client_Name='" + txtClientName.Text + "',Mobile_No= '" + txtMobileNo.Text + "',Country= '" + txtCountry.Text + "',Status= '" + sts + "' WHERE Client_ID LIKE '" + txtClientID.Text + "'";
                conn cn = new conn();

                if (cn.OpenConnection() == true)
                {
                    if (MessageBox.Show("Are you sure you want to make this changes?", "Kunis messaging system", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                        cmd.ExecuteNonQuery();
                        cleanData();
                        txtSearch.Text = "";
                        MessageBox.Show("Record saved", "Kunis messaging system", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        txtSearch.Focus();
                    }
                    else
                    {
                        cleanData();
                        txtSearch.Text = "";
                        MessageBox.Show("Record not saved", "Kunis messaging system", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtSearch.Focus();
                    }
                }
            }
        }
        private void btnEdit_Click_1(object sender, EventArgs e)
        {
            if (txtVehicleID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtVehicleID.Focus();
            }
            else if (txtMake.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMake.Focus();
            }
            else if (txtModel.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtModel.Focus();
            }
            else if (dtpicDoR.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpicDoR.Focus();
            }

            else if (txtRate.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRate.Focus();
            }
            else if (cboOwnerID.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboOwnerID.Focus();
            }


            else
            {
                int sts;
                // string gnder;
                if (chckStatus.CheckState == CheckState.Checked)
                {
                    sts = 1;
                }
                else
                {
                    sts = 0;
                }

                string pic;
                pic   = txtPic.Text.Replace("\\", "__");
                query = "UPDATE Vehicle SET Vehicle_ID='" + txtVehicleID.Text + "',Make='" + txtMake.Text + "',Model='" + txtModel.Text + "',Reg_Date='" + dtpicDoR.Value.ToString("yyyy-MM-dd") + "',Rate='" + txtRate.Text + "',Owner_ID='" + cboOwnerID.Text + "',Status='" + sts + "',Photo='" + pic + "' WHERE Vehicle_ID='" + txtVehicleID.Text + "'";
                conn cn = new conn();
                if (cn.OpenConnection() == true)
                {
                    if (MessageBox.Show("Are you sure you want to save changes?", "KUNIS Messaging System", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                        cmd.ExecuteNonQuery();

                        cleanData();
                        MessageBox.Show("Records Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Records not Saved!", "KUNIS Messaging System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtVehicleID.Focus();
                    }
                }
                cn.CloseConnection();
            }
        }