public MonthZP GetSavedMonthBonus(DateTime month, MonthEmployee mothemployee) { List <string> param = new List <string>() { "Year", "Month" }; List <string> znachenie = new List <string>() { month.Year.ToString(), month.Month.ToString() }; List <string> list = GetRowFromTable(mothemployee.Employee.TabelNumber + "ZP", param, znachenie); if (list.Count > 0) { DateTime dt = Convert.ToDateTime(list[6]).ToLocalTime(); MonthZP monthZP = new MonthZP(Convert.ToInt32(list[4]), Convert.ToInt32(list[5]), Convert.ToInt32(list[3]), Convert.ToDateTime(list[6]).ToLocalTime(), mothemployee); return(monthZP); } else { return(null); } }
private void Dtpicker_SelectedDateChanged(DateTime obj) { dtMain = obj; if (lbUsers.SelectedIndex == -1) { } else { MonthEmployee employee = monthEmployees[lbUsers.SelectedIndex]; Lb_users_SelectionChange?.Invoke(employee.Employee.TabelNumber); } UpdateMonthEmployees?.Invoke(); }
public void SaveMonthZP(MonthEmployee monthEmployee) { List <string> param = new List <string>() { "Year", "Month", "Salary", "MonthBonus" , "FreeBonus", "SaveDate" }; List <string> typeData = new List <string>() { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" }; List <string> znach = new List <string>() { monthEmployee.Days[0].DayOnPlan.Day.Year.ToString(), monthEmployee.Days[0].DayOnPlan.Day.Month.ToString(), monthEmployee.Employee.Salary.ToString(), monthEmployee.MonthZP.MonthBonus.ToString(), //monthEmployee.MonthZP.BiznessTripBonus.ToString(), //monthEmployee.MonthZP.OverWorkingBonus.ToString(), // monthEmployee.MonthZP.OverWorkingBonusIfVocation.ToString(), monthEmployee.MonthZP.FreeBonus.ToString(), DateTime.Now.ToUniversalTime().ToString() }; if (CheckExistingTable(monthEmployee.Employee.TabelNumber + "ZP") == true) { } else { Create_DataBase_Table(monthEmployee.Employee.TabelNumber + "ZP", param, typeData); } if (CheckExistingRowInTable(monthEmployee.Employee.TabelNumber + "ZP", monthEmployee.Days[0].DayOnFact.StartWork.Year, monthEmployee.Days[0].DayOnFact.StartWork.Month) == true) { UpdateRowYearDay(monthEmployee.Employee.TabelNumber + "ZP", param, znach); } else { AddRowToTable(monthEmployee.Employee.TabelNumber + "ZP", param, znach); } }
public MonthEmployee GetMonthEmployee(DateTime month, Employee employee) { DayEmployee[] Days = new DayEmployee[DateTime.DaysInMonth(month.Year, month.Month)]; for (int i = 1; i <= DateTime.DaysInMonth(month.Year, month.Month); i++) { Days[i - 1] = GetDayEmployee(new DateTime(month.Year, month.Month, i), employee); } MonthEmployee monthEmployee = new MonthEmployee(Days); monthEmployee.Employee = employee; try { monthEmployee.MonthZP = GetSavedMonthBonus(month, monthEmployee); if (monthEmployee.MonthZP != null) { monthEmployee.Employee.Salary = monthEmployee.MonthZP.Salary; } } catch (Exception ex) { Loger.SetLog(ex.ToString()); } return(monthEmployee); }
public void SetSource(MonthEmployee employee) { this.employee = employee; datagrid1.ItemsSource = employee.Days; }
private void Presenter_SaveMonthZP(MonthEmployee obj) { //for (int i=0; i< monthemployees.Count; i++) //{ DBmanager.SaveMonthZP(obj); } DBmanager.SaveMonthZP(obj); }