コード例 #1
0
        public ActionResult Videos()
        {
            Logger.InitLogger();
            bool check = false;
            InstructionsVideos load_inst = new InstructionsVideos();
            ArrayList          inst_data = new ArrayList();

            load_inst.LoadInstructions(check);
            inst_data.Add(load_inst);
            return(View("InstructionsAndTests", inst_data));
        }
コード例 #2
0
 public JsonResult AjaxDelete(string Str, string Str2, string Str3, string Str4, string Str5)
 {
     try
     {
         Logger.InitLogger();
         string   tmp        = Str + " " + Str2 + " " + Str3 + " " + Str4 + " " + Str5;
         string[] substrings = tmp.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
         if (tmp.Contains("mp4"))
         {
             if (substrings.Length == 0)
             {
                 return(Json("Ни одного видеофайла не выбрано не выбрано!"));
             }
             else
             {
                 InstructionsVideos inst_delete = new InstructionsVideos();
                 for (int i = 0; i < substrings.Length; i++)
                 {
                     inst_delete.DeleteVideos(substrings[i]);
                 }
                 Logger.Log.Info("Удаление видеофайла");
                 return(Json("Удаление " + substrings.Length + " видеофайлов успешно!"));
             }
         }
         else
         {
             if (substrings.Length == 0)
             {
                 return(Json("Ни одной инструкции не выбрано!"));
             }
             else
             {
                 InstructionsVideos inst_delete = new InstructionsVideos();
                 for (int i = 0; i < substrings.Length; i++)
                 {
                     inst_delete.DeleteInstruction(substrings[i]);
                 }
                 Logger.Log.Info("Удаление производственной инструкции");
                 return(Json("Удаление " + substrings.Length + " инструкций успешно!"));
             }
         }
     }
     catch (Exception ex)
     {
         return(Json("Ошибка при удалении медиаданных!" + ex.Message));
     }
 }
コード例 #3
0
        //[OutputCache(Duration = 30, Location = OutputCacheLocation.Downstream)]
        public ActionResult InstructionsAndTests()
        {
            try
            {
                Logger.InitLogger();
                ClaimsIdentity user  = (ClaimsIdentity)(User.Identity);
                string         type  = string.Empty;
                string         right = string.Empty;

                IEnumerable <Claim> claims = user.Claims;

                try
                {
                    type  = claims.ElementAt(4).Type;
                    right = claims.ElementAt(4).Value;
                }
                catch (Exception ex)
                {
                    Logger.Log.Error("Попытка несанкционированный доступ!" + ex.Message);
                    return(Redirect("/Account/Login"));
                }
                if (type == "Rights" && right == "Мастер" || right == "Работник ОК")
                {
                    bool check = true;
                    InstructionsVideos load_inst = new InstructionsVideos();
                    ArrayList          inst_data = new ArrayList();
                    load_inst.LoadInstructions(check);
                    inst_data.Add(load_inst);

                    return(View(inst_data));
                }
                else
                {
                    return(View("ErrorRight"));
                }
            }
            catch (Exception ex)
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Ошибка в ходе загрузки страницы!" + ex.Message + "');window.location.href = 'Index';</script>"));
            }
        }