public HttpResponseMessage GeneratePayslip(int employee_id)//e_id employee_id { HttpResponseMessage response = null; try { if (employee_id != 0) { Salary_Structure salary = SalaryRepo.GetSalaryStructureByEmpId(employee_id); Payslip payslip = SalaryCalculation.Calculatepayslip(salary); Payslip existing_instance = PayslipRepo.GetExistingPayslip(payslip.emp_id, payslip.payslip_month, payslip.payslip_year); if (payslip != null && existing_instance == null) { PayslipRepo.AddPayslip(payslip); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Pay slip generated successfully!", "Pay slip generated successfully!")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_603", "Failure : Pay slip generation Error or payslip for specified month is already exists", "Pay slip generation Error or payslip for specified month is already exists")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
internal void SaveUserData(SalaryCalculation salcal) { if (CheckValidation(salcal) == true) { using (SalDbContext _db = new SalDbContext()) { var updatedSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); updatedSalCal.RealWorkTime = salcal.RealWorkTime; updatedSalCal.VacationAccure = salcal.VacationAccure; updatedSalCal.IllnessDay = salcal.IllnessDay; updatedSalCal.IllnessMonth = salcal.IllnessMonth; updatedSalCal.IllnessSum = salcal.IllnessSum; updatedSalCal.Indexation = salcal.Indexation; updatedSalCal.AnotherDeduct = salcal.AnotherDeduct; updatedSalCal.Advance = salcal.Advance; try { _db.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Помилка"); } } } }
public ActionResult Save(FormCollection collection) { try { // TODO: Add update logic here var result = new ResultModel(); var model = new SalaryCalculation(); TryUpdateModel(model); //Delete them all then add new. Only allow one record for setting var objs = SalaryCalculation.GetAll(); foreach (var obj in objs) { obj.Delete(); } result = model.Insert(); return(new JsonResult() { Data = result }); } catch { return(new JsonResult() { Data = ResultModel.FailResult() }); } }
private static void SumAccureCalculation(SalaryCalculation salcal) { using (SalDbContext _db = new SalDbContext()) { var updateSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); updateSalCal.SumAccure = updateSalCal.BasicSalary + updateSalCal.VacationAccure + updateSalCal.IllnessSum + updateSalCal.Indexation; _db.SaveChanges(); } }
private static void DeductSumCalculation(SalaryCalculation salcal) { using (SalDbContext _db = new SalDbContext()) { var updateSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); updateSalCal.DeductSum = updateSalCal.DeductMilitaryTex + updateSalCal.DeductPDFO; _db.SaveChanges(); } }
public SalaryCaclulationResultViewModel() { _salcalLogic = new SalaryCalculationLogic(); TheSalaryCalculation = new SalaryCalculation(); ThePeriod = new TimePeriod(); TheEmployee = new Employee(); EmployeeCollection = new ObservableCollection <Employee>(_salcalLogic.GetEmployee()); PeriodCollection = new ObservableCollection <TimePeriod>(_salcalLogic.GetPC()); SalaryCalculationCollection = new ObservableCollection <SalaryCalculation>(); }
void FillComboID() //display Available employee ids in combobox list { SalaryCalculation calc = new SalaryCalculation(); List <string> range = calc.FillComboID(); foreach (string item in range) { cmbID.Items.Add(item); } }
private static void ESVCalculation(SalaryCalculation salcal) { using (SalDbContext _db = new SalDbContext()) { var updateSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); var tax = _db.Taxes.FirstOrDefault(p => p.TaxName == "Єдиний соціальний внесок"); updateSalCal.ESV = updateSalCal.SumAccure * (tax.TaxPresentage / 100); _db.SaveChanges(); } }
void FillCombo_with_EmployeeID() { SalaryCalculation calc = new SalaryCalculation(); List <string> range = calc.FillComboID(); foreach (string item in range) { cmbEmpID.Items.Add(item); } }
private static void DeductMilitaryTexCalculation(SalaryCalculation salcal) { using (SalDbContext _db = new SalDbContext()) { var updateSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); var tax = _db.Taxes.FirstOrDefault(p => p.TaxName == "Військовий збір"); updateSalCal.DeductMilitaryTex = updateSalCal.SumAccure * (tax.TaxPresentage / 100); _db.SaveChanges(); } }
internal void Add(SalaryCalculation salcal) { if (CheckValidation(salcal) == true) { using (SalDbContext _db = new SalDbContext()) { _db.SalaryCalculations.Add(salcal); _db.SaveChanges(); } } }
internal static void AllCalculationOperations(SalaryCalculation salcal, TimePeriod ThePeriod, int NavigationYear) { BasicSalaryCalculation(salcal, ThePeriod, NavigationYear); SumAccureCalculation(salcal); PspCalculation(salcal, NavigationYear); ESVCalculation(salcal); DeductMilitaryTexCalculation(salcal); DeductPDFOCalculation(salcal); DeductSumCalculation(salcal); FinalSalaryCalculation(salcal); }
private void cmbEmpID_SelectedIndexChanged(object sender, EventArgs e) { SalaryCalculation calc = new SalaryCalculation(); Tuple <string, string, double> result = calc.IndexChange(cmbEmpID.Text); txtEmpName.Text = result.Item1; txtDesignation.Text = result.Item2; txtBasicSal.Text = result.Item3.ToString(); ClearText(); SalaryID_Setup(); }
private static void FinalSalaryCalculation(SalaryCalculation salcal) { using (SalDbContext _db = new SalDbContext()) { var updateSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); updateSalCal.FinalSalary = updateSalCal.SumAccure - updateSalCal.DeductSum - updateSalCal.Advance - updateSalCal.AnotherDeduct; _db.SaveChanges(); } }
public SalaryCalculationViewModel() { _dbContext = new SalDbContext(); _sallogic = new SalaryCalculationLogic(); TheEmployee = new Employee(); ThePeriod = new TimePeriod(); TheSalaryCalculation = new SalaryCalculation(); EmployeeCollection = new ObservableCollection <Employee>(_sallogic.GetEmployee()); PeriodCollection = new ObservableCollection <TimePeriod>(_sallogic.GetPC()); SalaryCalculationCollection = new ObservableCollection <SalaryCalculation>(_sallogic.GetSalaryWithPar(ThePeriod, NavigationYear)); }
private void btnCalculate_Click(object sender, EventArgs e) { SalaryCalculation calc = new SalaryCalculation(); string Date = monthCalendar1.SelectionRange.Start.ToString("yyyy-MM"); Tuple <int, double, double, double, double, double, double> resultcalculated = calc.CalculateSalary(cmbEmpID.Text, Date); txtDaysWorked.Text = resultcalculated.Item1.ToString(); txtFinal.Text = resultcalculated.Item2.ToString(); txtEPF8.Text = resultcalculated.Item3.ToString(); txtEPF12.Text = resultcalculated.Item4.ToString(); txtETF3.Text = resultcalculated.Item5.ToString(); txtAdvance.Text = resultcalculated.Item6.ToString(); txtLoan.Text = resultcalculated.Item7.ToString(); }
private static void BasicSalaryCalculation(SalaryCalculation salcal, TimePeriod ThePeriod, int NavigationYear) { int idealnumber = 0; using (SalDbContext _db = new SalDbContext()) { var monthday = _db.SpecialDays.First(p => p.DayTypeId == 2 && p.PeriodId == ThePeriod.PeriodID && p.SpecialDayYear == NavigationYear); idealnumber = monthday.DayValue; var updateSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); updateSalCal.BasicSalary = (updateSalCal.employee.Salary / idealnumber) * (decimal)updateSalCal.RealWorkTime; _db.SaveChanges(); } }
private static void DeductPDFOCalculation(SalaryCalculation salcal) { using (SalDbContext _db = new SalDbContext()) { var updateSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); var tax = _db.Taxes.FirstOrDefault(p => p.TaxName == "Податок на доходи фізичних осіб"); updateSalCal.DeductPDFO = (updateSalCal.SumAccure - updateSalCal.PSP) * (tax.TaxPresentage / 100); if (updateSalCal.DeductPDFO <= 0) { updateSalCal.DeductPDFO = 0; } _db.SaveChanges(); } }
private void SetCalculationDataGrid() { if (NavigationYear != 0 && ThePeriod != null) { using (SalDbContext _db = new SalDbContext()) { var CheckSalCalculation = _db.SalaryCalculations. FirstOrDefault(p => p.CalculationYear == NavigationYear && p.TimePeriodID == ThePeriod.PeriodID); if (CheckSalCalculation == null) { var CurrentTimeperiod = _db.TimePeriods.FirstOrDefault(p => p.PeriodID == ThePeriod.PeriodID); var CurrentEmployee = _db.Employees.Where(p => p.EndDate == null); foreach (Employee empl in CurrentEmployee) { SalaryCalculation salcal = new SalaryCalculation { CalculationYear = NavigationYear, EmployeeID = empl.EmployeeID, employee = empl, TimePeriodID = CurrentTimeperiod.PeriodID, timeperiod = CurrentTimeperiod }; _db.SalaryCalculations.Add(salcal); } try { _db.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.InnerException.ToString(), "Зауваження"); } } } DataGridStackPanelVis = true; RefeshCollection(); } else { MessageBox.Show("Поля місяць та рік є обов'язковими для введення", "Зауваження"); } }
public HttpResponseMessage UpdateSalaryStructure(int employee_id, decimal ctc) { HttpResponseMessage response = null; try { if (employee_id != 0 && EmployeeRepo.GetEmployeeStatusById(employee_id) != 0 && ctc != 0) { Salary_Structure active_instance = SalaryRepo.GetSalaryStructureByEmpId(employee_id); if (active_instance != null) { active_instance.is_active = 0; active_instance.to_date = DateTime.Now; SalaryRepo.UpdateSalaryStructure(active_instance); Salary_Structure new_sal_structure = new Salary_Structure(); new_sal_structure = SalaryCalculation.CalculateSalaryStructure(ctc); new_sal_structure.emp_id = employee_id; new_sal_structure.is_active = 1; new_sal_structure.from_date = DateTime.Now; new_sal_structure.to_date = null; SalaryRepo.CreateSalaryStructure(new_sal_structure); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Salary structure successfully updated", "Salary structure successfully updated")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_401", "No active Salary Structure", "No active Salary Structure - unable to find active record ")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
private static void PspCalculation(SalaryCalculation salcal, int NavigationYear) { using (SalDbContext _db = new SalDbContext()) { var updateSalCal = _db.SalaryCalculations.FirstOrDefault(p => p.SalaryCalculationID == salcal.SalaryCalculationID); var PSPtax = _db.Taxes.FirstOrDefault(p => p.TaxName == "Податково-соціальна пільга"); var calculationrestrictedSum = _db.LivingWageMins.FirstOrDefault(p => p.PeriodId == 1 && p.WageYear == NavigationYear); if (updateSalCal.PSP <= ((decimal)0.5 * calculationrestrictedSum.WageValue)) { var livingwage = _db.LivingWageMins.FirstOrDefault(p => p.PeriodId == salcal.TimePeriodID && p.WageYear == NavigationYear); updateSalCal.PSP = 0.5m * (decimal)livingwage.WageValue; } else { updateSalCal.PSP = 0; } _db.SaveChanges(); } }
public override void Execute() { //The BL is not allowed to run any queries, it can not even reference this assembly containing the //queries because that would be a cyclical reference. We need to give all data to the BL. IQueryable <SalaryCalculation> previousSalaries = QueryRunner.ExecuteQuery(new GetSalaryCalculationsForAnEmployee(db, _employeeId)); var validation = new SalaryCalculationValidation(); validation.ValidateSalaryCalculationPreConditions(_periodStartDate, _periodEndDate, previousSalaries); string idString = _employeeId; Taxcard taxCard = db.Taxcards.SingleOrDefault(card => card.EmployeeId == idString); var calculator = new SalaryCalculator(); SalaryCalculationResults res = calculator.CalculateSalary(taxCard, _grossSalary); //Saving the new calculation is not BL, that's why it is here. var salaryCalc = new SalaryCalculation { //EmployeeId = _employeeId, //GrossAmount = _grossSalary, //NetAmount = res.NetSalary, //PeriodStartDate = _periodStartDate, //PeriodEndDate = _periodEndDate, //Tax = res.Tax, SalaryCalculationId = Guid.NewGuid().ToString() }; db.SalaryCalculations.Add(salaryCalc); db.SaveChanges(); //You could argue that sending this event could be BL. Or you can say it is an infrastructural concern, like using //a transaction (if that was required here). However, it can not really exist in the salary calculation core because //the core only calculates and the whole process is not done until the result is persisted. So I would say this is //the right place after all. MessageBus.Send(new SalaryCalculationDoneEvent()); }
private void btnInsert_Click(object sender, EventArgs e) { SalaryCalculation calc = new SalaryCalculation(); if (txtDaysWorked.Text == "" || txtEPF8.Text == "" || txtEPF12.Text == "" || txtETF3.Text == "" || txtFinal.Text == "") { MessageBox.Show("Press Calculate button before continue"); } else { if (cmbEmpID.Text == "" || txtSalID.Text == "") { MessageBox.Show("Please Select Employee ID to Continue"); } else { int EmpID = Convert.ToInt32(cmbEmpID.Text.Trim()); DateTime date = DateTime.Now; string PaidDate = date.ToString("yyyy-MM-dd"); string RawPaidDate = date.ToString("yyyy-MM"); if (calc.CheckPaid(EmpID, RawPaidDate)) { int SalID = Convert.ToInt32(txtSalID.Text.Trim()); int DWork = Convert.ToInt32(txtDaysWorked.Text.Trim()); double EPF8 = Convert.ToDouble(txtEPF8.Text.Trim()); double EPF12 = Convert.ToDouble(txtEPF12.Text.Trim()); double ETF3 = Convert.ToDouble(txtETF3.Text.Trim()); double Salary = Convert.ToDouble(txtFinal.Text.Trim()); calc.Insert_into_SalaryDatabase(SalID, EmpID, DWork, PaidDate, EPF8, EPF12, ETF3, Salary); } else { MessageBox.Show("Salary Already Paid for this Month"); } } } }
// GET: SalaryCalculation public ActionResult Index() { return(PartialView(SalaryCalculation.GetAll().FirstOrDefault())); }
public HttpResponseMessage EmployeeUpdate(EmployeeModel employee_details) { HttpResponseMessage Response = null; try { if (employee_details != null) { Employee existingInstance = EmployeeRepo.GetEmployeeById(employee_details.id); if (existingInstance == null) { Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_403", "Employee record doesnot exists!", "Employee record doesnot exists!")); } else//(if existingInstance != null) { Employee employee = new Employee(); employee.id = employee_details.id; employee.first_name = employee_details.first_name; employee.last_name = employee_details.last_name; employee.email = employee_details.email; employee.date_of_birth = employee_details.date_of_birth; employee.date_of_joining = employee_details.date_of_joining; employee.contact_no = employee_details.contact_no; employee.reporting_to = employee_details.reporting_to; employee.year_of_experience = Decimal.Parse(employee_details.Year_of_experience); employee.gender = employee_details.gender; employee.pan_no = employee_details.pan_no; employee.bank_account_no = employee_details.bank_account_no; employee.emergency_contact_no = employee_details.emergency_contact_no; employee.emergency_contact_person = employee_details.emergency_contact_person; employee.PF_no = employee_details.PF_no; employee.medical_insurance_no = employee_details.medical_insurance_no; employee.blood_group = employee_details.blood_group; employee.designation = employee_details.designation_id; employee.created_on = existingInstance.created_on; employee.user_id = existingInstance.user_id; User_role userrole_instance = EmployeeRepo.GetUserRoleByUserid(employee.user_id); userrole_instance.role_id = employee_details.role_id; EmployeeRepo.UpdateUserRole(userrole_instance); Salary_Structure active_sal_instance = SalaryRepo.GetSalaryStructureByEmpId(employee.id); if (active_sal_instance != null && active_sal_instance.ctc != employee_details.ctc) { active_sal_instance.is_active = 0; active_sal_instance.to_date = DateTime.Now; SalaryRepo.UpdateSalaryStructure(active_sal_instance); Salary_Structure new_sal_structure = new Salary_Structure(); new_sal_structure = SalaryCalculation.CalculateSalaryStructure(employee_details.ctc); new_sal_structure.emp_id = employee.id; new_sal_structure.is_active = 1; new_sal_structure.from_date = DateTime.Now; new_sal_structure.to_date = null; SalaryRepo.CreateSalaryStructure(new_sal_structure); } EmployeeRepo.EditEmployee(employee); Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Employee details updated successfully!", "Employee details updated successfully!")); } //(existingInstance != null) ELSE PART } //employee_details != null IF PART else //IF employee_details == null { Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(Response); }
public HttpResponseMessage CreateNewEmployee(EmployeeModel employee_details) { HttpResponseMessage Response = null; try { if (employee_details != null && employee_details.role_id != 0 /*&& employee_details.ctc != 0*/ && employee_details.id != 0 && employee_details.reporting_to != 0 && employee_details.designation_id != 0) { Employee existingInstance = EmployeeRepo.GetEmployeeById(employee_details.id); List <Employee> employeeByMailid = EmployeeRepo.GetEmployeeByMailId(employee_details.email); if (existingInstance != null) { Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_402", "Employee ID already exists", "Employee ID already exists")); return(Response); } if (employeeByMailid.Count != 0) { Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_402", "Mail ID already exists", "Mail ID already exists")); return(Response); } Employee employee = new Employee(); employee.id = employee_details.id; employee.first_name = employee_details.first_name; employee.last_name = employee_details.last_name; employee.email = employee_details.email; employee.date_of_birth = employee_details.date_of_birth; employee.date_of_joining = employee_details.date_of_joining; employee.contact_no = employee_details.contact_no; employee.reporting_to = employee_details.reporting_to; employee.year_of_experience = Decimal.Parse(employee_details.Year_of_experience); employee.gender = employee_details.gender; employee.pan_no = employee_details.pan_no; employee.bank_account_no = employee_details.bank_account_no; employee.emergency_contact_no = employee_details.emergency_contact_no; employee.emergency_contact_person = employee_details.emergency_contact_person; employee.PF_no = employee_details.PF_no; employee.medical_insurance_no = employee_details.medical_insurance_no; employee.blood_group = employee_details.blood_group; employee.designation = employee_details.designation_id; employee.created_on = DateTime.Now; bool isEmail = Regex.IsMatch(employee.email, @"^([0-9a-zA-Z]" + //Start with a digit or alphabetical @"([\+\-_\.][0-9a-zA-Z]+)*" + // No continuous or ending +-_. chars in email @")+" + @"@(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[a-zA-Z0-9]{2,17})$" , RegexOptions.IgnoreCase); if (isEmail != true) { Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_402", "Enter valid MailId", "Enter valid MailId")); } else if ((employee.date_of_birth.Year > (DateTime.Now.Year - 21))) { Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_402", "Employee age is below 21 years", "Employee age is below 21 years")); } else { User user = new User(); user.user_name = employee.email; string Temp_password = PasswordGenerator.GeneratePassword(); //Debug.WriteLine(Temp_password); user.password = EncryptPassword.CalculateHash(Temp_password); //Debug.WriteLine(user.password); user.is_active = 1; EmployeeRepo.CreateNewUser(user); employee.user_id = user.id; EmployeeRepo.CreateNewEmployee(employee); User_role user_role = new User_role(); user_role.user_id = user.id; user_role.role_id = employee_details.role_id; EmployeeRepo.AssignEmployeeRole(user_role); if (employee.gender.ToLower() == "male") { EmployeeRepo.InsertLeaveBalance(employee, Constants.MALE_LEAVE_TYPES); } else { EmployeeRepo.InsertLeaveBalance(employee, Constants.FEMALE_LEAVE_TYPES); } Salary_Structure salary = new Salary_Structure(); salary = SalaryCalculation.CalculateSalaryStructure(employee_details.ctc); salary.emp_id = employee_details.id; salary.is_active = 1; salary.from_date = DateTime.Now; salary.to_date = null; SalaryRepo.CreateSalaryStructure(salary); Payslip payslip = new Payslip(); payslip = SalaryCalculation.FirstMonthSalary(employee_details.date_of_joining, salary); if (payslip != null) { PayslipRepo.AddPayslip(payslip); } else { Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_401", "Error in salary structure generation or payslip generation", "Error in salary structure generation or payslip generation")); return(Response); } string username = employee.first_name + " " + employee.last_name; MailHandler.PasswordMailingFunction(username, employee.email, Temp_password); Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Employee added Successfully", "Employee added Successfully")); } } else { Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_190", "Invalid Input - check the fileds", "Invalid Input - check the fileds")); } } catch (DbEntityValidationException DBexception) { Debug.WriteLine(DBexception.Message); Debug.WriteLine(DBexception.GetBaseException()); Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_190", "Mandatory fields missing or Type mismatch", DBexception.Message)); } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); Response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(Response); }
private void ClearProperties() { TheSalaryCalculation = new SalaryCalculation(); }
static void Main(string[] args) { using (SalDbContext db = new SalDbContext()) { db.Database.CreateIfNotExists(); Person per1 = new Person { Surname = "Petrov", FirstName = "Max", MidleName = "Petrovich", IndentificalCode = "7895231456", PasportCode = "AT54782", BirthDay = new DateTime(1987, 02, 05), gender = Person.Gender.Male, // PersonID = 1 }; Position pos1 = new Position() { PositionName = "Director", //PositionId = 1 }; Position pos2 = new Position() { PositionName = "Acountant", // PositionId = 2 }; Employee emp1 = new Employee { EmployeeID = per1.PersonID, StartDate = new DateTime(2008, 05, 02), EndDate = new DateTime(2018, 05, 02), position = pos1 }; Tax tax1 = new Tax { // TaxID = 1, TaxName = "Військовий збір", TaxPresentage = 18 }; DayType daytype1 = new DayType { // DayTypeID = 1, NameDayType = "Каледнарні дні" }; TimePeriod tp1 = new TimePeriod { PeriodID = 1, PeriodName = "Січень" }; SpecialDay specday1 = new SpecialDay { // SpecialDayID = 1, daytype = daytype1, SpecialDayYear = 2017, DayValue = 20, PeriodId = tp1.PeriodID, DayTypeId = daytype1.DayTypeID, timeperiod = tp1 }; LivingWageMin wagemin1 = new LivingWageMin() { // WageID = 1, WageYear = 2017, WageValue = 1600, PeriodId = tp1.PeriodID, timeperiod = tp1 }; Company comp1 = new Company { // CompanyID = 1, CompanyName = "ІП Симоненко", ErdpoyCode = "8745632179985", CompanyAdress = "Леніна 24", InformationCode = "АП 87512", RegistrationDate = "5/07/2014", RegistrationAdress = "Вінницьке Рувд " }; SalaryCalculation salcal1 = new SalaryCalculation { SalaryCalculationID = 1, Advance = 234.5m, EmployeeID = emp1.EmployeeID, TimePeriodID = tp1.PeriodID, timeperiod = tp1, }; db.Companys.Add(comp1); db.LivingWageMins.Add(wagemin1); db.DayTypes.Add(daytype1); db.SpecialDays.Add(specday1); db.Taxes.Add(tax1); //db.SaveChanges(); db.Employees.Add(emp1); db.Positions.Add(pos1); db.Positions.Add(pos2); db.TimePeriods.Add(tp1); db.Persons.Add(per1); db.SalaryCalculations.Add(salcal1); try { //db.SaveChanges(); } catch (DbUpdateException e) { Console.WriteLine("\n\n*** {0}\n\n", e.InnerException); } Console.WriteLine("Success"); } Console.ReadKey(true); }
private bool CheckValidation(SalaryCalculation salcal) { return(true); }
static void Main(string[] args) { // First, load a workflow from compiled XAML. // Open SalaryCalculation.xaml in workflow designer to see the usage of expressions. // Open SalaryCalculation.xaml in an XML editor to see these expressions represented in XAML. Activity workflow1 = new SalaryCalculation(); // Second, create workflow in code. Activity workflow2 = CreateCodeOnlyWorkflow(); // Finally, create a workflow in code with the purpose of saving it to XAML. Activity workflow3 = CreateXamlSerializableCodeWorkflow(); Console.WriteLine("Starting workflow defined in designer..."); WorkflowInvoker.Invoke(workflow1); Console.WriteLine(); Console.WriteLine("Starting workflow defined in code..."); WorkflowInvoker.Invoke(workflow2); Console.WriteLine(); Console.WriteLine("Saving workflow defined in code to XAML..."); string workflowXamlString = XamlServices.Save(workflow3); Console.WriteLine(); Console.WriteLine("Starting workflow loaded from XAML..."); Activity workflow4 = (Activity)XamlServices.Load(new StringReader(workflowXamlString)); WorkflowInvoker.Invoke(workflow4); Console.WriteLine(); Console.WriteLine("Press ENTER to exit..."); Console.ReadLine(); }
void SalaryID_Setup() { SalaryCalculation calc = new SalaryCalculation(); txtSalID.Text = calc.SalaryID().ToString(); }