示例#1
0
        //fungsi: Tampilkan Lookup pegawai
        protected void txtItem0FormView_TextChanged(object sender, EventArgs e)
        {
            TextBox txtNIP  = (TextBox)FvPunishment.FindControl("txtItem0FormView");
            Label   lblNama = (Label)FvPunishment.FindControl("lblItem1FormView");

            setNama(txtNIP, lblNama);
        }
示例#2
0
        protected void GvLookupPegawai_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Session["Triger"] != null)
            {
                if (Session["Triger"].ToString() == "txtFilterItem2")
                {
                    if (isEntryUseNIP())
                    {
                        this.txtFilterItem2.Text = ((Label)GvLookupPegawai.SelectedRow.Cells[0].FindControl("Label1")).Text;
                    }
                    else
                    {
                        this.txtFilterItem2.Text = GvLookupPegawai.SelectedRow.Cells[1].Text;
                    }
                }
                else if (Session["Triger"].ToString() == "txtItem0FormView")
                {
                    if (isEntryUseNIP())
                    {
                        ((TextBox)FvPunishment.FindControl("txtItem0FormView")).Text = ((Label)GvLookupPegawai.SelectedRow.Cells[0].FindControl("Label1")).Text;
                        ((Label)FvPunishment.FindControl("lblItem1FormView")).Text   = ((Label)GvLookupPegawai.SelectedRow.Cells[2].FindControl("Label2")).Text;
                    }
                    else
                    {
                        ((TextBox)FvPunishment.FindControl("txtItem0FormView")).Text = GvLookupPegawai.SelectedRow.Cells[1].Text;
                        ((Label)FvPunishment.FindControl("lblItem1FormView")).Text   = ((Label)GvLookupPegawai.SelectedRow.Cells[2].FindControl("Label2")).Text;
                    }
                }

                Session.Remove("Triger");
            }

            setInitialLookupState();
            UpdatePanel1.Update();
        }
示例#3
0
        //fungsi: Handle Ketika akan insert database
        protected void dsPunishmentEdit_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            try
            {
                ViewState["TglAwal"]      = ((TextBox)FvPunishment.FindControl("txtItem2FormView")).Text;
                ViewState["TglAkhir"]     = ((TextBox)FvPunishment.FindControl("txtItem3FormView")).Text;
                ViewState["TglPenetapan"] = ((TextBox)FvPunishment.FindControl("txtItem5FormView")).Text;

                string sNIP;
                if (isEntryUseNIP())
                {
                    sNIP = ((TextBox)FvPunishment.FindControl("txtItem0FormView")).Text;
                }
                else
                {
                    sNIP = azlib.getNIP(((TextBox)FvPunishment.FindControl("txtItem0FormView")).Text, Application["strCn"].ToString());
                }
                TextBox TGL_AWAL      = (TextBox)FvPunishment.FindControl("txtItem2FormView");
                TextBox TGL_AKHIR     = (TextBox)FvPunishment.FindControl("txtItem3FormView");
                TextBox TGL_PENETAPAN = (TextBox)FvPunishment.FindControl("txtItem5FormView");
                e.Command.Parameters["@NIP"].Value           = sNIP;
                e.Command.Parameters["@TGL_AWAL"].Value      = DateTime.Parse(TGL_AWAL.Text);
                e.Command.Parameters["@TGL_AKHIR"].Value     = DateTime.Parse(TGL_AKHIR.Text);
                e.Command.Parameters["@TGL_PENETAPAN"].Value = DateTime.Parse(TGL_PENETAPAN.Text);
            }
            catch (Exception ex)
            {
                ExceptionDetails.Text = lblWrongDate.Text;
                e.Cancel = true;
            }
        }
示例#4
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();
            }
        }
