public string ChangeEquipment()
        {
            SortedList <string, string> form = new SortedList <string, string>();

            foreach (string key in Request.Form.Keys)
            {
                StringValues value = "";
                Request.Form.TryGetValue(key, out value);
                form.Add(key, value.ToString());
            }
            if (form.ContainsKey(SaveEquip.HtmlNames[Values.ID]) == false)
            {
                return("Нет ID");
            }
            long id = 0;

            if (Int64.TryParse(form[SaveEquip.HtmlNames[Values.ID]], out id) == false)
            {
                return("Ошибка парсинга ID");
            }
            if (SaveEquip.Equipments.ContainsKey(id) == false)
            {
                return("Неправильный ID");
            }
            string saveresult = SaveEquip.Equipments[id].ChangeEquipment(form, SaveEquip.Accounts[User.Identity.Name].Name);

            if (saveresult == "")
            {
                SaveEquip.SaveEquipments();
            }
            return(saveresult);
        }
        public string CorrectValue(string id, string pos, string date, string val)
        {
            if (id == null || id == "")
            {
                return("Ошибка данных");
            }
            long longid = 0;

            if (Int64.TryParse(id, out longid) == false)
            {
                return("Ошибка данных");
            }
            if (SaveEquip.Equipments.ContainsKey(longid) == false)
            {
                return("Не найдено оборудование");
            }
            if (pos == null || pos == "")
            {
                return("Ошибка данных");
            }
            int intpos = 0;

            if (Int32.TryParse(pos, out intpos) == false)
            {
                return("Ошибка данных");
            }
            if (SaveEquip.Equipments[longid].Parameters.Count <= intpos)
            {
                return("Ошибка данных");
            }
            if (date == null || date == "")
            {
                return("Ошибка данных");
            }
            DateTime ParseDate;

            if (DateTime.TryParse(date, out ParseDate) == false)
            {
                return("Ошибка данных");
            }
            if (val == null || val == "")
            {
                return("Ошибка данных");
            }
            string correctresult = SaveEquip.Equipments[longid].TryCorrectParameter(intpos, ParseDate.Date, val);

            if (correctresult == "")
            {
                SaveEquip.SaveEquipments();
            }
            return(correctresult);
        }
        public string MoveEquipment(string idlist, string date, string locationID)
        {
            if (idlist == null || idlist == "")
            {
                return("Ошибка при парсинге ID");
            }
            if (date == null || date == "")
            {
                return("Ошибка при парсинге даты");
            }
            if (locationID == null || locationID == "")
            {
                return("Ошибка при парсинге локации");
            }
            DateTime curdate;

            if (DateTime.TryParse(date, out curdate) == false)
            {
                return("Ошибка парсинга даты");
            }
            List <long> listformove = SplitID(idlist);

            if (listformove.Count == 0)
            {
                return("Ошибка при парсинге ID");
            }
            if (SaveEquip.All_Filters.ContainsKey(locationID) == false || SaveEquip.All_Filters[locationID].Parent.CurValues != Values.Location)
            {
                return("Ошибка при парсинге локации");
            }
            foreach (long id in listformove)
            {
                if (SaveEquip.Equipments.ContainsKey(id) == false)
                {
                    return("Ошибка при парсинге ID");
                }
                if (SaveEquip.Equipments[id].CheckParameter(Values.Location, curdate, location) == false)
                {
                    return("Невозможно изменить расположение для оборудования");
                }
            }
            SortedList <long, Parameter> LogData = new SortedList <long, Parameter>();

            foreach (long id in listformove)
            {
                LogData.Add(id, SaveEquip.Equipments[id].SetParameter(Values.Location, curdate, location));
            }
            Log.MoveEquipment(SaveEquip.Accounts[User.Identity.Name].Name, LogData);
            SaveEquip.SaveEquipments();
            return("");
        }
        public IActionResult RemoveEquipmentFromHtml(string allid, string idforremove)
        {
            if (idforremove == null || idforremove == "")
            {
                return(null);
            }
            List <long> listforremove = SplitID(idforremove);
            List <long> alllist       = SplitID(allid);

            foreach (long id in listforremove)
            {
                if (SaveEquip.Equipments.ContainsKey(id))
                {
                    SaveEquip.Equipments.Remove(id);
                    alllist.Remove(id);
                }
            }
            SaveEquip.SaveEquipments();
            return(View("EquipmentTable", new WellEquipment.Models.EquipInfo(alllist, 0)));
        }
        public string DeleteValue(string id, string pos)
        {
            if (id == null || id == "")
            {
                return("Ошибка данных");
            }
            long longid = 0;

            if (Int64.TryParse(id, out longid) == false)
            {
                return("Ошибка данных");
            }
            if (SaveEquip.Equipments.ContainsKey(longid) == false)
            {
                return("Не найдено оборудование");
            }
            if (pos == null || pos == "")
            {
                return("Ошибка данных");
            }
            int intpos = 0;

            if (Int32.TryParse(pos, out intpos) == false)
            {
                return("Ошибка данных");
            }
            if (SaveEquip.Equipments[longid].Parameters.Count <= intpos)
            {
                return("Ошибка данных");
            }
            string deleteresult = SaveEquip.Equipments[longid].TryDeleteParamater(intpos);

            if (deleteresult == "")
            {
                SaveEquip.SaveEquipments();
            }
            return(deleteresult);
        }
        public string[] AddEquipment(bool b)
        {
            SortedList <string, string> form = new SortedList <string, string>();

            foreach (string key in Request.Form.Keys)
            {
                StringValues value = "";
                Request.Form.TryGetValue(key, out value);
                form.Add(key, value.ToString());
            }
            Equipment equip = Equipment.CreateNewEquipmentFromHtml(form);

            if (equip != null)
            {
                SaveEquip.Equipments.Add(equip.ID, equip);
                Log.AddEquipment(SaveEquip.Accounts[User.Identity.Name].Name, equip);
                SaveEquip.SaveEquipments();
                return(new string[] { "", equip.ID.ToString() });
            }
            else
            {
                return(new string[] { "Ошибка", "" });
            }
        }