Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        private void saveButton_Click(object sender, EventArgs e)

        {
            string query = "";

            if (EmpIdtextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Employee ID");
                EmpIdtextBox.Focus();
                return;
            }

            if (userNametextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter UserName");
                userNametextBox.Focus();
                return;
            }

            if (passwordtextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Password");
                passwordtextBox.Focus();
                return;
            }

            if (confirmpasswordtextBox.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Confirm Passowrd");
                confirmpasswordtextBox.Focus();
                return;
            }

            if (passwordtextBox.Text != confirmpasswordtextBox.Text)
            {
                MessageBox.Show("Password does not match with Confirm Passowrd");
                passwordtextBox.Focus();
                confirmpasswordtextBox.Focus();
                return;
            }

            query = "SELECT COUNT(*) FROM Employee_Info WHERE UserName = '******'";

            if (EmployeeID == 0)
            {
                if (DbAccess.NumberOfRecords(query) > 0)
                {
                    MessageBox.Show("This username already exists! Please try another username!");
                    userNametextBox.Focus();
                    return;
                }
            }
            else
            {
                if (DbAccess.NumberOfRecords(query) > 1)
                {
                    MessageBox.Show("This username already exists! Please try another username!");
                    userNametextBox.Focus();
                    return;
                }
            }

            try
            {
                if (EmployeeID == 0)
                {
                    query = "INSERT INTO Employee_Info(EmpID,UserName,Password) VALUES(" + EmpIdtextBox.Text + ", '" + userNametextBox.Text + "', '" + passwordtextBox.Text + "')";
                }
                else
                {
                    query = "UPDATE Employee_Info SET Password = '******' WHERE EmpID = " + EmployeeID;
                }

                if (DbAccess.ExecuteToDB(query))
                {
                    if (EmployeeID == 0)
                    {
                        MessageBox.Show("Saved Successfully!!!");
                    }
                    else
                    {
                        MessageBox.Show("Updated Successfully!!!");
                    }
                }
                else
                {
                    MessageBox.Show("Failed To Save!!!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection Error!!!");
            }
            finally
            {
                Reset();
            }
        }
Exemplo n.º 3
0
        private void OFSaveButton_Click(object sender, EventArgs e)
        {
            string query = ""; int DepartmentKey = ((KeyValuePair <int, string>)DeptcomboBox.SelectedItem).Key;
            String DepartmentValue = ((KeyValuePair <int, string>)DeptcomboBox.SelectedItem).Value;
            String DesignationValue = ((KeyValuePair <int, string>)DesigcomboBox.SelectedItem).Value;
            String BloodValue = ((KeyValuePair <int, string>)BloodcomboBox.SelectedItem).Value;
            String StatusValue = ((KeyValuePair <int, string>)Statuscombo.SelectedItem).Value;
            string que = ""; int DesignationKey = ((KeyValuePair <int, string>)DesigcomboBox.SelectedItem).Key;
            string qu = ""; int BloodKey = ((KeyValuePair <int, string>)BloodcomboBox.SelectedItem).Key;
            string q = ""; int StatusKey = ((KeyValuePair <int, string>)Statuscombo.SelectedItem).Key;

            if (StaftextBox.Text == "")
            {
                query = "SELECT Count(*) AS Count FROM Official_Info";
                int rowsCount = DbAccess.NumberOfRecords(query) + 1;
                stfID = Convert.ToInt32(DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + rowsCount.ToString());
            }
            if (StaffNatext.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Staff Name");
                StaffNatext.Focus();
                return;
            }

            if (DepartmentKey < 1)
            {
                MessageBox.Show("Please Enter Department");
                DeptcomboBox.Focus();
                return;
            }
            if (DesignationKey < 1)
            {
                MessageBox.Show("Please Enter designation");
                DesigcomboBox.Focus();
                return;
            }

            if (EXPText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Experience");
                EXPText.Focus();
                return;
            }
            if (BloodKey < 1)
            {
                MessageBox.Show("Please Enter BloodGroup");
                BloodcomboBox.Focus();
                return;
            }
            if (joindateTimePicker.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Time");
                joindateTimePicker.Focus();
                return;
            }
            if (NationaText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Nationality");
                NationaText.Focus();
                return;
            }
            if (StatusKey < 1)
            {
                MessageBox.Show("Please Enter Status");
                Statuscombo.Focus();
                return;
            }
            try
            {
                if (StaftextBox.Text == "")
                {
                    query = "INSERT INTO Official_Info(StaffID,StaffName,Department,Designation,AgeExp,BloodGroup,JoiningDate,Nationality,Status ) VALUES(" + stfID + ", '" + StaffNatext.Text + "',  '" + DepartmentValue + "', '" + DesignationValue + "', " + Convert.ToInt32(EXPText.Text) + ", '" + BloodValue + "' , '" + joindateTimePicker.Value.ToString("yyyy/MM/dd") + "',  '" + NationaText.Text + "',  '" + StatusValue + "' )";
                }
                else
                {
                    query = "UPDATE Official_Info SET StaffName = '" + StaffNatext.Text + "' ,Department = '" + DepartmentValue + "', Designation = '" + DesignationValue + "',  AgeExp= '" + Convert.ToInt32(EXPText.Text) + "',BloodGroup = '" + BloodValue + "', JoiningDate = '" + joindateTimePicker.Value.ToString("yyyy/MM/dd") + "',Nationality = '" + NationaText.Text + "',Status = '" + StatusValue + "' WHERE StaffID = " + Convert.ToInt32(StaftextBox.Text);
                }

                if (DbAccess.ExecuteToDB(query))
                {
                    if (stfID != 0)
                    {
                        MessageBox.Show("Saved Successfully!!!");
                    }
                    else
                    {
                        MessageBox.Show("Updated Successfully!!!");
                    }
                }
                else
                {
                    MessageBox.Show("Failed To Save!!!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection Error!!!");
            }
            finally
            {
                Reset();
            }
        }
Exemplo n.º 4
0
        private void eduSaveButton_Click(object sender, EventArgs e)
        {
            string query = ""; int studyKey = ((KeyValuePair <int, string>)studyCombo.SelectedItem).Key;
            String studyValue = ((KeyValuePair <int, string>)studyCombo.SelectedItem).Value;
            string quer = ""; int BoardKey = ((KeyValuePair <int, string>)BoardCombo.SelectedItem).Key;
            String BoardValue = ((KeyValuePair <int, string>)BoardCombo.SelectedItem).Value;

            if (stIText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Staff ID");
                stIText.Focus();
                return;
            }


            if (studyKey < 1)
            {
                MessageBox.Show("Please Enter Studylevel");
                studyCombo.Focus();
                return;
            }
            if (NameofInstitutetext.Text == "")
            {
                MessageBox.Show("Please Enter Name Of Institute");
                NameofInstitutetext.Focus();
                return;
            }
            if (BoardKey < 1)
            {
                MessageBox.Show("Please Enter Your Board");
                BoardCombo.Focus();
                return;
            }

            if (Yeartext.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Your passing year");
                Yeartext.Focus();
                return;
            }
            if (CGPAtext.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Your CGPA");
                CGPAtext.Focus();
                return;
            }
            query = "SELECT COUNT(*) AS Count FROM Educational_Info WHERE StaffID = " + stIText.Text + "";
            if (stfID == 0)
            {
                if (DbAccess.NumberOfRecords(query) > 0)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    stIText.Focus();
                    return;
                }
            }
            else
            {
                if (DbAccess.NumberOfRecords(query) > 1)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    stIText.Focus();
                    return;
                }
            }
            try
            {
                if (stfID == 0)
                {
                    query = "INSERT INTO Educational_Info(StaffID,SudyLevel,NameOfIns,Board,PassingYear,CGPA) VALUES(" + Convert.ToInt32(stIText.Text) + ",  '" + studyValue + "',  '" + NameofInstitutetext.Text + "', '" + BoardValue + "', '" + Yeartext.Text + "', '" + CGPAtext.Text + "' )";
                }


                else
                {
                    query = "UPDATE Educational_Info SET SudyLevel = '" + studyValue + "', NameOfIns = '" + NameofInstitutetext.Text + "',  Board= '" + BoardValue + "',PassingYear = '" + Yeartext.Text + "', CGPA = '" + CGPAtext.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();
            }
        }
Exemplo n.º 5
0
        private void ReSavebtn_Click(object sender, EventArgs e)
        {
            string query = "";

            if (StaaFText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Employee ID");
                StaaFText.Focus();
                return;
            }



            if (BasicSalaryText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Password");
                BasicSalaryText.Focus();
                return;
            }

            if (TransportText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Transport Parcentage");
                TransportText.Focus();
                return;
            }
            if (MedicalText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Medicalbill Percentage");
                MedicalText.Focus();
                return;
            }
            if (MobileBill.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter MobileBill Percentage");
                MobileBill.Focus();
                return;
            }
            if (FoodbillText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter FoodBil Percentage");
                FoodbillText.Focus();
                return;
            }

            if (totalAllow.Text.Trim() == "")
            {
                totalAllow.Focus();
                return;
            }

            query = "SELECT COUNT(*) AS Count FROM Salary_Info WHERE StaffID = " + StaaFText.Text + "";
            if (stfID == 0)
            {
                if (DbAccess.NumberOfRecords(query) > 0)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    StaaFText.Focus();
                    return;
                }
            }
            else
            {
                if (DbAccess.NumberOfRecords(query) > 1)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    StaaFText.Focus();
                    return;
                }
            }
            try
            {
                if (stfID == 0)
                {
                    query = "INSERT INTO Salary_Info(StaffID,BasicSalary,Transport,Medical,MobileBill,Food,Total) VALUES(" + Convert.ToInt32(StaaFText.Text) + ",  '" + BasicSalaryText.Text + "',  '" + TransportText.Text + "', '" + MedicalText.Text + "', '" + MobileBill.Text + "', '" + FoodbillText.Text + "', '" + totalAllow.Text + "' )";
                }


                else
                {
                    query = "UPDATE Salary_Info SET  BasicSalary = '" + BasicSalaryText.Text + "', Transport = '" + TransportText.Text + "', Medical= '" + MedicalText.Text + "',MobileBill = '" + MobileBill.Text + "', Food = '" + FoodbillText.Text + "',  Total = '" + totalAllow.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();
            }
        }