示例#5
0
 //fungsi: set kondisi awal komponen di FormView
 private void setInitialComponent()
 {
     ((TextBox)FvPunishment.FindControl("txtItem0FormView")).Text = "";
     ((Label)FvPunishment.FindControl("lblItem1FormView")).Text   = "";
     ((TextBox)FvPunishment.FindControl("txtItem2FormView")).Text = DateTime.Now.ToShortDateString();
     ((TextBox)FvPunishment.FindControl("txtItem3FormView")).Text = DateTime.Now.ToShortDateString();
     ((DropDownList)FvPunishment.FindControl("ddlItem4FormView")).SelectedIndex = 0;
     ((TextBox)FvPunishment.FindControl("txtItem5FormView")).Text = DateTime.Now.ToShortDateString();
     ((TextBox)FvPunishment.FindControl("txtItem6FormView")).Text = "";
 }
示例#6
0
        protected void FvPunishment_DataBound(object sender, EventArgs e)
        {
            if (FvPunishment.CurrentMode == FormViewMode.Insert)
            {
                if (isEntryUseNIP())
                {
                    ((Label)FvPunishment.FindControl("lblPIN")).Visible = false;
                }
                else
                {
                    ((Label)FvPunishment.FindControl("lblNip")).Visible = false;
                }

                if ((ViewState["TglAwal"] != null) && (ViewState["TglAkhir"] != null) && (ViewState["TglPenetapan"] != null))
                {
                    ((TextBox)FvPunishment.FindControl("txtItem2FormView")).Text = ViewState["TglAwal"].ToString();
                    ((TextBox)FvPunishment.FindControl("txtItem3FormView")).Text = ViewState["TglAkhir"].ToString();
                    ((TextBox)FvPunishment.FindControl("txtItem5FormView")).Text = ViewState["TglPenetapan"].ToString();

                    ViewState.Remove("TglAwal");
                    ViewState.Remove("TglAkhir");
                    ViewState.Remove("TglPenetapan");
                }
                else
                {
                    ((TextBox)FvPunishment.FindControl("txtItem2FormView")).Text = DateTime.Now.ToShortDateString();
                    ((TextBox)FvPunishment.FindControl("txtItem3FormView")).Text = DateTime.Now.ToShortDateString();
                    ((TextBox)FvPunishment.FindControl("txtItem5FormView")).Text = DateTime.Now.ToShortDateString();
                }

                //TIGA
                RangeValidator ValTglAdd = (RangeValidator)FvPunishment.FindControl("CompareValTglAdd");
                ValTglAdd.MinimumValue = DateTime.Parse(Session["tglTutup"].ToString()).ToShortDateString();

                TextBox txtNip = (TextBox)FvPunishment.FindControl("txtItem0FormView");
                txtNip.Focus();
            }
            else if (FvPunishment.CurrentMode == FormViewMode.Edit)
            {
                if (isEntryUseNIP())
                {
                    ((Label)FvPunishment.FindControl("lblPIN")).Visible            = false;
                    ((Label)FvPunishment.FindControl("lblItem0_FormView")).Visible = false;
                }
                else
                {
                    ((Label)FvPunishment.FindControl("lblNip")).Visible           = false;
                    ((Label)FvPunishment.FindControl("lblItem0FormView")).Visible = false;
                }
            }
        }
示例#7
0
 //fungsi: Handle Ketika akan mengupdate data pada database
 protected void dsPunishmentEdit_Updating(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
 {
     try
     {
         TextBox TGL_AKHIR     = (TextBox)FvPunishment.FindControl("txtItem3FormView");
         TextBox TGL_PENETAPAN = (TextBox)FvPunishment.FindControl("txtItem5FormView");
         e.Command.Parameters["@TGL_AKHIR"].Value     = DateTime.Parse(TGL_AKHIR.Text);
         e.Command.Parameters["@TGL_PENETAPAN"].Value = DateTime.Parse(TGL_PENETAPAN.Text);
     }
     catch (Exception ex)
     {
         ExceptionDetails.Text = lblWrongDate.Text;
         e.Cancel = true;
     }
 }