Exemple #1
0
        public static void getCountDevice(TypeDevice typeDevice, double sizeData)
        {
            double total = 0;

            switch (typeDevice)
            {
            case TypeDevice.Flash:
            {
                int i = 1;
                foreach (Flash item in flashes)
                {
                    total = Math.Floor(sizeData / item.memory);
                    Console.WriteLine(" {0}.{1} \t({2})\t- {3} gb: {4} sht", i++, item.name, item.model, item.memory, total);
                }

                Console.WriteLine("Choose variant: ");
                i = Int32.Parse(Console.ReadLine());
                getTimeToCopy(TypeDevice.Flash, i, sizeData);
            }
            break;

            case TypeDevice.DVD:
            {
            }
            break;

            case TypeDevice.HDD:
            {
            }
            break;
            }
        }
Exemple #2
0
        public static void GetCountDevice(TypeDevice td, double sizeData)
        {
            double total = 0;

            switch (td)
            {
            case TypeDevice.flash:
            {
                int i = 1;
                foreach (Flash item in Flashes)
                {
                    total = Math.Floor(sizeData / item.memory);
                    Console.WriteLine("{0}. {1} {{2}} - {3}гб \t-{4} штук", i++, item.Name, item.Model, item.memory, total);
                }

                Console.Write("выберите тип флешки: ");
                i = Int32.Parse(Console.ReadLine());
            } break;

            case TypeDevice.dvd:
                break;

            case TypeDevice.hdd:
                break;

            default:
                break;
            }
        }
Exemple #3
0
 public static List <TypeDevice> toTypeDevices(this MySqlDataReader reader)
 {
     if (reader.HasRows)
     {
         List <TypeDevice> datas = new List <TypeDevice>();
         while (reader.Read())
         {
             if (!reader.IsDBNull(0))
             {
                 TypeDevice t = new TypeDevice();
                 t.ID   = reader.GetInt32(Define.type_id);
                 t.Name = reader.GetString(Define.type_name);
                 t.Time = reader.GetDateTime(Define.type_time);
                 try
                 {
                     t.Comment = reader.GetString(Define.type_comment);
                 }
                 catch (Exception)
                 {
                 }
                 datas.Add(t);
             }
         }
         return(datas);
     }
     return(null);
 }
Exemple #4
0
        public static void GetTimeToCopyDevice(TypeDevice typeDevice, int choice, double sizeData)
        {
            switch (typeDevice)
            {
            case TypeDevice.Flash:
            {
                Flash choiceFlash = Flashes[choice - 1];

                int CountDevice = 3;

                Flash[] flashesD = new Flash[CountDevice];
                for (int i = 0; i < 3; i++)
                {
                    flashesD[i] = choiceFlash;
                    if (i == CountDevice - 1)
                    {
                        flashesD[i].CopyFile(sizeData);
                    }

                    flashesD[i].CopyFile(flashesD[i].Memory);
                    sizeData -= flashesD[i].Memory;
                }
            }
            break;

            case TypeDevice.DVD:
                break;

            case TypeDevice.HDD:
                break;

            default:
                break;
            }
        }
Exemple #5
0
        public static void getTimeToCopy(TypeDevice typeDevice, int variant, double sizeData)
        {
            switch (typeDevice)
            {
            case TypeDevice.Flash:
            {
                Flash t           = flashes[variant - 1];
                int   countDevice = 23;

                Flash[] flashesD = new Flash[countDevice];
                for (int i = 0; i < countDevice; i++)
                {
                    flashesD[i] = t;
                    if (i == countDevice - 1)
                    {
                        flashesD[i].copyData(sizeData);
                    }

                    double currentData = flashesD[i].memory;
                    flashesD[i].copyData(flashesD[i].memory);
                }
            }
            break;

            case TypeDevice.DVD:
                break;

            case TypeDevice.HDD:
                break;

            default:
                break;
            }
        }
Exemple #6
0
    //*********************************//
    //*********DEVICE INTERFACE********//
    //*********************************//
    public ICollection <DeviceView> GetAllDevice()
    {
        ICollection <DeviceView> devices = new Collection <DeviceView>();
        string test = settings["urlJee"].ConnectionString;
        ICollection <Device> listDevices = serviceDao.GetAllDevicesEnabled();

        foreach (Device device in listDevices)
        {
            DeviceView deviceView = new DeviceView();
            deviceView.id         = device.id;
            deviceView.name       = device.name;
            deviceView.addressMac = device.adressMac;
            deviceView.disabled   = device.disabled.Value;
            TypeDevice typeDevice = device.TypeDevice;
            if (typeDevice != null)
            {
                TypeDeviceView typeDeviceView = new TypeDeviceView();
                typeDeviceView.id      = typeDevice.id;
                typeDeviceView.name    = typeDevice.name;
                deviceView.typeDevices = typeDeviceView;
            }
            devices.Add(deviceView);
        }
        return(devices);
    }
