public CentralConnectCode CreateClient(Client client) { //Contact ContactAction contactAction = new ContactAction(this.ConnectString); List <Contact> primaryContacts = contactAction.RetrieveContactByFullName(client.PrimaryContact); if (primaryContacts.Count != 1) { return(CentralConnectCode.PrimaryContactNotFound); } List <Contact> secondaryContacts = contactAction.RetrieveContactByFullName(client.SecondaryContact); if (secondaryContacts.Count != 1) { return(CentralConnectCode.SecondaryContactNotFound); } //Company CompanyAction companyAction = new CompanyAction(this.ConnectString); List <Company> companys = companyAction.RetrieveCompanyByCompanyName(client.CompanyName); if (companys.Count != 1) { return(CentralConnectCode.CompanyNotFound); } if (Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(this.ConnectString, "SP_CreateCentralConnectClient", client.ClientName, client.Domain, client.ProductNumber, client.SerialNumber, client.CoreSystemModel, client.OSName, client.OSVersion, client.CompanyName, client.PrimaryContact, client.SecondaryContact, client.CreateBy) != 1) { return(CentralConnectCode.CreateClientFail); } return(CentralConnectCode.Success); }
Core.ServiceResponse IContactService.CreateContact(ContactServiceRequest contactServiceRequest) { if (contactServiceRequest.Contact == null) { return(new Core.ServiceResponse() { Code = 400, Message = "Contact should not null" }); } if (string.IsNullOrEmpty(contactServiceRequest.Contact.FirstName) || string.IsNullOrEmpty(contactServiceRequest.Contact.LastName) || string.IsNullOrEmpty(contactServiceRequest.Contact.EmailAddress) || string.IsNullOrEmpty(contactServiceRequest.Contact.Phone) || string.IsNullOrEmpty(contactServiceRequest.Contact.CreateBy)) { return(new Core.ServiceResponse() { Code = 400, Message = "FirstName LastName EmailAddress Phone CreateBy should not null" }); } if (string.IsNullOrEmpty(contactServiceRequest.Id) || string.IsNullOrEmpty(contactServiceRequest.Token) || string.IsNullOrEmpty(contactServiceRequest.Type)) { return(new Core.ServiceResponse() { Code = 400, Message = "Id Type and Token should not null" }); } string message = string.Empty; if (HP.TS.Devops.Security.SecurityCode.Success != HP.TS.Devops.Security.SecurityAction.CheckAccess(this.ConnectString, contactServiceRequest, out message)) { return(new Core.ServiceResponse() { Code = 403, Message = contactServiceRequest.Id + " of type " + contactServiceRequest.Type + " have no access of " + message }); } ContactAction contactAction = new ContactAction(this.ConnectString); if (contactAction.CreateContact(contactServiceRequest.Contact) <= 0) { return(new Core.ServiceResponse() { Code = 500, Message = "Create Contact Fail" }); } return(new Core.ServiceResponse() { Code = 0, Message = "Success" }); }
public async Task ValidateAsync(Contact entity, ContactAction action) { switch (action) { case ContactAction.Create: await ValidateCreateAsync(entity); break; default: throw new NotImplementedException(); } }
/// <summary> /// Method called when the page is displayed, fetches and display contact information and create actions. /// </summary> protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); while (actions.Children.Count > 0) { actions.Children.RemoveAt(0); } contact = ContactManager.Instance.TempContact; contactName.Text = contact.DisplayName; Stream imgStream = contact.GetPicture(); if (imgStream != null) { Image contactPicture = new Image(); contactPicture.Width = 150; contactPicture.Height = 150; contactPicture.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; contactPicture.Source = PictureDecoder.DecodeJpeg(imgStream); contactPicture.Margin = new Thickness(0, 0, 0, 15); actions.Children.Add(contactPicture); } foreach (ContactPhoneNumber phone in contact.PhoneNumbers) { ContactAction entry = new ContactAction(); entry.Action = "/Assets/AppBar/feature.phone.png"; entry.Action2 = "/Assets/AppBar/chat.png"; entry.Label = phone.Kind.ToString(); entry.NumberOrAddress = phone.PhoneNumber; entry.Click += action_Click_1; entry.Click2 += action_Click_2; actions.Children.Add(entry); } foreach (ContactEmailAddress email in contact.EmailAddresses) { ContactAction entry = new ContactAction(); entry.Action = "/Assets/AppBar/feature.phone.png"; entry.Action2 = "/Assets/AppBar/chat.png"; entry.Label = email.Kind.ToString(); entry.NumberOrAddress = email.EmailAddress; entry.Click += action_Click_1; entry.Click2 += action_Click_2; actions.Children.Add(entry); } }
ContactServiceResponse IContactService.RetrieveContactByFullName(ContactServiceRequest contactServiceRequest) { if (contactServiceRequest.Contact == null) { return(new ContactServiceResponse() { Code = 400, Message = "Contact should not null" }); } if (string.IsNullOrEmpty(contactServiceRequest.Contact.FullName)) { return(new ContactServiceResponse() { Code = 400, Message = "ContactName should not null" }); } if (string.IsNullOrEmpty(contactServiceRequest.Id) || string.IsNullOrEmpty(contactServiceRequest.Token) || string.IsNullOrEmpty(contactServiceRequest.Type)) { return(new ContactServiceResponse() { Code = 400, Message = "Id Type and Token should not null" }); } string message = string.Empty; if (HP.TS.Devops.Security.SecurityCode.Success != HP.TS.Devops.Security.SecurityAction.CheckAccess(this.ConnectString, contactServiceRequest, out message)) { return(new ContactServiceResponse() { Code = 403, Message = contactServiceRequest.Id + " of type " + contactServiceRequest.Type + " have no access of " + message }); } ContactAction contactAction = new ContactAction(this.ConnectString); List <Contact> contacts = contactAction.RetrieveContactByFullName(contactServiceRequest.Contact.FullName); return(new ContactServiceResponse() { Code = 0, Message = "Success", Contacts = contacts }); }
/// <summary> /// Method called when the page is displayed, fetches and display contact information and create actions. /// </summary> protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); while (actions.Children.Count > 0) { actions.Children.RemoveAt(0); } contact = ContactsManager.Instance.TempContact; contactName.Text = contact.ContactName; if (contact.ContactImage != null) { contactPicture.ImageSource = contact.ContactImage; } foreach (ContactPhone phone in contact.ContactPhones) { ContactAction entry = new ContactAction(); entry.Label = phone.Kind.ToString(); entry.NumberOrAddress = phone.Number; entry.Click += action_Click_1; entry.Click2 += action_Click_2; actions.Children.Add(entry); } foreach (ContactEmail email in contact.ContactEmails) { ContactAction entry = new ContactAction(); entry.Label = email.Kind.ToString(); entry.NumberOrAddress = email.Address; entry.Click += action_Click_1; entry.Click2 += action_Click_2; actions.Children.Add(entry); } }
public CentralConnectCode RegisterDevice(string environment, string deviceName, string domain, string createBy) { List <RegisterDeviceMessage> registerDeviceMessages = this.RetrieveRegisterDeviceMessageByEnvironmentAndDeviceNameAndDomain(environment, deviceName, domain); if (registerDeviceMessages.Count > 0) { return(CentralConnectCode.RegisterDeviceMessageExist); } DictionaryAction dictionaryAction = new DictionaryAction(this.ConnectString); string serviceUrl = string.Format("{0}/{1}", dictionaryAction.RetrieveServiceUrl(environment), "OOSRegistration/OOSRegistrationService.svc"); Logger.Write(string.Format("ServiceUrl={0},DeviceName={1},Domain={2}", serviceUrl, deviceName, domain)); //Device List <Device> devices = this.RetrieveDeviceByDeviceNameAndDomain(deviceName, domain); if (devices.Count != 1) { return(CentralConnectCode.DeviceNotFound); } Logger.Write("Retrieve Device", devices[0]); Device device = devices[0]; //RegisterClientMessage ClientAction clientAction = new ClientAction(this.ConnectString); List <RegisterClientMessage> registerClientMessages = clientAction.RetrieveRegisterClientMessageByEnvironmentAndClientNameAndDomain(environment, device.ClientName, device.ClientDomain); if (registerClientMessages.Count != 1) { return(CentralConnectCode.ClientNotRegister); } Logger.Write("RegisterClientMessage", registerClientMessages[0]); RegisterClientMessage registerClientMessage = registerClientMessages[0]; //Client List <Client> clients = clientAction.RetrieveClientByClientNameAndDomain(device.ClientName, device.ClientDomain); if (clients.Count != 1) { return(CentralConnectCode.ClientNotFound); } Logger.Write("Client", clients[0]); Client client = clients[0]; //Contact ContactAction contactAction = new ContactAction(this.ConnectString); List <Contact> primaryContacts = contactAction.RetrieveContactByFullName(client.PrimaryContact); if (primaryContacts.Count != 1) { return(CentralConnectCode.PrimaryContactNotFound); } Logger.Write("Retrieve PrimaryContacts", primaryContacts[0]); Contact primaryContact = primaryContacts[0]; List <Contact> secondaryContacts = contactAction.RetrieveContactByFullName(client.SecondaryContact); if (secondaryContacts.Count != 1) { return(CentralConnectCode.SecondaryContactNotFound); } Logger.Write("Retrieve SecondaryContact", secondaryContacts[0]); Contact secondaryContact = secondaryContacts[0]; //Company CompanyAction companyAction = new CompanyAction(this.ConnectString); List <Company> companys = companyAction.RetrieveCompanyByCompanyName(client.CompanyName); if (companys.Count != 1) { return(CentralConnectCode.CompanyNotFound); } Logger.Write("Retrieve Company", companys[0]); Company company = companys[0]; //Request HP.TS.Devops.CentralConnect.OOSRegistration.RequestBody requestBody = new HP.TS.Devops.CentralConnect.OOSRegistration.RequestBody() { AutoDetectedSystemSerialNumber = device.SerialNumber, ProductId = device.ProductNumber, SystemModel = device.CoreSystemModel, CoreSystemModel = device.CoreSystemModel, Hostname = device.DeviceName, FQDN = string.Format("{0}.{1}", device.DeviceName, device.Domain), IPAddress = device.IPAddress, Client_HPPID = registerClientMessage.HPPID, MacAddress = device.MAC, OSNameAndVersionString = string.Format("{0},{1}", device.OSName, device.OSVersion), //--prs-- PRSAddress1 = company.Street, PRSCity = company.City, PRSRegion = company.StateProvince, PRSPostalCode = company.PostalCode, PRSCountry = company.CountryCode, //--ISEEEnt--- ISEEEntSerialNumber = client.SerialNumber, ISEEEntProductNumber = client.ProductNumber, ISEEEntProductId = client.ProductNumber, //--iseecus-- ISEECusName = client.CompanyName, //--iseeperson-- ISEEFirstPersonFirstName = primaryContact.FirstName, ISEEFirstPersonLastName = primaryContact.LastName, ISEEFirstPersonEmailAddress = primaryContact.EmailAddress, ISEEFirstPersonTelephoneNumber = primaryContact.Phone, ISEESecondPersonFirstName = secondaryContact.FirstName, ISEESecondPersonLastName = secondaryContact.LastName, ISEESecondPersonEmailAddress = secondaryContact.EmailAddress, ISEESecondPersonTelephoneNumber = secondaryContact.Phone, }; Logger.Write("requestBody", requestBody); HP.TS.Devops.CentralConnect.OOSRegistration.OOSRegistrationServiceResult oosRegistrationServiceResult = this.RegisterDeviceRequest(serviceUrl, requestBody, registerClientMessage.CSID, registerClientMessage.OSGDID, registerClientMessage.RegistrationToken); if (!oosRegistrationServiceResult.IsSuccess) { Logger.Write("OOSRegistrationServiceResult Fail", oosRegistrationServiceResult); if (oosRegistrationServiceResult.Error.IsClientError) { return(CentralConnectCode.RegisterDeviceClientError); } else if (oosRegistrationServiceResult.Error.IsReRegisterError) { return(CentralConnectCode.RegisterDeviceReRegisterError); } else if (oosRegistrationServiceResult.Error.IsTransientError) { return(CentralConnectCode.RegisterDeviceTransientError); } } RegisterDeviceMessage registerDeviceMessage = new RegisterDeviceMessage(); registerDeviceMessage.Environment = environment; registerDeviceMessage.DeviceName = deviceName; registerDeviceMessage.Domain = domain; registerDeviceMessage.OSGDID = oosRegistrationServiceResult.Gdid; registerDeviceMessage.OSGDIDUsn = oosRegistrationServiceResult.OSGdidUsn.ToString(); registerDeviceMessage.HWGDID = oosRegistrationServiceResult.HWGdid; registerDeviceMessage.HWGDIDUsn = oosRegistrationServiceResult.HWGdidUsn.ToString(); registerDeviceMessage.CreateBy = createBy; if (this.AddRegisterDeviceMessage(registerDeviceMessage) != 1) { return(CentralConnectCode.AddRegisterDeviceMessageFail); } return(CentralConnectCode.Success); }
internal void Input(IEnumerable <ContactInfo> contactInfos) { foreach (ContactInfo contactInfo in contactInfos) { ContactAction clickAction = clickStates.GetAction(contactInfo); RoutedEvent routedEvent = null; switch (contactInfo.State) { case ContactState.Down: routedEvent = MultitouchScreen.ContactDownEvent; break; case ContactState.Up: routedEvent = MultitouchScreen.ContactUpEvent; break; case ContactState.Move: routedEvent = MultitouchScreen.ContactMoveEvent; break; default: break; } if (routedEvent != null) { dispatcher.Invoke(DispatcherPriority.Input, (Action)(delegate { try { Point localPoint = Application.Current.MainWindow.PointFromScreen(contactInfo.Center); IInputElement inputElement = Application.Current.MainWindow.InputHitTest(localPoint); MultitouchDevice device; if (!devices.TryGetValue(contactInfo.Id, out device)) { //novoe kasanie v predelah elementa. posilaem snachalo ContactEnterEvent. device = new MultitouchDevice(contactInfo.Id, inputElement); devices.Add(contactInfo.Id, device); ContactEventArgs mouseEnter = new ContactEventArgs(device, contactInfo); mouseEnter.RoutedEvent = MultitouchScreen.ContactEnterEvent; InputManager.Current.ProcessInput(mouseEnter); } else { if (device.Target != inputElement) { //staroe kasanie popalo na novij element. posilaem ContactLeaveEvent v starij element. ContactEventArgs mouseLeave = new ContactEventArgs(device, contactInfo); mouseLeave.RoutedEvent = MultitouchScreen.ContactLeaveEvent; try { InputManager.Current.ProcessInput(mouseLeave); } finally { devices.Remove(contactInfo.Id); } } } //posilaem event v element. RaiseInputEvent(device, inputElement, contactInfo, routedEvent); //esli bil click ili double click, to posilaem ih tozhe. if (clickAction == ContactAction.Click) { RaiseInputEvent(device, inputElement, contactInfo, MultitouchScreen.ContactClickEvent); } else if (clickAction == ContactAction.DoubleClick) { RaiseInputEvent(device, inputElement, contactInfo, MultitouchScreen.ContactDoubleClickEvent); } if (routedEvent == MultitouchScreen.ContactUpEvent) { devices.Remove(contactInfo.Id); } } catch (Exception ex) { Trace.TraceError(ex.ToString()); } })); } } }
public CentralConnectCode RegisterClient(string environment, string clientName, string domain, string createBy) { List <RegisterClientMessage> registerClientMessages = this.RetrieveRegisterClientMessageByEnvironmentAndClientNameAndDomain(environment, clientName, domain); if (registerClientMessages.Count > 0) { return(CentralConnectCode.RegisterClientMessageExist); } DictionaryAction dictionaryAction = new DictionaryAction(this.ConnectString); string serviceUrl = string.Format("{0}/{1}", dictionaryAction.RetrieveServiceUrl(environment), "ClientRegistration/ClientRegistrationService.asmx"); Logger.Write(string.Format("ServiceUrl={0},ClientName={1},Domain={2}", serviceUrl, clientName, domain)); //Client List <Client> clients = this.RetrieveClientByClientNameAndDomain(clientName, domain); if (clients.Count != 1) { return(CentralConnectCode.ClientNotFound); } Logger.Write("Retrieve Client", clients[0]); Client client = clients[0]; //Contact ContactAction contactAction = new ContactAction(this.ConnectString); List <Contact> primaryContacts = contactAction.RetrieveContactByFullName(client.PrimaryContact); if (primaryContacts.Count != 1) { return(CentralConnectCode.PrimaryContactNotFound); } Logger.Write("Retrieve PrimaryContacts", primaryContacts[0]); Contact primaryContact = primaryContacts[0]; List <Contact> secondaryContacts = contactAction.RetrieveContactByFullName(client.SecondaryContact); if (secondaryContacts.Count != 1) { return(CentralConnectCode.SecondaryContactNotFound); } Logger.Write("Retrieve SecondaryContact", secondaryContacts[0]); Contact secondaryContact = secondaryContacts[0]; //Company CompanyAction companyAction = new CompanyAction(this.ConnectString); List <Company> companys = companyAction.RetrieveCompanyByCompanyName(client.CompanyName); if (companys.Count != 1) { return(CentralConnectCode.CompanyNotFound); } Logger.Write("Retrieve Company", companys[0]); Company company = companys[0]; //Request HP.TS.Devops.CentralConnect.ClientRegistration.RequestBody requestBody = new HP.TS.Devops.CentralConnect.ClientRegistration.RequestBody() { CoreSystemModel = client.CoreSystemModel, ProductId = client.ProductNumber, FQDN = string.Format("{0}.{1}", client.ClientName, client.Domain), Hostname = client.ClientName, OSNameAndVersionString = string.Format("{0},{1}", client.OSName, client.OSVersion), SystemModel = client.CoreSystemModel, MacAddress = client.MAC, IPAddress = client.IPAddress, PRSCaption = client.CompanyName, PRSDirtyFlag = 1, PRSUniqueName = client.CompanyName, PRSAddress1 = company.Street, PRSCity = company.City, PRSRegion = company.StateProvince, PRSPostalCode = company.PostalCode, PRSCountry = company.CountryCode, ISEECusCaption = client.CompanyName, ISEECusPRSUniqueName = client.CompanyName, ISEECusName = client.CompanyName, ISEEEntSerialNumber = client.SerialNumber, ISEEEntProductNumber = client.ProductNumber, ISEEEntProductId = client.ProductNumber, ISEEFirstPersonFirstName = primaryContact.FirstName, ISEEFirstPersonLastName = primaryContact.LastName, ISEEFirstPersonEmailAddress = primaryContact.EmailAddress, ISEEFirstPersonTelephoneNumber = primaryContact.Phone, ISEESecondPersonFirstName = secondaryContact.FirstName, ISEESecondPersonLastName = secondaryContact.LastName, ISEESecondPersonEmailAddress = secondaryContact.EmailAddress, ISEESecondPersonTelephoneNumber = secondaryContact.Phone, }; Logger.Write("requestBody", requestBody); string xmlEscapedCSID = string.Empty; HP.TS.Devops.CentralConnect.ClientRegistration.ClientRegistrationResult result = this.RegisterClientRequest(serviceUrl, requestBody, out xmlEscapedCSID); Logger.Write("ClientRegistration Result", result); //load to database if (!result.IsSuccess) { return(CentralConnectCode.ClientRegistrationFail); } RegisterClientMessage registerClientMessage = new RegisterClientMessage(); registerClientMessage.Environment = environment; registerClientMessage.ClientName = clientName; registerClientMessage.Domain = domain; registerClientMessage.CSID = xmlEscapedCSID; registerClientMessage.OSGDID = result.Gdid; registerClientMessage.RegistrationToken = result.RegistrationToken; registerClientMessage.HWGDID = result.Gdid; registerClientMessage.CreateBy = createBy; if (this.AddRegisterClientMessage(registerClientMessage) != 1) { return(CentralConnectCode.AddRegisterClientMessageFail); } return(CentralConnectCode.Success); }
public CentralConnectCode CreateAndSendMetrics(MetricsEnhancement metricsEnhancement) { //Client ClientAction clientAction = new ClientAction(this.ConnectString); List <Client> clients = clientAction.RetrieveClientByClientNameAndDomain(metricsEnhancement.ClientName, metricsEnhancement.Domain); if (clients.Count != 1) { return(CentralConnectCode.ClientNotFound); } Logger.Write("Client", clients[0]); Client client = clients[0]; //Contact ContactAction contactAction = new ContactAction(this.ConnectString); List <Contact> primaryContacts = contactAction.RetrieveContactByFullName(client.PrimaryContact); if (primaryContacts.Count != 1) { return(CentralConnectCode.PrimaryContactNotFound); } Logger.Write("Retrieve PrimaryContacts", primaryContacts[0]); Contact primaryContact = primaryContacts[0]; List <Contact> secondaryContacts = contactAction.RetrieveContactByFullName(client.SecondaryContact); if (secondaryContacts.Count != 1) { return(CentralConnectCode.SecondaryContactNotFound); } Logger.Write("Retrieve SecondaryContact", secondaryContacts[0]); Contact secondaryContact = secondaryContacts[0]; //Company CompanyAction companyAction = new CompanyAction(this.ConnectString); List <Company> companys = companyAction.RetrieveCompanyByCompanyName(client.CompanyName); if (companys.Count != 1) { return(CentralConnectCode.CompanyNotFound); } Logger.Write("Retrieve Company", companys[0]); Company company = companys[0]; //registerClientMessages List <RegisterClientMessage> registerClientMessages = this.RetrieveRegisterClientMessageByEnvironmentAndClientNameAndDomain(metricsEnhancement.Environment, metricsEnhancement.ClientName, metricsEnhancement.Domain); if (registerClientMessages.Count != 1) { return(CentralConnectCode.RegisterClientMessageNotExist); } Logger.Write("Retrieve registerClientMessages", registerClientMessages[0]); RegisterClientMessage registerClientMessage = registerClientMessages[0]; //devices List <Device> devices = this.RetrieveRegisterDeviceByEnvironmentAndClientNameAndClientDomain(metricsEnhancement.Environment, metricsEnhancement.ClientName, metricsEnhancement.Domain); if (devices.Count == 0) { return(CentralConnectCode.ClientNotFoundAssociatedDevice); } Logger.Write("Retrieve devices", devices); MetricsRequest metricsRequest = new MetricsRequest(); //ClientInformation ClientInformation clientInformation = new ClientInformation(); clientInformation.ClientName = metricsEnhancement.ClientName; clientInformation.Domain = metricsEnhancement.Domain; clientInformation.ProductNumber = client.ProductNumber; clientInformation.SerialNumber = client.SerialNumber; clientInformation.CoreSystemModel = client.CoreSystemModel; clientInformation.MAC = client.MAC; clientInformation.OSName = client.OSName; clientInformation.OSVersion = client.OSVersion; clientInformation.IPAddress = client.IPAddress; clientInformation.HPPID = registerClientMessage.HPPID; clientInformation.Password = registerClientMessage.Password; clientInformation.CSID = registerClientMessage.CSID; clientInformation.OSGDID = registerClientMessage.OSGDID; clientInformation.HWGDID = registerClientMessage.HWGDID; clientInformation.RegistrationToken = registerClientMessage.RegistrationToken; clientInformation.CompanyName = client.CompanyName; clientInformation.CountryCode = company.CountryCode; clientInformation.StateProvince = company.StateProvince; clientInformation.City = company.City; clientInformation.Street = company.Street; clientInformation.PostalCode = company.PostalCode; clientInformation.PrimaryContact = client.PrimaryContact; clientInformation.PrimaryFirstName = primaryContact.FirstName; clientInformation.PrimaryLastName = primaryContact.LastName; clientInformation.PrimaryEmailAddress = primaryContact.EmailAddress; clientInformation.PrimaryPhone = primaryContact.Phone; clientInformation.SecondaryContact = client.SecondaryContact; clientInformation.SecondaryFirstName = secondaryContact.FirstName; clientInformation.SecondaryLastName = secondaryContact.LastName; clientInformation.SecondaryEmailAddress = secondaryContact.EmailAddress; clientInformation.SecondaryPhone = secondaryContact.Phone; clientInformation.SupportPartnerId = metricsEnhancement.SupportPartnerId; clientInformation.ServicePartnerId = metricsEnhancement.ServicePartnerId; metricsRequest.ClientInformation = clientInformation; //deviceinformation DeviceAction deviceAction = new DeviceAction(this.ConnectString); List <DeviceInformation> deviceInformations = new List <DeviceInformation>(); foreach (Device item in devices) { DeviceInformation deviceInformation = new DeviceInformation(); deviceInformation.ClientName = client.ClientName; deviceInformation.ClientDomain = client.Domain; deviceInformation.DeviceName = item.DeviceName; deviceInformation.Domain = item.Domain; deviceInformation.ProductNumber = item.ProductNumber; deviceInformation.SerialNumber = item.SerialNumber; deviceInformation.CoreSystemModel = item.CoreSystemModel; deviceInformation.MAC = item.MAC; deviceInformation.OSName = item.OSName; deviceInformation.OSVersion = item.OSVersion; deviceInformation.IPAddress = item.IPAddress; List <RegisterDeviceMessage> registerDeviceMessages = deviceAction.RetrieveRegisterDeviceMessageByEnvironmentAndDeviceNameAndDomain(metricsEnhancement.Environment, item.DeviceName, item.Domain); if (registerDeviceMessages.Count != 1) { return(CentralConnectCode.RegisterDeviceMessageNotExist); } RegisterDeviceMessage registerDeviceMessage = registerDeviceMessages[0]; deviceInformation.OSGDID = registerDeviceMessage.OSGDID; deviceInformation.OSGDIDUsn = registerDeviceMessage.OSGDIDUsn; deviceInformation.HWGDID = registerDeviceMessage.HWGDID; deviceInformation.HWGDIDUsn = registerDeviceMessage.HWGDIDUsn; deviceInformation.CollectionProblem = registerDeviceMessage.CollectionProblem; deviceInformation.MonitoringProblem = registerDeviceMessage.MonitoringProblem; deviceInformations.Add(deviceInformation); } metricsRequest.DeviceInformations = deviceInformations; //enhancementArguments Dictionary <string, string> enhancementArguments = new Dictionary <string, string>(); if (metricsEnhancement.Arguments != null) { foreach (Argument item in metricsEnhancement.Arguments) { if (!enhancementArguments.ContainsKey(item.key)) { enhancementArguments.Add(item.key, item.value); } } } metricsRequest.EnhancementArguments = enhancementArguments; //InvokeMetrics Plugin EnhancementAction enhancementAction = new EnhancementAction(this.ConnectString); PluginResponse result = enhancementAction.InvokeMetrics(metricsRequest, metricsEnhancement.Type); if (!result.IsSuccess) { Logger.Write("CreateMetricsFail-" + result.Message); return(CentralConnectCode.CreateMetricsFail); } //SendMetrics DictionaryAction dictionaryAction = new DictionaryAction(this.ConnectString); string serviceUrl = string.Format("{0}/{1}", dictionaryAction.RetrieveServiceUrl(metricsEnhancement.Environment), "DataPackageReceiver/DataPackageReceiver.asmx"); DataPackageSubmissionResult dataPackageSubmissionResult = this.SendMetricsRequest(serviceUrl, registerClientMessage.CSID, registerClientMessage.HWGDID, registerClientMessage.OSGDID, registerClientMessage.RegistrationToken, result.FileName, result.FileContent); if (!dataPackageSubmissionResult.IsSuccess) { if (dataPackageSubmissionResult.Error.IsClientError) { return(CentralConnectCode.SendMetricsClientError); } else if (dataPackageSubmissionResult.Error.IsReRegisterError) { return(CentralConnectCode.SendMetricsReRegisterError); } else if (dataPackageSubmissionResult.Error.IsTransientError) { return(CentralConnectCode.SendMetricsTransientError); } } MetricsMessage metricsMessage = new MetricsMessage(); metricsMessage.Environment = metricsEnhancement.Environment; metricsMessage.ClientName = metricsEnhancement.ClientName; metricsMessage.Domain = metricsEnhancement.Domain; metricsMessage.PackageName = result.FileName; metricsMessage.ServicePartnerId = metricsEnhancement.ServicePartnerId; metricsMessage.SupportPartnerId = metricsEnhancement.SupportPartnerId; metricsMessage.CreateBy = "TBD"; if (this.AddMetricsMessage(metricsMessage) != 1) { return(CentralConnectCode.AddMetricsMessageFail); } return(CentralConnectCode.Success); }
public ContactDetailsViewModel(Contact contact) { Contact = contact; _ciscoService = DependencyService.Get <CiscoService>(); _actionType = ContactAction.Update; }
public ContactDetailsViewModel() { Contact = new Contact(); _ciscoService = DependencyService.Get <CiscoService>(); _actionType = ContactAction.Add; }