private void button2_Click(object sender, EventArgs e) { if (textBox3.Text != "" && textBox4.Text != "") { if (textBox3.Text == textBox4.Text) { u1.password = textBox3.Text; DataBase_connector dc = new DataBase_connector(); string update = "UPDATE `sim_registaration`.`user` SET `Password`='" + u1.password + "' WHERE `UserID`='" + u1.userID + "';"; dc.datainput(update); MessageBox.Show("Succsessfully reset you password"); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; } else { MessageBox.Show("Password not match please re check"); } } else { MessageBox.Show("fill the all fields"); } }
private void button1_Click_1(object sender, EventArgs e) { if (textBox1.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && pictureBox1.Image != null && pictureBox2.Image != null && (radioButton1.Checked || radioButton2.Checked)) { //pass customer details to Sim class Sim s1 = new Sim(); s1.sim_num = textBox1.Text; s1.P_num = textBox2.Text; s1.F_name = textBox3.Text; s1.L_name = textBox4.Text; s1.nic = textBox5.Text; s1.address = textBox6.Text; s1.img1Loc = textBox8.Text; s1.img2Loc = textBox7.Text; string newFileName1 = s1.img1Loc.Replace("\\", "\\\\"); string newFileName2 = s1.img2Loc.Replace("\\", "\\\\"); if (radioButton1.Checked) { s1.Gender = "Male"; } else if (radioButton2.Checked) { s1.Gender = "Female"; } s1.SIM_Category = label9.Text; // pass data to database s1.date = DateTime.Now.ToString("yyyy/MM/dd"); string add = "INSERT INTO `sim_registaration`.`sim` (`phonnumbr`, `SIM_Number`, `First Name`, `Last Name`, `NIC Number`, `Address`, `Gender`, `SIM Category`, `Date`, `img1Location`, `img2Location`) VALUES ('" + s1.P_num + "', '" + s1.sim_num + "', '" + s1.F_name + "', '" + s1.L_name + "', '" + s1.nic + "', '" + s1.address + "', '" + s1.Gender + "', '" + s1.SIM_Category + "', '" + s1.date + "', '" + newFileName1 + "', '" + newFileName2 + "');"; DataBase_connector db2 = new DataBase_connector(); db2.datainput(add); MessageBox.Show("Successfuly save details"); //image backup save // File.Copy(textBox7.Text, Path.Combine(@"C:\Users\Chinthaka\Desktop\saveiamge\", Path.GetFileName(textBox7.Text)), true); //auto clear form data textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; pictureBox1.Image = null; pictureBox2.Image = null; } else { MessageBox.Show("Please fill the all filed"); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && textBox8.Text != "" && textBox9.Text != "") { if (textBox7.Text == textBox8.Text) { //pass user input to user class Userclass u1 = new Userclass(); u1.F_name = textBox1.Text; u1.L_name = textBox2.Text; u1.address = textBox3.Text; u1.nic = textBox4.Text; u1.contact = textBox5.Text; u1.u_name = textBox6.Text; u1.password = textBox7.Text; u1.c_question = comboBox1.Text; u1.c_answer = textBox9.Text; //pass data to database string add = "INSERT INTO `sim_registaration`.`user` (`UserName`, `Password`, `F_name`, `L_name`, `address`, `nic_num`, `contact_num`, `confirm_qustn`, `confirm_anwr`) VALUES('" + u1.u_name + "', '" + u1.password + "', '" + u1.F_name + "', '" + u1.L_name + "', '" + u1.address + "', '" + u1.nic + "', '" + u1.contact + "', '" + u1.c_question + "', '" + u1.c_answer + "');"; DataBase_connector db1 = new DataBase_connector(); db1.datainput(add); MessageBox.Show("You have been successfuly"); // data clear textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; comboBox1.Text = "Select"; } else { MessageBox.Show("not match password please recheck"); } } else { MessageBox.Show("Fill all fields"); } }
private void button2_Click_1(object sender, EventArgs e) { if (textBox1.Text != "" && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && pictureBox1.Image != null && pictureBox2.Image != null && (radioButton1.Checked || radioButton2.Checked)) { //pass customer details to Sim class Sim s1 = new Sim(); s1.sim_num = textBox1.Text; s1.P_num = textBox2.Text; s1.F_name = textBox3.Text; s1.L_name = textBox4.Text; s1.nic = textBox5.Text; s1.address = textBox6.Text; s1.img1Loc = textBox8.Text; s1.img2Loc = textBox7.Text; string newFileName1 = s1.img1Loc.Replace("\\", "\\\\"); string newFileName2 = s1.img2Loc.Replace("\\", "\\\\"); Int32 id = Convert.ToInt32(label10.Text); if (radioButton1.Checked) { s1.Gender = "Male"; } else if (radioButton2.Checked) { s1.Gender = "Female"; } s1.SIM_Category = label9.Text; // update database data s1.date = DateTime.Now.ToString("yyyy/MM/dd"); string update = "UPDATE `sim_registaration`.`sim` SET `phonnumbr`='" + s1.P_num + "', `SIM_Number`='" + s1.sim_num + "', `First Name`='" + s1.F_name + "', `Last Name`='" + s1.L_name + "', `NIC Number`='" + s1.nic + "', `Address`='" + s1.address + "', `Gender`='" + s1.Gender + "', `SIM Category`='" + s1.SIM_Category + "', `Date`='" + s1.date + "', `img1Location`='" + newFileName1 + "', `img2Location`='" + newFileName2 + "' WHERE `SIM_Id`='" + id + "';"; DataBase_connector db3 = new DataBase_connector(); db3.datainput(update); //image backup save // File.Copy(textBox7.Text, Path.Combine(@"C:\Users\Chinthaka\Desktop\saveiamge\", Path.GetFileName(textBox7.Text)), true); //print printDocument1.PrintPage += printDocument1_PrintPage; if (printDialog1.ShowDialog() == DialogResult.OK) { button1.Hide(); button2.Hide(); button3.Hide(); button4.Hide(); button5.Hide(); button6.Hide(); button7.Hide(); printDocument1.Print(); } //auto clear form data textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; pictureBox1.Image = null; pictureBox2.Image = null; } else { MessageBox.Show("Please fill the all filed"); } }