Exemple #7
0
    public void CreateNewDevice(string id, string name, string deviceType)
    {
        TypeDevice typeDevice = serviceDao.GetTypeDeviceByName(deviceType);
        Device     device     = new Device();

        device.adressMac  = id;
        device.name       = name;
        device.TypeDevice = typeDevice;
        serviceDao.SaveNewDevice(device);
    }
 public static TypeDeviceName GetTypeDeviceName(TypeDevice type)
 {
     for (var i = 0; i < Collection.Count; i++)
     {
         if (Collection[i].Type == type)
         {
             return(Collection[i]);
         }
     }
     return(null);
 }
        public JsonResult GetTypeDevice(int id)
        {
            using (db_inventaireContext context = new db_inventaireContext())
            {
                TypeDevice type   = context.TypeDevice.FirstOrDefault(t => t.IdTypeDev == id);
                TypeDevice device = new TypeDevice();
                device.IdTypeDev   = type.IdTypeDev;
                device.Description = type.Description;

                return(Json(device));
            }
        }
Exemple #10
0
        public static void GetTimeToCopy(TypeDevice td, int choice)
        {
            switch (td)
            {
            case TypeDevice.flash:
            {
                Flash choosenFlash = Flashes[choice - 1];
            }  break;

            case TypeDevice.dvd:
                break;

            case TypeDevice.hdd:
                break;

            default:
                break;
            }
        }
Exemple #11
0
        public static void GetTimeToCopy(TypeDevice typeDevice, int choise, double sizeData)
        {
            switch (typeDevice)
            {
            case TypeDevice.Flash:
            {
            }
            break;

            case TypeDevice.HDD:
            {
            }
            break;

            case TypeDevice.DVD:
            {
            }
            break;
            }
        }
Exemple #12
0
        public static void GetCountDevice(TypeDevice typeDevice, double sizeData)
        {
            double total = 0;

            switch (typeDevice)
            {
            case TypeDevice.Flash:
            {
                int i = 1;
                foreach (Flash item in Flashes)
                {
                    total = Math.Floor(sizeData / item.Memory);
                    if (total == 0)
                    {
                        total++;
                    }
                    Console.WriteLine("{0}. {1} ({2}) - {3}Mb \t - {4}штук",
                                      i++, item.Name, item.Model, item.Memory, total);
                }
                Console.WriteLine("Введите тип флешки");
                i = Int32.Parse(Console.ReadLine());
                GetTimeToCopy(typeDevice, i, sizeData);
            }
            break;

            case TypeDevice.DVD:
            {
            }
            break;

            case TypeDevice.HDD:
            {
            }
            break;

            default:
                break;
            }
        }
Exemple #13
0
    public ICollection <DataMetricView> GetListMetrics(string sensorType, string dateType)
    {
        ICollection <DataMetric>     dataMetrics      = null;
        ICollection <DataMetricView> dataMetricsViews = new Collection <DataMetricView>();
        TypeDevice deviceType = serviceDao.GetTypeDeviceByName(sensorType);
        DateTime   now        = DateTime.Now;
        DateTime   date1      = new DateTime();
        DateTime   date2      = new DateTime();

        switch (dateType)
        {
        case "day":
            date1 = DateTime.Parse(now.ToString("d"));
            date2 = date1.AddDays(1);
            break;

        case "week":
        case "month":
            int delta = DayOfWeek.Monday - now.DayOfWeek;
            date1 = DateTime.Parse(now.AddDays(delta).ToString("d"));
            delta = now.DayOfWeek - DayOfWeek.Sunday;
            date2 = DateTime.Parse(now.AddDays(delta).ToString("d"));
            break;
            //case "month":
            //int month = now.Month;
            //int year = now.Year;
            //date1 = DateTime.Parse("01/" + month + "/" + year);
            //date2 = DateTime.Parse(DateTime.DaysInMonth(year,month ) +"/" + month + "/" + year);
            //break;
        }
        dataMetrics = serviceDao.GetDataMetricsBehindDatesByType(deviceType, date1, date2);
        foreach (DataMetric dataMetric in dataMetrics)
        {
            DataMetricView dataMetricView = new DataMetricView();
            dataMetricView.value = dataMetric.value;
            dataMetricsViews.Add(dataMetricView);
        }
        return(dataMetricsViews);
    }
        /// <summary>
        /// расчет необходимого количества носителей информации представленных типов для переноса информации.
        /// </summary>
        /// <param name="tdDevice">Тип устройства</param>
        /// <param name="capacity">Объем информации</param>
        public void DeviceQuantity(TypeDevice tdDevice, double capacity)
        {
            int count = 0;

            switch (tdDevice)
            {
            case TypeDevice.DVD:
            {
                foreach (DVD item in ListDVD)
                {
                    count = Int32.Parse((capacity / item.Capacity).ToString());
                    Console.WriteLine("Вам понадобится дисков типа {0} - {1} штук", item.DeviceType, count);
                }
            }
            break;

            case TypeDevice.Flash:
            {
                foreach (Flash item in listFlashes)
                {
                    double x = capacity / item.Capacity;
                    count = Int32.Parse(Math.Round(x).ToString());
                    Console.WriteLine("Вам понадобится {0} {1} флеш-носителей", count, item.Capacity);
                }
            }
            break;

            case TypeDevice.HDD:
            {
                foreach (HDD item in ListHDD)
                {
                    count = Int32.Parse((capacity / item.Capacity).ToString());
                    Console.WriteLine("Вам понадобится дисков {0} {1} жесткий диск", count, capacity);
                }
            }
            break;
            }
        }
