public ActionResult Create([Bind(Include = "SerialNo,Data")] SalaryHis salaryHis) { if (ModelState.IsValid) { db.SalaryHises.Add(salaryHis); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(salaryHis)); }
public ActionResult Create([Bind(Include = "SerialNo,DepartmentName")] Department department) { if (ModelState.IsValid) { db.Departments.Add(department); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Create([Bind(Include = "GradeNo,GradeRange")] Grade grade) { if (ModelState.IsValid) { db.Grades.Add(grade); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(grade)); }
public ActionResult Create([Bind(Include = "SerialNo,DutyName,AllowanceAmount")] Allowance allowance) { if (ModelState.IsValid) { db.Allowances.Add(allowance); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(allowance)); }
public ActionResult Create([Bind(Include = "SerialNo,TitleName,Category")] Title title) { if (ModelState.IsValid) { db.Titles.Add(title); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(title)); }
public ActionResult SalarySheetAng() { var salaries = new List <Salary>(); var firstOrDefault = db.SalaryHises.ToList().FirstOrDefault(); if (firstOrDefault != null) { var preData = firstOrDefault.Data; if (preData.Equals("")) { var employees = db.Employees.ToList(); foreach (Employee employee in employees) { Salary salary = MapEmployeeToSalary(employee); salaries.Add(salary); } db.SalaryHises.AddOrUpdate(i => i.SerialNo, new SalaryHis { SerialNo = 1, Data = JsonConvert.SerializeObject(salaries) }); db.SaveChanges(); } else { /* var obj = JObject.Parse(preData); * var url = obj["Data"];*/ salaries = JsonConvert.DeserializeObject <List <Salary> >(preData); } return(Json(salaries, JsonRequestBehavior.AllowGet)); } var preData2 = ""; var employees2 = db.Employees.ToList(); foreach (Employee employee in employees2) { Salary salary = MapEmployeeToSalary(employee); salaries.Add(salary); } string json = new JavaScriptSerializer().Serialize(Json(salaries).Data); SalaryHis sal = new SalaryHis { SerialNo = 1, Data = json }; try { db.SalaryHises.AddOrUpdate(i => i.SerialNo, sal); db.SaveChanges(); } catch (Exception e) { string j = e.StackTrace; } return(Json(salaries, JsonRequestBehavior.AllowGet)); }
public ActionResult Create([Bind(Include = "SerialNo,IdNo,FullName,EnglishFullName,Email,Podobi,Salary,Category,Department,JoiningDate,AccountNo,MainSalaryGrade,IncrementNo,Sex,IsFreedomFighter,IsAddiitonalDuties,IsStudentAdviser,IsDean,IsChairman,IsProvost,IsProctor,IsAssistantProctor,HasOwnTransportationMethod,IsTeacher")] Employee employee) { if (ModelState.IsValid) { var grade = from a in db.Grades where a.GradeRange.Equals(employee.MainSalaryGrade) select a; Grade orDefault = grade.FirstOrDefault(); if (orDefault != null) { int grad = orDefault.GradeNo; int increment = Int32.Parse(LanguageConverter.BanglaToEnglish(employee.IncrementNo)); var mainsalaryString = from a in db.Taxes where a.Grade.Equals(grad) && a.Scale.Equals(increment) select a; var firstOrDefault = mainsalaryString.FirstOrDefault(); if (firstOrDefault != null) { employee.Salary = firstOrDefault.MainSalary; } } db.Employees.Add(employee); db.SaveChanges(); var v = new RegisterViewModel { FullName = employee.EnglishFullName, Name = "Teacher", Email = employee.Email, Password = "******", ConfirmPassword = "******" }; var controller = new AccountController(); controller.RegisterMid(v); return(RedirectToAction("Index")); } return(View(employee)); }