Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (CurrentCourse != 0)
         {
             //BindData();
             DBLayer db = new DBLayer();
             DataSet ds = new DataSet();
             ds = db.GetCourse(CurrentCourse);
             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();
                 uiTextBoxMaxGrade.Text = ds.Tables[0].Rows[0]["MinGrade"].ToString();
                 uiTextBoxMinGrade.Text = ds.Tables[0].Rows[0]["MaxGrade"].ToString();
                 uiCheckBoxInTotal.Checked = string.IsNullOrEmpty(ds.Tables[0].Rows[0]["InTotal"].ToString()) ? false : (bool)ds.Tables[0].Rows[0]["InTotal"];
             }
             uiPanelCurrentCourses.Visible = false;
             uiPanelCurrent.Visible = true;
         }
         else
         {
             uiPanelCurrentCourses.Visible = true;
             uiPanelCurrent.Visible = false;
             LoadDDLs();
             BindData();
         }
     }
 }
Exemplo n.º 2
0
 protected void uiGridViewCourses_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditCourse")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentCourse = id;
         DBLayer db = new DBLayer();
         DataSet ds = new DataSet();
         ds = db.GetCourse(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();
             uiTextBoxMaxGrade.Text = ds.Tables[0].Rows[0]["MinGrade"].ToString();
             uiTextBoxMinGrade.Text = ds.Tables[0].Rows[0]["MaxGrade"].ToString();
             uiCheckBoxInTotal.Checked = string.IsNullOrEmpty(ds.Tables[0].Rows[0]["InTotal"].ToString()) ? false : (bool)ds.Tables[0].Rows[0]["InTotal"];
         }
         uiPanelCurrentCourses.Visible = false;
         uiPanelCurrent.Visible = true;
     }
     else if (e.CommandName == "DeleteCourse")
     {
         int id = Convert.ToInt32(e.CommandArgument.ToString());
         CurrentCourse = id;
         DBLayer db = new DBLayer();
         db.DeleteCourse(id);
         uiPanelCurrentCourses.Visible = true;
         uiPanelCurrent.Visible = false;
         BindData();
     }
 }