Exemplo n.º 1
0
 public ActionResult Index()
 {
     var user = UserHelper.GetUserByEmail(User.Identity.Name);
     var userUsedDiskSpase = UserHelper.GetUserUsedDiskSpase(user.Id);
     var Redactors = RedactorsHelper.GetAllRedactors(user); ;
     var tables = userRepository.Find(u => u.Id == user.Id).TableModels.Where(t => t.AdministratorId_Id == user.Id).ToList();
     var unitsHelper = new UnitsHelper(); 
     //var redactors
     int userExist = 0;
     var unitInfo = unitsHelper.GetUnitInfo();
     if (Redactors != null && Redactors.Count > 0)
     {
         userExist = Redactors.Count;
     }
     ProfileViewModel profile = new ProfileViewModel
     {
         Email = user.Email,
         Role = user.AspNetUserRoles.Where(r => r.UserId == user.Id).First().AspNetRoles.Name,
         Balance = 100,
         DaysEnough = 15,
         Units = user.Units,
         UsedDiskSpace = userUsedDiskSpase / 1048576,
         EmailsExist = user.EmailsParsed,
         EmailsLimit = unitInfo.LimitOfParsingEmails*user.Units,
         FullDiskSpase = unitInfo.LimitOfDiskSpase * user.Units,
         PercentageOfSpaceUsedOnTheDrive = userUsedDiskSpase / 1073741824 * 100 / unitInfo.LimitOfDiskSpase * user.Units,
         UsersExist = userExist,
         UsersLimit = unitInfo.Redactors * user.Units
     };
     return View(profile);
 
 }
Exemplo n.º 2
0
 public JsonResult GetUnitProperties()
 {
     UnitsHelper uhelp = new UnitsHelper();
     var unitInfo = uhelp.GetUnitInfo();
     double[] BodyAndSubjectForSelectedKey = new double[3] { unitInfo.Redactors, unitInfo.LimitOfDiskSpase, unitInfo.LimitOfParsingEmails };
     return Json(BodyAndSubjectForSelectedKey, JsonRequestBehavior.AllowGet);
 }