void BindGridViewPeserta(FestivalClass f, Guid evID) { var pesertaList = EventFassControl.getPesertaListByFestival(f, evID); GridViewPeserta.DataSource = pesertaList; GridViewPeserta.DataBind(); }
protected void ButtonSubmit_Click(object sender, EventArgs e) { try { int rowCount = 0; if (String.IsNullOrEmpty(HiddenID.Value)) { int i = FestivalModel.GetMaksID(); i++; int temp = i; string enol = "00"; int digit = 0; while (temp != 0) { temp /= 10; digit++; } if (digit == 1) enol = "00"; else if (digit == 2) enol = "0"; else if (digit == 3) enol = ""; string newid = "FS" + enol + i; FestivalClass newfestival = new FestivalClass(newid, TextBoxNamaFestival.Text, RadioButtonListSistem.Text, TextBoxDescription.Text); Employee emp = (Employee)Session["Login"]; newfestival.CreatedBy = emp.employeeid; newfestival.UpdatedBy = emp.employeeid; rowCount=FestivalControl.InsertFestival(newfestival); clearField(); bindGridViewFestival(); bindGridViewFestivalDetail(""); } else { FestivalClass newfestival = new FestivalClass(HiddenID.Value, TextBoxNamaFestival.Text, RadioButtonListSistem.Text, TextBoxDescription.Text); Employee emp = (Employee)Session["Login"]; newfestival.UpdatedBy = emp.employeeid; rowCount= FestivalControl.UpdateFestival(newfestival); bindGridViewFestival(); clearField(); bindGridViewFestivalDetail(""); } if (rowCount > 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); } }
protected void GridViewFestival_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { FestivalClass festdelete = new FestivalClass(GridViewFestival.DataKeys[e.RowIndex][0].ToString()); Employee emp = (Employee)Session["Login"]; festdelete.CreatedBy = emp.employeeid; festdelete.UpdatedBy = emp.employeeid; int i = FestivalControl.DeleteFestival(festdelete); if (i > 0) ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('Data telah dihapus.');", true); bindGridViewFestival(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('" + ex.Message + "');", true); } }