public void Start() { //Make sure WUA Is up to Date WUA.Run(); WUA.DisableAutomaticWindowsUpdates(); _updateChecker.Enable(SendNewUpdatesHandler); //Disable Java, Adobe, Acrobat Updaters DisableUpdaters.DisableAll(); //Check WSUS Status Logger.Log("WSUS enabled? {0}", LogLevel.Info, WSUS.IsWSUSEnabled()); Logger.Log("WSUS address? {0}", LogLevel.Info, WSUS.GetServerWSUS); Logger.Log("Automatic updates Enabled? {0}", LogLevel.Info, WSUS.IsAutomaticUpdatesEnabled()); try { var sysTimeZone = GetTimeZone.GetMyTimeZone(); Logger.Log("Current time zone {0}, utc off set {1}.", LogLevel.Info, sysTimeZone.time_zone, sysTimeZone.utc_offset); } catch { Logger.Log("Unable to obtain timezone.", LogLevel.Error); } switch (WSUS.GetAutomaticUpdatesOptions()) { case WSUS.AutomaticUpdateStatus.AutomaticDownloadAndNotifyOfInstall: Logger.Log("Automatic updates setting? {0}", LogLevel.Info, "Automatic download and notify of install."); break; case WSUS.AutomaticUpdateStatus.AutomaticDownloadAndScheduleInstall: Logger.Log("Automatic updates setting? {0}", LogLevel.Info, "Automatic download and schedule install."); break; case WSUS.AutomaticUpdateStatus.AutomaticUpdatesIsRequiredAndUsersCanConfigureIt: Logger.Log("Automatic updates setting? {0}", LogLevel.Info, "Automatic updates is required and users can configure it."); break; case WSUS.AutomaticUpdateStatus.NotifyBeforeDownload: Logger.Log("Automatic updates setting? {0}", LogLevel.Info, "Notify before download."); break; default: Logger.Log("Automatic updates setting? {0}", LogLevel.Info, "Not set."); break; } //Check AntiMalware and Firewall Settings Logger.Log("Anti Spyware protection? {0}", LogLevel.Info, WindowsAntiSpyware.IsProtectionEnabled()); Logger.Log("Windows firewall protection? {0}", LogLevel.Info, WindowsFirewall.IsProtectionEnabled()); //Check if system is Windows 8 and Disable automatic restarts //after critical system updates are installed. RvUtils.Windows8AutoRestart(false); }
public static JObject SysTimeZone() { var myZone = new JObject(); try { var zoneDetails = GetTimeZone.GetMyTimeZone(); myZone["time_zone"] = zoneDetails.time_zone; myZone["utc_offset"] = zoneDetails.utc_offset; } catch { Logger.Log("Unable to obtain timezone.", LogLevel.Error); } return(myZone); }
public HttpResponseMessage GetEnvelopeHistoryByCode(int envelopeCode) { HttpResponseMessage responseToClient = new HttpResponseMessage(); EnvelopeGetEnvelopeHistoryByEnvelopeCode newEnvelope = new EnvelopeGetEnvelopeHistoryByEnvelopeCode(); string userName = string.Empty; try { System.Collections.Generic.IEnumerable <string> iHeader; Request.Headers.TryGetValues("AuthToken", out iHeader); string authToken = iHeader.ElementAt(0); using (var dbContext = new eSignEntities()) { UserTokenRepository tokenRepository = new UserTokenRepository(dbContext); EnvelopeRepository envelopeRepository = new EnvelopeRepository(dbContext); string userEmail = tokenRepository.GetUserEmailByToken(authToken); Guid UserId = tokenRepository.GetUserProfileUserIDByID(tokenRepository.GetUserProfileIDByEmail(userEmail)); userName = envelopeRepository.GetUserNameByAuthToken(authToken); Envelopes = envelopeRepository.GetAll(UserId).OrderByDescending(r => r.CreatedDateTime).Where(r => r.DisplayCode != null && r.DisplayCode != 0 && r.IsEnvelopeComplete == true).ToList(); foreach (var env in Envelopes) { if (env.DisplayCode == envelopeCode)//envelope.EnvelopeCode) { newEnvelope.DocumentList = new List <string>(); newEnvelope.DocumentHistory = new List <DocumentStatus>(); var documentList = env.Documents.Select(m => m.DocumentName).ToList(); string recipients = string.Empty; newEnvelope.EnvelopeCode = env.DisplayCode; newEnvelope.Subject = env.Subject; newEnvelope.CurrentStatus = env.EnvelopeStatusDescription; newEnvelope.Sent = String.Format("{0:MM/dd/yyyy HH:mm tt}", env.CreatedDateTime); if (env.StatusID != Constants.StatusCode.Envelope.Waiting_For_Signature) { newEnvelope.Completed = String.Format("{0:MM/dd/yyyy HH:mm tt}", env.ModifiedDateTime); } for (int i = 0; i < documentList.Count; i++) { newEnvelope.DocumentList.Add(documentList[i]); } newEnvelope.EnvelopeID = env.EnvelopeCodeDisplay; newEnvelope.Sender = userName; foreach (var recipient in env.Recipients.OrderByDescending(r => r.RecipientTypeDescription).ToList()) { if (recipient.RecipientTypeID == Constants.RecipientType.Sender) // Sender { continue; } if (recipient.RecipientTypeID == Constants.RecipientType.CC) // CC { recipients += recipient.Name + "(CC), "; } else if (recipient.RecipientTypeID == Constants.RecipientType.Signer) // Signer { recipients += recipient.Name + ", "; } } if (!string.IsNullOrEmpty(recipients)) { recipients = recipients.Substring(0, recipients.Length - 2); } foreach (var recipient in env.Recipients.OrderBy(r => r.StatusDate)) { DocumentStatus docHistory = new DocumentStatus(); if (recipient.RecipientTypeID == Constants.RecipientType.CC || (recipient.StatusID == null || recipient.StatusID == Guid.Empty)) { continue; } if (recipient.RecipientTypeID == Constants.RecipientType.Signer) { docHistory.StatusDate = String.Format("{0:MM/dd/yyyy HH:mm tt}", recipient.StatusDate) + " " + GetTimeZone.GetTimeZoneAbbreviation(TimeZone.CurrentTimeZone.StandardName); if (recipient.StatusID == Constants.StatusCode.Signer.Delegated) { newEnvelope.DelegatedTo = recipient.DelegatedTo; } else { docHistory.SignerStatusDescription = recipient.SignerStatusDescription; docHistory.Recipient = recipient.Name; docHistory.RecipientEmailAddress = recipient.EmailAddress; if (recipient.StatusID == Constants.StatusCode.Signer.Pending) { docHistory.IPAddress = "-.-.-.-"; } else { docHistory.IPAddress = recipient.SignerIPAddress; } } } newEnvelope.DocumentHistory.Add(docHistory); } if (env.StatusID == Constants.StatusCode.Envelope.Completed) { var recipient = env.Recipients.Where(r => r.StatusID == Constants.StatusCode.Signer.Signed).OrderByDescending(r => r.StatusDate).FirstOrDefault(); newEnvelope.CompletedStatusDate = String.Format("{0:MM/dd/yyyy HH:mm tt}", recipient.StatusDate) + " " + GetTimeZone.GetTimeZoneAbbreviation(TimeZone.CurrentTimeZone.StandardName); newEnvelope.EnvelopeStatusDescription = env.EnvelopeStatusDescription; } if (env.StatusID == Constants.StatusCode.Envelope.Terminated) { var recipient = env.Recipients.Where(r => r.StatusID == Constants.StatusCode.Signer.Rejected).OrderByDescending(r => r.StatusDate).First(); newEnvelope.CompletedStatusDate = String.Format("{0:MM/dd/yyyy HH:mm tt}", recipient.StatusDate) + " " + GetTimeZone.GetTimeZoneAbbreviation(TimeZone.CurrentTimeZone.StandardName); newEnvelope.EnvelopeStatusDescription = env.EnvelopeStatusDescription; } } } } if (newEnvelope.EnvelopeCode == 0) { ResponseMessage responseMessage = new ResponseMessage(); responseMessage.StatusCode = HttpStatusCode.NoContent; responseMessage.StatusMessage = "NoContent"; responseMessage.Message = Convert.ToString(ConfigurationManager.AppSettings["NoContent"].ToString()); responseToClient = Request.CreateResponse(HttpStatusCode.NoContent, responseMessage); return(responseToClient); } else { responseToClient = Request.CreateResponse(HttpStatusCode.OK, newEnvelope); return(responseToClient); } } catch (Exception ex) { responseToClient = Request.CreateResponse((HttpStatusCode)422); responseToClient.Content = new StringContent(ex.Message, Encoding.Unicode); throw new HttpResponseException(responseToClient); } }