Ejemplo n.º 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);                
            }

        }
Ejemplo n.º 2
0
 protected void ButtonSubmit_Click(object sender, EventArgs e)
 {
     if (DropDownListEventID.Text != "")
     {
         int i = 0;
         try
         {
             Guid pesid = Guid.NewGuid();
             i = PesertaControl.InsertPeserta(new Peserta(pesid, TextBoxNamaPeserta.Text, TextBoxUmur.Text, RadioButtonListGender.Text, DropDownListDesa.Text, TextBoxKelompok.Text, DropDownListFestival.Text));
             var festiDetails = FestivalControl.getFestivalDetailList(DropDownListFestival.Text);
             if (festiDetails != null)
             {
                 List <EventFassDetail> evFassDet = new List <EventFassDetail>();
                 foreach (FestivalDetail a in festiDetails)
                 {
                     evFassDet.Add(new EventFassDetail(Guid.Parse(DropDownListEventID.Text), pesid, a.festivalID, a.poinID, 0));
                 }
                 int j = EventFassControl.InsertEvent(evFassDet);
                 if (j > 0)
                 {
                     ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('Data telah disimpan');", true);
                 }
                 clearField();
             }
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "showPop('" + ex.Message + "');", true);
         }
     }
 }
Ejemplo n.º 3
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);
                }
            }
        }
Ejemplo n.º 4
0
        void BindGVFestival()
        {
            var festivalList = FestivalControl.getFestivalList();

            GridViewFestival.DataSource = festivalList;
            GridViewFestival.DataBind();
        }
Ejemplo n.º 5
0
        void BindDropdownListFestival()
        {
            var list = FestivalControl.getFestivalList(DropDownListSistem.Text);

            DropDownListFestival.DataSource     = list;
            DropDownListFestival.DataTextField  = "NamaFestival";
            DropDownListFestival.DataValueField = "FestivalID";
            DropDownListFestival.DataBind();
        }
Ejemplo n.º 6
0
        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);
            }
            
        }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
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);                
     }
 }
Ejemplo n.º 9
0
 void bindGridViewFestivalDetail(string id)
 {
     var FestivalDetailList = FestivalControl.getFestivalDetailList(id);
     GridViewPoinPenilaian.DataSource = FestivalDetailList;
     GridViewPoinPenilaian.DataBind();
     if (FestivalDetailList.Count<FestivalDetail>() <= 0 && id!="")
     {
         DataTable a = new DataTable();
         a.Columns.AddRange(new DataColumn[3]
         {
             new DataColumn("FestivalID"),
             new DataColumn("PoinID"),
             new DataColumn("PoinPenilaian")
         }
             );
         a.Rows.Add("","","");
         GridViewPoinPenilaian.DataSource = a;
         GridViewPoinPenilaian.DataBind();
         GridViewPoinPenilaian.Rows[0].Visible = false;
     }
 }