Beispiel #1
0
        private void UpdateEmployeebutton_Click(object sender, EventArgs e)
        {
            if (employeeNametextBox.Text.Length != 0)
            {
                try
                {
                    Employee aEmployee = new Employee();
                    aEmployee.EmployeeId = EmployyId;
                    aEmployee.EmployeeName = employeeNametextBox.Text.Replace("'", "''");
                    aEmployee.EmployeeAddress = employeeAddresstextBox.Text.Replace("'", "''");
                    aEmployee.EmployeePId = "123";
                    aEmployee.EmployeePhone = employeePhonetextBox.Text.Replace("'", "''");
                    aEmployee.EmployeePostion = positiontextBox.Text.Replace("'", "''");
                   // aEmployee.LastPayDate = DateTime.Now.Date;
                    EmployeeDAO aDao = new EmployeeDAO();
                    string sr = aDao.UpdateEmployee(aEmployee);

                    MessageBox.Show(sr);
                    if (sr == "Update Sucessfully")
                    {
                        this.Close();
                    }
                }
                catch (Exception)
                {

                    MessageBox.Show("Please Check Your Input");
                }

            }
            else MessageBox.Show("Please Check Your Input");
        }
Beispiel #2
0
 public EmployeeSalaryReport()
 {
     InitializeComponent();
     yearcomboBox.SelectedIndex = 0;
     monthcomboBox.SelectedIndex = 0;
     EmployeeDAO aEmployeeDao=new EmployeeDAO();
     List<Employee> aEmployees=new List<Employee>();
     aEmployees = aEmployeeDao.GetAllEmployee();
     employeecomboBox.DataSource = aEmployees;
     employeecomboBox.DisplayMember = "EmployeeName";
     employeecomboBox.ValueMember = "EmployeeId";
 }
Beispiel #3
0
        private void employeedataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            try
            {

                if (e.ColumnIndex == 9) //when paid
                {
                    PaidSalaryForm aForm = new PaidSalaryForm();
                    aForm.EmployeeId = Convert.ToInt32("0" + employeedataGridView.Rows[e.RowIndex].Cells["EmployeeId"].Value);
                    aForm.employeeNamelabel.Text = (employeedataGridView.Rows[e.RowIndex].Cells["EmployeeName"].Value).ToString();
                    aForm.ShowDialog();
                    LoadDataGridView();
                }
                if (e.ColumnIndex == 10) //when update
                {
                    UpdateEmployee aForm = new UpdateEmployee();
                    aForm.EmployyId = Convert.ToInt32("0" + employeedataGridView.Rows[e.RowIndex].Cells["EmployeeId"].Value);
                    aForm.employeeNametextBox.Text = (employeedataGridView.Rows[e.RowIndex].Cells["EmployeeName"].Value).ToString();
                    aForm.employeePhonetextBox.Text = (employeedataGridView.Rows[e.RowIndex].Cells["EmployeePhone"].Value).ToString();
                    aForm.employeeAddresstextBox.Text = (employeedataGridView.Rows[e.RowIndex].Cells["EmployeeAddress"].Value).ToString();
                    aForm.positiontextBox.Text = (employeedataGridView.Rows[e.RowIndex].Cells["EmployeePostion"].Value).ToString();
                    aForm.employeePidtextBox.Text = (employeedataGridView.Rows[e.RowIndex].Cells[4].Value).ToString();
                    aForm.ShowDialog();
                    LoadDataGridView();
                }

                if (e.ColumnIndex == 11) //when delete
                {
                    DialogResult dialogResult = MessageBox.Show("Are you sure want to delete it?", "Alert!", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        EmployeeDAO aEmployeeDao = new EmployeeDAO();
                        string sr = aEmployeeDao.EmployeeDeleted(Convert.ToInt32("0" + employeedataGridView.Rows[e.RowIndex].Cells[0].Value));
                        MessageBox.Show(sr);
                        LoadDataGridView();
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        //do something else
                    }
                }

            }
            catch (Exception)
            {

            }
        }
