コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DashboardforAdmin dashboardforAdmin = new DashboardforAdmin();

            this.Hide();



            DialogResult d;

            d = MessageBox.Show("Do you want to Go Back?", "", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (d == DialogResult.Yes)
            {
                dashboardforAdmin.Show();
            }
            else if (d == DialogResult.No)
            {
                this.Show();
            }
            else
            {
                Close();
            }
        }
コード例 #2
0
ファイル: Login.cs プロジェクト: jnjohnny/ClickForService
        private void LoginButton_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString);

            connection.Open();

            string        sql     = "SELECT *FROM userpermissions WHERE userName='******'";
            SqlCommand    command = new SqlCommand(sql, connection);
            SqlDataReader reader  = command.ExecuteReader();

            if (reader.Read())
            {
                string Permission   = Convert.ToString(reader["uniqueCode"]);
                string passwordtext = Convert.ToString(reader["password"]);
                if (passwordtext == Convert.ToString(textBoxPassword.Text))
                {
                    username = Convert.ToString(textBoxUsername.Text);
                    if (Permission == "ST")
                    {
                        Dashboard dashboard = new Dashboard();
                        this.Hide();
                        dashboard.Show();
                    }
                    else if (Permission == "GU")
                    {
                        AddServiceProviderDetails addServiceProviderDetails = new AddServiceProviderDetails(textBoxUsername.Text);
                        this.Hide();
                        addServiceProviderDetails.Show();
                    }

                    else
                    {
                        DashboardforAdmin dfa = new DashboardforAdmin();
                        this.Hide();
                        dfa.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Wrong Username or Password...!!");
                    connection.Close();
                }
            }

            else
            {
                MessageBox.Show("Wrong Username or Password...!!");
                connection.Close();
            }
        }
コード例 #3
0
        private void Registerformbutton_Click(object sender, EventArgs e)
        {
            SqlConnection connection11 = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString);

            connection11.Open();

            string        sql       = "SELECT *FROM Registrations WHERE userName='******'";
            SqlCommand    command11 = new SqlCommand(sql, connection11);
            SqlDataReader reader    = command11.ExecuteReader();

            if (reader.Read())
            {
                MessageBox.Show("This Username Already Used by Another Person....Give Another User Name....!!");
                Registration rr = new Registration();
                this.Hide();
                rr.Show();
                connection11.Close();
            }

            else
            {
                connection11.Close();
                if (AgreeregistercheckBox.Text == "")
                {
                    MessageBox.Show("agree can not be empty");
                }

                else if (NameregistertextBox.Text == "")
                {
                    MessageBox.Show("Name can not be empty");
                }

                else if (UsernameregistertextBox.Text == "")
                {
                    MessageBox.Show("User Name can not be empty");
                }

                else if (PasswordregistertextBox.Text == "")
                {
                    MessageBox.Show("Password can not be empty");
                }

                else if (ConfirmpasswordregistertextBox.Text == "")
                {
                    MessageBox.Show("Confrim Password can not be empty");
                }
                else if (EmailregistertextBox.Text == " ")
                {
                    MessageBox.Show("Email can not be empty");
                }

                else if (DateofbirthregisterdateTimePicker.Text == "")
                {
                    MessageBox.Show("Date of Birth can not be empty");
                }

                else if (MaleregisterradioButton.Text == "" && FemaleregisterradioButton.Text == "")
                {
                    MessageBox.Show("Gender can not be empty");
                }

                else if (CityregistercomboBox.Text == "")
                {
                    MessageBox.Show("Blood Group can not be empty");
                }

                else if (NidregistertextBox.Text == "")
                {
                    MessageBox.Show("Blood Group can not be empty");
                }

                else if (MobilenumberregistertextBox.Text == "")
                {
                    MessageBox.Show("Blood Group can not be empty");
                }

                else if (DivisionregistercomboBox.Text == "")
                {
                    MessageBox.Show("Blood Group can not be empty");
                }

                else if (AddressregistertextBox.Text == "")
                {
                    MessageBox.Show("Blood Group can not be empty");
                }

                else if (CategoryregistercomboBox.Text == "")
                {
                    MessageBox.Show("Blood Group can not be empty");
                }



                else
                {
                    SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString);
                    connect.Open();
                    string Gender = "";
                    if (MaleregisterradioButton.Checked)
                    {
                        Gender = "Male";
                    }
                    else
                    {
                        Gender = "Female";
                    }

                    string sql1 = "INSERT INTO Registrations(userName, emailId, password, category, Address, City, Division, bloodGroup, mobileNumber, NID, fullName, dateofbirth, gender, Profession) VALUES ('" + UsernameregistertextBox.Text + "','" + EmailregistertextBox.Text + "', '" + PasswordregistertextBox.Text + "','" + CategoryregistercomboBox.Text + "','" + AddressregistertextBox.Text + "','" + CityregistercomboBox.Text + "','" + DivisionregistercomboBox.Text + "','" + BloodgroupregistercomboBox.Text + "','" + MobilenumberregistertextBox.Text + "','" + NidregistertextBox.Text + "','" + NameregistertextBox.Text + "','" + DateofbirthregisterdateTimePicker.Text + "','" + Gender + "','" + ProfessionregistercomboBox.Text + "')";

                    string ab = "";
                    if (CategoryregistercomboBox.Text == "Service Giver")
                    {
                        ab = "GU";
                    }
                    else if (CategoryregistercomboBox.Text == "Service Taker")
                    {
                        ab = "ST";
                    }

                    else
                    {
                        ab = "AD";
                    }



                    SqlCommand command1 = new SqlCommand(sql1, connect);

                    int result = command1.ExecuteNonQuery();
                    if (result > 0)
                    {
                        string     sql2     = "INSERT INTO userpermissions (userName, uniqueCode, password, Designation) VALUES('" + UsernameregistertextBox.Text + "','" + ab + "', '" + PasswordregistertextBox.Text + "','" + comboBoxDesig.Text + "')";
                        SqlCommand command2 = new SqlCommand(sql2, connect);
                        int        result3  = command2.ExecuteNonQuery();


                        MessageBox.Show("Registration Sucessful....Please Login");
                        DashboardforAdmin login = new DashboardforAdmin();
                        this.Hide();
                        login.Show();

                        connect.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error");
                        connect.Close();
                    }


                    connect.Close();
                }
            }
        }