Пример #1
0
        public Equipment CreatEquipment(User userActiv, string iD, string name, string serialNumber, string location, string statusQuall, string numberProtocol, string dateQual, int periodQual)
        {
            MessageBox.Show("Добрый вечер!");
            //if (userActiv.loginStatus)
            //{
            //MessageBox.Show("Попытка создания объекта"); Создаем объект оборудовнаие и сохраняем в Базу данных
            var equipment = new Equipment();

            equipment.ID             = CheckValue(CheckEquipmentsId, EquipmentList.ReturnEquipment(iD), "", iD, "Field ID");
            equipment.Name           = CheckValue(CheckEquipmentsName, equipment, "", name, "Field Name Equipment");
            equipment.Location       = CheckValue(CheckEquipmentsLocation, equipment, "", location, "Field Equipment Location");
            equipment.SerialNumber   = CheckValue(CheckEquipmentsSerialNumber, EquipmentList.ReturnEquipment(serialNumber), "", serialNumber, "Field Equipment Serial Number");
            equipment.Status         = CheckValue(CheckEquipmentsNumberStatusQuall, equipment, "", statusQuall, "Field Equipment Status Quall");
            equipment.NumberProtocol = CheckValue(CheckEquipmentsNumberProtocol, EquipmentList.ReturnEquipment(numberProtocol), "", numberProtocol, "Field Equipment Number Protocol");
            equipment.DateQual       = dateQual;
            equipment.PeriodQual     = periodQual;
            var date = DateTime.Parse(equipment.DateQual);

            equipment.NextDateQual = date.AddYears(periodQual).ToString();
            EquipmentList.AddDB(equipment);
            return(equipment);
            //}

            /* else
             * {
             *   Console.WriteLine("Необходим вход зарегистрирвоанного пользователя");
             *   return null;
             * }*/
            //MessageBox.Show("Вроде как и создан");
        }