public bool HasAccount(string email, IMyLog log) { string folder = FolderNames.GetFolder(NiceSystemInfo.DEFAULT, MyFolders.ASP_UserAccountFolder_); string file = folder + Path.DirectorySeparatorChar + Data_AppUserFile.EmailSaveChars(email) + ".txt"; if (File.Exists(file)) { return(true); } return(false); }
public static void CommitOrThrow_Send(this Data_AppUserFile appUserFile, string[] telList, bool isWelcomeMessage, int MessageLength, ref Data_AppUserFile.eUserStatus accountStatus, out bool sendFooter) { sendFooter = true; Data_AppUserFile_CheckerBase checker = appUserFile.GetCheckerBase(); if (checker == null) { throw new ArgumentException("Account not active (5). " + appUserFile.AccountStatusExplained()); } checker.CommitOrThrow_Send(appUserFile.MobileNumbers_AllConfirmed__, telList, isWelcomeMessage, MessageLength, ref appUserFile.AccountStatus, out sendFooter); }
private void showUsers_tableEntry(Data_AppUserFile u1, string emailFile) { Response.Write("<tr>"); Response.Write("<td>" + HttpUtility.HtmlEncode(u1.Email) + "</td>"); Response.Write("<td>" + HttpUtility.HtmlEncode(CountryListLoader.Lookup(u1.MainTelNo())) + "</td>"); Response.Write("<td>" + u1.MobileNumbersCount().ToString() + "</td>"); Response.Write("<td>" + new DateTime(u1.CreationDate).ToString("dd/MM/yyyy") + "</td>"); Response.Write("<td>" + u1.UsedInPercent().ToString() + "</td>"); if (u1.QueuedCount() > 0) { Response.Write("<td>" + u1.QueuedCount().ToString() + "</td>"); } else { Response.Write("<td></td>"); } if ( (u1.AccountStatus == Data_AppUserFile.eUserStatus.free_account) || (u1.AccountStatus == Data_AppUserFile.eUserStatus.commercial_monthly) || (u1.AccountStatus == Data_AppUserFile.eUserStatus.commercial_payassent) || (u1.AccountStatus == Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice) || (u1.AccountStatus == Data_AppUserFile.eUserStatus.commercial_systemDuplication)) { // commercial or acive free Response.Write("<td><a href=\"Test?Id=ShowSentMessages&u=" + emailFile + "\" target=\"_blank\">" + u1.AccountStatus.ToString() + "</a></td>"); } else { // not active yet Response.Write("<td>" + HttpUtility.HtmlEncode(u1.AccountStatus.ToString()) + "</td>"); } if ( (u1.AccountStatus == Data_AppUserFile.eUserStatus.commercial_monthly) || (u1.AccountStatus == Data_AppUserFile.eUserStatus.commercial_payassent) || (u1.AccountStatus == Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice) || (u1.AccountStatus == Data_AppUserFile.eUserStatus.commercial_systemDuplication)) { string edit = "edit " + u1.GetCheckerBase(true).Info(u1); Response.Write("<td><a href=\"DataAll?user="******"\" target=\"_blank\">" + edit + "</a></td>"); } else { Response.Write("<td><a href=\"DataAll?user="******"\" target=\"_blank\">" + "edit" + "</a></td>"); } Response.Write("<td></td>"); //Response.Write("<td><a href=\"Test?Id=SendWelcomeSMS&u=" + emailFile + "\" target=\"_blank\">" + "WA_Wel" + "</a></td>"); //Response.Write("<td><a href=\"Test?Id=SendJustActivated&u=" + emailFile + "\" target=\"_blank\">" + "E_OnNow" + "</a></td>"); Response.Write("</tr>"); }
public static void AddCommentLine(this Data_AppUserFile appUserFile, string text, bool withTime) { if (appUserFile.Comment.Length > 0) { appUserFile.Comment += "\r\n"; } if (withTime) { appUserFile.Comment += DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss: "); } appUserFile.Comment += text; }
private void Init(string data, bool dataIsEmail) { if (dataIsEmail) { this.Email = data; this.APIId = null; } else { this.Email = Data_AppUserFile.API_IdToEmail(data); this.APIId = data; } }
private string createMessageFile(NiceSystemInfo niceSystem, int telId, string telNumber, string cleanMessage, string email, DateTime utcNow, IMyLog log, bool noCounterUpdate, bool sendFooter, Int32 MaxFailBeforeDispose) { Data_Net__00NormalMessage msg = new Data_Net__00NormalMessage( Data_AppUserFile.EmailSaveChars(email), "zapi_" + telNumber, utcNow.Ticks + (Int64)telId, sendFooter ? cleanMessage + "\r\nSent via NiceApi.net\r\n" : cleanMessage + "\r\n", 0, MaxFailBeforeDispose, noCounterUpdate); DSSwitch.msgFile00().Store(niceSystem, msg, Data_Net__00NormalMessage.eLocation.Queued, log); return(msg.GetFileName()); }
protected void checkPasswordWithConfirm_ServerValidate(ref bool bOk) { resetError(errorConfirmPassword); resetError(errorPassword); if (Password.Text != ConfirmPassword.Text) { setError(errorConfirmPassword, "The password and confirm password do not match.", ref bOk); } else { string error = Data_AppUserFile.Check_Password(Password.Text); if (error != null) { setError(errorPassword, error, ref bOk); } } }
public static bool SendRegisterActivation(Data_AppUserFile user, LogForEmailSend log) { try { string to = user.Email; string subject = "Register with NiceApi.net"; string htmlBodyNoHeader = EMail_Data.GetRegistrationEmailBody("https://NiceApi.net/Register?ApiGuId=" + Base64_URLEncoding(user.ApiGuId)); string error; bool ret = Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "Verify Please"); return(ret); } catch (SystemException) { } return(false); }
public Data_AppUserFile RetrieveOne(string email, IMyLog log) { string folder = FolderNames.GetFolder(NiceSystemInfo.DEFAULT, MyFolders.ASP_UserAccountFolder_); string filePath = folder + Path.DirectorySeparatorChar + Data_AppUserFile.EmailSaveChars(email) + ".txt"; Data_AppUserFile o = Data_AppUserFile.CreateBlank(); Stream stream = OpenFile.ForRead(filePath, false, false, log); if (stream == null) { return(null); } using (BinaryReader br = new BinaryReader(stream)) { o.ReadFromStream(br); } return(o); }
public void RetrieveAll(Data_AppUserFile.SortType sort, d1_Data_AppUserFile d, IMyLog log) { List <Data_AppUserFile> allUsers = new List <Data_AppUserFile>(); foreach (string s1 in Directory.GetFiles(FolderNames.GetFolder(NiceSystemInfo.DEFAULT, MyFolders.ASP_UserAccountFolder_))) { string file = Path.GetFileNameWithoutExtension(s1); Data_AppUserFile u1 = this.RetrieveOne(file, log); allUsers.Add(u1); } Sort(allUsers, sort); foreach (Data_AppUserFile u1 in allUsers) { if (d != null) { d(u1); } } }
protected void Page_Load(object sender, EventArgs e) { // This comes from the AdminTool try { Response.ContentType = "text/plain"; string XAPIId = Request.Headers["X-APIId"]; string email_ = Data_AppUserFile.API_IdToEmail(XAPIId); string email = Data_AppUserFile.EmailToRealEmail(email_); Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(email, MyLog.GetLogger("APICredit")); switch (user.AccountStatus) { case Data_AppUserFile.eUserStatus.commercial_monthly: Response.Write(user.MonthlyAccount.monthly_CurrentCredit.ToString()); break; case Data_AppUserFile.eUserStatus.commercial_payassent: Response.Write(user.PayAsSentAccount.payAsSent_CurrentCredit.ToString()); break; case Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice: Response.Write(user.MonthlyDifPriceAccount.monthlyDifPrice_CurrentCredit.ToString()); break; case Data_AppUserFile.eUserStatus.commercial_systemDuplication: Response.Write(user.SystemDuplicationAccount.systemDuplication_PaidUntil.ToUkTime(false)); break; default: Response.Write(Data_AppUserFile.GetNiceStatusText(user.AccountStatus)); break; } } catch (Exception) { Response.ContentType = "text/plain"; Response.Write("Fehler"); } }
public static bool SendUpgrade032018(Data_AppUserFile user, LogForEmailSend log) { try { string to = user.Email; string subject = "Hardware upgrade"; Assembly assembly = Assembly.GetExecutingAssembly(); string htmlBodyNoHeader = new StreamReader(assembly.GetManifestResourceStream("NiceApiLibrary.Embedded.ServerMove032018EmialText.txt")).ReadToEnd(); htmlBodyNoHeader = doFieldReplacement(htmlBodyNoHeader, user); string error; return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "Upgrade032018")); } catch (SystemException) { } return(false); }
public static bool SendWrongTelRegistered(Data_AppUserFile user, LogForEmailSend log) { try { string to = user.Email; string subject = "Your registration with with NiceApi.net"; Assembly assembly = Assembly.GetExecutingAssembly(); string htmlBodyNoHeader = new StreamReader(assembly.GetManifestResourceStream("NiceApiLibrary.Embedded.Reg_TelWrong_EmailText.txt")).ReadToEnd(); htmlBodyNoHeader = doFieldReplacement(htmlBodyNoHeader, user); string error; return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "WrongTelRegistered")); } catch (SystemException) { } return(false); }
private static string doFieldReplacement(string htmlBodyNoHeader, Data_AppUserFile user) { string strActivationDate = (new DateTime(user.CreationDate)).ToString("dd MMMM yyyy"); htmlBodyNoHeader = htmlBodyNoHeader .Replace("{SentCount}", user.SentCount().ToString()) .Replace("{User}", System.Web.HttpUtility.HtmlEncode(user.UserName)) .Replace("{RegistrationDate}", System.Web.HttpUtility.HtmlEncode(strActivationDate)) .Replace("{Name}", System.Web.HttpUtility.HtmlEncode(user.UserName)) .Replace("{Email}", System.Web.HttpUtility.HtmlEncode(user.Email)) .Replace("{Password}", System.Web.HttpUtility.HtmlEncode(user.Password)) .Replace("{APIId}", System.Web.HttpUtility.HtmlEncode(user.ApiGuId)) .Replace("{Mobile1}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(0))) .Replace("{Mobile2}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(1))) .Replace("{Mobile3}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(2))) .Replace("{Mobile4}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(3))) .Replace("{Mobile5}", System.Web.HttpUtility.HtmlEncode(user.MobileNumberX(4))) .Replace("{NiceAPI_Number}", System.Web.HttpUtility.HtmlEncode(System.Configuration.ConfigurationManager.AppSettings["NiceAPI_Number"])); return(htmlBodyNoHeader); }
public static bool SendUpgradeRequestOnHighPercent(Data_AppUserFile user, LogForEmailSend log) { try { string to = user.Email; string subject = "Your account usage"; Assembly assembly = Assembly.GetExecutingAssembly(); string htmlBodyNoHeader = new StreamReader(assembly.GetManifestResourceStream("NiceApiLibrary.Embedded.UpgradeEmail.txt")).ReadToEnd(); htmlBodyNoHeader = doFieldReplacement(htmlBodyNoHeader, user); string error; return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, subject)); } catch (SystemException) { } return(false); }
public static string CommitOrThrow_TelNumberRemove(this Data_AppUserFile appUserFile, string TelList) { Data_AppUserFile_CheckerBase checker = appUserFile.GetCheckerBase(); if (checker == null) { throw new ArgumentException("Account not active (4). " + appUserFile.AccountStatusExplained()); } MobileNoHandler noToRemove = new MobileNoHandler(TelList); MobileHandleConfUnconfList existing = new MobileHandleConfUnconfList(); existing.Add(appUserFile.MobileNumbers_AllConfirmed__.getVal, true); existing.Add(appUserFile.MobileNumbers_AllUnConfirmed__.getVal, false); checker.CommitOrThrow_TelNumberRemove(existing, noToRemove); existing.Remove(TelList); string retString; existing.SortAndReturn(out appUserFile.MobileNumbers_AllConfirmed__, out appUserFile.MobileNumbers_AllUnConfirmed__, out retString); return(retString); }
protected void checkEmail_ServerValidate(ref bool bOk) { IMyLog log = MyLog.GetLogger("Register"); resetError(errorEmail); string error = Data_AppUserFile.Check_Email(Email.Text); if (error != null) { setError(errorEmail, error, ref bOk); } else if (DSSwitch.appUser().HasAccount(Email.Text, log)) { setError(errorEmail, "Email is already registred.", ref bOk); } else if (isOnBlacklist(Email.Text)) { log.Debug("Blacklisted " + Email.Text + " refused"); setError(errorEmail, "Email is invalid", ref bOk); } }
public override string Info(Data_AppUserFile user) { StringBuilder sb = new StringBuilder(); sb.Append("SD: "); if (DateTime.UtcNow.Ticks > duplicationAccount.systemDuplication_PaidUntil) { // expired TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - duplicationAccount.systemDuplication_PaidUntil); sb.AppendFormat("Expired {0:0}Days ", ts.TotalDays); } else { // active TimeSpan ts = new TimeSpan(duplicationAccount.systemDuplication_PaidUntil - DateTime.UtcNow.Ticks); sb.AppendFormat("{0:0.0}DaysLeft ", ts.TotalDays); } sb.Append(user.MonthlyAccount.monthly_CurrentCredit.ToString() + " "); sb.Append(duplicationAccount.systemDuplication_LastMsgQueued.ToSwissTime(false)); return(sb.ToString()); }
public void Update_General(string email, d_On_User_Action action, Object args, d_On_User_PostAction postAction, IMyLog log) { string filePath = FolderNames.GetFolder(NiceSystemInfo.DEFAULT, MyFolders.ASP_UserAccountFolder_) + Path.DirectorySeparatorChar + Data_AppUserFile.EmailSaveChars(email) + ".txt"; using (Stream stream = OpenFile.ForRead(filePath, true, true, log)) { Data_AppUserFile r = null; if (stream != null) { r = Data_AppUserFile.CreateBlank(); //1) read it in BinaryReader br = new BinaryReader(stream); r.ReadFromStream(br); } //2) update values if (action != null) { action(r, args); } //3) write it back if (r != null) { stream.Seek(0, SeekOrigin.Begin); BinaryWriter bw = new BinaryWriter(stream); r.WriteToStream(bw); stream.SetLength(stream.Position); stream.Close(); } } if (postAction != null) { postAction(args); } }
protected void Page_Load(object sender, EventArgs e) { // This comes from a logged in user NiceASP.SessionData.LoggedOnOrRedirectToLogin(Session, Response, Request); sd = ConstantStrings.GetSessionData(Session); if (!IsPostBack) { // check if a committed request exists, if so display it Data_AppUserWallet existingWallet = DSSwitch.appWallet().RetrieveOne( sd.LoggedOnUserEmail, MyLog.GetVoidLogger()); Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, MyLog.GetVoidLogger()); if ((user != null) && (user.AccountStatus != Data_AppUserFile.eUserStatus.free_account)) { MainSection_Normal.Visible = false; TitleId.Text = "Upgrade Request"; string niceName = Data_AppUserFile.GetNiceStatusText(user.AccountStatus); Literal1.Text = "You currently hold a " + niceName + " account. Please contact us to do the upgrade."; } else if ((existingWallet != null) && (existingWallet.HasUpgradeRequest())) { // display existing request showStoredData(existingWallet); } else { // no commit yet UpdateInfo priceInfo = getHardcodedPriceInfoOrGoBackToPricePage(); TitleId.Text = priceInfo.Title + " - Upgrade Request"; userName.Text = sd.LoggedOnUserName; InfoText.Text = new UpgradeTextList(priceInfo.Info).GetAsHTML; alterStep1DivVisibility(true, priceInfo, 0, 0, 0, 0); CalculateButton.Focus(); } } }
public override string Info(Data_AppUserFile user) { StringBuilder sb = new StringBuilder(); sb.Append("Md: "); if (user.MonthlyDifPriceAccount.HasExpired()) { // expired TimeSpan ts = user.MonthlyDifPriceAccount.ExpiredSince(); sb.AppendFormat("Expired {0:0}Days ", ts.TotalDays); } else { // active TimeSpan ts = user.MonthlyDifPriceAccount.TimeLeft(); sb.AppendFormat("{0:0.0}DaysLeft ", ts.TotalDays); } sb.Append(user.MonthlyDifPriceAccount.monthlyDifPrice_CurrentCredit.ToString() + " "); sb.Append($"L{user.MonthlyDifPriceAccount.monthlyDifPrice_Level} "); sb.Append(user.MonthlyDifPriceAccount.monthlyDifPrice_LastMsgQueued.ToSwissTime(false)); return(sb.ToString()); }
public void StoreNew(Data_AppUserFile data, out bool fileArleadyUsed, IMyLog log) { fileArleadyUsed = false; string folder = FolderNames.GetFolder(NiceSystemInfo.DEFAULT, MyFolders.ASP_UserAccountFolder_); string file = folder + Path.DirectorySeparatorChar + Data_AppUserFile.EmailSaveChars(data.Email) + ".txt"; if (File.Exists(file)) { fileArleadyUsed = true; return; } try { using (BinaryWriter bw = new BinaryWriter(OpenFile.ForWrite(file, log))) { data.WriteToStream(bw); } } catch (IOException) { } }
public static String AccountStatusExplained(this Data_AppUserFile appUserFile) { switch (appUserFile.AccountStatus) { case Data_AppUserFile.eUserStatus.email_sent_for_verification: return("An email has beed sent to you to verify your email address."); case Data_AppUserFile.eUserStatus.verified_welcome_No_sent: return("Your email address is verified. Please allow us 48 hours to activate your account."); case Data_AppUserFile.eUserStatus.verified_welcome_queued: return("Your email address is verified. We have queued a welcome message for you."); case Data_AppUserFile.eUserStatus.verified_checkingTelNumbers: return("Your email address is verified. We are verifying your numbers."); case Data_AppUserFile.eUserStatus.blocked: return("Your account has been blocked. Please contact support to resolve the issue."); case Data_AppUserFile.eUserStatus.free_account: return("Your account is active"); case Data_AppUserFile.eUserStatus.commercial_monthly: return("Your commercial account is active"); case Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice: return("Your commercial account is active"); case Data_AppUserFile.eUserStatus.commercial_payassent: return("Your commercial account is active"); case Data_AppUserFile.eUserStatus.commercial_systemDuplication: return("Your commercial account is active"); default: return("Account not active (6)"); } }
public string Process_Registration(NiceSystemInfo niceSystem, out bool fileArleadyUsed, bool sendActivationEmail, string UserName, string MoblieAllNumbers, string Email, string Password, string CreationIp, string WhereHeardText, IMyLog log, LogForEmailSend log4Email) { StringBuilder sbInfo = new StringBuilder(); fileArleadyUsed = true; try { timeNow = DateTime.UtcNow; Data_AppUserFile ud = Data_AppUserFile.Create( UserName, true, MoblieAllNumbers, Email, Password, CreationIp); sbInfo.Append(ud.ApiGuId); DSSwitch.appUser().StoreNew(ud, out fileArleadyUsed, log); if (!fileArleadyUsed) { if (sendActivationEmail) { EMail.SendRegisterActivation(ud, log4Email); } if (log != null) { log.Info(ud.Email + " account created"); } if (log != null) { log.Info("WhereHeard " + WhereHeardText); } } } catch (ArgumentException ae) { sbInfo.Append(ae.Message); } catch (Exception) { sbInfo.Append("ERROR"); } return(sbInfo.ToString()); }
protected void Page_Load(object sender, EventArgs e) { // This comes from a logged in user try { NiceASP.SessionData.LoggedOnOrRedirectToLogin(Session, Response, Request); if (!IsPostBack) { SessionData sd = ConstantStrings.GetSessionData(Session); // refresh from file IMyLog log = MyLog.GetLogger("Details"); Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, log); UserName.Text = user.UserName; UserEmail.Text = user.Email; if (user.MobileNumbersCount() > 5) { Tel1.Text = Tel2.Text = Tel3.Text = Tel4.Text = Tel5.Text = "Many"; } else { Tel1.Text = user.MobileNumberX(0); Tel2.Text = user.MobileNumberX(1); Tel3.Text = user.MobileNumberX(2); Tel4.Text = user.MobileNumberX(3); Tel5.Text = user.MobileNumberX(4); } ApiGuId.Text = user.ApiGuId; Status.Text = Data_AppUserFile.GetNiceStatusText(user.AccountStatus); } } catch (DataUnavailableException) { DSSwitch.OnDataUnavailableException(this); } }
public override void OnProcessed(Data_AppUserFile user, OnProcessedHandler args) { }
public override string Info(Data_AppUserFile user) { return($"Default {Data_AppUserFile.GetNiceStatusText(user.AccountStatus)} {user.AccountStatus.Importance()}"); }
public abstract void OnProcessed(Data_AppUserFile user, OnProcessedHandler args);
public abstract string Info(Data_AppUserFile user);
protected void Page_Load(object sender, EventArgs e) { // This comes from a logged in user try { NiceASP.SessionData.LoggedOnOrRedirectToLogin(Session, Response, Request); if (!IsPostBack) { SessionData sd = ConstantStrings.GetSessionData(Session); // refresh from file Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, MyLog.GetLogger("Counters")); if (user != null) { switch (user.AccountStatus) { case Data_AppUserFile.eUserStatus.free_account: sectionFree.Visible = true; F_Tel1.Text = user.MobileNumbers_AllConfirmed__.MobileNumberX(0); F_Tel2.Text = user.MobileNumbers_AllConfirmed__.MobileNumberX(1); F_Tel3.Text = user.MobileNumbers_AllConfirmed__.MobileNumberX(2); F_Tel4.Text = user.MobileNumbers_AllConfirmed__.MobileNumberX(3); F_Tel5.Text = user.MobileNumbers_AllConfirmed__.MobileNumberX(4); F_LastMsgQueued.Text = user.FreeAccount.free_LastMsgQueued.ToUkTime(false); F_MsgSent.Text = (user.FreeAccount.free_MsgQueued + user.FreeAccount.free_MsgSent).ToString(); F_MsgLeft.Text = user.FreeAccount.free_MsgLeft.ToString(); F_MinDelayInSeconds.Text = user.FreeAccount.free_MinDelayInSeconds.ToString() + " seconds"; break; case Data_AppUserFile.eUserStatus.commercial_monthly: sectionMonthly.Visible = true; M_Tels.Text = user.MobileNumbers_AllConfirmed__.getVal; M_ActiveUntil.Text = user.MonthlyAccount.monthly_PaidUntil.ToUkTime(false); if (user.MonthlyAccount.monthly_PaidUntil < DateTime.UtcNow.Ticks) { M_ActiveUntil.BackColor = System.Drawing.Color.Red; } M_LastQueued.Text = user.MonthlyAccount.monthly_LastMsgQueued.ToUkTime(false); M_CurrentCredit.Text = user.MonthlyAccount.monthly_CurrentCredit.ToString(); M_CostPerNumber.Text = user.MonthlyAccount.monthly_CostPerNumber.ToString(); M_MsgSent.Text = user.MonthlyAccount.monthly_MsgSent.ToString(); M_MinDelayInSeconds.Text = user.MonthlyAccount.monthly_MinDelayInSeconds.ToString() + " seconds"; break; case Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice: sectionMonthlyDifPrice.Visible = true; M2_Tels.Text = user.MobileNumbers_AllConfirmed__.getVal; M2_ActiveUntil.Text = user.MonthlyDifPriceAccount.PaidUntil().Ticks.ToUkTime(true); if (user.MonthlyDifPriceAccount.PaidUntil() < DateTime.UtcNow) { M2_ActiveUntil.BackColor = System.Drawing.Color.Red; } M2_LastQueued.Text = user.MonthlyDifPriceAccount.monthlyDifPrice_LastMsgQueued.ToUkTime(false); M2_CurrentCredit.Text = user.MonthlyDifPriceAccount.monthlyDifPrice_CurrentCredit.ToString(); M2_CostPerNumber.Text = user.MonthlyDifPriceAccount.monthlyDifPrice_CostPerNumber.ToString(); M2_TotalMsgSent.Text = user.MonthlyDifPriceAccount.monthlyDifPrice_TotalMsgSent.ToString(); M2_MsgSentThisPeriod.Text = user.MonthlyDifPriceAccount.monthlyDifPrice_ThisMonthMsgSent.ToString(); break; case Data_AppUserFile.eUserStatus.commercial_payassent: sectionPayAsSent.Visible = true; P_Tels.Text = user.MobileNumbers_AllConfirmed__.getVal; P_CurrentCredit.Text = user.PayAsSentAccount.payAsSent_CurrentCredit.ToString(); P_CostPerNumber.Text = user.PayAsSentAccount.payAsSent_CostPerNumber.ToString(); P_CostPerMessage.Text = user.PayAsSentAccount.payAsSent_CostPerMessage.ToString(); P_LastQueued.Text = user.PayAsSentAccount.payAsSent_LastMsgQueued.ToUkTime(false); P_MsgSent.Text = user.PayAsSentAccount.payAsSent_MsgSent.ToString(); P_MinDelayInSeconds.Text = user.PayAsSentAccount.payAsSent_MinDelayInSeconds.ToString() + " seconds"; break; case Data_AppUserFile.eUserStatus.commercial_systemDuplication: sectionSystemDuplication.Visible = true; D_ActiveUntil.Text = user.SystemDuplicationAccount.systemDuplication_PaidUntil.ToUkTime(false); if (user.SystemDuplicationAccount.systemDuplication_PaidUntil < DateTime.UtcNow.Ticks) { D_ActiveUntil.BackColor = System.Drawing.Color.Red; } D_LastQueued.Text = user.SystemDuplicationAccount.systemDuplication_LastMsgQueued.ToUkTime(false); D_MsgSent.Text = user.SystemDuplicationAccount.systemDuplication_MsgSent.ToString(); break; default: sectionWrong.Visible = true; X_Status.Text = Data_AppUserFile.GetNiceStatusText(user.AccountStatus); break; } } } } catch (DataUnavailableException) { DSSwitch.OnDataUnavailableException(this); } }