private void pictureBox2_Click(object sender, EventArgs e)
        {
            this.Close();
            saw s = new saw();

            s.ShowDialog();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (IsValid())
            {
                try
                {
                    SaveData();

                    MessageBox.Show("New User is Added in the System", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();

                    saw sw = new saw();
                    sw.ShowDialog();
                }
                catch (ApplicationException ex)
                {
                    MessageBox.Show("error agya ha coding ma" + ex.Message);
                }
            }
        }
Exemplo n.º 3
0
        public void DeleteKlye()
        {
            if (nametextBox.Text == string.Empty)
            {
                MessageBox.Show("First Select A Row Then Try Again !!", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else

            {
                DialogResult resullt = MessageBox.Show("Do you want to Delete Record ?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (resullt == DialogResult.Yes)
                {
                    string        conn = ConfigurationManager.ConnectionStrings["testdb"].ConnectionString;
                    SqlConnection con  = new SqlConnection(conn);
                    SqlCommand    cmd  = new SqlCommand("delet", con);
                    cmd.CommandType = CommandType.StoredProcedure;


                    cmd.Parameters.AddWithValue("@id", this.studentP);



                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();

                    MessageBox.Show("Delete Data Successfully", "DELETE DATA", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Hide();
                    saw s = new saw();
                    s.ShowDialog();
                }
            }
        }
Exemplo n.º 4
0
        private void UpdateKlyeMethod()
        {
            try
            {
                DialogResult resullt = MessageBox.Show("Do you want to Update Record ?", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (resullt == DialogResult.Yes)
                {
                    if (maleradioButton.Checked == false && femaleradioButton.Checked == false)
                    {
                        MessageBox.Show("Please Select Gender and Interest Correctly !!", "Error !!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        string        conn = ConfigurationManager.ConnectionStrings["testdb"].ConnectionString;
                        SqlConnection con  = new SqlConnection(conn);
                        SqlCommand    cmd  = new SqlCommand("updat", con);
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@id", this.studentP);
                        cmd.Parameters.AddWithValue("@name", nametextBox.Text);
                        //cmd.Parameters.Add("@name", SqlDbType.NVarChar, 50).Value = nametextBox.Text;
                        cmd.Parameters.Add("@age", SqlDbType.NVarChar, 55).Value      = agetextBox.Text;
                        cmd.Parameters.Add("@feedback", SqlDbType.NVarChar, 50).Value = feedbacktextBox.Text;
                        cmd.Parameters.AddWithValue("@class", classtextBox.Text);
                        cmd.Parameters.AddWithValue("@email", emailtextBox.Text);

                        //checked hoga text ni ayga . kbad iski type bit hoge
                        cmd.Parameters.AddWithValue("@csharp", csharpcheckBox.Checked);
                        cmd.Parameters.AddWithValue("@java", javacheckBox.Checked);
                        cmd.Parameters.AddWithValue("@php", phpcheckBox.Checked);

                        cmd.Parameters.AddWithValue("@city", citytextBox1.Text);
                        //country ka alg table bnaygy fr sp ma b country ko lygy enter waly r h jo asl table ha usmy
                        //b country name sy ak colom lygy q k dekhany k lye ye sp r h ko use kryga r
                        //pic yni fetch ye c waly table sy he kryga
                        cmd.Parameters.AddWithValue("@country", countrycomboBox.Text);

                        cmd.Parameters.AddWithValue("@dob", dobdateTimePicker.Value.Date);

                        cmd.Parameters.AddWithValue("@gender", getGender());

                        //image k lye
                        cmd.Parameters.AddWithValue("@photo", SavePhoto());


                        con.Open();
                        cmd.ExecuteNonQuery();
                        con.Close();
                        MessageBox.Show("Update Data Successfully", "ENTER DATA", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.Hide();
                        saw s = new saw();
                        s.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in updation Code \n" + ex.Message);
            }
        }
Exemplo n.º 5
0
        private void viewbutton2_Click(object sender, EventArgs e)
        {
            saw s = new saw();

            s.ShowDialog();
        }
Exemplo n.º 6
0
        private void SavekAnderWalaMethod()
        {
            //insert k lye
            try
            {
                if (nametextBox.Text == "" || agetextBox.Text == "" || classtextBox.Text == "" || emailtextBox.Text == "" || countrycomboBox.Text == "" || citytextBox1.Text == "")
                {
                    MessageBox.Show("Please Fill all Blank Box !!", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string        conn = ConfigurationManager.ConnectionStrings["testdb"].ConnectionString;
                    SqlConnection con  = new SqlConnection(conn);
                    SqlCommand    cmd  = new SqlCommand("enter", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("@name", SqlDbType.NVarChar, 50).Value     = nametextBox.Text;
                    cmd.Parameters.Add("@age", SqlDbType.NVarChar, 55).Value      = agetextBox.Text;
                    cmd.Parameters.Add("@feedback", SqlDbType.NVarChar, 50).Value = feedbacktextBox.Text;
                    cmd.Parameters.AddWithValue("@class", classtextBox.Text);
                    cmd.Parameters.AddWithValue("@email", emailtextBox.Text);//string waly .text hoty ha\
                    cmd.Parameters.AddWithValue("@country", countrycomboBox.Text);
                    cmd.Parameters.AddWithValue("@city", citytextBox1.Text);


                    //checked hoga text ni ayga . kbad iski type bit hoge
                    cmd.Parameters.AddWithValue("@csharp", csharpcheckBox.Checked);//ye .checked hota ha
                    cmd.Parameters.AddWithValue("@java", javacheckBox.Checked);
                    cmd.Parameters.AddWithValue("@php", phpcheckBox.Checked);

                    //country ka alg table bnaygy fr sp ma b country ko lygy enter waly r h jo asl table ha usmy
                    //b country name sy ak colom lygy q k dekhany k lye ye sp r h ko use kryga r
                    //pic yni fetch ye c waly table sy he kryga

                    cmd.Parameters.AddWithValue("@dob", dobdateTimePicker.Value.Date);//.value.date k sath likhna ha
                    if (maleradioButton.Checked == false && femaleradioButton.Checked == false)
                    {
                        MessageBox.Show("Please Select Gender and Interest !!", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@gender", getGender());//method nichy define kia hoa ha

                        //image k lye
                        cmd.Parameters.AddWithValue("@photo", SavePhoto());

                        con.Open();
                        cmd.ExecuteNonQuery();
                        con.Close();
                        MessageBox.Show("Save Data Successfully", "SAVE DATA", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        //jsy he insert ya update data krygy usky bad message show hoga fr ye saw form ki trf chla jayga
                        this.Hide();
                        saw s = new saw();
                        s.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in insertion Code \n" + ex.Message);
            }
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (IsValidated()) //ye if k sath valid ha ye khali block k lye ha k koi blok empty to ni
            {
                try
                {
                    bool usernamecorrect, passwordcorrect;

                    GetUserLogin(out usernamecorrect, out passwordcorrect);//ye just method ha if k sath ni
                    {
                        if (usernamecorrect && passwordcorrect)
                        {
                            this.Hide();

                            //rememberme k lye ye sb must ha
                            if (remembermecheckBox.Checked)
                            {
                                Properties.Settings.Default.UserName = usernametextBox.Text;
                                Properties.Settings.Default.Save();
                            }

                            saw o = new saw();
                            o.ShowDialog();
                        }
                        else
                        {
                            //idr is veriable ko increment krygy k
                            //logindetailwrong++;

                            if (!usernamecorrect)
                            {
                                MessageBox.Show("Username is Not Correct", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                usernametextBox.Clear();
                                passwordtextBox.Clear();
                                usernametextBox.Focus();
                            }
                            else
                            {
                                MessageBox.Show("Password is Not Correct", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                                //password ma condition lgaygy na k username ma q k br br password wrong enter krny p
                                //account disable hona chaia
                                //so idr lgaygy condition yad rkhy
                                //if (logindetailwrong >= 3)
                                //{
                                //    MessageBox.Show("Disable This Account Please Contact with the \n Admin Hassan Malik", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                //    DisableThisAccount(); //ak method bnaya ha ta k accout disable hojay
                                //}

                                passwordtextBox.Clear();
                                passwordtextBox.Focus();
                                //usernametextBox.Focus();
                            }
                        }
                    }
                }

                catch (ApplicationException ex)
                {
                    MessageBox.Show("Error in coding of login form" + ex.Message);
                }
            }
        }