protected void Commit_Click(object sender, EventArgs e) { IMyLog logUpgrade = MyLog.GetLogger("Upgrade"); try { UpdateInfo priceInfo = getHardcodedPriceInfoOrGoBackToPricePage(); int howManyNumbers = 0; int.TryParse(HowManyNumbers.SelectedItem.Value, out howManyNumbers); int howManyMessages = 0; int.TryParse(HowManyMessages.SelectedItem.Value, out howManyMessages); int howManyTopups = 0; int.TryParse(HowManyTopups.SelectedItem.Value, out howManyTopups); int fullpayment = 0; int.TryParse(FullPayment.SelectedItem.Value, out fullpayment); logUpgrade.Info("Commit"); Data_AppUserWallet wal = Data_AppUserWallet.Create( sd.LoggedOnUserEmail, TitleId.Text, priceInfo.Info, priceInfo.Type, new AmountAndPrice(howManyNumbers, GetPrice(priceInfo.Number)), new AmountAndPrice(howManyMessages, GetPrice(priceInfo.Message)), new AmountAndPrice(howManyTopups, GetPrice(priceInfo.Month)), new AmountAndPrice(1, GetPrice(priceInfo.OneTimeSetup)), new AmountAndPrice(fullpayment, GetPrice(priceInfo.FullPayment))); string emailBody = wal.GetEmailBody(sd.LoggedOnUserName, sd.LoggedOnUserEmail); bool alreadyThere; DSSwitch.appWallet().StoreNew(wal, out alreadyThere, logUpgrade); EMail.SendGeneralEmail(sd.LoggedOnUserEmail, true, wal.Title, emailBody, new LogForEmailSend(MyLog.GetLogger("Email"))); showStoredData(wal); } catch (DataUnavailableException) { DSSwitch.OnDataUnavailableException(this); } catch (Exception ex) { logUpgrade.Debug(ex.Message); } }
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(); } } }
protected void CancelCommit_Click(object sender, EventArgs e) { IMyLog logUpgrade = MyLog.GetLogger("Upgrade"); try { logUpgrade.Info("CancelCommit_Click"); sd.QuickMessage = "You have just cancelled your upgrade request"; sd.QuickMessageGood = true; DSSwitch.appWallet().DeleteOne(sd.LoggedOnUserEmail, logUpgrade); Response.Redirect("~/Price"); } catch (DataUnavailableException) { DSSwitch.OnDataUnavailableException(this); } catch (Exception ex) { logUpgrade.Debug(ex.Message); } }
public static void Go(IMyLog log, QuestionOption it) { DSSwitch.appWallet().RetrieveAll( delegate(Data_AppUserWallet w1) { Console.WriteLine(); Console.WriteLine(w1.RequestedType.ToString()); Console.WriteLine(w1.Title); Console.WriteLine(w1.Email); foreach (var l1 in w1.DisplayLines) { Console.WriteLine(l1); } Console.WriteLine(w1.Setup.ToString("Setup")); Console.WriteLine(w1.Messages.ToString("Messages")); Console.WriteLine(w1.Month.ToString("Month")); Console.WriteLine(w1.Numbers.ToString("Numbers")); Console.WriteLine(); PriceAndText pt = w1.CalucateCost(); Console.WriteLine(pt.Explained); Console.WriteLine(pt.FinalPrice); }, log); }
protected void Page_Load(object sender, EventArgs e) { // This comes from the Admin User (protected) try { string id = Request["id"]; IMyLog logItemX = MyLog.GetLogger("ItemX"); switch (id) { case "GetAllTelNumbers": // as used by the fone NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); Response.ContentType = "text/plain"; Response.Write("GetAllTelNumbers:\r\n"); Response.Write(DateTime.UtcNow.ToString() + "\r\n"); { int telCounter = 0; int userCounter = 0; List <MobileNoHandlerWithUserName> commercialUsersToConfirm = new List <MobileNoHandlerWithUserName>(); DSSwitch.appUser().RetrieveAll( Data_AppUserFile.SortType.Date, delegate(Data_AppUserFile d) { if ((d.AccountStatus == Data_AppUserFile.eUserStatus.verified_welcome_No_sent) || (d.AccountStatus == Data_AppUserFile.eUserStatus.verified_welcome_queued) || (d.AccountStatus == Data_AppUserFile.eUserStatus.verified_checkingTelNumbers)) { userCounter++; Response.Write("User: "******"\r\n"); foreach (string m1 in d.MobileNumbers_AllConfirmed__.MobileNumberArray) { telCounter++; Response.Write(m1 + "\r\n"); } foreach (string m1 in d.MobileNumbers_AllUnConfirmed__.MobileNumberArray) { telCounter++; Response.Write(m1 + "\r\n"); } } else if ( (d.AccountStatus == Data_AppUserFile.eUserStatus.commercial_monthly) || (d.AccountStatus == Data_AppUserFile.eUserStatus.commercial_payassent)) { if (d.AddNumber_ActivateOnSyncRequest) { userCounter++; Response.Write("User: "******"\r\n"); MobileNoHandlerWithUserName conf = new MobileNoHandlerWithUserName(d.Email); foreach (string tel1 in d.MobileNumbers_AllUnConfirmed__.MobileNumberArray) { telCounter++; Response.Write(tel1 + "\r\n"); conf.Handler.Add(tel1); } commercialUsersToConfirm.Add(conf); } } }, logItemX); Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString() + "\r\n"); } break; case "GetTelNumbersBlockedUsers": Response.ContentType = "text/plain"; Response.Write("GetTelNumbersBlockedUsers:\r\n"); Response.Write(DateTime.UtcNow.ToString() + "\r\n"); { int telCounter = 0; int userCounter = 0; DSSwitch.appUser().RetrieveAll( Data_AppUserFile.SortType.Date, delegate(Data_AppUserFile d) { if (d.AccountStatus == Data_AppUserFile.eUserStatus.blocked) { userCounter++; Response.Write("User: "******"\r\n"); foreach (string m1 in d.MobileNumberArray()) { telCounter++; Response.Write(m1 + "\r\n"); } } }, logItemX); Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString()); } break; case "GetTelNumbers": // no check as this comes from the TrayApp - NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); Response.ContentType = "text/plain"; Response.Write("GetTelNumbers:\r\n"); Response.Write(DateTime.UtcNow.ToString() + "\r\n"); { int telCounter = 0; int userCounter = 0; DSSwitch.appUser().RetrieveAll( Data_AppUserFile.SortType.Date, delegate(Data_AppUserFile d) { if (d.IsAccountActive("Welcome")) { userCounter++; Response.Write("User: "******"\r\n"); foreach (string m1 in d.MobileNumberArray()) { telCounter++; Response.Write(m1 + "\r\n"); } } }, logItemX); Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString()); } break; case "Home": Response.Redirect("~/"); break; case "LibVer": NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); Assembly a = Assembly.GetAssembly(typeof(IMyLog)); Response.ContentType = "text/plain"; a.WriteAssemblyVersion(Response.Output); break; case "DSSwitch": NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); Response.ContentType = "text/plain"; Response.Write("appUser: "******"\r\n"); Response.Write("appWallet: " + DSSwitch.appWallet().GetInfo() + "\r\n"); Response.Write("msgFile00: " + DSSwitch.msgFile00().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n"); Response.Write("msgFile02: " + DSSwitch.msgFile02().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n"); Response.Write("msgFile04: " + DSSwitch.msgFile04().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n"); Response.Write(DSSwitch.GetMaintenanceLog() + "\r\n"); break; case "SetSubSystem": NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); string val = Request["val"]; var sub = DSSwitch.full().GetSystems(false).FirstOrDefault(_ => _.Name == val); if (sub == null) { Response.ContentType = "text/plain"; Response.Write("No such SubSystem " + val + "\r\n"); } else { SessionData.SessionsSystem_Set(Session, sub); Response.Redirect("~/Admin.aspx"); } break; case "ShowSubSystem": NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); Response.ContentType = "text/plain"; DSSwitch.full().GetSystems(false).ForEach(_ => Response.Write(string.Format("{0}, {1}, {2}\r\n", _.Name, _.APIId, _.Default))); Response.Write("\r\n"); var cur = SessionData.SessionsSystem_Get(Session); Response.Write(string.Format("currently on\r\n{0}, {1}, {2}\r\n", cur.Name, cur.APIId, cur.Default)); break; case "Screen": NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); Response.ContentType = "image/png"; byte[] baImg; using (DataFile_ScreenShot ss = new DataFile_ScreenShot(NiceASP.SessionData.SessionsSystem_Get(Session), DataFile_Base.OpenType.ReadOnly_CreateIfNotThere)) { MemoryStream ms = new MemoryStream(); ss.imgScreen.Save(ms, System.Drawing.Imaging.ImageFormat.Png); baImg = ms.ToArray(); } Response.OutputStream.Write(baImg, 0, baImg.Length); Response.OutputStream.Flush(); break; case "AllValues": NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); Response.ContentType = "text/plain"; int count = 0; foreach (string k1 in Request.ServerVariables) { Response.Write(count++.ToString() + ":" + k1 + " = " + Request.ServerVariables[k1] + "\r\n"); } using (StreamReader sr = new StreamReader(Request.InputStream)) { Response.Write(sr.ReadToEnd()); Response.Write("\r\n"); } Response.Write("Done a"); break; case "TestX": NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); Response.ContentType = "text/plain"; string pathX = Request.ServerVariables["APPL_PHYSICAL_PATH"]; Response.Write("in1b: " + pathX + "\n"); pathX = Directory.GetParent(pathX).FullName; foreach (string p1 in Directory.GetFiles(pathX)) { Response.Write(p1 + "\n"); } Response.Write("in2: " + pathX + "\n"); pathX = Directory.GetParent(pathX).FullName; foreach (string p1 in Directory.GetFiles(pathX)) { Response.Write(p1 + "\n"); } Response.Write("in3: " + pathX + "\n"); foreach (string p1 in Directory.GetFiles(pathX)) { Response.Write(p1 + "\n"); } throw new NotImplementedException("end"); case "Dir": NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); FolderNames.CreateFoldersForAsp(NiceASP.SessionData.SessionsSystem_Get(Session)); Response.ContentType = "text/plain"; Response.Write("Done Dir"); break; default: NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true); throw new ArgumentException(); //break; } } catch (Exception se) { Response.ContentType = "text/plain"; Response.Write("ups"); Response.Write(se.ToString()); Response.Write(se.Message); } }