public void UpdateEmployeeInformation(string employeeCode, EmployeePersonalInfoBO objEmployeePersonalBO, EmployeePaymentBO objEmployeePaymentBO, EmployeeDoucmentBO objEmployeeDoucment, Employee_EmergencyBO objEmployeeEmgerBO, Employee_HolidayBO objEmployeeHolidayBO, SalaryPurposeBO objSalaryPurposeBO)
        {
            string personalqueryString = "";

            personalqueryString = "UPDATE SBP_Employee_PersonalInfo SET [Name]='" + objEmployeePersonalBO.EmployeeName + "',FatherName='" + objEmployeePersonalBO.FatherName +
                                  "',MotherName='" + objEmployeePersonalBO.MotherName + "',Address='" + objEmployeePersonalBO.Address + "',Gender='" + objEmployeePersonalBO.Gender +
                                  "',DOB='" + objEmployeePersonalBO.DOB + "',FillingStatus='" + objEmployeePersonalBO.FillingStatus +
                                  "',Nationality='" + objEmployeePersonalBO.Nationality + "',NationalID='" + objEmployeePersonalBO.NationalID + "',ContactNumber='" + objEmployeePersonalBO.ContactNumber +
                                  "',Homephone='" + objEmployeePersonalBO.HomePhone + "',EmailAddress='" + objEmployeePersonalBO.EmailAddress + "',PassportNo='" + objEmployeePersonalBO.PassportNo + "',Title='" + objEmployeePersonalBO.EmployeeTitle + "',AlternativeNumber='" + objEmployeePersonalBO.AlternativePhoneNumber + "',Reference_Name='" + objEmployeePersonalBO.ReferenceName + "',Reference_Profession='" + objEmployeePersonalBO.ReferenceProfession + "',Reference_Phone='" + objEmployeePersonalBO.ReferencePhoneNumber + "',Reference_Email='" + objEmployeePersonalBO.ReferenceEmailAddress + "',Reference_Address='" + objEmployeePersonalBO.ReferenceAddress +
                                  "' WHERE EmployeeCode='" + employeeCode + "';";

            string paymenqueryString = "UPDATE SBP_Employee_PaymentInfo SET JoinDate='" + objEmployeePaymentBO.JoinDate +
                                       "',Department='" + objEmployeePaymentBO.Department + "',Designation='" + objEmployeePaymentBO.JoinPosition + "',Responsiblity='" + objEmployeePaymentBO.JobResponsibility +
                                       "',PaymentMedia='" + objEmployeePaymentBO.PaymentBy + "',BankName='" + objEmployeePaymentBO.BankName +
                                       "',BankBranchName='" + objEmployeePaymentBO.BankBranchName + "',AccountNo='" + objEmployeePaymentBO.AccountNo +
                                       "',BasicSalary=" + objEmployeePaymentBO.BasicSalary +
                                       ",Others=" + objEmployeePaymentBO.Others + ",ProvidentFund=" + objEmployeePaymentBO.ProFund + ",BranchName='" + objEmployeePaymentBO.BanchName + "',ReportTo='" + objEmployeePaymentBO.ReportTo + "',RecuritedBy='" + objEmployeePaymentBO.RecuritBy + "',TinNumber='" + objEmployeePaymentBO.TinNumber + "' WHERE EmployeeCode='" + employeeCode + "';";


            string EmgergencyString = "UPDATE SBP_Employee_Emergency SET Employee_Disability='" + objEmployeeEmgerBO.MedicalDisability + "',BloodGroup='" + objEmployeeEmgerBO.BloodGroup + "',Contact_Person_Name='" + objEmployeeEmgerBO.ContactPersonName + "',RelationShip='" + objEmployeeEmgerBO.RelationShip + "',Contact_Number='" + objEmployeeEmgerBO.ContactNumber + "',Contact_Address='" + objEmployeeEmgerBO.Adddress + "',Insurance_Details='" + objEmployeeEmgerBO.MedicalInsurance + "',Special_Instruction='" + objEmployeeEmgerBO.SpecialInstruction + "' WHERE EmployeeCode='" + employeeCode + "';";
            string HolidayString    = "UPDATE SBP_Employee_Holiday SET Yearly_Holiday=" + objEmployeeHolidayBO.YearlyHoliday + ",Sick_Leave=" + objEmployeeHolidayBO.SickLeave + ",Maternity_Policy=" + objEmployeeHolidayBO.MaternityPolicy + ",Paternity_Policy=" + objEmployeeHolidayBO.PaternityPolicy + ",Remarks='" + objEmployeeHolidayBO.Remarks + "' WHERE EmployeeCode='" + employeeCode + "';";



            try
            {
                _dbConnection.ConnectDatabase();
                _dbConnection.StartTransaction();
                _dbConnection.ExecuteNonQuery(personalqueryString);
                _dbConnection.ExecuteNonQuery(paymenqueryString);
                _dbConnection.ExecuteNonQuery(EmgergencyString);
                _dbConnection.ExecuteNonQuery(HolidayString);



                for (int i = 0; i < objSalaryPurposeBO.PurposeAmount.Count; ++i)
                {
                    string PurposequeryString = "";
                    if (objSalaryPurposeBO.EmployeePurposeId[i] == 0)
                    {
                        PurposequeryString = "INSERT INTO SBP_Employee_PurposeAmount(EmployeeCode,purposeId,Amount) VALUES ('" + employeeCode + "'," + objSalaryPurposeBO.PurposeId[i] + "," + objSalaryPurposeBO.PurposeAmount[i] + ");";
                    }

                    else
                    {
                        PurposequeryString = "UPDATE SBP_Employee_PurposeAmount SET purposeId=" + objSalaryPurposeBO.PurposeId[i] + ",Amount=" + objSalaryPurposeBO.PurposeAmount[i] + " WHERE Employee_Purpose_Id=" + objSalaryPurposeBO.EmployeePurposeId[i] + ";";
                    }

                    _dbConnection.ExecuteNonQuery(PurposequeryString);
                }

                _dbConnection.Commit();
            }
            catch (Exception)
            {
                _dbConnection.Rollback();
                throw;
            }

            finally
            {
                _dbConnection.CloseDatabase();
            }

            if (objEmployeeDoucment.Image != null)
            {
                string doucmentqueryString = "SaveEmployeeDoc";
                _dbConnection.ConnectDatabase();
                _dbConnection.ActiveStoredProcedure();
                _dbConnection.AddParameter("@imageBytes", SqlDbType.Image, objEmployeeDoucment.Image);
                _dbConnection.AddParameter("@employeeCode", SqlDbType.VarChar, employeeCode);
                _dbConnection.ExecuteNonQuery(doucmentqueryString);
                _dbConnection.CloseDatabase();
            }
        }
        public void InsertEmployeelInformation(EmployeePersonalInfoBO objEmployeePersonalInfo, EmployeePaymentBO objEmployeePaymentBO, EmployeeDoucmentBO objEmployeeDoucmentBO, Employee_HolidayBO obJEmployeeHolidayBO, Employee_EmergencyBO objEmgergoBO, SalaryPurposeBO objSalaryPurposeBO)
        {
            string personalqueryString = "";

            personalqueryString =
                "INSERT INTO SBP_Employee_PersonalInfo (EmployeeCode,Title,[Name],[FatherName],[MotherName],[Address],Gender,DOB,FillingStatus,Nationality,NationalID,ContactNumber,HomePhone,EmailAddress,PassportNo,AlternativeNumber,Reference_Name,Reference_Profession,Reference_Phone,Reference_Email,Reference_Address) VALUES ('" +
                objEmployeePersonalInfo.EmployeeCode + "','" + objEmployeePersonalInfo.EmployeeTitle + "','" + objEmployeePersonalInfo.EmployeeName + "','" +
                objEmployeePersonalInfo.FatherName + "','" + objEmployeePersonalInfo.MotherName + "','" +
                objEmployeePersonalInfo.Address + "','" + objEmployeePersonalInfo.Gender + "','" +
                objEmployeePersonalInfo.DOB + "','" +
                objEmployeePersonalInfo.FillingStatus + "','" +
                objEmployeePersonalInfo.Nationality + "','" + objEmployeePersonalInfo.NationalID + "','" +
                objEmployeePersonalInfo.ContactNumber + "','" +
                objEmployeePersonalInfo.HomePhone + "','" + objEmployeePersonalInfo.EmailAddress + "','" +
                objEmployeePersonalInfo.PassportNo + "','" + objEmployeePersonalInfo.AlternativePhoneNumber + "','" + objEmployeePersonalInfo.ReferenceName + "','" + objEmployeePersonalInfo.ReferenceProfession + "','" + objEmployeePersonalInfo.ReferencePhoneNumber + "','" + objEmployeePersonalInfo.ReferenceEmailAddress + "','" + objEmployeePersonalInfo.ReferenceAddress + "')";

            string PaymentqueryString =
                "INSERT INTO SBP_Employee_PaymentInfo (EmployeeCode,[JoinDate],Department,Designation,Responsiblity,PaymentMedia,BankName,BankBranchName,AccountNo,BasicSalary,ProvidentFund,Others,EntryDate,IsActive,BranchName,ReportTo,RecuritedBy,TinNumber) VALUES ('" +
                objEmployeePaymentBO.EmployeeCode + "','" + objEmployeePaymentBO.JoinDate + "','" +
                objEmployeePaymentBO.Department + "','" + objEmployeePaymentBO.JoinPosition + "','" +
                objEmployeePaymentBO.JobResponsibility + "','" + objEmployeePaymentBO.PaymentBy + "','" + objEmployeePaymentBO.BankBranchName + "','" +
                objEmployeePaymentBO.BankName + "','" + objEmployeePaymentBO.AccountNo + "'," +
                objEmployeePaymentBO.BasicSalary + "," + objEmployeePaymentBO.ProFund + "," + objEmployeePaymentBO.Others + ",GETDATE(),1,'" + objEmployeePaymentBO.BanchName + "','" + objEmployeePaymentBO.ReportTo + "','" + objEmployeePaymentBO.RecuritBy + "','" + objEmployeePaymentBO.TinNumber + "')";


            string HolidayQueryString = "";

            HolidayQueryString =
                "INSERT INTO SBP_Employee_Holiday (EmployeeCode,Yearly_Holiday,Sick_Leave,Maternity_Policy,Paternity_Policy,Remarks) VALUES ('" +
                obJEmployeeHolidayBO.EmployeeCode + "'," + obJEmployeeHolidayBO.YearlyHoliday + "," +
                obJEmployeeHolidayBO.SickLeave + "," +
                obJEmployeeHolidayBO.MaternityPolicy + "," + obJEmployeeHolidayBO.PaternityPolicy + ",'" +
                obJEmployeeHolidayBO.Remarks + "')";

            string EmgergencyQueryString = "INSERT INTO SBP_Employee_Emergency (EmployeeCode,Employee_Disability,BloodGroup,Contact_Person_Name,RelationShip,Contact_Number,Contact_Address,Insurance_Details,Special_Instruction) VALUES ('" + objEmgergoBO.EmployeeCode + "','" + objEmgergoBO.MedicalDisability + "','" + objEmgergoBO.BloodGroup + "','" + objEmgergoBO.ContactPersonName + "','" + objEmgergoBO.RelationShip + "','" + objEmgergoBO.ContactNumber + "','" + objEmgergoBO.Adddress + "','" + objEmgergoBO.MedicalInsurance + "','" + objEmgergoBO.SpecialInstruction + "')";



            try
            {
                _dbConnection.ConnectDatabase();
                _dbConnection.StartTransaction();
                _dbConnection.ExecuteNonQuery(personalqueryString);
                _dbConnection.ExecuteNonQuery(PaymentqueryString);
                _dbConnection.ExecuteNonQuery(HolidayQueryString);
                _dbConnection.ExecuteNonQuery(EmgergencyQueryString);

                if (objEmployeeDoucmentBO.EmployeeCode != "")
                {
                    string doucementqueryString = "INSERT INTO SBP_Employee_Doucment VALUES(@EmployeeCode,@ImageData)";
                    _dbConnection.AddParameter("@EmployeeCode", SqlDbType.VarChar, objEmployeeDoucmentBO.EmployeeCode);
                    _dbConnection.AddParameter("@ImageData", SqlDbType.Image, objEmployeeDoucmentBO.Image);
                    _dbConnection.ExecuteNonQuery(doucementqueryString);
                }

                for (int i = 0; i < objSalaryPurposeBO.PurposeAmount.Count; ++i)
                {
                    string queryString = "INSERT INTO SBP_Employee_PurposeAmount (EmployeeCode,purposeId,Amount) VALUES ('" + objSalaryPurposeBO.EmployeeCode + "'," + objSalaryPurposeBO.PurposeId[i] + "," + objSalaryPurposeBO.PurposeAmount[i] + ")";
                    _dbConnection.ExecuteNonQuery(queryString);
                }

                _dbConnection.Commit();
            }
            catch (Exception)
            {
                _dbConnection.Rollback();
                throw;
            }

            finally
            {
                _dbConnection.CloseDatabase();
            }
        }