Exemplo n.º 1
0
 //delete the patient record
 public IActionResult Delete(int patid)
 {
     try
     {
         Patient lpatient = context.Patient.FirstOrDefault(p => p.PatientId == patid);
         if (lpatient != null)
         {
             string result = lIPatientRxRepository.DeletePatientRecordsWithCasecade(patid);
             if (!string.IsNullOrEmpty(result) && result == "success")
             {
                 //Insert to User Activity Log
                 UserActivityLog llog = new UserActivityLog();
                 llog.SessionId        = HttpContext.Session.GetString("SessionId");
                 llog.ActivityType     = "Update";
                 llog.StartTimeStamp   = !string.IsNullOrEmpty(HttpContext.Session.GetString("SessionTime")) ? Convert.ToDateTime(HttpContext.Session.GetString("SessionTime")) : DateTime.Now;
                 llog.Duration         = Convert.ToInt32((DateTime.Now - Convert.ToDateTime(HttpContext.Session.GetString("SessionTime"))).TotalSeconds);
                 llog.RecordChangeType = "Delete";
                 llog.RecordType       = "Patient";
                 llog.Comment          = "Record deleted";
                 llog.RecordJson       = JsonConvert.SerializeObject(lpatient);
                 llog.UserId           = HttpContext.Session.GetString("UserId");
                 llog.UserName         = HttpContext.Session.GetString("UserName");
                 llog.UserType         = HttpContext.Session.GetString("UserType");
                 if (!string.IsNullOrEmpty(HttpContext.Session.GetString("ReviewID")))
                 {
                     llog.ReviewId = HttpContext.Session.GetString("ReviewID");
                 }
                 lIUserActivityLogRepository.InsertUserActivityLog(llog);
             }
         }
     }
     catch (Exception ex)
     {
         logger.LogDebug("Error: " + ex);
     }
     if (!string.IsNullOrEmpty(HttpContext.Session.GetString("UserType")) && HttpContext.Session.GetString("UserType") == "0")
     {
         return(RedirectToAction("Index", "Patient"));
     }
     if (!string.IsNullOrEmpty(HttpContext.Session.GetString("UserType")) && HttpContext.Session.GetString("UserType") == "1")
     {
         return(RedirectToAction("Dashboard", "Support"));
     }
     if (!string.IsNullOrEmpty(HttpContext.Session.GetString("UserType")) && HttpContext.Session.GetString("UserType") == "2")
     {
         return(RedirectToAction("Dashboard", "Therapist"));
     }
     if (!string.IsNullOrEmpty(HttpContext.Session.GetString("UserType")) && HttpContext.Session.GetString("UserType") == "3")
     {
         return(RedirectToAction("Dashboard", "Provider"));
     }
     else
     {
         return(RedirectToAction("Dashboard", "Provider"));
     }
 }
        public IActionResult Delete(string id)
        {
            DeviceCalibration ldevice = (from p in context.DeviceCalibration
                                         where p.SetupId == id
                                         select p).FirstOrDefault();

            if (ldevice != null)
            {
                int res = lIDeviceCalibrationRepository.deleteDeviceCalibrationCascade(id);
                if (res > 0)
                {
                    //Insert to User Activity Log
                    UserActivityLog llog = new UserActivityLog();
                    llog.SessionId        = HttpContext.Session.GetString("SessionId");
                    llog.ActivityType     = "Update";
                    llog.StartTimeStamp   = !string.IsNullOrEmpty(HttpContext.Session.GetString("SessionTime")) ? Convert.ToDateTime(HttpContext.Session.GetString("SessionTime")) : DateTime.Now;
                    llog.Duration         = Convert.ToInt32((DateTime.Now - Convert.ToDateTime(HttpContext.Session.GetString("SessionTime"))).TotalSeconds);
                    llog.RecordChangeType = "Delete";
                    llog.RecordType       = "Equipment";
                    llog.Comment          = "Record deleted";
                    llog.RecordJson       = JsonConvert.SerializeObject(ldevice);
                    llog.UserId           = HttpContext.Session.GetString("UserId");
                    llog.UserName         = HttpContext.Session.GetString("UserName");
                    llog.UserType         = HttpContext.Session.GetString("UserType");
                    if (!string.IsNullOrEmpty(HttpContext.Session.GetString("ReviewID")))
                    {
                        llog.ReviewId = HttpContext.Session.GetString("ReviewID");
                    }
                    lIUserActivityLogRepository.InsertUserActivityLog(llog);
                }
            }
            return(RedirectToAction("Index", "Equipment"));
        }
        public JsonResult insertuseractivity([FromBody] UserActivityLog Ilog)
        {
            try
            {
                if (!string.IsNullOrEmpty(HttpContext.Session.GetString("SessionId")) && Ilog != null)
                {
                    User luser = lIUserRepository.getUserbySessionId(HttpContext.Session.GetString("SessionId"));
                    if (luser != null)
                    {
                        Ilog.SessionId      = HttpContext.Session.GetString("SessionId");
                        Ilog.ActivityType   = "Review";
                        Ilog.StartTimeStamp = !string.IsNullOrEmpty(HttpContext.Session.GetString("SessionTime")) ? Convert.ToDateTime(HttpContext.Session.GetString("SessionTime")) : DateTime.Now;

                        Ilog.UserId   = HttpContext.Session.GetString("UserId");
                        Ilog.UserName = HttpContext.Session.GetString("UserName");
                        Ilog.UserType = HttpContext.Session.GetString("UserType");
                        if (!string.IsNullOrEmpty(HttpContext.Session.GetString("ReviewID")))
                        {
                            Ilog.ReviewId = HttpContext.Session.GetString("ReviewID");
                        }
                        int _result = lIUserActivityLogRepository.InsertUserActivityLog(Ilog);
                        if (_result > 0)
                        {
                            return(Json(new { result = "success" }));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogDebug("Error: " + ex);
            }
            return(Json(new { result = "failure" }));
        }
Exemplo n.º 4
0
        //delete the record of support staff
        public IActionResult DeleteSupport(string support)
        {
            try
            {
                var _user = (from p in context.User where p.UserId == support select p).FirstOrDefault();

                context.User.Remove(_user);

                int res = context.SaveChanges();
                if (res > 0)
                {
                    VSeeHelper lhelper = new VSeeHelper();
                    DeleteUser luser   = new DeleteUser();
                    luser.secretkey = ConfigVars.NewInstance.secretkey;
                    luser.username  = _user.UserId;
                    var resUser = lhelper.DeleteUser(luser);
                    if (resUser != null && resUser["status"] == "success")
                    {
                        //Insert to User Activity Log
                        UserActivityLog llog = new UserActivityLog();
                        llog.SessionId        = HttpContext.Session.GetString("SessionId");
                        llog.ActivityType     = "Update";
                        llog.StartTimeStamp   = !string.IsNullOrEmpty(HttpContext.Session.GetString("SessionTime")) ? Convert.ToDateTime(HttpContext.Session.GetString("SessionTime")) : DateTime.Now;
                        llog.Duration         = Convert.ToInt32((DateTime.Now - Convert.ToDateTime(HttpContext.Session.GetString("SessionTime"))).TotalSeconds);
                        llog.RecordChangeType = "Delete";
                        llog.RecordType       = "SupportStaff";
                        llog.Comment          = "Record deleted";
                        llog.RecordJson       = JsonConvert.SerializeObject(_user);
                        llog.UserId           = HttpContext.Session.GetString("UserId");
                        llog.UserName         = HttpContext.Session.GetString("UserName");
                        llog.UserType         = HttpContext.Session.GetString("UserType");
                        if (!string.IsNullOrEmpty(HttpContext.Session.GetString("ReviewID")))
                        {
                            llog.ReviewId = HttpContext.Session.GetString("ReviewID");
                        }
                        lIUserActivityLogRepository.InsertUserActivityLog(llog);
                    }
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", "Support"));
            }
            return(RedirectToAction("Index", "Support"));
        }