public bool LogoutRecord(int id, TimeSpan time)
 {
     try
     {
         UserActivity userActivity =
             session1.UserActivities.Where(ua => ua.UserID == id)
             .OrderByDescending(ua => ua.ID).First();
         userActivity.LogOutTime            = time;
         userActivity.TimeSpend             = userActivity.LogOutTime - userActivity.LogInTime;
         session1.Entry(userActivity).State = System.Data.Entity.EntityState.Modified;
         session1.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
 public ActionResult Edit([Bind(Include = "ID,AssetSN,AssetName,DepartmentLocationID,EmployeeID,AssetGroupID,Description,WarrantyDate")] Asset asset)
 {
     if (ModelState.IsValid)
     {
         db.Entry(asset).State = EntityState.Modified;
         db.SaveChanges();
         return Json("Edit asset successful!");
     }
     return Json("Unable to edit asset!");
 }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "ID,AssetSN,AssetName,DepartmentLocationID,EmployeeID,AssetGroupID,Description,WarrantyDate")] Asset asset)
 {
     if (ModelState.IsValid)
     {
         db.Entry(asset).State = EntityState.Modified;
         db.SaveChanges();
         return(Json("Successfully edited Asset!"));
     }
     return(Json("An error occured while editing Asset! Please check and try again!"));
 }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "ID,AssetSN,AssetName,DepartmentLocationID,EmployeeID,AssetGroupID,Description,WarrantyDate")] Asset asset)
 {
     if (ModelState.IsValid)
     {
         db.Entry(asset).State = EntityState.Modified;
         db.SaveChanges();
         return(Json("Asset modified successfully!"));
     }
     return(Json("An unexpected error occured! Please try again later"));
 }
 public ActionResult Edit([Bind(Include = "resId,resName,resTypeIdFK,remainingQuantity")] Resource resource)
 {
     if (ModelState.IsValid)
     {
         db.Entry(resource).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.resTypeIdFK = new SelectList(db.Resource_Type, "resTypeId", "resTypeName", resource.resTypeIdFK);
     return(View(resource));
 }
 public ActionResult Edit([Bind(Include = "userId,userName,userPw,userTypeIdFK")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.userTypeIdFK = new SelectList(db.User_Type, "userTypeId", "userTypeName", user.userTypeIdFK);
     return(View(user));
 }
Exemple #7
0
 public ActionResult Edit([Bind(Include = "allocId,resIdFK,skillIdFK")] Resource_Allocation resource_Allocation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(resource_Allocation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.resIdFK   = new SelectList(db.Resources, "resId", "resName", resource_Allocation.resIdFK);
     ViewBag.skillIdFK = new SelectList(db.Skills, "skillId", "skillName", resource_Allocation.skillIdFK);
     return(View(resource_Allocation));
 }
Exemple #8
0
 public ActionResult Edit([Bind(Include = "ID,AssetID,TransferDate,FromAssetSN,ToAssetSN,FromDepartmentLocationID,ToDepartmentLocationID")] AssetTransferLog assetTransferLog)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assetTransferLog).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AssetID = new SelectList(db.Assets, "ID", "AssetSN", assetTransferLog.AssetID);
     ViewBag.FromDepartmentLocationID = new SelectList(db.DepartmentLocations, "ID", "ID", assetTransferLog.FromDepartmentLocationID);
     ViewBag.ToDepartmentLocationID   = new SelectList(db.DepartmentLocations, "ID", "ID", assetTransferLog.ToDepartmentLocationID);
     return(View(assetTransferLog));
 }
Exemple #9
0
        public bool DisableLogin(int id)
        {
            User user = session1.Users.SingleOrDefault(u => u.ID == id);

            if (user == null)
            {
                return(false);
            }
            else
            {
                if (user.Active == true)
                {
                    user.Active = false;
                }
                else
                {
                    user.Active = true;
                }
                session1.Entry(user).State = System.Data.Entity.EntityState.Modified;
                session1.SaveChanges();
                return(true);
            }
        }