Exemple #15
0
        public static void GetCountDevice(TypeDevice typeDevice, double SizeMem)
        {
            double total = 0;

            switch (typeDevice)
            {
            case TypeDevice.Flash:
            {
                int i = 1;
                foreach (Flash item in Flashes)
                {
                    total = Math.Round(SizeMem / item.Memory);
                    if (SizeMem % (int)item.Memory != 0)
                    {
                        total++;
                    }
                    Console.WriteLine("{0}. {1} ({2}) - {3} GB - {4} шт.", i++, item.NameNositel, item.Model, item.Memory, total);
                }
                Console.Write("Выберите тип флэшки: ");
                i = Int32.Parse(Console.ReadLine());
                GetTimeToCopyDevice(typeDevice, i, SizeMem);
            }
            break;

            case TypeDevice.DVD:
            {
            }
            break;

            case TypeDevice.HDD:
            {
            }
            break;

            default:
                break;
            }
        }
 public ICollection <DataMetric> GetDataMetricsBehindDatesByType(TypeDevice deviceType, DateTime date1, DateTime date2)
 {
     return(_dbo.DataMetrics.Where(o => o.Metric.date >= date1 && o.Metric.date < date2 && o.Metric.Device.idTypeDevice == deviceType.id).ToList());
 }
Exemple #17
0
        public static void GetTimeToCopy(TypeDevice typeDevice, int choise, double sizeData, double[] total)
        {
            switch (typeDevice)
            {
            case TypeDevice.Flash:
            {
                Flash chFlash = Flashes[choise - 1];

                Console.WriteLine("/////////////////////////////////////");
                Flashes[choise - 1].StorageInfo();
                Console.WriteLine(Flashes[choise - 1]);
                Console.WriteLine("\n/////////////////////////////////////");

                Flash[]  flashesD = new Flash[(int)total[choise - 1]];
                TimeSpan d        = new TimeSpan();
                for (int i = 0; i < (int)total[choise - 1]; i++)
                {
                    Flash temp = new Flash(chFlash.Memory, chFlash.TypeUSB);
                    flashesD[i] = temp;
                    d          += flashesD[i].GetTimeToCopy(sizeData);
                    flashesD[i].CopyData(sizeData);
                    if (sizeData >= flashesD[i].Memory)
                    {
                        sizeData -= flashesD[i].Memory;
                    }
                }
                Console.WriteLine("На копирования ушло {0} сек.", d.Seconds);
            }
            break;

            case TypeDevice.DVD:
            {
                DVD chDVD = DVDs[choise - 1];
                Console.WriteLine("/////////////////////////////////////");
                DVDs[choise - 1].StorageInfo();
                Console.WriteLine(DVDs[choise - 1]);
                Console.WriteLine("\n/////////////////////////////////////");
                DVD[]    dvdsD = new DVD[(int)total[choise - 1]];
                TimeSpan d     = new TimeSpan();

                for (int i = 0; i < (int)total[choise - 1]; i++)
                {
                    DVD temp = new DVD(chDVD.TypeDVD);

                    dvdsD[i] = temp;
                    d       += dvdsD[i].GetTimeToCopy(sizeData);
                    dvdsD[i].CopyData(sizeData);

                    if (sizeData >= (int)dvdsD[i].TypeDVD)
                    {
                        sizeData -= (int)dvdsD[i].TypeDVD;
                    }
                }
                Console.WriteLine("На копирования ушло {0} сек.", d.Seconds);
            }
            break;

            case TypeDevice.HDD:
            {
                HDD chHDD = HDDs[choise - 1];
                Console.WriteLine("/////////////////////////////////////");
                HDDs[choise - 1].StorageInfo();
                Console.WriteLine(HDDs[choise - 1]);
                Console.WriteLine("\n/////////////////////////////////////");
                double   x     = chHDD.KolRazd * chHDD.ObemRazd;
                HDD[]    hddsD = new HDD[(int)total[choise - 1]];
                TimeSpan d     = new TimeSpan();

                for (int i = 0; i < (int)total[choise - 1]; i++)
                {
                    HDD temp = new HDD(chHDD.TypeUSB, chHDD.KolRazd, chHDD.ObemRazd);
                    hddsD[i] = temp;
                    d       += hddsD[i].GetTimeToCopy(sizeData);
                    hddsD[i].CopyData(sizeData);

                    if (sizeData >= hddsD[i].KolRazd * hddsD[i].ObemRazd)
                    {
                        sizeData -= hddsD[i].KolRazd * hddsD[i].ObemRazd;
                    }
                }
                Console.WriteLine("На копирования ушло {0} сек.", d.Seconds);
            }
            break;

            default:
                break;
            }
        }
