Exemple #1
0
        public string write_data(Monitor_models input, string asset, string resou)
        {
            string result = "";

            string cmdText = "insert into monitor_log (manu,ictag,monitor_ID,serial,size,resou,model) values ('" + input.Manafacture + "','" + asset + "','" + input.MonitorID + "','" + input.SerialNumber + "','" + input.SizeDiaginch + "','" + resou + "','" + input.Model + "') on duplicate key update serial = '" + input.SerialNumber + "',monitor_ID = '" + input.MonitorID + "', model = '" + input.Model + "'";

            using (MySqlCommand cmd = new MySqlCommand(cmdText, conn))
            {
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
            }


            return(result);
        }
Exemple #2
0
        public async void save_data_action()
        {
            if (get_networkDrive() == 0)
            {
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "No Network Drive Mapped");

                return;
            }
            ValidationResult validationResult = Validator.ValidateAll();
            string           message          = "Please Check the following input: \n\r";

            foreach (var item in validationResult.ErrorList)
            {
                message += item.ErrorText + "\n\r";
            }
            if (validationResult.IsValid == false)
            {
                await _dialogCoordinator.ShowMessageAsync(this, "Error", message);

                return;
            }
            Monitor_models result = new Monitor_models();

            result.Model        = Model;
            result.Manafacture  = Manu;
            result.MonitorID    = Monitor_ID;
            result.Name         = Name;
            result.SerialNumber = Serial;
            result.SizeDiaginch = Size;
            write_xml();
            try
            {
                mysql_data.write_data(result, Asset_tag, Selected_resou);
            }
            catch (Exception e)
            {
                await _dialogCoordinator.ShowMessageAsync(this, "Error", e.Message);
            }
        }
Exemple #3
0
        public Monitor_models get_monitor_detail(string model)
        {
            Monitor_models result = new Monitor_models();

            try
            {
                ManagementObjectSearcher searcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                                                 "SELECT * FROM Win32_MonitorDetails  where Model = '" + model + "'");

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Model      = (queryObj["Model"].ToString());
                    Monitor_ID = (queryObj["MonitorID"].ToString());
                    var manafacture = queryObj["MonitorID"].ToString();
                    Manu   = manafacture.Substring(0, 2);
                    Manu   = manu_database(Manu);
                    Name   = (queryObj["Name"].ToString());
                    Serial = (queryObj["SerialNumber"].ToString());
                    Size   = (queryObj["SizeDiagInch"].ToString());

                    var rounded = Math.Round(double.Parse(size), 0, MidpointRounding.AwayFromZero);
                    result.SizeDiaginch = rounded.ToString();
                    Resou = monitor_resou();

                    //round_up();

                    //five.Items.Add(monitor_size);
                }
            }
            catch (ManagementException e)
            {
                //  ("An error occurred while querying for WMI data: " + e.Message);
            }
            return(result);
        }