Beispiel #4
0
        private void paidbutton_Click(object sender, EventArgs e)
        {
            if(totalPayableSalarytextBox.Text.Length!=0)
            {
                try
                {
                    Employee aEmployee=new Employee();
                    aEmployee.EmployeeId = EmployeeId;
                    aEmployee.LastPaidAmount = Convert.ToDouble(totalPayableSalarytextBox.Text);
                    EmployeeDAO aDao=new EmployeeDAO();
                    string sr = aDao.UpdateAmount(aEmployee);
                    if (sr == "Update Sucessfully")
                    {
                        SalaryTransaction aSalaryTransaction=new SalaryTransaction();
                        aSalaryTransaction.EmployeeId = EmployeeId;
                        aSalaryTransaction.WorkingDay = Convert.ToInt32("0" + workingdaystextBox.Text);
                        aSalaryTransaction.AttendingDay = Convert.ToInt32("0" + attendingtextBox.Text);
                        aSalaryTransaction.Salary = Convert.ToDouble("0" + salarystructuretextBox.Text);
                        aSalaryTransaction.DeductedSalary = Convert.ToDouble("0" + deductedsalarytextBox.Text);
                        aSalaryTransaction.PayableSalary = Convert.ToDouble("0" + payablesalarytextBox.Text);
                        aSalaryTransaction.ServiceCharge = Convert.ToDouble("0" + servicechargetextBox.Text);
                        aSalaryTransaction.FoodAndRoomAllowance = Convert.ToDouble("0" + foodAndRoomtextBox.Text);
                        aSalaryTransaction.TotalPayableSalary = Convert.ToDouble("0" +totalPayableSalarytextBox.Text);
                        aSalaryTransaction.Remarks =  remarkstextBox.Text;
                        aDao.InsertPaidAmountReport(aSalaryTransaction,monthcomboBox.Text, yearcomboBox.Text);
                        this.Close();
                    }

                }
                catch (Exception)
                {

                    MessageBox.Show("Please Check Your Input");
                }

            }
            else MessageBox.Show("Please Check Your Input");
        }
Beispiel #5
0
 private void employeeNametextBox_TextChanged(object sender, EventArgs e)
 {
     if (employeeNametextBox.Text == "" || string.IsNullOrEmpty(employeeNametextBox.Text))
     {
         LoadDataGridView();
     }
     else
     {
         EmployeeDAO aEmployeeDao = new EmployeeDAO();
         List<Employee> aEmployees = new List<Employee>();
         aEmployees = aEmployeeDao.GetAllEmployee();
         List<Employee> aaEmployees = (from myRow in aEmployees.AsEnumerable()
                                       where myRow.EmployeeName.ToUpper().StartsWith(employeeNametextBox.Text.ToUpper())
                                select myRow).ToList();
         // DataView view = results.AsDataView();
         employeedataGridView.DataSource = aaEmployees;
     }
 }
Beispiel #6
0
 private void LoadDataGridView()
 {
     EmployeeDAO aEmployeeDao=new EmployeeDAO();
        List<Employee> aEmployees=new List<Employee>();
     aEmployees = aEmployeeDao.GetAllEmployee();
     employeedataGridView.DataSource = aEmployees;
 }
Beispiel #7
0
        private void showreportButton_Click(object sender, EventArgs e)
        {
            DateTime fromDate = fromdateTimePicker.Value;
            fromDate = fromDate.Date;
            DateTime toDate = todateTimePicker.Value;
            toDate = toDate.Date;
            toDate = toDate.AddDays(1);
            toDate = toDate.AddSeconds(-1);

            List<Transaction1> otherTransactions = new List<Transaction1>();
            List<Transaction1> aTransactions = new List<Transaction1>();
            List<Transaction1> employeeTransactions = new List<Transaction1>();
            StoreDAO aStoreDao = new StoreDAO();
            EmployeeDAO aEmployeeDao=new EmployeeDAO();
            otherTransactions = aStoreDao.GetOtherTransactionBydateForProfit(fromDate, toDate);
            aTransactions = aStoreDao.GetTransactionBydateForProfit(fromDate, toDate);
            employeeTransactions = aEmployeeDao.EmployeeTransactionReportBydate(fromDate, toDate);

            Int64 startDate = new DateTime(fromdateTimePicker.Value.Year, fromdateTimePicker.Value.Month, fromdateTimePicker.Value.Day, 0, 0, 0).Ticks;
            DateTime dtTemp = todateTimePicker.Value.AddDays(1);
            Int64 endDate = new DateTime(dtTemp.Year, dtTemp.Month, dtTemp.Day, 0, 0, 0).Ticks;
            List<Transaction1> saleTransactions = new List<Transaction1>();
            saleTransactions = aStoreDao.showAllData(startDate, endDate);
            toDate = todateTimePicker.Value;
            toDate = toDate.Date;
            List<ProfitLoss> aProfitLosses=new List<ProfitLoss>();
            while(fromDate<=toDate)
            {
                ProfitLoss aProfitLoss=new ProfitLoss();
                aProfitLoss.Date = fromDate;
                aProfitLoss.AccsCost = AmountCalculate(otherTransactions, fromDate);
                aProfitLoss.RMCost = AmountCalculate(aTransactions, fromDate);
                aProfitLoss.SalaryCost = AmountCalculate(employeeTransactions, fromDate);
                aProfitLoss.SaleAmount = AmountCalculate(saleTransactions, fromDate);
                double amount1 = (aProfitLoss.AccsCost + aProfitLoss.RMCost + aProfitLoss.SalaryCost);
                if (aProfitLoss.SaleAmount - amount1 < 0)
                {
                    aProfitLoss.Loss = aProfitLoss.SaleAmount - amount1;
                }
                else aProfitLoss.Profit = aProfitLoss.SaleAmount - amount1;
                aProfitLosses.Add(aProfitLoss);
                fromDate = fromDate.AddDays(1);
            }

            profitlossdataGridView.DataSource = aProfitLosses;
        }