示例#1
0
    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("APIForm"));
                rbTel1.Checked = true;
                setTelNo(labTel1, rbTel1, user.MobileNumberX(0));
                setTelNo(labTel2, rbTel2, user.MobileNumberX(1));
                setTelNo(labTel3, rbTel3, user.MobileNumberX(2));
                setTelNo(labTel4, rbTel4, user.MobileNumberX(3));
                setTelNo(labTel5, rbTel5, user.MobileNumberX(4));
                MessageText.Text = "What a great day.";
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
示例#2
0
    protected void SendMessage_Click(object sender, EventArgs e)
    {
        MyLog.GetLogger("APIForm").Info("APIForm send message");
        SessionData      sd   = ConstantStrings.GetSessionData(Session);
        Data_AppUserFile user = null;

        try
        {
            user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, MyLog.GetLogger("APIForm"));
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
        bool   bFound  = false;
        string telText = "";

        getTextDependOnRadiobox(rbTel1, user.MobileNumberX(0), ref telText, ref bFound);
        getTextDependOnRadiobox(rbTel2, user.MobileNumberX(1), ref telText, ref bFound);
        getTextDependOnRadiobox(rbTel3, user.MobileNumberX(2), ref telText, ref bFound);
        getTextDependOnRadiobox(rbTel4, user.MobileNumberX(3), ref telText, ref bFound);
        getTextDependOnRadiobox(rbTel5, user.MobileNumberX(4), ref telText, ref bFound);

        if (bFound)
        {
            string sRet = new APIActualSending(sd.LoggedOnUsersNiceSystemInfo).SendWhatsApp(user.ApiGuId, telText, MessageText.Text, MyLog.GetLogger("APIForm"));
            MyLog.GetLogger("APIForm").Info("APIForm " + sRet);
            State1.Visible      = false;
            State2.Visible      = true;
            sent2.InnerHtml     = APIActualSending.fakeRequest(user.ApiGuId, telText, MessageText.Text);
            received2.InnerHtml = APIActualSending.fakeResponse(sRet);
        }
    }
示例#3
0
    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);
        }
    }
示例#4
0
        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);
        }
示例#5
0
        public static bool SendJustActivated(Data_AppUserFile user, LogForEmailSend log)
        {
            try
            {
                string to      = user.Email;
                string subject = "Register with NiceApi.net";

                Assembly assembly         = Assembly.GetExecutingAssembly();
                string   htmlBodyNoHeader = new StreamReader(assembly.GetManifestResourceStream("NiceApiLibrary.Embedded.JustActivated.txt")).ReadToEnd();
                htmlBodyNoHeader = htmlBodyNoHeader
                                   .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)));

                string error;

                return(Send(EMailCredentials.GetSupport(), to, subject, htmlBodyNoHeader, out error, log, "JustActivated"));
            }
            catch (SystemException)
            {
            }
            return(false);
        }