コード例 #1
0
        protected void Zapisz_click(object sender, EventArgs e)
        {
            SMSServiceConfiguration newConfig = new SMSServiceConfiguration()
            {
                Sender = txtSender.Text
                ,
                Username = txtUser.Text
                ,
                Password = txtPassword.Text
                ,
                IsFlash = cbIsFlash.Checked
                ,
                IsTest = cbIsTest.Checked
                ,
                MessageTemplate = txtTemplate.Text
            };

            if (new SMSServiceDAO().SaveSMSConfig(newConfig))
            {
                msg.Text = "Konfiguracja zapisana poprawnie";
            }
            else
            {
                msg.Attributes["style"] = "color:red;";
                msg.Text = "Błąd w trakcie zapisu konfiguracji";
            }
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SMSServiceDAO           dao    = new SMSServiceDAO();
         SMSServiceConfiguration config = dao.GetSMSConfig();
         bindConfig(config);
         msg.Text = string.Empty;
     }
 }
コード例 #3
0
 public bool SaveSMSConfig(SMSServiceConfiguration config)
 {
     try
     {
         db.ExecuteNonQuery("dbo.ZapiszKonfiguracjeSMS", config.Sender, config.Username, config.Password, config.IsFlash, config.IsTest, config.MessageTemplate);
         return(true);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
     }
     return(false);
 }
コード例 #4
0
 private void bindConfig(SMSServiceConfiguration config)
 {
     if (!(config is SMSServiceConfiguration))
     {
         return;
     }
     txtSender.Text    = config.Sender;
     txtUser.Text      = config.Username;
     txtPassword.Text  = config.Password;
     txtTemplate.Text  = config.MessageTemplate;
     cbIsFlash.Checked = config.IsFlash;
     cbIsTest.Checked  = config.IsTest;
 }