Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                if (CurrentSection != 0)
                {
                    //BindData();
                    DBLayer db = new DBLayer();
                    DataSet ds = new DataSet();
                    ds = db.GetSection(CurrentSection);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        uiTextBoxEnName.Text = ds.Tables[0].Rows[0]["EnName"].ToString();
                        uiTextBoxArName.Text = ds.Tables[0].Rows[0]["ArName"].ToString();
                        uiTextBoxDuration.Text = ds.Tables[0].Rows[0]["Duration"].ToString();
                    }
                    uiPanelCurrentSections.Visible = false;
                    uiPanelCurrent.Visible = true;
                }
                else
                {
                    uiPanelCurrentSections.Visible = true;
                    uiPanelCurrent.Visible = false;
                    BindData();
                }
            }
        }
Exemplo n.º 2
0
 protected void uiGridViewSections_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditSection")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentSection = id;
         DBLayer db = new DBLayer();
         DataSet ds = new DataSet();
         ds = db.GetSection(id);
         if (ds.Tables[0].Rows.Count > 0)
         {
             uiTextBoxEnName.Text = ds.Tables[0].Rows[0]["EnName"].ToString();
             uiTextBoxArName.Text = ds.Tables[0].Rows[0]["ArName"].ToString();
             uiTextBoxDuration.Text = ds.Tables[0].Rows[0]["Duration"].ToString();
         }
         uiPanelCurrentSections.Visible = false;
         uiPanelCurrent.Visible = true;
     }
     else if (e.CommandName == "DeleteSection")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentSection = id;
         DBLayer db = new DBLayer();
         db.DeleteSection(id);
         uiPanelCurrentSections.Visible = true;
         uiPanelCurrent.Visible = false;
         BindData();
     }
 }