Beispiel #1
0
        protected void GridViewPoinPenilaian_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {

                string id = GridViewPoinPenilaian.DataKeys[e.RowIndex][0].ToString();
                string poinid = GridViewPoinPenilaian.DataKeys[e.RowIndex][1].ToString();
                GridViewRow row = GridViewPoinPenilaian.Rows[e.RowIndex];
                TextBox poin = (TextBox)row.FindControl("TextBoxPoinPenilaian");
                var fd = new FestivalDetail(id, Int32.Parse(poinid), poin.Text);
                Employee emp = (Employee)Session["Login"];
                fd.UpdatedBy = emp.employeeid;
                int i = FestivalControl.UpdateFestivalDetail(fd);
                if (i > 0)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('Data telah disimpan');", true);
                    GridViewPoinPenilaian.EditIndex = -1;
                    bindGridViewFestivalDetail(HiddenID.Value);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('" + ex.Message + "');", true);                
            }

        }
Beispiel #2
0
        protected void GridViewPoinPenilain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Add")
            {
                try
                {

                    GridViewRow row = GridViewPoinPenilaian.FooterRow;
                    int getId = FestivalModel.GetMaksID(HiddenID.Value);
                    getId++;
                    TextBox poinpenilaian = (TextBox)row.FindControl("TextBoxPoinPenilaian");
                    var fd = new FestivalDetail(HiddenID.Value, getId, poinpenilaian.Text);
                    Employee emp = (Employee)Session["Login"];
                    fd.CreatedBy = emp.employeeid;
                    fd.UpdatedBy = emp.employeeid;
                    int i = FestivalControl.InsertFestivalDetail(fd);
                    bindGridViewFestivalDetail(HiddenID.Value);
                    if (i > 0)
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('Data telah disimpan');", true);

                
                
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('" + ex.Message + "');", true);
                }
            }
        }
Beispiel #3
0
 protected void GridViewPoinPenilain_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         string id = GridViewPoinPenilaian.DataKeys[e.RowIndex][0].ToString();
         string poinid = GridViewPoinPenilaian.DataKeys[e.RowIndex][1].ToString();
         var fd = new FestivalDetail(id, Int32.Parse(poinid));
         Employee emp = (Employee)Session["Login"];
         fd.UpdatedBy = emp.employeeid;
         int i = FestivalControl.DeleteFestivalDetail(fd);
         if (i > 0)
             ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('Data telah dihapus.');", true);
         bindGridViewFestivalDetail(HiddenID.Value);
         
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('" + ex.Message + "');", true);                
     }
 }