示例#1
0
 //fungsi: Handle Permintaan Tambah data, Tampilkan FormView
 protected void lblTambah_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         FvPunishment.DefaultMode = FormViewMode.Insert;
         FvPunishment.ChangeMode(FormViewMode.Insert);
         showGridView(false);
     }
 }
示例#2
0
        protected void GvPunishment_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Show")
            {
                if (Page.IsValid)
                {
                    GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
                    GvPunishment.SelectedIndex = row.RowIndex;
                    GvPunishment.DataBind();
                    string sTahun;
                    if (ddlTahun.Text == DateTime.Now.Year.ToString())
                    {
                        sTahun = azlib.FirstDate(DateTime.Now, "en").ToString();
                    }
                    else
                    {
                        sTahun = "'1/1/" + Convert.ToString(Convert.ToInt32(ddlTahun.Text) + 1) + "'";
                    }
                    dsMangkir.SelectCommand = "select TGL_MASUK from q_AbsenHarianDetil where MANGKIR = 1 AND PIN = '" + ((LinkButton)row.Cells[0].FindControl("lnkCol0Item")).Text + "' AND TGL_MASUK >= '1/1/" + ddlTahun.Text + "' AND TGL_MASUK < '" + sTahun + "'";
                    dsMangkir.DataBind();
                    lblTitleRincianMangkir.Text    = "Rincian ketidakhadiran PIN " + ((LinkButton)row.Cells[0].FindControl("lnkCol0Item")).Text;
                    lblTitleRincianMangkir.Visible = true;
                    gvMangkir.Visible = true;

                    dsAkumulasiMangkir.SelectCommand = "SELECT [JML_JAM_LAMBAT_CPTPLG],[KONVERSI_MANGKIR] FROM [q_LambatCepatPulang]where PIN = '" + ((LinkButton)row.Cells[0].FindControl("lnkCol0Item")).Text + "' AND TAHUN = " + ddlTahun.Text + "";
                    dsAkumulasiMangkir.DataBind();
                    if (gvAkumulasiMangkir.Rows.Count > 0)
                    {
                        lblTitleAkumulasiMangkir.Text    = "Akumulasi Keterlambatan dan Cepat Pulang PIN " + ((LinkButton)row.Cells[0].FindControl("lnkCol0Item")).Text;
                        lblTitleAkumulasiMangkir.Visible = true;
                        gvAkumulasiMangkir.Visible       = true;
                    }
                }
            }
            else if (e.CommandName == "TambahPelanggaran")
            {
                FvPunishment.DefaultMode = FormViewMode.Insert;
                FvPunishment.ChangeMode(FormViewMode.Insert);
                showGridView(false);

                ImageButton b     = (ImageButton)e.CommandSource;
                GridViewRow myRow = (GridViewRow)b.NamingContainer;

                ((TextBox)FvPunishment.FindControl("txtItem0FormView")).Text    = GvPunishment.DataKeys[myRow.RowIndex].Value.ToString();
                ((TextBox)FvPunishment.FindControl("txtItem0FormView")).Enabled = false;
                TextBox txtNIP  = (TextBox)FvPunishment.FindControl("txtItem0FormView");
                Label   lblNama = (Label)FvPunishment.FindControl("lblItem1FormView");
                setNama(txtNIP, lblNama);
                ((LinkButton)FvPunishment.FindControl("lnkItem0FormView")).Visible = false;
                ((TextBox)FvPunishment.FindControl("txtItem2FormView")).Text       = (azlib.FirstDate(DateTime.Now, "id")).ToShortDateString();
                int iLamaPotongan;
                iLamaPotongan = Convert.ToInt32(((Label)(myRow.Cells[8].FindControl("lblCol11Item"))).Text.ToString());
                ((TextBox)FvPunishment.FindControl("txtItem3FormView")).Text = (azlib.FirstDate(DateTime.Now, "id")).AddMonths(iLamaPotongan).AddDays(-1).ToShortDateString();
                ((DropDownList)FvPunishment.FindControl("ddlItem4FormView")).SelectedValue = ((Label)(myRow.Cells[3].FindControl("lblCol3Item"))).Text.ToString();
            }
        }
示例#3
0
 //fungsi: Handle ketika tombol Edit di GridView di tekan
 protected void GvPunishment_RowEditing(object sender, GridViewEditEventArgs e)
 {
     if (Page.IsValid)
     {
         dsPunishment.SelectCommand = "SELECT NIP, PIN, NAMA, TGL_AWAL, TGL_AKHIR, KODE_POTONGAN, TGL_PENETAPAN, DOKUMEN_DISIPLIN FROM q_HukumanDisiplin";
         if (isEntryUseNIP())
         {
             dsPunishment.SelectCommand += " WHERE NIP = '" + GvPunishment.Rows[e.NewEditIndex].Cells[0].Text + "' AND TGL_AWAL = '" + DateTime.Parse(((Label)GvPunishment.Rows[e.NewEditIndex].Cells[2].FindControl("lblCol2Item")).Text).ToString("MM/dd/yyyy") + "'";
         }
         else
         {
             dsPunishment.SelectCommand += " WHERE PIN = '" + GvPunishment.Rows[e.NewEditIndex].Cells[0].Text + "' AND TGL_AWAL = '" + DateTime.Parse(((Label)GvPunishment.Rows[e.NewEditIndex].Cells[2].FindControl("lblCol2Item")).Text).ToString("MM/dd/yyyy") + "'";
         }
         e.Cancel = true;
         FvPunishment.DefaultMode = FormViewMode.Edit;
         FvPunishment.ChangeMode(FormViewMode.Edit);
         showGridView(false);
     }
     else
     {
         e.Cancel = true;
     }
 }