private SalaryIncrease AssignValues() { SalaryIncrease salary_increase = new SalaryIncrease(); salary_increase.employee_code = txtEmployeeCode.Text; salary_increase.date_submitted = dtpSubmitted.Text; salary_increase.date_effective = dtpEffective.Text; salary_increase.note = txtNote.Text; salary_increase.increase_amount = float.Parse(txtIncreaseAmount.Value.ToString()); return(salary_increase); }
private void BtnCreateSalaryIncrease_Click(object sender, EventArgs e) { SalaryIncrease salary_increase = AssignValues(); MessageBox.Show(salary_increase.create()); }
public void excutee() { var emp_id = (from Z in db.SelfCards where Z.Status != "بحكم المستقيل" && Z.Status != "كف اليد" && Z.Status != "مصروف من الخدمة" select new { Z.PersonId, full = Z.FirstName + " " + Z.FatherName + " " + Z.LastName, Z.Salary, Z.maxsalary, Z.Status, Z.JobTitle, Z.Workplace, Z.Category, Z.Register }).ToList(); foreach (string ss in emp.ToList()) { var id = emp_id.Where(d => d.full == ss).ToList().ElementAt(0); long eid = id.PersonId; long before = (long)id.Salary; int c = db.SalaryIncrease.Where(x => x.DecisionId == long.Parse(dec_id.Text) && x.PersonId == eid).Count(); if (c > 0) { MessageBox.Show(" تم تطبيق هذا القرار على الموظف " + id.full); } else { if (id.Status == "متقاعد") { SalaryIncrease sn = new SalaryIncrease { PersonId = eid, DecisionId = long.Parse(dec_id.Text), SalaryBefore = before, SalaryAfter = before + long.Parse(off.Text), Increase = long.Parse(off.Text), Category = id.Category, Workplace = id.Workplace, JobTitle = id.JobTitle, Register = Login.regName }; db.SalaryIncrease.Add(sn); db.SaveChanges(); var self = db.SelfCards.Where(x => x.PersonId == eid).Single(); self.Salary = before + long.Parse(off.Text); self.maxsalary = id.maxsalary + long.Parse(off.Text); db.SelfCards.Update(self); db.SaveChanges(); } else { SalaryIncrease sn = new SalaryIncrease { PersonId = eid, DecisionId = long.Parse(dec_id.Text), SalaryBefore = before, SalaryAfter = before + long.Parse(increase1.Text), Increase = long.Parse(increase1.Text), }; db.SalaryIncrease.Add(sn); db.SaveChanges(); var self = db.SelfCards.Where(x => x.PersonId == eid).Single(); self.Salary = before + long.Parse(increase1.Text); self.maxsalary = id.maxsalary + long.Parse(increase1.Text); db.SelfCards.Update(self); db.SaveChanges(); } } } MessageBox.Show("تمت عملية الانتهاء من تنفيذ قرار الزيادة"); var d = db.Decisions.Where(c => c.DecisionId == long.Parse(dec_id.Text)).Single(); excute.IsChecked = true; d.IsExcute = true; db.Decisions.Update(d); db.SaveChanges(); Decision_View dv = new Decision_View(); Window parentWindow = Window.GetWindow(this); parentWindow.Close(); dv.Show(); }