private static void DateUpdateFromOnlineServer() { //******************Check Internet connection********************************************************* if (CheckInternetconnection.CheckForInternetConnection()) { //******************online date and system date same or not check********************************************************* DateTime?onlineDate = OnlineServerDateTimeTools.GetOnlineServerDate(); if (onlineDate != null) { if (DateTime.Now.Date == onlineDate.Value.Date) { #region Update datetime from online to offline server //***********************Update datetime from online to offline server************************************** string Activation_Key = "", StartDate = "", EndDate = "", msg = ""; string mEncryptStartDate = "", mEncryptEndDate = "", mEncryptCurrentDate = ""; if (OnlineActivationTools.IsValidLicenseDate(out Activation_Key)) { //*******************GET ONLINE DATABASE <START DATE> AND <END DATE> PERIOD********************* OnlineActivationTools.OutOlnActivationDate(Activation_Key, out StartDate, out EndDate); //*******************ENCRIPT DATE **************************************************************** string CurrentDate = DateTime.Now.ToString(); mEncryptStartDate = CryptorEngine.Encrypt(StartDate, true); mEncryptEndDate = CryptorEngine.Encrypt(EndDate, true); mEncryptCurrentDate = CryptorEngine.Encrypt(CurrentDate, true); string qry = "update ApplicationInfo set StartDate='" + mEncryptStartDate + "',EndDate='" + mEncryptEndDate + "',CurrentDate='" + mEncryptCurrentDate + "'"; if (SQLHelper.GetInstance().ExcuteQuery(qry, out msg)) { } } #endregion } else { if (MessageBox.Show("Your system Date and Time is not currect \n you can chang the Date and Time in now ? ", "Invalid Date", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { //*******************Set System Date **************************************************************** onlineDate.SetSystemDate(); DesktopNotify("System Date Changing Successfull", ToolTipIcon.Info); } else { DesktopNotify("Please Set Current Date and Time in Your system", ToolTipIcon.Warning); Application.Exit(); } } } } }
public static AzureSQLHelper GetInstance() { if (mInstance == null) { CONNECTION_STRING = string.Empty; CONNECTION_STRING = "Server =tcp:dtl.database.windows.net,1433; Initial Catalog = DC_DAPRO; " + "Persist Security Info = False;" + mUserPass + "MultipleActiveResultSets = False; Encrypt = True; " + "TrustServerCertificate = False; Connection Timeout = 30"; mInstance = new AzureSQLHelper(); if (!CheckInternetconnection.CheckForInternetConnection()) { MessageBox.Show("Internet connection not available.", "Please check your internet connection.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } return(mInstance); }