예제 #1
0
 protected void uiGridViewClasses_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditClass")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentClass = id;
         DBLayer db = new DBLayer();
         DataSet ds = new DataSet();
         ds = db.GetClass(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();
             if (ds.Tables[0].Rows[0]["ClassTypeID"] != null)
             {
                 uiDropDownListClassType.SelectedValue = ds.Tables[0].Rows[0]["ClassTypeID"].ToString();
             }
         }
         uiPanelCurrentClasses.Visible = false;
         uiPanelCurrent.Visible = true;
     }
     else if (e.CommandName == "EditClassRoom")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         Session["CurrentClassForclassRoom"] = id;
         Response.Redirect("EditClassRoom.aspx");
     }
     else if (e.CommandName == "DeleteClass")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentClass = id;
         DBLayer db = new DBLayer();
         db.DeleteClass(id);
         uiPanelCurrentClasses.Visible = true;
         uiPanelCurrent.Visible = false;
         BindData();
     }
 }