Exemple #18
0
        public static void GetCountDevice(TypeDevice typeDevice, double sizeData)
        {
            /*double total = 0;*/
            switch (typeDevice)
            {
            case TypeDevice.Flash:
            {
                int      i = 1;
                double[] total = new double[Flashes.Count]; int c = 0;
                foreach (Flash item in Flashes)
                {
                    double x = sizeData / item.Memory;
                    total[c] = Math.Floor(sizeData / item.Memory);
                    if (x > (int)total[c])
                    {
                        total[c]++;
                    }
                    if (total[c] == 0)
                    {
                        total[c]++;
                    }
                    Console.WriteLine("{0}. {1} ({2}) - {3}Mb \t - {4}штук",
                                      i++, item.Name, item.Model, item.Memory, total[c]);
                    c++;
                }
                Console.WriteLine("Введите тип флешки");
                i = Int32.Parse(Console.ReadLine());
                GetTimeToCopy(typeDevice, i, sizeData, total);
            }
            break;

            case TypeDevice.DVD:
            {
                int      i = 0;
                double[] total = new double[DVDs.Count]; int c = 0;
                foreach (DVD item in DVDs)
                {
                    double y = (int)item.TypeDVD * 1024;
                    double x = sizeData / (int)item.TypeDVD;
                    total[c] = Math.Floor(sizeData / y);
                    if (x > (int)total[c])
                    {
                        total[c]++;
                    }
                    if (total[c] == 0)
                    {
                        total[c]++;
                    }
                    Console.WriteLine("{0}. {1} ({2}) - {3}Mb \t - {4}штук",
                                      i++, item.Name, item.Model, y, total[c]);
                    c++;
                }
                Console.WriteLine("Введите тип диска");
                i = Int32.Parse(Console.ReadLine());
                GetTimeToCopy(typeDevice, i, sizeData, total);
            }
            break;

            case TypeDevice.HDD:
            {
                int      i = 1;
                double[] total = new double[HDDs.Count]; int c = 0;
                foreach (HDD item in HDDs)
                {
                    double Memory = item.KolRazd * item.ObemRazd;
                    double x      = sizeData / Memory;
                    total[c] = Math.Floor(sizeData / Memory);
                    if (x > (int)total[c])
                    {
                        total[c]++;
                    }
                    if (total[c] == 0)
                    {
                        total[c]++;
                    }
                    Console.WriteLine("{0}. {1} ({2}) - {3}Mb \t - {4}штук",
                                      i++, item.Name, item.Model, item.KolRazd * item.ObemRazd, total[c]);
                    c++;
                }
                Console.WriteLine("Введите тип жесткого диска");
                i = Int32.Parse(Console.ReadLine());
                GetTimeToCopy(typeDevice, i, sizeData, total);
            }
            break;

            default:
                break;
            }
        }
 public HDD(int SpeedHDD, TypeDevice typeDevice) : base()
 {
     this.SpeedHDD   = SpeedHDD;
     this.typeDevice = typeDevice;
 }
        public int Connect2Device(TypeDevice typeDevice, uint NumDev)
        {
            DeviceToConnect = typeDevice;
            UseFtdiChip.SearchDevice();

            bool bFound = false;
            if (typeDevice == TypeDevice.Selector)
            {
                for (uint i = 0; i < UseFtdiChip.DevInformation.Length; i++)
                {
                    FTDI.DevData _dev = UseFtdiChip.DevInformation[i];

                    if (_dev == null) continue;
                    string str = _dev.DevDescription;

                    if (str.Contains(TypeDevice.Selector.ToString())
                        || str.Contains("USB <-> Serial")
                        || str.Contains("FT232R USB UART")
                        || str.Contains("Electric") == false
                        )
                    {
                        NumConDev = i;
                        bFound = true;
                    }
                }
            }
            else if (typeDevice == TypeDevice.ElectricBarred)
            {
                for (uint i = 0; i < UseFtdiChip.DevInformation.Length; i++)
                {
                    FTDI.DevData _dev = UseFtdiChip.DevInformation[i];

                    if (_dev == null) continue;
                    string str = _dev.DevDescription;

                    if (str.Contains("Electric"))
                    {
                        NumConDev = i;
                        bFound = true;
                    }
                }
            }
            if (bFound == false)
            {
                if (tmConnect == null)
                {
                    if (StatCon != StatusConnect.NotConnect)
                    {
                        StatCon = StatusConnect.NotConnect;
                        if (evStatusConnect != null)
                            evStatusConnect(StatCon);
                    }
                    tmConnect = new Timer(timerDelegate, DeviceToConnect, 0, 250);
                }
                return 1;
            }
            NumDev = NumConDev;

            //Установка параметров связи по умолчанию
            if (UseFtdiChip.ConnectWithDefSetting(NumDev) != 0)
            {
                //Соединение не удалось
                if (tmConnect == null)
                {
                    if (StatCon != StatusConnect.NotConnect)
                    {
                        StatCon = StatusConnect.NotConnect;
                        if (evStatusConnect != null)
                            evStatusConnect(StatCon);
                    }
                    tmConnect = new Timer(timerDelegate, DeviceToConnect, 0, 250);
                }
                return 1;
            }
            if (StatCon != StatusConnect.Connected)
            {
                StatCon = StatusConnect.Connected;
                if (evStatusConnect != null)
                    evStatusConnect(StatCon);
            }

            if (tmConnect != null)
            {
                try
                {
                    //tmConnect.Stop();//.Abort();
                    tmConnect.Dispose();
                    tmConnect = null;
                }
                catch
                {
                }
                finally
                {
                }
            }
            try
            {
                ReceiveDataTh = new Thread(FuncRecD);
                //ReceiveDataTh.
                ReceiveDataTh.Name = "ReceiveDataTh";
                ReceiveDataTh.Start();
            }
            catch (System.Exception e)
            {

            }

            return 0;
        }