Exemplo n.º 6
0
        private void expSaveBtn_Click(object sender, EventArgs e)
        {
            string query = "";

            if (stIDTEXT.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Employee ID");
                stIDTEXT.Focus();
                return;
            }



            if (CompanyNameText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Company Name");
                CompanyNameText.Focus();
                return;
            }

            if (Workedas.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Designation!");
                Workedas.Focus();
                return;
            }
            if (expdurnumbering.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Experience Year!");
                expdurnumbering.Focus();
                return;
            }
            if (joiiningText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Your Joining Date");
                joiiningText.Focus();
                return;
            }
            if (ResignedDate.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Resigned Date");
                ResignedDate.Focus();
                return;
            }
            query = "SELECT COUNT(*) AS Count FROM Experience_Info WHERE StaffID = " + stIDTEXT.Text + "";
            if (stfID == 0)
            {
                if (DbAccess.NumberOfRecords(query) > 0)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    stIDTEXT.Focus();
                    return;
                }
            }
            else
            {
                if (DbAccess.NumberOfRecords(query) > 1)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    stIDTEXT.Focus();
                    return;
                }
            }
            try
            {
                if (stfID == 0)
                {
                    query = "INSERT INTO Experience_Info(StaffID,CompanyName,WorkedAs,ExpDur,JoiningDate,ResignedDate) VALUES(" + Convert.ToInt32(stIDTEXT.Text) + ",  '" + CompanyNameText.Text + "',  '" + Workedas.Text + "', '" + Convert.ToInt32(expdurnumbering.Text) + "', '" + joiiningText.Value.ToString("yyyy/MM/dd") + "', '" + ResignedDate.Value.ToString("yyyy/MM/dd") + "' )";
                }


                else
                {
                    query = "UPDATE Experience_Info SET CompanyName = '" + CompanyNameText.Text + "', WorkedAs = '" + Workedas.Text + "', ExpDur= '" + Convert.ToInt32(expdurnumbering.Text) + "',JoiningDate = '" + joiiningText.Value.ToString("yyyy/MM/dd") + "', ResignedDate = '" + ResignedDate.Value.ToString("yyyy/MM/dd") + "' 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();
            }
        }
