public void SaveOtherDevice(OtherDevice otherDevice, bool isNew) { SystemMessages sm; try { string result = CommonFunctions.SaveOtherDevice(null, otherDevice, isNew); ClearForm(); sm = new SystemMessages(new Message() { UserMessage = result, SystemMessage = string.Empty, UserMessageType = MessageType.Success }, ButtonType.OkOnly); sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); OtherDevicesUserControl otherDevicesUserControl = new OtherDevicesUserControl(); ((MasterLayoutWindow)Window.GetWindow(this)).ContentFrame.Navigate(otherDevicesUserControl); } catch (Exception ex) { CommonFunctions.LogException(null, "WPF.SaveOtherDevice", ex); sm = new SystemMessages(new Message() { UserMessage = "Failed to Save Other Device Information", SystemMessage = ex.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); } }
void ButtonSave_Click(object sender, RoutedEventArgs e) { #if SILVERLIGHT Storyboard sb = new Storyboard(); sb = Application.Current.Resources["ButtonPressAnimation"] as Storyboard; sb.Completed += new EventHandler(delegate(object obj, EventArgs es) { sb.Stop(); }); Storyboard.SetTarget(sb, ButtonSaveTransform); sb.Begin(); #endif if (IsValid()) { OtherDevice otherDevice = new OtherDevice(); otherDevice.Acronym = TextBoxAcronym.Text.CleanText(); otherDevice.Name = TextBoxName.Text.CleanText(); otherDevice.IsConcentrator = (bool)CheckboxConcentrator.IsChecked; otherDevice.CompanyID = ((KeyValuePair <int, string>)ComboboxCompany.SelectedItem).Key == 0 ? (int?)null : ((KeyValuePair <int, string>)ComboboxCompany.SelectedItem).Key; otherDevice.VendorDeviceID = ((KeyValuePair <int, string>)ComboboxVendorDevice.SelectedItem).Key == 0 ? (int?)null : ((KeyValuePair <int, string>)ComboboxVendorDevice.SelectedItem).Key; otherDevice.Longitude = TextBoxLongitude.Text.ToNullableDecimal(); otherDevice.Latitude = TextBoxLatitude.Text.ToNullableDecimal(); otherDevice.InterconnectionID = ((KeyValuePair <int, string>)ComboboxInterconnection.SelectedItem).Key == 0 ? (int?)null : ((KeyValuePair <int, string>)ComboboxInterconnection.SelectedItem).Key; otherDevice.Planned = (bool)CheckboxPlanned.IsChecked; otherDevice.Desired = (bool)CheckboxDesired.IsChecked; otherDevice.InProgress = (bool)CheckboxInProgress.IsChecked; if (m_inEditMode == false && m_deviceID == 0) { SaveOtherDevice(otherDevice, true); } else { otherDevice.ID = m_deviceID; SaveOtherDevice(otherDevice, false); } } }
void client_GetOtherDeviceByDeviceIDCompleted(object sender, GetOtherDeviceByDeviceIDCompletedEventArgs e) { deviceToEdit = new OtherDevice(); if (e.Error == null) { deviceToEdit = e.Result; GridOtherDeviceDetail.DataContext = deviceToEdit; if (deviceToEdit.CompanyID.HasValue) { ComboboxCompany.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.CompanyID, deviceToEdit.CompanyName); } else { ComboboxCompany.SelectedIndex = 0; } if (deviceToEdit.InterconnectionID.HasValue) { ComboboxInterconnection.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.InterconnectionID, deviceToEdit.InterconnectionName); } else { ComboboxInterconnection.SelectedIndex = 0; } if (deviceToEdit.VendorDeviceID.HasValue) { ComboboxVendorDevice.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.VendorDeviceID, deviceToEdit.VendorDeviceName); } else { ComboboxVendorDevice.SelectedIndex = 0; } } else { SystemMessages sm; if (e.Error is FaultException <CustomServiceFault> ) { FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>; sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else { sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Other Device Information by ID", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.ShowPopup(); } }
public string SaveOtherDevice(OtherDevice otherDevice, bool isNew) { try { return(CommonFunctions.SaveOtherDevice(null, otherDevice, isNew)); } catch (Exception ex) { CommonFunctions.LogException(null, "Service.SaveOtherDevice", ex); CustomServiceFault fault = new CustomServiceFault() { UserMessage = "Failed to Save Other Device Information", SystemMessage = ex.Message }; throw new FaultException <CustomServiceFault>(fault); } }
private void AddOtherDevice(DeviceDescription deviceDescription, Uri deviceDescriptionUrl) { if (_otherDevices.ContainsKey(deviceDescriptionUrl.AbsoluteUri)) { return; } OtherDevice otherDevice = new OtherDevice(deviceDescription, deviceDescriptionUrl); _otherDevices.Add(deviceDescriptionUrl.AbsoluteUri, otherDevice); if (OnOtherDeviceFound != null) { OnOtherDeviceFound(this, new OtherDeviceFoundEventArgs(otherDevice)); } }
public void GetOtherDeviceByDeviceID(int deviceID) { try { OtherDevice deviceToEdit = new OtherDevice(); deviceToEdit = CommonFunctions.GetOtherDeviceByDeviceID(null, deviceID); GridOtherDeviceDetail.DataContext = deviceToEdit; if (deviceToEdit.CompanyID.HasValue) { ComboboxCompany.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.CompanyID, deviceToEdit.CompanyName); } else { ComboboxCompany.SelectedIndex = 0; } if (deviceToEdit.InterconnectionID.HasValue) { ComboboxInterconnection.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.InterconnectionID, deviceToEdit.InterconnectionName); } else { ComboboxInterconnection.SelectedIndex = 0; } if (deviceToEdit.VendorDeviceID.HasValue) { ComboboxVendorDevice.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.VendorDeviceID, deviceToEdit.VendorDeviceName); } else { ComboboxVendorDevice.SelectedIndex = 0; } } catch (Exception ex) { CommonFunctions.LogException(null, "WPF.GetOtherDeviceByDeviceID", ex); SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Other Device Information by ID", SystemMessage = ex.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; sm.ShowPopup(); } }
public void SaveOtherDevice(OtherDevice otherDevice, bool isNew) { m_client.SaveOtherDeviceAsync(otherDevice, isNew); }
void client_GetOtherDeviceByDeviceIDCompleted(object sender, GetOtherDeviceByDeviceIDCompletedEventArgs e) { deviceToEdit = new OtherDevice(); if (e.Error == null) { deviceToEdit = e.Result; GridOtherDeviceDetail.DataContext = deviceToEdit; if (deviceToEdit.CompanyID.HasValue) ComboboxCompany.SelectedItem = new KeyValuePair<int, string>((int)deviceToEdit.CompanyID, deviceToEdit.CompanyName); else ComboboxCompany.SelectedIndex = 0; if (deviceToEdit.InterconnectionID.HasValue) ComboboxInterconnection.SelectedItem = new KeyValuePair<int, string>((int)deviceToEdit.InterconnectionID, deviceToEdit.InterconnectionName); else ComboboxInterconnection.SelectedIndex = 0; if (deviceToEdit.VendorDeviceID.HasValue) ComboboxVendorDevice.SelectedItem = new KeyValuePair<int, string>((int)deviceToEdit.VendorDeviceID, deviceToEdit.VendorDeviceName); else ComboboxVendorDevice.SelectedIndex = 0; } else { SystemMessages sm; if (e.Error is FaultException<CustomServiceFault>) { FaultException<CustomServiceFault> fault = e.Error as FaultException<CustomServiceFault>; sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Other Device Information by ID", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.ShowPopup(); } }
public void SaveOtherDevice(OtherDevice otherDevice, bool isNew) { m_client.SaveOtherDeviceAsync(otherDevice, isNew); }
public OtherDeviceFoundEventArgs(OtherDevice otherDevice) { OtherDevice = otherDevice; }