Exemple #21
0
        public ChangeDeviceWindow(TypeDevice typeD, int ID, TypeChange change)
        {
            InitializeComponent();
            string commandString;

            typeDevice = typeD;
            typeChange = change;
            DeviceID   = ID;
            SqlDataReader reader;
            string        connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            if (typeChange == TypeChange.Change)
            {
                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    connection.Open();
                    switch (typeDevice)
                    {
                    case TypeDevice.PC:
                        commandString = "SELECT PC.ID as 'ID', " +
                                        "PC.InventoryNumber as 'Инвентарный номер', " +
                                        "PC.Name as 'Наименование', " +
                                        "PC.Cost as 'Цена', " +
                                        "MotherBoard as 'Материнская плата', " +
                                        "CPUModel as 'Процессор', " +
                                        "PC.RAMGB as 'ОЗУ', " +
                                        "VideoCard as 'Видеокарта', " +
                                        "PC.HDDCapacityGB as 'Объем HDD', " +
                                        "dbo.GetNameOS(OSID) as 'Операционная система', " +
                                        "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from PC where PC.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                                uint   invN = Convert.ToUInt32(reader["Инвентарный номер"]);
                                string n    = reader["Наименование"].ToString();
                                uint   cost = Convert.ToUInt32(reader["Цена"]);
                                string mb   = reader["Материнская плата"].ToString();
                                string cpu  = reader["Процессор"].ToString();
                                pc = new PC(invN, n, cost, mb, cpu);
                                inventoryNumberPC.Text = pc.InventoryNumber.ToString();
                                namePC.Text            = pc.Name;
                                costPC.Text            = pc.Cost.ToString();
                                motherboardPC.Text     = pc.Motherboard;
                                cpuPC.Text             = pc.CPU;
                            }
                        }
                        break;

                    case TypeDevice.Notebook:
                        commandString = "SELECT Notebook.ID as 'ID', " +
                                        "Notebook.InventoryNumber as 'Инвентарный номер', " +
                                        "dbo.GetTypeNotebook(TypeNotebookID) as 'Тип', " +
                                        "Notebook.Name as 'Наименование', " +
                                        "Notebook.Cost as 'Цена', " +
                                        "CPUModel as 'Процессор', " +
                                        "RAMGB as 'ОЗУ', " +
                                        "VideoCard as 'Видеокарта', " +
                                        "ScreenDiagonal as 'Диагональ экрана', " +
                                        "HDDCapacityGB as 'Объем HDD', " +
                                        "dbo.GetNameOS(OSID) as 'Операционная система', " +
                                        "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from Notebook where Notebook.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                            }
                        }
                        break;

                    case TypeDevice.Monitor:
                        commandString = "SELECT Monitor.ID as 'ID', " +
                                        "Monitor.InventoryNumber as 'Инвентарный номер', " +
                                        "Monitor.Name as 'Наименование', " +
                                        "Monitor.Cost as 'Цена', " +
                                        "ScreenDiagonal as 'Диагональ экрана', " +
                                        "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from Monitor where Monitor.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                            }
                        }
                        break;

                    case TypeDevice.Projector:
                        commandString = "SELECT Projector.ID as 'ID', " +
                                        "Projector.InventoryNumber as 'Инвентарный номер', " +
                                        "Projector.Name as 'Наименование', " +
                                        "Projector.Cost as 'Цена', " +
                                        "MaxDiagonal as 'Максимальная диагональ', " +
                                        "dbo.GetProjectorTechnology(ProjectorTechnologyID) as 'Технология проецирования', " +
                                        "Invoice.Number as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from Projector where Projector.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                            }
                        }
                        break;

                    case TypeDevice.InteractiveWhiteboard:
                        commandString = "SELECT InteractiveWhiteboard.ID as 'ID', " +
                                        "InteractiveWhiteboard.InventoryNumber as 'Инвентарный номер', " +
                                        "InteractiveWhiteboard.Name as 'Наименование', " +
                                        "InteractiveWhiteboard.Cost as 'Цена', " +
                                        "Diagonal as 'Диагональ', " +
                                        "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from InteractiveWhiteboard whete InteractiveWhiteboard.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                            }
                        }
                        break;

                    case TypeDevice.ProjectorScreen:
                        commandString = "SELECT ProjectorScreen.ID as 'ID', " +
                                        "ProjectorScreen.InventoryNumber as 'Инвентарный номер', " +
                                        "ProjectorScreen.Name as 'Наименование', " +
                                        "ProjectorScreen.Cost as 'Цена', " +
                                        "Diagonal as 'Диагональ', " +
                                        "IsElectronicDrive as 'С электроприводом', " +
                                        "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from ProjectorScreen where ProjectorScreen.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                            }
                        }
                        break;

                    case TypeDevice.PrinterScanner:
                        commandString = "SELECT PrinterScanner.ID as 'ID', " +
                                        "dbo.GetTypePrinter(TypePrinterID) as 'Тип', " +
                                        "PrinterScanner.InventoryNumber as 'Инвентарный номер', " +
                                        "PrinterScanner.Name as 'Наименование', " +
                                        "PrinterScanner.Cost as 'Цена', " +
                                        "dbo.GetPaperSize(PaperSizeID) as 'Максимальный формат', " +
                                        "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from PrinterScanner where PrinterScanner.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                            }
                        }
                        break;

                    case TypeDevice.NetworkSwitch:
                        commandString = "SELECT NetworkSwitch.ID as 'ID', " +
                                        "NetworkSwitch.InventoryNumber as 'Инвентарный номер', " +
                                        "NetworkSwitch.Name as 'Наименование', " +
                                        "NetworkSwitch.Cost as 'Цена', " +
                                        "NumberOfPorts as 'Количество портов', " +
                                        "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from NetworkSwitch where NetworkSwitch.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                            }
                        }
                        break;

                    case TypeDevice.OtherEquipment:
                        commandString = "SELECT OtherEquipment.ID as 'ID', " +
                                        "OtherEquipment.InventoryNumber as 'Инвентарный номер', " +
                                        "OtherEquipment.Name as 'Наименование', " +
                                        "OtherEquipment.Cost as 'Цена', " +
                                        "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                        "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                        $"from OtherEquipment where OtherEquipment.ID={DeviceID}";
                        reader = new SqlCommand(commandString, connection).ExecuteReader();
                        if (reader.HasRows)
                        {
                            if (reader.Read())
                            {
                            }
                        }
                        break;
                    }
                }
            }
        }