Exemplo n.º 7
0
        private void SaveLeave_Click(object sender, EventArgs e)
        {
            string query = "";

            if (SttafIdText.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Employee ID");
                SttafIdText.Focus();
                return;
            }



            if (CasualLeave.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter The Number");
                CasualLeave.Focus();
                return;
            }

            if (Sickleave.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter The Number");
                Sickleave.Focus();
                return;
            }
            if (MaternityLeave.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Password");
                MaternityLeave.Focus();
                return;
            }
            if (EarnedLeave.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Number");
                EarnedLeave.Focus();
                return;
            }
            query = "SELECT COUNT(*) AS Count FROM Leave_Info WHERE StaffID = " + SttafIdText.Text + "";
            if (stfID == 0)
            {
                if (DbAccess.NumberOfRecords(query) > 0)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    SttafIdText.Focus();
                    return;
                }
            }
            else
            {
                if (DbAccess.NumberOfRecords(query) > 1)
                {
                    MessageBox.Show("This username already exists! Please try another ID!");
                    SttafIdText.Focus();
                    return;
                }
            }
            try
            {
                if (stfID == 0)
                {
                    query = "INSERT INTO Leave_Info(StaffID,CasualLeave,SickLeave,MaternityLeave,EarnedLeave) VALUES(" + Convert.ToInt32(SttafIdText.Text) + ", '" + Convert.ToInt32(CasualLeave.Text) + "',  '" + Convert.ToInt32(Sickleave.Text) + "', '" + Convert.ToInt32(MaternityLeave.Text) + "', '" + Convert.ToInt32(EarnedLeave.Text) + "' )";
                }


                else
                {
                    query = "UPDATE Leave_Info SET  CasualLeave = '" + Convert.ToInt32(CasualLeave.Text) + "', SickLeave = '" + Convert.ToInt32(Sickleave.Text) + "',MaternityLeave= '" + Convert.ToInt32(MaternityLeave.Text) + "',EarnedLeave = '" + Convert.ToInt32(EarnedLeave.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();
            }
        }