Esempio n. 1
0
 public ActionResult ForEmployee(SalaryInfo info)
 {
     using (var dataClass = new DataClassesDataContext())
     {
         if (!info.Month.HasValue)
         {
             info.Month = DateTime.Now.AddMonths(-1);
         }
         var data    = SalaryCalculator.Get(UserID, Employee.ID, info, false);
         var isAdmin = dataClass.CheckCurrentLoginInAdmin(UserID).SingleOrDefault().IsAdmin;
         var model   = new SalaryDetail()
         {
             SalaryCalculator = data,
             IsAdmin          = (bool)isAdmin
         };
         if (Request.IsAjaxRequest())
         {
             return(Json(new
             {
                 html = RenderPartialViewToString(Views.ForEmployeePartial, model)
             }, JsonRequestBehavior.AllowGet));
         }
         return(View(Views.ForEmployee, model));
     }
 }
Esempio n. 2
0
 public ActionResult Detail(int id)
 {
     using (var dataClass = new DataClassesDataContext())
     {
         var data    = SalaryCalculator.Get(UserID, Employee.ID, SalaryCalculator.Get(id));
         var isAdmin = dataClass.CheckCurrentLoginInAdmin(UserID).SingleOrDefault().IsAdmin;
         var model   = new SalaryDetail()
         {
             SalaryCalculator = data,
             IsAdmin          = (bool)isAdmin
         };
         return(Json(new
         {
             html = RenderPartialViewToString(Views.Detail, model)
         }, JsonRequestBehavior.AllowGet));
     }
 }