Exemple #22
0
 public HDD(int SpeedHDD, TypeDevice typeDevice) : base("") // libo base() pustoi
 {
     this.SpeedHDD   = SpeedHDD;
     this.typeDevice = typeDevice;
 }
Exemple #23
0
 public ProcedureAddTypeDevice(TestProcedureContext context, TypeDevice typeDevice)
 {
     this.context    = context;
     this.typeDevice = typeDevice;
 }
Exemple #24
0
 public HDD(int SpeedHDD, TypeDevice typeDevice) : base() // -  вызавет констрруктор Storage
 {
     this.SpeedHDD   = SpeedHDD;
     this.typeDevice = typeDevice;
 }
Exemple #25
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="device">Bestimmt, ob ein einheitlicher Rahmen angezeigt werden soll</param>
 /// <param name="columns">Die Anzahl der verwendeten Spalten. Hinweis: Alle Spalten innerhalb eines PannelGrids muss die Summer 12 ergeben!</param>
 public PropertyGrid(TypeDevice device, int columns)
 {
     Device  = device;
     Columns = columns;
 }
Exemple #26
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     Define.Fonts = ExCss.ReadFile(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Asset\Fonts\font-awesome.min.css"));
     if (!File.Exists(FileName))
     {
         MessageBox.Show("Không tìm thấy file cấu hình!");
         Application.Current.Shutdown();
         return;
     }
     Registry = new ModifyRegistry();
     key      = Registry.Read("MTC_KEY");
     if (string.IsNullOrEmpty(key))
     {
         this.MainWindow = new MTC();
         this.MainWindow.Show();
         return;
     }
     setting = Config.Read(FileName, key);
     if (setting == null || setting.EndDate.Date < DateTime.Now.Date)
     {
         MessageBox.Show("Phần mềm đã hết hạn sử dụng.");
         this.MainWindow = new MTC();
         this.MainWindow.Show();
         return;
     }
     if (setting.temp_folder.IndexOf(@"://") < 0 || setting.temp_folder.IndexOf(@"\\") < 0)
     {
         setting.temp_folder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, setting.temp_folder);
     }
     if (!System.IO.Directory.Exists(setting.temp_folder))
     {
         System.IO.Directory.CreateDirectory(setting.temp_folder);
     }
     cache       = AltaCache.Read(CacheName);
     TypeUsers   = MysqlHelper.getTypeUserAll();
     TypeMedias  = new MediaTypeArray(TypeMedia.getList());
     TypeDevices = new DeviceTypeArray(TypeDevice.getList());
     initVLC();
     if (cache.autoLogin && !string.IsNullOrEmpty(cache.hashUserName))
     {
         int     tmpResult = UserData.getUserIdByHash(cache.hashUserName);
         UILogin form      = new UILogin();
         if (tmpResult != -1)
         {
             byte[] tmp = UserData.getFingerPrinter(tmpResult);
             form.cacheName = UserData.getUserName(tmpResult);
             if (tmp != null)
             {
                 form.Template = new DPFP.Template();
                 form.Template.DeSerialize(tmp);
             }
             form.Show();
         }
         else
         {
             form.Show();
         }
         return;
     }
     this.MainWindow = new UILogin();
     this.MainWindow.Show();
     Console.WriteLine("Debug");
 }
        private void UpdateDataGrid()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            switch (list.SelectedIndex)
            {
            case 0:
                adapter = new SqlDataAdapter("SELECT PC.ID as 'ID', " +
                                             "PC.InventoryNumber as 'Инвентарный номер', " +
                                             "PC.Name as 'Наименование', " +
                                             "str(PC.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "MotherBoard as 'Материнская плата', " +
                                             "CPUModel as 'Процессор', " +
                                             "str(PC.RAMGB, 3, 0) + N' ГБ' as 'ОЗУ', " +
                                             "VideoCard as 'Видеокарта', " +
                                             "str(PC.HDDCapacityGB, 4, 1) + N' ГБ' as 'Объем HDD', " +
                                             "dbo.GetNameOS(OSID) as 'Операционная система', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' from PC", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.PC;
                break;

            case 1:
                adapter = new SqlDataAdapter("SELECT Notebook.ID as 'ID', " +
                                             "Notebook.InventoryNumber as 'Инвентарный номер', " +
                                             "dbo.GetTypeNotebook(TypeNotebookID) as 'Тип', " +
                                             "Notebook.Name as 'Наименование', " +
                                             "str(Notebook.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "CPUModel as 'Процессор', " +
                                             "str(RAMGB, 3, 0) + N' ГБ' as 'ОЗУ', " +
                                             "VideoCard as 'Видеокарта', " +
                                             "ScreenDiagonal as 'Диагональ экрана', " +
                                             "str(HDDCapacityGB, 4, 1) + N' ГБ' as 'Объем HDD', " +
                                             "dbo.GetNameOS(OSID) as 'Операционная система', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' from Notebook", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.Notebook;
                break;

            case 2:
                adapter = new SqlDataAdapter("SELECT Monitor.ID as 'ID', " +
                                             "Monitor.InventoryNumber as 'Инвентарный номер', " +
                                             "Monitor.Name as 'Наименование', " +
                                             "str(Monitor.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "ScreenDiagonal as 'Диагональ экрана', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' from Monitor", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.Monitor;
                break;

            case 3:
                adapter = new SqlDataAdapter("SELECT Projector.ID as 'ID', " +
                                             "Projector.InventoryNumber as 'Инвентарный номер', " +
                                             "Projector.Name as 'Наименование', " +
                                             "str(Projector.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "MaxDiagonal as 'Максимальная диагональ', " +
                                             "dbo.GetProjectorTechnology(ProjectorTechnologyID) as 'Технология проецирования', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                             "from Projector", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.Projector;
                break;

            case 4:
                adapter = new SqlDataAdapter("SELECT InteractiveWhiteboard.ID as 'ID', " +
                                             "InteractiveWhiteboard.InventoryNumber as 'Инвентарный номер', " +
                                             "InteractiveWhiteboard.Name as 'Наименование', " +
                                             "str(InteractiveWhiteboard.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "Diagonal as 'Диагональ', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                             "from InteractiveWhiteboard", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.InteractiveWhiteboard;
                break;

            case 5:
                adapter = new SqlDataAdapter("SELECT ProjectorScreen.ID as 'ID', " +
                                             "ProjectorScreen.InventoryNumber as 'Инвентарный номер', " +
                                             "ProjectorScreen.Name as 'Наименование', " +
                                             "str(ProjectorScreen.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "Diagonal as 'Диагональ', " +
                                             "IsElectronicDrive as 'С электроприводом', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                             "from ProjectorScreen", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.ProjectorScreen;
                break;

            case 6:
                adapter = new SqlDataAdapter("SELECT PrinterScanner.ID as 'ID', " +
                                             "dbo.GetTypePrinter(TypePrinterID) as 'Тип', " +
                                             "PrinterScanner.InventoryNumber as 'Инвентарный номер', " +
                                             "PrinterScanner.Name as 'Наименование', " +
                                             "str(PrinterScanner.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "dbo.GetPaperSize(PaperSizeID) as 'Максимальный формат', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' from PrinterScanner", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.PrinterScanner;
                break;

            case 7:
                adapter = new SqlDataAdapter("SELECT NetworkSwitch.ID as 'ID', " +
                                             "NetworkSwitch.InventoryNumber as 'Инвентарный номер', " +
                                             "NetworkSwitch.Name as 'Наименование', " +
                                             "str(NetworkSwitch.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "NumberOfPorts as 'Количество портов', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' from NetworkSwitch", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.NetworkSwitch;
                break;

            case 8:
                adapter = new SqlDataAdapter("SELECT OtherEquipment.ID as 'ID', " +
                                             "OtherEquipment.InventoryNumber as 'Инвентарный номер', " +
                                             "OtherEquipment.Name as 'Наименование', " +
                                             "str(OtherEquipment.Cost, 10, 2) + N' ₽' as 'Цена', " +
                                             "dbo.GetNumberInvoice(InvoiceID) as 'Номер накладной', " +
                                             "dbo.GetLocalion(PlaceID) as 'Расположение' " +
                                             "from OtherEquipment", connectionString);
                set = new DataSet();
                adapter.Fill(set);
                view.ItemsSource           = set.Tables[0].DefaultView;
                view.Columns[0].Visibility = Visibility.Collapsed;
                typeDevice = TypeDevice.OtherEquipment;
                break;
            }
        }