예제 #1
0
 protected void uiLinkButtonSend_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(uiTextBoxEnMail.Text))
     {
         Subscribers sub = new Subscribers();
         sub.AddNew();
         sub.Email = uiTextBoxEnMail.Text;
         sub.Save();
         uiLabelMessage.Visible = true;
     }
 }
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            bool done =false;

            if (CurrentSubscriber != null)
            {
                Subscribers objData = CurrentSubscriber;
                objData.Email = uiTextBoxEMail.Text;
                objData.Save();
            }
            else
            {
                Subscribers objData = new Subscribers();
                objData.AddNew();
                objData.Email = uiTextBoxEMail.Text;
                objData.Save();
            }

            uiPanelEdit.Visible = false;
            uiPanelViewSubscribers.Visible = true;
            BindData();
            Clearfields();
            CurrentSubscriber = null;
        }
        protected void uiGridViewSubscribers_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditSubscriber")
            {
                Subscribers objData = new Subscribers();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                uiTextBoxEMail.Text = objData.Email;
                uiPanelViewSubscribers.Visible = false;
                uiPanelEdit.Visible = true;
            }
            else if (e.CommandName == "DeleteSubscriber")
            {
                Subscribers objData = new Subscribers();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                objData.MarkAsDeleted();
                objData.Save();
                uiPanelEdit.Visible = false;
                uiPanelViewSubscribers.Visible = true;
                BindData();
                Clearfields();

            }
        }