private void SendLogs(string ex) { Mess mes = new Mess() { Message = ex }; HttpMessage.MethodPut("api/Logs/" + pc.id, mes); logs.WriteEntry($"{DateTime.Now}\n" + ex, EventLogEntryType.Error, logsID++); }
private void SendLoad() { PcLoadInfo pci = GetLoadInfo(); HttpMessage.MethodPut("api/PcLoadInfoes/" + pc.id, pci); }
private void SendGeneralInfo() { PcGeneralInfo pgi = GetGeneralInfo(); HttpMessage.MethodPut("api/PcGeneralInfoes/" + pc.id, pgi); }
private void SendDrive() { List <PcDrive> lpd = GetDrive(); HttpMessage.MethodPut("api/PcDrives/" + pc.id, lpd); }
public EditMV() { Init(); AddPC = new CustomCUMmand <string>( (s) => { switch (s) { case "Chouse": Data.Pc = ChosenGroupePC; break; case "All": Data.Pc = ChosenAllPC; break; } Manager.AddWindowsOpen(new AddPC()); Data.Pc = new PC(); }); Save = new CustomCUMmand <string>( (s) => { List <PcGroupe> temp = new List <PcGroupe>(); temp.Add(UnGroupe); temp.AddRange(MainGroupe); Data.PcGroupe = new ObservableCollection <PcGroupe>(temp); Manager.Close(typeof(EditV)); }); Remove = new CustomCUMmand <string>( (s) => { PC ret = HttpMessage.MethodDell <PC>("api/PcEditor/", ChosenGroupePC.id).Result; if (ret.id == -1) { System.Windows.MessageBox.Show("Wrong Input"); return; } PC temp = ChosenGroupePC; UnGroupe.PcMs.Add(temp); SelectedGroupe.PcMs.Remove(temp); ChosenGroupePC = null; }, () => { if (ChosenGroupePC == null) { return(false); } else { return(true); } }); Add = new CustomCUMmand <string>( (s) => { PC ret = HttpMessage.MethodPut("api/PcEditor/" + SelectedGroupe.id, ChosenAllPC).Result; if (ret.id == -1) { System.Windows.MessageBox.Show("Wrong Input"); return; } PC temp = ChosenAllPC; SelectedGroupe.PcMs.Add(temp); UnGroupe.PcMs.Remove(temp); ChosenAllPC = null; }, () => { if (ChosenAllPC == null || SelectedGroupe == null) { return(false); } else { return(true); } }); AddGroupe = new CustomCUMmand <string>( (s) => { PcGroupe newGroup = new PcGroupe() { Name = "NewGroup" }; newGroup = HttpMessage.MethodPost("api/PcGroups", newGroup).Result; if (newGroup.id == 0 || string.IsNullOrWhiteSpace(newGroup.Name)) { System.Windows.MessageBox.Show("Wrong Input"); return; } MainGroupe.Add(newGroup); }); UpdateName = new CustomCUMmand <string>( (s) => { PcGroupe result = HttpMessage.MethodPut("api/PcGroups/" + SelectedGroupe.id, SelectedGroupe).Result; if (result.id != selectedGroupe.id) { System.Windows.MessageBox.Show("Wrong Input"); } }, () => { if (SelectedGroupe != null) { if (!string.IsNullOrWhiteSpace(SelectedGroupe.Name)) { return(true); } else { return(false); } } else { return(false); } }); RemoveGroupe = new CustomCUMmand <string>( (s) => { //TODO Ебанет? PcGroupe respounce = HttpMessage.MethodDell <PcGroupe>("api/PcGroups", SelectedGroupe.id).Result; if (respounce.id == -1) { System.Windows.MessageBox.Show("WrongInput"); return; } PcGroupe temp = SelectedGroupe; temp.PcMs.ToList().ForEach(x => unGroupe.PcMs.Add(x)); MainGroupe.Remove(temp); Data.PcGroupe.Remove(temp); SelectedGroupe = null; }, () => { if (SelectedGroupe == null) { return(false); } else { return(true); } }); }