예제 #1
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);
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This come from an anonymous browser
        try
        {
            if (!IsPostBack)
            {
                if (!FolderNames.IsDevMachine())
                {
                    if (Request["SCRIPT_NAME"] != "/default.aspx")
                    {
                        Response.Redirect("~/ItemX.aspx?id=Home");
                    }
                }

                Page.MetaKeywords    = "API, Online, Send Whatsapp message, Free";
                Page.MetaDescription = "Let your application send you WhatsApp messages. Sign up for free today.";
                NiceASP.KeywordLoader.Load(this, KeywordLoader.Which.Default);
                ExOut.InnerHtml = APIActualSending.fakeRequest("<Your unique X-APIId>", "<Mobile number>", "What a great day");
                ExRes.InnerHtml = APIActualSending.fakeResponse("queued");
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }