private void EnrollmentDate_Focused(object sender, FocusEventArgs e) { var entryText = (sender as Entry)?.Text; if (DateTime.TryParseExact(entryText, "MM/dd/yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None, out _)) { EnrollmentDate.Text = entryText; } else { ((NewAssessmentViewModel)this.BindingContext).EnrollmentDateIsValid = false; EnrollmentDateStackLayout.BackgroundColor = EnrollmentDate.BackgroundColor = Color.White; EnrollmentDate.Text = ""; EnrollmentDate.TextColor = Colors.LightGrayColor; EnrollmentDate.FontAttributes = FontAttributes.None; EnrollmentFrame.BorderColor = Color.FromHex("#898D8D"); EnrollmentImageFrame.BackgroundColor = Color.FromHex("147cbd"); EnrollmentImageFrame.BorderColor = Color.FromHex("#898D8D"); if (((NewAssessmentViewModel)this.BindingContext).DOBIsValid && _dobErrorMsgShown) { DOB.Focus(); } else if (((NewAssessmentViewModel)this.BindingContext).DOBIsValid) { RefreshDobErrorStack(); } } }
private void cmbBoxMStatus_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { DOB.Focus(); e.Handled = true; } else { e.Handled = false; } }
private void btnSave_Click(object sender, EventArgs e) { if (Gender.Text == "") { MessageBox.Show("Please select gender", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Gender.Focus(); return; } if (Category.Text == "") { MessageBox.Show("Please select Category", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Category.Focus(); return; } if (FatherName.Text == "") { MessageBox.Show("Please enter father's name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); FatherName.Focus(); return; } if (Session.Text == "") { MessageBox.Show("Please enter session", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Session.Focus(); return; } if (DOB.Text == "") { MessageBox.Show("Please enter dob", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DOB.Focus(); return; } if (MotherName.Text == "") { MessageBox.Show("Please enter mother's name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); MotherName.Focus(); return; } if (Religion.Text == "") { MessageBox.Show("Please select religion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Religion.Focus(); return; } if (Address.Text == "") { MessageBox.Show("Please select address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Address.Focus(); return; } if (Address.Text == "") { MessageBox.Show("Please enter address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Address.Focus(); return; } if (ContactNo.Text == "") { MessageBox.Show("Please enter contact no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ContactNo.Focus(); return; } if (Email.Text == "") { MessageBox.Show("Please enter email", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Email.Focus(); return; } if (Course.Text == "") { MessageBox.Show("Please select course", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Course.Focus(); return; } if (Branch.Text == "") { MessageBox.Show("Please select branch", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Branch.Focus(); return; } if (DocumentSubmitted.Text == "") { MessageBox.Show("Please enter submitted documents", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DocumentSubmitted.Focus(); return; } if (Nationality.Text == "") { MessageBox.Show("Please enter nationality", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Nationality.Focus(); return; } auto(); try { con = new SqlConnection(cs.DBConn); con.Open(); string ct = "select Admission_No from studentRegistration where Admission_No=@find"; cmd = new SqlCommand(ct); cmd.Connection = con; cmd.Parameters.Add(new SqlParameter("@find", System.Data.SqlDbType.NChar, 20, "AdmissionNo")); cmd.Parameters["@find"].Value = AdmissionNo.Text; rdr = cmd.ExecuteReader(); if (rdr.Read()) { MessageBox.Show("Admission No. Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); AdmissionNo.Text = ""; if ((rdr != null)) { rdr.Close(); } return; } con = new SqlConnection(cs.DBConn); con.Open(); string cb = "insert into studentRegistration(Student_name,Admission_No,DateOfAdmission,Fathers_Name,Gender,DOB,Address,Session,Contact_No,Email,Course,Branch,Submitted_Documents,Nationality,GuardianName,GuardianContactNo,GuardianAddress,High_School_name,HS_Year_of_passing,HS_Percentage,HS_Board,Higher_secondary_Name,H_year_of_passing,H_percentage,H_board,Graduation,G_year_of_passing,G_percentage,G_University,Post_graduation,PG_year_of_passing,PG_percentage,PG_university,mother_name,religion,category) VALUES (@d2,@d3,@d4,@d6,@d7,@d8,@d9,@d10,@d11,@d12,@d13,@d14,@d15,@d16,@d17,@d18,@d19,@d20,@d21,@d22,@d23,@d24,@d25,@d26,@d27,@d28,@d29,@d30,@d31,@d32,@d33,@d34,@d35,@d36,@d37,@d38)"; cmd = new SqlCommand(cb); cmd.Connection = con; if (UG.SelectedIndex == -1) { UG.Text = ""; } if (PG.SelectedIndex == -1) { PG.Text = ""; } cmd.Parameters.Add(new SqlParameter("@d2", System.Data.SqlDbType.NChar, 30, "Student_name")); cmd.Parameters.Add(new SqlParameter("@d3", System.Data.SqlDbType.NChar, 15, "Admission_No")); cmd.Parameters.Add(new SqlParameter("@d4", System.Data.SqlDbType.NChar, 30, "DateOfAdmission")); cmd.Parameters.Add(new SqlParameter("@d6", System.Data.SqlDbType.NChar, 30, "Fathers_Name")); cmd.Parameters.Add(new SqlParameter("@d7", System.Data.SqlDbType.NChar, 10, "Gender")); cmd.Parameters.Add(new SqlParameter("@d8", System.Data.SqlDbType.NChar, 15, "DOB")); cmd.Parameters.Add(new SqlParameter("@d9", System.Data.SqlDbType.NChar, 50, "Address")); cmd.Parameters.Add(new SqlParameter("@d10", System.Data.SqlDbType.NChar, 10, "Session")); cmd.Parameters.Add(new SqlParameter("@d11", System.Data.SqlDbType.NChar, 10, "Contact_No")); cmd.Parameters.Add(new SqlParameter("@d12", System.Data.SqlDbType.NChar, 30, "Email")); cmd.Parameters.Add(new SqlParameter("@d13", System.Data.SqlDbType.NChar, 30, "Course")); cmd.Parameters.Add(new SqlParameter("@d14", System.Data.SqlDbType.NChar, 30, "Branch")); cmd.Parameters.Add(new SqlParameter("@d15", System.Data.SqlDbType.VarChar, 250, "Submitted_Documents")); cmd.Parameters.Add(new SqlParameter("@d16", System.Data.SqlDbType.NChar, 20, "Nationality")); cmd.Parameters.Add(new SqlParameter("@d17", System.Data.SqlDbType.NChar, 30, "GuardianName")); cmd.Parameters.Add(new SqlParameter("@d18", System.Data.SqlDbType.NChar, 10, "GuardianContactNo")); cmd.Parameters.Add(new SqlParameter("@d19", System.Data.SqlDbType.NChar, 50, "GuardianAddress")); cmd.Parameters.Add(new SqlParameter("@d20", System.Data.SqlDbType.NChar, 30, "High_School_name")); cmd.Parameters.Add(new SqlParameter("@d21", System.Data.SqlDbType.NChar, 10, "HS_Year_of_passing")); cmd.Parameters.Add(new SqlParameter("@d22", System.Data.SqlDbType.NChar, 10, "HS_Percentage")); cmd.Parameters.Add(new SqlParameter("@d23", System.Data.SqlDbType.NChar, 30, "HS_Board")); cmd.Parameters.Add(new SqlParameter("@d24", System.Data.SqlDbType.NChar, 30, "Higher_secondary_Name")); cmd.Parameters.Add(new SqlParameter("@d25", System.Data.SqlDbType.NChar, 10, "H_year_of_passing")); cmd.Parameters.Add(new SqlParameter("@d26", System.Data.SqlDbType.NChar, 10, "H_percentage")); cmd.Parameters.Add(new SqlParameter("@d27", System.Data.SqlDbType.NChar, 30, "H_board")); cmd.Parameters.Add(new SqlParameter("@d28", System.Data.SqlDbType.NChar, 30, "Graduation")); cmd.Parameters.Add(new SqlParameter("@d29", System.Data.SqlDbType.NChar, 10, "G_year_of_passing")); cmd.Parameters.Add(new SqlParameter("@d30", System.Data.SqlDbType.NChar, 10, "G_percentage")); cmd.Parameters.Add(new SqlParameter("@d31", System.Data.SqlDbType.NChar, 30, "G_University")); cmd.Parameters.Add(new SqlParameter("@d32", System.Data.SqlDbType.NChar, 30, "Post_graduation")); cmd.Parameters.Add(new SqlParameter("@d33", System.Data.SqlDbType.NChar, 10, "PG_year_of_passing")); cmd.Parameters.Add(new SqlParameter("@d34", System.Data.SqlDbType.NChar, 10, "PG_percentage")); cmd.Parameters.Add(new SqlParameter("@d35", System.Data.SqlDbType.NChar, 30, "PG_university")); cmd.Parameters.Add(new SqlParameter("@d36", System.Data.SqlDbType.NChar, 30, "mother_name")); cmd.Parameters.Add(new SqlParameter("@d37", System.Data.SqlDbType.NChar, 30, "religion")); cmd.Parameters.Add(new SqlParameter("@d38", System.Data.SqlDbType.NChar, 15, "category")); cmd.Parameters["@d2"].Value = StudentName.Text.Trim(); cmd.Parameters["@d3"].Value = AdmissionNo.Text.Trim(); cmd.Parameters["@d4"].Value = DateOfAdmission.Text.Trim(); cmd.Parameters["@d6"].Value = FatherName.Text.Trim(); cmd.Parameters["@d7"].Value = Gender.Text.Trim(); cmd.Parameters["@d8"].Value = DOB.Text.Trim(); cmd.Parameters["@d9"].Value = Address.Text.Trim(); cmd.Parameters["@d10"].Value = Session.Text.Trim(); cmd.Parameters["@d11"].Value = ContactNo.Text.Trim(); cmd.Parameters["@d12"].Value = Email.Text.Trim(); cmd.Parameters["@d13"].Value = Course.Text.Trim(); cmd.Parameters["@d14"].Value = Branch.Text.Trim(); cmd.Parameters["@d15"].Value = DocumentSubmitted.Text.Trim(); cmd.Parameters["@d16"].Value = Nationality.Text.Trim(); cmd.Parameters["@d17"].Value = GuardianName.Text.Trim(); cmd.Parameters["@d18"].Value = GuardianContactNo.Text.Trim(); cmd.Parameters["@d19"].Value = GuardianAddress.Text.Trim(); cmd.Parameters["@d20"].Value = HS.Text.Trim(); cmd.Parameters["@d21"].Value = HSYOP.Text.Trim(); cmd.Parameters["@d22"].Value = HSPercentage.Text.Trim(); cmd.Parameters["@d23"].Value = HSBoard.Text.Trim(); cmd.Parameters["@d24"].Value = HSS.Text.Trim(); cmd.Parameters["@d25"].Value = HSSYOP.Text.Trim(); cmd.Parameters["@d26"].Value = HSSPercentage.Text.Trim(); cmd.Parameters["@d27"].Value = HSSBoard.Text.Trim(); cmd.Parameters["@d28"].Value = UG.Text.Trim(); cmd.Parameters["@d29"].Value = GYOP.Text.Trim(); cmd.Parameters["@d30"].Value = GPercentage.Text.Trim(); cmd.Parameters["@d31"].Value = GUniy.Text.Trim(); cmd.Parameters["@d32"].Value = PG.Text.Trim(); cmd.Parameters["@d33"].Value = PGYOP.Text.Trim(); cmd.Parameters["@d34"].Value = PGpercentage.Text.Trim(); cmd.Parameters["@d35"].Value = PGUniy.Text.Trim(); cmd.Parameters["@d36"].Value = MotherName.Text.Trim(); cmd.Parameters["@d37"].Value = Religion.Text.Trim(); cmd.Parameters["@d38"].Value = Category.Text.Trim(); cmd.ExecuteNonQuery(); MessageBox.Show("Successfully Resistered", "Student", MessageBoxButtons.OK, MessageBoxIcon.Information); btnSave.Enabled = false; con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void SavePersonal_Click(object sender, EventArgs e) { string query = ""; int DistrictKey = ((KeyValuePair <int, string>)District.SelectedItem).Key; string que = ""; int ThanaKey = ((KeyValuePair <int, string>)Thana.SelectedItem).Key; string qu = ""; int MarriedKey = ((KeyValuePair <int, string>)MarriedCombox.SelectedItem).Key; String DistrictValue = ((KeyValuePair <int, string>)District.SelectedItem).Value; String ThanaValue = ((KeyValuePair <int, string>)Thana.SelectedItem).Value; String MarriedValue = ((KeyValuePair <int, string>)MarriedCombox.SelectedItem).Value; if (StaffIDtextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); StaffIDtextBox.Focus(); return; } if (ContacttextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Contact Number"); ContacttextBox.Focus(); return; } if (DOB.Text == "") { MessageBox.Show("Please Enter Date of Birth"); DOB.Focus(); return; } if (DistrictKey < 1) { MessageBox.Show("Please Enter District"); District.Focus(); return; } if (ThanaKey < 1) { MessageBox.Show("Please Enter Thana"); District.Focus(); return; } if (PostCodetextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Post Code"); PostCodetextBox.Focus(); return; } if (VillagetextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Village Name"); VillagetextBox.Focus(); return; } if (PresentAddresstextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Present Address"); PresentAddresstextBox.Focus(); return; } if (PermanentadresstextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Permanent Address"); PermanentadresstextBox.Focus(); return; } if (MarriedKey < 1) { MessageBox.Show("Please Enter Marital Status"); District.Focus(); return; } if (FathersNametextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Father's name"); FathersNametextBox.Focus(); return; } if (MothersNametextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Mother's Name"); MothersNametextBox.Focus(); return; } if (ParentsAddresstextBox.Text.Trim() == "") { MessageBox.Show("Please Enter Present Address"); ParentsAddresstextBox.Focus(); return; } query = "SELECT COUNT(*) AS Count FROM Personal_Info WHERE StaffID = " + StaffIDtextBox.Text + ""; if (stfID == 0) { if (DbAccess.NumberOfRecords(query) > 0) { MessageBox.Show("This Username already exists! Please try another ID!"); StaffIDtextBox.Focus(); return; } } else { if (DbAccess.NumberOfRecords(query) > 1) { MessageBox.Show("Update Not Successfully Done!"); StaffIDtextBox.Focus(); return; } } try { if (stfID == 0) { query = "INSERT INTO Personal_Info(StaffID,Contact,[Date of Birth],District,Thana,[Post Code],Village,[Present Address],[Permanent Address],[Marital Status],[Father's Name],[Mother's Name],[Parent's Address]) VALUES(" + Convert.ToInt32(StaffIDtextBox.Text) + ", '" + ContacttextBox.Text + "', '" + DOB.Value.ToString("yyyy/MM/dd") + "', '" + DistrictValue + "', '" + ThanaValue + "', '" + PostCodetextBox.Text + "', '" + VillagetextBox.Text + "', '" + PresentAddresstextBox.Text + "', '" + PermanentadresstextBox.Text + "', '" + MarriedValue + "', '" + FathersNametextBox.Text + "', '" + MothersNametextBox.Text + "', '" + ParentsAddresstextBox.Text + "')"; } else { query = "UPDATE Personal_Info SET Contact = '" + ContacttextBox.Text + "', [Date of Birth] = '" + DOB.Text + "', District= '" + District.Text + "', Thana = '" + Thana.Text + "', [Post Code] = '" + PostCodetextBox.Text + "', Village = '" + VillagetextBox.Text + "',[Present Address] = '" + PresentAddresstextBox.Text + "', [Permanent Address] = '" + PermanentadresstextBox.Text + "', [Marital Status] = '" + MarriedValue + "',[Father's Name] = '" + FathersNametextBox.Text + "', [Mother's Name]= '" + MothersNametextBox.Text + "',[Parent's Address] = '" + ParentsAddresstextBox.Text + "' WHERE StaffID = " + stfID; } if (DbAccess.ExecuteToDB(query)) { if (stfID == 0) { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Update Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtStaffName.Text == "") { MessageBox.Show("Please enter staff name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtStaffName.Focus(); return; } if (cmbGender.Text == "") { MessageBox.Show("Please select gender", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbGender.Focus(); return; } if (DOB.Text == "") { MessageBox.Show("Please enter DOB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DOB.Focus(); return; } if (txtFatherName.Text == "") { MessageBox.Show("Please enter father's name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtFatherName.Focus(); return; } if (txtPAddress.Text == "") { MessageBox.Show("Please enter permanent address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPAddress.Focus(); return; } if (txtTAddress.Text == "") { MessageBox.Show("Please enter temporary address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTAddress.Focus(); return; } if (txtPhoneNo.Text == "") { MessageBox.Show("Please enter phone no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPhoneNo.Focus(); return; } if (txtMobileNo.Text == "") { MessageBox.Show("Please enter mobile no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMobileNo.Focus(); return; } if (txtDepartment.Text == "") { MessageBox.Show("Please select department", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDepartment.Focus(); return; } if (txtQualifications.Text == "") { MessageBox.Show("Please enter qualifications", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtQualifications.Focus(); return; } if (txtYOP.Text == "") { MessageBox.Show("Please enter year of experience", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtYOP.Focus(); return; } if (txtDesignation.Text == "") { MessageBox.Show("Please enter staff designation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDesignation.Focus(); return; } if (txtEmail.Text == "") { MessageBox.Show("Please enter email", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtEmail.Focus(); return; } if (txtBasicSalary.Text == "") { MessageBox.Show("Please enter basic salary", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtBasicSalary.Focus(); return; } if (pictureBox1.Image == null) { MessageBox.Show("Please browse & select photo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Browse.Focus(); return; } auto(); con = new SqlConnection(cs.DBConn); con.Open(); string cb = "insert into Employee(Staffid,staffname,department,gender,fathername,permanentaddress,temporaryaddress,phoneno,mobileno,dateofjoining,qualification,yearofexperience,designation,email,Basicsalary,lic,groupinsurance,familybenefitfund,loans,otherdeductions,IncomeTax,picture,DOB) values(@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11,@d12,@d13,@d14,@d15,@d16,@d17,@d18,@d19,@d20,@d21,@d22,@d23)"; cmd = new SqlCommand(cb); cmd.Connection = con; cmd.Parameters.Add(new SqlParameter("@d1", System.Data.SqlDbType.NChar, 15, "Staffid")); cmd.Parameters.Add(new SqlParameter("@d2", System.Data.SqlDbType.NChar, 30, "Staffname")); cmd.Parameters.Add(new SqlParameter("@d3", System.Data.SqlDbType.VarChar, 100, "department")); cmd.Parameters.Add(new SqlParameter("@d4", System.Data.SqlDbType.NChar, 10, "gender")); cmd.Parameters.Add(new SqlParameter("@d5", System.Data.SqlDbType.NChar, 30, "fathername")); cmd.Parameters.Add(new SqlParameter("@d6", System.Data.SqlDbType.VarChar, 100, "permanentaddress")); cmd.Parameters.Add(new SqlParameter("@d7", System.Data.SqlDbType.VarChar, 100, "temporaryaddress")); cmd.Parameters.Add(new SqlParameter("@d8", System.Data.SqlDbType.NChar, 10, "Phoneno")); cmd.Parameters.Add(new SqlParameter("@d9", System.Data.SqlDbType.NChar, 10, "mobileno")); cmd.Parameters.Add(new SqlParameter("@d10", System.Data.SqlDbType.NChar, 30, "dateofjoining")); cmd.Parameters.Add(new SqlParameter("@d11", System.Data.SqlDbType.NChar, 70, "qualiication")); cmd.Parameters.Add(new SqlParameter("@d12", System.Data.SqlDbType.Int, 10, "yearofexperience")); cmd.Parameters.Add(new SqlParameter("@d13", System.Data.SqlDbType.VarChar, 100, "designation")); cmd.Parameters.Add(new SqlParameter("@d14", System.Data.SqlDbType.NChar, 30, "email")); cmd.Parameters.Add(new SqlParameter("@d15", System.Data.SqlDbType.Int, 10, "basicsalary")); cmd.Parameters.Add(new SqlParameter("@d16", System.Data.SqlDbType.Int, 10, "lic")); cmd.Parameters.Add(new SqlParameter("@d17", System.Data.SqlDbType.Int, 10, "groupinsurance")); cmd.Parameters.Add(new SqlParameter("@d18", System.Data.SqlDbType.Int, 10, "familybenefitfund")); cmd.Parameters.Add(new SqlParameter("@d19", System.Data.SqlDbType.Int, 10, "loans")); cmd.Parameters.Add(new SqlParameter("@d20", System.Data.SqlDbType.Int, 10, "otherdeductions")); cmd.Parameters.Add(new SqlParameter("@d21", System.Data.SqlDbType.Int, 10, "incometax")); cmd.Parameters.Add(new SqlParameter("@d23", System.Data.SqlDbType.NChar, 20, "DOB")); cmd.Parameters["@d1"].Value = txtStaffID.Text; cmd.Parameters["@d2"].Value = txtStaffName.Text; cmd.Parameters["@d3"].Value = txtDepartment.Text; cmd.Parameters["@d4"].Value = cmbGender.Text; cmd.Parameters["@d5"].Value = txtFatherName.Text; cmd.Parameters["@d6"].Value = txtPAddress.Text; cmd.Parameters["@d7"].Value = txtTAddress.Text; cmd.Parameters["@d8"].Value = txtPhoneNo.Text; cmd.Parameters["@d9"].Value = txtMobileNo.Text; cmd.Parameters["@d10"].Value = dtpDateOfJoining.Text; cmd.Parameters["@d11"].Value = txtQualifications.Text; cmd.Parameters["@d12"].Value = Convert.ToInt16(txtYOP.Text); cmd.Parameters["@d13"].Value = txtDesignation.Text; cmd.Parameters["@d14"].Value = txtEmail.Text; cmd.Parameters["@d15"].Value = Convert.ToInt32(txtBasicSalary.Text); if (txtLIC.Text == "") { cmd.Parameters["@d16"].Value = 0; } else { cmd.Parameters["@d16"].Value = Convert.ToInt32(txtLIC.Text); } if (txtGrpInsurance.Text == "") { cmd.Parameters["@d17"].Value = 0; } else { cmd.Parameters["@d17"].Value = Convert.ToInt32(txtGrpInsurance.Text); } if (txtFamilyBenefitFund.Text == "") { cmd.Parameters["@d18"].Value = 0; } else { cmd.Parameters["@d18"].Value = Convert.ToInt32(txtFamilyBenefitFund.Text); } if (txtLoans.Text == "") { cmd.Parameters["@d19"].Value = 0; } else { cmd.Parameters["@d19"].Value = Convert.ToInt32(txtLoans.Text); } if (txtOtherDeductions.Text == "") { cmd.Parameters["@d20"].Value = 0; } else { cmd.Parameters["@d20"].Value = Convert.ToInt32(txtOtherDeductions.Text); } if (txtIncomeTax.Text == "") { cmd.Parameters["@d21"].Value = 0; } else { cmd.Parameters["@d21"].Value = Convert.ToInt32(txtIncomeTax.Text); } cmd.Parameters["@d23"].Value = DOB.Text; MemoryStream ms = new MemoryStream(); Bitmap bmpImage = new Bitmap(pictureBox1.Image); bmpImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] data = ms.GetBuffer(); SqlParameter p = new SqlParameter("@d22", SqlDbType.Image); p.Value = data; cmd.Parameters.Add(p); cmd.ExecuteNonQuery(); MessageBox.Show("Successfully saved", "Employee Record", MessageBoxButtons.OK, MessageBoxIcon.Information); btnSave.Enabled = false; con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnUpdate_record_Click_1(object sender, EventArgs e) { try { if ((radioButton1.Checked == false & radioButton2.Checked == false)) { MessageBox.Show("Please select Gender", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if ((radioButton1.Checked == true)) { txtStatus = radioButton1.Text; } if ((radioButton2.Checked == true)) { txtStatus = radioButton2.Text; } if ((txtcheckBox.Checked == true)) { txtStatus1 = txtcheckBox.Text; } if ((txtcheckBox.Checked == false)) { txtStatus1 = "Inactive"; } if (txtEmployeeName.Text == "") { MessageBox.Show("Please enter Employee name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtEmployeeName.Focus(); return; } if (!txtDOB.MaskFull) { MessageBox.Show("Please Enter DOB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDOB.Focus(); return; } if (DOB.Text == "") { MessageBox.Show("Please enter DOB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DOB.Focus(); return; } if (txtFatherName.Text == "") { MessageBox.Show("Please enter father's name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtFatherName.Focus(); return; } if (txtAddress.Text == "") { MessageBox.Show("Please enter Address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtAddress.Focus(); return; } if (txtCity.Text == "") { MessageBox.Show("Please enter City", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCity.Focus(); return; } if (txtCountry.Text == "") { MessageBox.Show("Please enter Country.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCountry.Focus(); return; } if (txtContactNo.Text == "") { MessageBox.Show("Please enter Contact no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtContactNo.Focus(); return; } if (txtDepartment.Text == "") { MessageBox.Show("Please select department", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDepartment.Focus(); return; } if (txtBloodGroup.Text == "") { MessageBox.Show("Please Select Blood Group", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtBloodGroup.Focus(); return; } if (txtDesignation.Text == "") { MessageBox.Show("Please enter staff designation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDesignation.Focus(); return; } if (txtEmail.Text == "") { MessageBox.Show("Please enter email", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtEmail.Focus(); return; } if (txtBasicSalary.Text == "") { MessageBox.Show("Please enter basic salary", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtBasicSalary.Focus(); return; } if (pictureBox1.Image == null) { MessageBox.Show("Please browse & select photo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Browse.Focus(); return; } if (txtSchoolName.Text == "") { MessageBox.Show("Please Select School", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSchoolName.Focus(); return; } con = new SqlConnection(cs.DBcon); con.Open(); string cb = "update Employee Set EmpMaxID=@d1,EmployeeName=@d2,Gender=@d3,DOB=@d4,Religion=@d5,FatherName=@d6,MotherName=@d7,City=@d8,Country=@d9,Address=@d10,contactNo=@d11,DateofJoining=@d12,Email=@d13,Salary=@d14,Status=@d15,Photo=@d16,Department_ID=@d17,Designation_ID=@d18,BloodGroup=@d19,SchoolID=@d20,AccountName=@d21,AccountNumber=@d22,Bank=@d23,Branch=@d24,IFSCcode=@d25 where EMPID='" + txtEmployeeID.Text + "'"; cmd = new SqlCommand(cb); cmd.Connection = con; cmd.Parameters.AddWithValue("@d1", txtEmployeeMAX.Text); cmd.Parameters.AddWithValue("@d2", txtEmployeeName.Text); cmd.Parameters.AddWithValue("@d3", txtStatus); cmd.Parameters.AddWithValue("@d4", txtDOB.Text); cmd.Parameters.AddWithValue("@d5", txtReligion.Text); cmd.Parameters.AddWithValue("@d6", txtFatherName.Text); cmd.Parameters.AddWithValue("@d7", txtmotherName.Text); cmd.Parameters.AddWithValue("@d8", txtCity.Text); cmd.Parameters.AddWithValue("@d9", txtCountry.Text); cmd.Parameters.AddWithValue("@d10", txtAddress.Text); cmd.Parameters.AddWithValue("@d11", txtContactNo.Text); cmd.Parameters.AddWithValue("@d12", txtJoiningDate.Value.Date); cmd.Parameters.AddWithValue("@d13", txtEmail.Text); cmd.Parameters.AddWithValue("@d14", txtBasicSalary.Text); cmd.Parameters.AddWithValue("@d15", txtStatus1); cmd.Parameters.AddWithValue("@d17", txtDepartmentID.Text); cmd.Parameters.AddWithValue("@d18", txtDesignationID.Text); cmd.Parameters.AddWithValue("@d19", txtBloodGroup.Text); cmd.Parameters.AddWithValue("@d20", txtSchoolID.Text); cmd.Parameters.AddWithValue("@d21", txtAccountName.Text); cmd.Parameters.AddWithValue("@d22", txtAccountNo.Text); cmd.Parameters.AddWithValue("@d23", txtBank.Text); cmd.Parameters.AddWithValue("@d24", txtBranch.Text); cmd.Parameters.AddWithValue("@d25", txtIFSCcode.Text); MemoryStream ms = new MemoryStream(); Bitmap bmpImage = new Bitmap(pictureBox1.Image); bmpImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] data = ms.GetBuffer(); SqlParameter p = new SqlParameter("@d16", SqlDbType.Image); p.Value = data; cmd.Parameters.Add(p); cmd.ExecuteReader(); // auto(); st1 = lblUser.Text; st2 = "Updated the Staff'" + txtEmployeeName.Text + "' having EmployeeID '" + txtEmployeeID.Text + "'"; cf.LogFunc(st1, System.DateTime.Now, st2); MessageBox.Show("Successfully updated", "Employee Details", MessageBoxButtons.OK, MessageBoxIcon.Information); btnUpdate_record.Enabled = false; if (con.State == ConnectionState.Open) { con.Close(); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool Verification() { if (EN_No.Text == "G") { EN_No.Focus(); string errorEnrollmentNumber = "Please Provide Enrollment Number"; errorPro.SetError(EN_No, errorEnrollmentNumber); MessageBox.Show("Please Provide Enrollment Number"); return(false); } if (C_Name.Text == string.Empty) { C_Name.Focus(); string errorCousrse = "Please Choose Course"; errorPro.SetError(C_Name, errorCousrse); return(false); } if (C_Sem.Text == string.Empty) { C_Sem.Focus(); string errorSemester = "Please Choose Semester"; errorPro.SetError(C_Sem, errorSemester); MessageBox.Show("Please Choose Semester"); return(false); } if (Batch.Text == string.Empty) { Batch.Focus(); string errorBatch = "Please Choose Batch"; errorPro.SetError(Batch, errorBatch); return(false); } if (S_FName.Text == string.Empty) { S_FName.Focus(); string errorFname = "Please Provide First Name"; errorPro.SetError(S_FName, errorFname); MessageBox.Show("Please Provide First Name"); return(false); } if (DOB.Text == string.Empty) { DOB.Focus(); string errorDOB = "Please Provide Date Of Birth"; errorPro.SetError(DOB, errorDOB); return(false); } if (Father.Text == string.Empty) { Father.Focus(); string errorFather = "Please Provide Father Name"; errorPro.SetError(Father, errorFather); return(false); } if (MtxtFContact.Text == "+91-") { MtxtFContact.Focus(); string errorMtxtFContact = "Please Provide Father Contact Number"; errorPro.SetError(MtxtFContact, errorMtxtFContact); return(false); } return(true); }
private void saveResBtn_Click(object sender, EventArgs e) { try { var mydate = DateTime.Now; string healthStat = ""; string healthProb = ""; string vaccine = ""; if (fname.Text == "" || lname.Text == "" || YrLvl.Text == "" || skill.Text == "") { MessageBox.Show("Please fill up all forms"); } else { try { if (healthProblems.CheckedItems.Count > 0 && healthStatus.CheckedItems.Count > 0 && vaccineTaken.CheckedItems.Count > 0) { for (int i = 0; i < healthProblems.CheckedItems.Count; i++) { if (healthProb == "") { healthProb = healthProblems.CheckedItems[i].ToString(); } else { healthProb += ", " + healthProblems.CheckedItems[i].ToString(); } } for (int i = 0; i < healthStatus.CheckedItems.Count; i++) { if (healthStat == "") { healthStat = healthStatus.CheckedItems[i].ToString(); } else { healthStat += ", " + healthStatus.CheckedItems[i].ToString(); } } for (int i = 0; i < vaccineTaken.CheckedItems.Count; i++) { if (vaccine == "") { vaccine = vaccineTaken.CheckedItems[i].ToString(); } else { vaccine += ", " + vaccineTaken.CheckedItems[i].ToString(); } } Connection con = new Connection(); con.Connect(); SqlCommand cmd = new SqlCommand(); SqlCommand scmd = new SqlCommand(); cmd.CommandText = "INSERT INTO resident(RESIDENT_FNAME,RESIDENT_MNAME,RESIDENT_LNAME,RESIDENT_CNUM,RESIDENT_DOB,RESIDENT_CIVIL_REGESTERED,RESIDENT_MARITAL,RESIDENT_POSITION,RESIDENT_FAMILY_HEAD,RESIDENT_GENDER,RESIDENT_EDUC_STATUS,RESIDENT_EDUC_LVL,RESIDENT_EDUC_GRADE,RESIDENT_SPECIALSKILL,RESIDENT_SOURCE_OF_FUND,RESIDENT_JOB_TYPE,RESIDENT_INCOME,RESIDENT_HEALTH_PROBLEM,RESIDENT_HEALTH_STATUS,RESIDENT_VACCINE,RESIDENT_IMAGE,RESIDENT_FINGERPRINT,STAFF_ID) " + "VALUES(@fname,@mname,@lname,@cnum,@dob,@civilReg,@marital,@position,@head,@gender,@eduStatus,@eduLevel,@gradeLevel,@skill,@sof,@job,@income,@healthProb,@healthStat,@vaccine,@pic,@finger,@sid)"; scmd.CommandText = "update resident set resident_age = datediff(YY, resident_dob,GETDATE())"; cmd.Connection = Connection.con; scmd.Connection = Connection.con; if (res_Image.Image == null) { MessageBox.Show("Please take a photo"); } else if (fingerPrint1.Image == null) { MessageBox.Show("Please scan your fingerprint!"); } else if (cnum.Text.Length < 11 || cnum.Text.Length > 11) { MessageBox.Show("Check your Contact Number!"); cnum.Focus(); } else if (mi.Text.Length > 1) { MessageBox.Show("Initials should be 1 character!"); mi.Focus(); } else if (healthStatus.CheckedItems.Count >= 2) { MessageBox.Show("Only choose 1 health status!"); healthStatus.Focus(); } else if (healthProblems.CheckedItems.Count > 3) { MessageBox.Show("Only choose 3 health problems!"); healthProblems.Focus(); } else if (DOB.Value == mydate.AddYears(-2)) { MessageBox.Show("System is available only for 3 years old and above!"); } else if (DOB.Value > DateTime.Now) { MessageBox.Show("Date must be in the past!"); DOB.Focus(); } else if (prompts.Text != "Done.") { MessageBox.Show("Unclear Fingerprint Captured!"); Reset(); } else { UpdateStatus(); switch (Enroller.TemplateStatus) { case DPFP.Processing.Enrollment.Status.Ready: // report success and stop capturing { // byte[] btarr = null; // Enroller.Template.Serialize(ref btarr); MemoryStream fingerprint = new MemoryStream(); Enroller.Template.Serialize(fingerprint); fingerprint.Position = 0; BinaryReader br = new BinaryReader(fingerprint); byte[] bytes = br.ReadBytes((Int32)fingerprint.Length); try { MemoryStream stream = new MemoryStream(); fingerprint.Position = (0); res_Image.Image = resizeImage(res_Image.Image, new Size(177, 151)); res_Image.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); //fingerPrint1.Image.Save(fingerprint, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] pic = stream.ToArray(); // byte[] fic = br.ReadBytes((Int32)fingerprint.Length); cmd.Parameters.AddWithValue("@fname", fname.Text); cmd.Parameters.AddWithValue("@mname", mi.Text); cmd.Parameters.AddWithValue("@lname", lname.Text); cmd.Parameters.AddWithValue("@cnum", cnum.Text); cmd.Parameters.AddWithValue("@dob", DOB.Value); cmd.Parameters.AddWithValue("@gender", gender.Text); cmd.Parameters.AddWithValue("@civilReg", civilRegStat.Text); cmd.Parameters.AddWithValue("@marital", maritalStatus.Text); cmd.Parameters.AddWithValue("@position", familyPos.Text); cmd.Parameters.AddWithValue("@head", familyHead.Text); cmd.Parameters.AddWithValue("@eduStatus", eduStat.Text); cmd.Parameters.AddWithValue("@eduLevel", eduLvl.Text); cmd.Parameters.AddWithValue("@gradeLevel", YrLvl.Text); cmd.Parameters.AddWithValue("@skill", skill.Text); cmd.Parameters.AddWithValue("@income", monthlyIncome.Text); cmd.Parameters.AddWithValue("@sof", sourceOfFund.Text); cmd.Parameters.AddWithValue("@job", jobType.Text); cmd.Parameters.AddWithValue("@healthProb", healthProb); cmd.Parameters.AddWithValue("@healthStat", healthStat); cmd.Parameters.AddWithValue("@vaccine", vaccine); cmd.Parameters.AddWithValue("@finger", bytes); cmd.Parameters.AddWithValue("@pic", pic); cmd.Parameters.AddWithValue("@sid", ID); cmd.ExecuteNonQuery(); scmd.ExecuteNonQuery(); MessageBox.Show("Resident Added Successfully"); FMPIclear(); myCamera.Stop(); res_Image.Image = null; fingerPrint1.Image = null; SqlDataAdapter da = new SqlDataAdapter("select RESIDENT_LNAME AS Lastname,RESIDENT_FNAME AS Firstname,RESIDENT_MNAME AS MI,RESIDENT_AGE AS Age,RESIDENT_POSITION AS Position,RESIDENT_FAMILY_HEAD AS Family_Head from resident where family_id is null", Connection.con); SqlCommandBuilder cd = new SqlCommandBuilder(da); DataTable dt = new DataTable(); da.Fill(dt); LFMdata.DataSource = dt; Reset(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.ToString()); Reset(); } break; } case DPFP.Processing.Enrollment.Status.Failed: // report failure and restart capturing { Enroller.Clear(); cp.StopCapture(); UpdateStatus(); OnTemplate(null); cp.StartCapture(); break; } } } } else { MessageBox.Show("Dont leave empty spaces"); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.ToString()); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.ToString()); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtStaffName.Text == "") { MessageBox.Show("Please enter staff name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtStaffName.Focus(); return; } if (cmbGender.Text == "") { MessageBox.Show("Please select gender", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbGender.Focus(); return; } if (DOB.Text == "") { MessageBox.Show("Please enter DOB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DOB.Focus(); return; } if (txtFatherName.Text == "") { MessageBox.Show("Please enter father's name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtFatherName.Focus(); return; } if (txtPAddress.Text == "") { MessageBox.Show("Please enter permanent address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPAddress.Focus(); return; } if (txtTAddress.Text == "") { MessageBox.Show("Please enter temporary address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTAddress.Focus(); return; } if (txtPhoneNo.Text == "") { MessageBox.Show("Please enter phone no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPhoneNo.Focus(); return; } if (txtMobileNo.Text == "") { MessageBox.Show("Please enter mobile no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMobileNo.Focus(); return; } if (txtDepartment.Text == "") { MessageBox.Show("Please select department", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDepartment.Focus(); return; } if (txtQualifications.Text == "") { MessageBox.Show("Please enter qualifications", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtQualifications.Focus(); return; } if (txtYOP.Text == "") { MessageBox.Show("Please enter year of experience", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtYOP.Focus(); return; } if (txtDesignation.Text == "") { MessageBox.Show("Please enter staff designation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDesignation.Focus(); return; } if (txtEmail.Text == "") { MessageBox.Show("Please enter email", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtEmail.Focus(); return; } if (txtBasicSalary.Text == "") { MessageBox.Show("Please enter basic salary", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtBasicSalary.Focus(); return; } if (pictureBox1.Image == null) { MessageBox.Show("Please browse & select photo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Browse.Focus(); return; } auto(); con = new SqlConnection(cs.DBcon); con.Open(); string cb = "insert into Employee(Staffid,staffname,department,gender,fathername,permanentaddress,temporaryaddress,phoneno,mobileno,dateofjoining,qualification,yearofexperience,designation,email,Basicsalary,picture,DOB,status,mothername) values(@d1,@d2,@d3,@d4,@d5,@d6,@d7,@d8,@d9,@d10,@d11,@d12,@d13,@d14,@d15,@d16,@d17,@d18,@d19)"; cmd = new SqlCommand(cb); cmd.Connection = con; cmd.Parameters.Add(new SqlParameter("@d1", System.Data.SqlDbType.NChar, 15, "Staffid")); cmd.Parameters.Add(new SqlParameter("@d2", System.Data.SqlDbType.NChar, 30, "Staffname")); cmd.Parameters.Add(new SqlParameter("@d3", System.Data.SqlDbType.VarChar, 100, "department")); cmd.Parameters.Add(new SqlParameter("@d4", System.Data.SqlDbType.NChar, 10, "gender")); cmd.Parameters.Add(new SqlParameter("@d5", System.Data.SqlDbType.NChar, 30, "fathername")); cmd.Parameters.Add(new SqlParameter("@d6", System.Data.SqlDbType.VarChar, 100, "permanentaddress")); cmd.Parameters.Add(new SqlParameter("@d7", System.Data.SqlDbType.VarChar, 100, "temporaryaddress")); cmd.Parameters.Add(new SqlParameter("@d8", System.Data.SqlDbType.NChar, 10, "Phoneno")); cmd.Parameters.Add(new SqlParameter("@d18", System.Data.SqlDbType.NChar, 15, "status")); cmd.Parameters.Add(new SqlParameter("@d19", System.Data.SqlDbType.NChar, 30, "mothername")); cmd.Parameters["@d1"].Value = txtStaffID.Text; cmd.Parameters["@d2"].Value = txtStaffName.Text; cmd.Parameters["@d3"].Value = txtDepartment.Text; cmd.Parameters["@d4"].Value = cmbGender.Text; cmd.Parameters["@d5"].Value = txtFatherName.Text; cmd.Parameters["@d6"].Value = txtPAddress.Text; cmd.Parameters["@d18"].Value = cmbstatus.Text; cmd.Parameters["@d19"].Value = txtmotherName.Text; MemoryStream ms = new MemoryStream(); Bitmap bmpImage = new Bitmap(pictureBox1.Image); byte[] data = ms.GetBuffer(); SqlParameter p = new SqlParameter("@d16", SqlDbType.Image); p.Value = data; cmd.Parameters.Add(p); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Successfully saved", "Employee Record", MessageBoxButtons.OK, MessageBoxIcon.Information); st1 = lblUser.Text; st2 = "Added the New Staff'" + txtStaffName.Text + "'"; cf.LogFunc(st1, System.DateTime.Now, st2); btnSave.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnUpdate_record_Click_1(object sender, EventArgs e) { try { if ((radioButton1.Checked == true)) { txtStatus = radioButton1.Text; } if ((radioButton2.Checked == true)) { txtStatus = radioButton2.Text; } if ((txtcheckBox.Checked == true)) { txtStatus1 = txtcheckBox.Text; } if ((txtcheckBox.Checked == false)) { txtStatus1 = "Inactive"; } if (txtEmployeeName.Text == "") { MessageBox.Show("Please enter Employee name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtEmployeeName.Focus(); return; } if (!txtDOB.MaskFull) { MessageBox.Show("Please Enter DOB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDOB.Focus(); return; } if (DOB.Text == "") { MessageBox.Show("Please enter DOB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DOB.Focus(); return; } if (txtFatherName.Text == "") { MessageBox.Show("Please enter father's name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtFatherName.Focus(); return; } if (txtAddress.Text == "") { MessageBox.Show("Please enter Address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtAddress.Focus(); return; } if (txtCity.Text == "") { MessageBox.Show("Please enter City", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCity.Focus(); return; } if (txtCountry.Text == "") { MessageBox.Show("Please enter Country.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCountry.Focus(); return; } if (txtContactNo.Text == "") { MessageBox.Show("Please enter Contact no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtContactNo.Focus(); return; } if (txtDepartment.Text == "") { MessageBox.Show("Please select department", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDepartment.Focus(); return; } if (txtBloodGroup.Text == "") { MessageBox.Show("Please Select Blood Group", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtBloodGroup.Focus(); return; } if (txtDesignation.Text == "") { MessageBox.Show("Please enter staff designation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDesignation.Focus(); return; } if (txtEmail.Text == "") { MessageBox.Show("Please enter email", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtEmail.Focus(); return; } if (txtBasicSalary.Text == "") { MessageBox.Show("Please enter basic salary", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtBasicSalary.Focus(); return; } if (pictureBox1.Image == null) { MessageBox.Show("Please browse & select photo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Browse.Focus(); return; } if (txtSchoolName.Text == "") { MessageBox.Show("Please Select School", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSchoolName.Focus(); return; } st1 = lblUser.Text; st2 = "Updated the Staff'" + txtEmployeeName.Text + "' having EmployeeID '" + txtEmployeeID.Text + "'"; cf.LogFunc(st1, System.DateTime.Now, st2); MessageBox.Show("Successfully updated", "Employee Details", MessageBoxButtons.OK, MessageBoxIcon.Information); btnUpdate_record.Enabled = false; if (con.State == ConnectionState.Open) { con.Close(); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }