private void btnLogin_Click(object sender, EventArgs e) { userControl11.inputs_ftl_1(); ft_login_form21.input_ftl_2(); string Username, Company_Name, Password, Password_hint, pin_Number; Username = userControl11.username; Company_Name = userControl11.companyname; Password = ft_login_form21.password; Password_hint = ft_login_form21.passwordhint; pin_Number = ft_login_form21.pinnumber; DB_Connection dB_Connection = new DB_Connection(); string qry = "INSERT INTO Usertb (Username,Company_Name,Password,Password_hint,Pin_Number) VALUES ('" + Username + "','" + Company_Name + "','" + Password + "','" + Password_hint + "','" + pin_Number + "')"; string qry2 = "Select * From Usertb"; dB_Connection.InsertData(qry); DataTable dt = dB_Connection.getDataGrid(qry2); if (dt.Rows.Count != 0) { GMS_1v gMS_1V = new GMS_1v(); gMS_1V.ShowDialog(); Console.WriteLine(qry); } }
private void button1_Click(object sender, EventArgs e) { string name = txtequipname.Text; string type = txtequiptype.Text; string price = txtamount.Text; DB_Connection dB_Connection = new DB_Connection(); string insertqry = "INSERT INTO Equipment (Equip_Name,Equip_Type,Equip_Amount,Equip_img1,Equip_img2,Equip_img3,Equip_img4) VALUES('" + name + "','" + type + "','" + price + "','" + equip_imgpath1 + "','" + equip_imgpath2 + "','" + equip_imgpath3 + "','" + equip_imgpath4 + "')"; Console.WriteLine(insertqry); dB_Connection.InsertData(insertqry); }
private void btnAP_Add_Click(object sender, EventArgs e) { string package_name, duration, fee, qry; package_name = Package_Name_tb.Text; duration = Duration_tb.Text; fee = Fee_tb.Text; qry = "INSERT INTO Packages(Package_Name,Duration,Fee) VALUES('" + package_name + "','" + duration + "','" + fee + "')"; DB_Connection dB_Connection = new DB_Connection(); DialogResult dialog = MessageBox.Show("Are you sure that you want to add this package?", "Add Package", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { dB_Connection.InsertData(qry); } }
private void button1_Click_1(object sender, EventArgs e) { string type = "StaffMember"; string NIC_No = txt_boxNIC.Text; string name = txt_boxName.Text; string Dob = this.dateTimePickerDOB.Text; string joinDte = this.dateTimePickerJoinedDate.Text; string jobType = txt_boxJobtype.Text; string homeAdrss = txt_boxHomeAddress.Text; string Adrs_Lvg = txt_boxAddressLivg.Text; string PrivtNo = txt_boxPN.Text; string PubNo = txt_boxPubN.Text; string EmergConName = txt_boxEmergencyContactNme.Text; string EmergConNo = (txt_boxEmergencyContactPNo.Text); string ProQuli = txt_boxProQuli.Text; string Gendr = txt_boxGender.Text; string Email = txt_boxMail.Text; string qrimgpath = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\\Images\\Staff QR\\" + staffmem_id + "memQR.jpg"; string qrsubject = (staffmem_id + NIC_No + name).ToString(); DB_Connection dB_Connection = new DB_Connection(); string insrtqry = "INSERT INTO Staff_Member (Capture_path,QR_img_path,NIC,Name,Gender,Job_Type,Professional_qualifications,DOB,Joined_date,Address_Living,Mobile_no_public,Mobile_no_private,Home_Address,Emergency_Contact_Name,Emergency_Contact_Number,Email) VALUES('" + staffmem_imgpath + "','" + NIC_No + "','" + name + "','" + Gendr + "','" + jobType + "','" + ProQuli + "','" + Dob + "','" + joinDte + "','" + Adrs_Lvg + "','" + PubNo + "','" + PrivtNo + "','" + homeAdrss + "','" + EmergConName + "','" + EmergConNo + "','" + Email + "' )"; Console.WriteLine(insrtqry); dB_Connection.InsertData(insrtqry); QRmailSender qRmailSender = new QRmailSender(); qRmailSender.qrgen(qrsubject, qrimgpath); if (Email != null) { DialogResult dialog = MessageBox.Show("This Staff member has not provided an Email Address! So, You can print the QR code. Do you want to print it ?", "Print QR Code", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { string filename = qrimgpath; var p = new Process(); p.StartInfo.FileName = filename; p.StartInfo.Verb = "print"; p.Start(); } } else { qRmailSender.Emailgen(name, type); qRmailSender.Emailsend(Email, qrimgpath); } }
private void button1_Click(object sender, EventArgs e) { string type = "Member"; string NIC = textBoxNIC.Text; string name = textboxName.Text; string DOB = this.dateTimePicker1.Text; string Gender = Gender_cb.Text; string Body_Type = textboxBodyType.Text; string Address = richTextBoxAddress.Text; string Mobile_Number = textboxMobileNumber.Text; string Health_Condition = richTextBoxHealthCondition.Text; string Emergency_Contact_Name = textboxEmergencyContactName.Text; string Emergency_Contact_Number = (textboxEmergencyContactPhoneNumber.Text); string joineddate = DateTime.Now.Date.ToString("MM/dd/yyyy"); string Email = memEmail_tb.Text; string qrimgpath = Application.StartupPath.Substring(0, Application.StartupPath.Length - 10) + "\\Images\\Member QR\\" + mem_id + "memQR.jpg"; Console.WriteLine(qrimgpath); string packageName = Package_cb.Text; string qrsubject = (mem_id + NIC + name).ToString(); if (packageName != "") { //Insert Data to members table DB_Connection dB_Connection = new DB_Connection(); string insertqry = "INSERT INTO Members(NICorDL,MemberName,DOB,Gender,Body_Type,Address,Mobile_Number,Health_Condition,Emergency_Contact_Name,Emergency_Contact_Number,Member_dp,Email,QR_img_path,Joined_Date,Package_name) VALUES('" + NIC + "','" + name + "','" + DOB + "','" + Gender + "','" + Body_Type + "','" + Address + "'," + Mobile_Number + ",'" + Health_Condition + "','" + Emergency_Contact_Name + "','" + Emergency_Contact_Number + "','" + mem_imgpath + "','" + Email + "','" + qrimgpath + "','" + joineddate + "','" + packageName + "')"; dB_Connection.InsertData(insertqry); //get data from package table DB_Connection dB_Connection1 = new DB_Connection(); string qrypack = "Select * From Packages where Package_Name='" + packageName + "'"; SqlDataReader da2 = dB_Connection1.getData(qrypack); da2.Read(); //calculation string amount = da2["Fee"].ToString(); DateTime date = DateTime.Now.Date; string days = da2["Duration"].ToString(); Console.WriteLine(date.AddDays(int.Parse(days))); string due_date = date.AddDays(int.Parse(days)).ToString("MM/dd/yyyy"); //Insert Data to Payments table DB_Connection dB_Connection2 = new DB_Connection(); string qryinsertpay = "INSERT INTO Payment(mem_id,Name,package,due_date,amount,paid) VALUES('" + mem_id + "','" + name + "','" + packageName + "','" + due_date + "','" + amount + "','0')"; Console.WriteLine(qryinsertpay); dB_Connection2.InsertData(qryinsertpay); QRmailSender qRmailSender = new QRmailSender(); qRmailSender.qrgen(qrsubject, qrimgpath); if (Email != null) { DialogResult dialog = MessageBox.Show("This member has not provided an Email Address! So, You can print the QR code. Do you want to print it ?", "Print QR Code", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { string filename = qrimgpath; var p = new Process(); p.StartInfo.FileName = filename; p.StartInfo.Verb = "print"; p.Start(); } } else { qRmailSender.Emailgen(name, type); qRmailSender.Emailsend(Email, qrimgpath); } } else { MessageBox.Show("Select package or check if you have added packages to the system!", "Warning!"); } }