protected void txtItem0FormView_TextChanged(object sender, EventArgs e)
        {
            TextBox txtNIP  = (TextBox)Fvceremony_manual.FindControl("txtItem0FormView");
            Label   lblNama = (Label)Fvceremony_manual.FindControl("lblItem1FormView");

            setNama(txtNIP, lblNama);
        }
        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 = ((Label)GvLookupPegawai.SelectedRow.Cells[1].FindControl("Label3")).Text;
                    }
                }
                else if (Session["Triger"].ToString() == "txtItem0FormView")
                {
                    if (isEntryUseNIP())
                    {
                        ((TextBox)Fvceremony_manual.FindControl("txtItem0FormView")).Text = ((Label)GvLookupPegawai.SelectedRow.Cells[0].FindControl("Label1")).Text;
                        ((Label)Fvceremony_manual.FindControl("lblItem1FormView")).Text   = ((Label)GvLookupPegawai.SelectedRow.Cells[2].FindControl("Label2")).Text;
                    }
                    else
                    {
                        ((TextBox)Fvceremony_manual.FindControl("txtItem0FormView")).Text = ((Label)GvLookupPegawai.SelectedRow.Cells[1].FindControl("Label3")).Text;
                        ((Label)Fvceremony_manual.FindControl("lblItem1FormView")).Text   = ((Label)GvLookupPegawai.SelectedRow.Cells[2].FindControl("Label2")).Text;
                    }
                }

                Session.Remove("Triger");
            }

            setInitialLookupState();
            UpdatePanel1.Update();
        }
 private void setInitialComponent()
 {
     ((TextBox)Fvceremony_manual.FindControl("txtItem0FormView")).Text = "";
     ((Label)Fvceremony_manual.FindControl("lblItem1FormView")).Text   = "";
     ((TextBox)Fvceremony_manual.FindControl("txtItem2FormView")).Text = DateTime.Now.ToShortDateString();
     ((TextBox)Fvceremony_manual.FindControl("txtItem3FormView")).Text = "";
     ((TextBox)Fvceremony_manual.FindControl("txtItem4FormView")).Text = "";
     ((CheckBox)Fvceremony_manual.FindControl("cbGantiHari")).Checked  = false;
 }
 protected void lblTambah_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Fvceremony_manual.DefaultMode = FormViewMode.Insert;
         Fvceremony_manual.ChangeMode(FormViewMode.Insert);
         showGridView(false);
     }
 }
        protected void Fvceremony_manual_DataBound(object sender, EventArgs e)
        {
            if (Fvceremony_manual.CurrentMode == FormViewMode.Insert)
            {
                if (isEntryUseNIP())
                {
                    ((Label)Fvceremony_manual.FindControl("lblPIN")).Visible = false;
                }
                else
                {
                    ((Label)Fvceremony_manual.FindControl("lblNIP")).Visible = false;
                }

                if (ViewState["TglHadir"] != null)
                {
                    ((TextBox)Fvceremony_manual.FindControl("txtItem2FormView")).Text = ViewState["TglHadir"].ToString();
                    ViewState.Remove("TglHadir");
                }
                else
                {
                    ((TextBox)Fvceremony_manual.FindControl("txtItem2FormView")).Text = DateTime.Now.ToShortDateString();
                }
                //TIGA
                RangeValidator ValTglAdd = (RangeValidator)Fvceremony_manual.FindControl("CompareValTglAdd");
                ValTglAdd.MinimumValue = DateTime.Parse(Session["tglTutup"].ToString()).ToShortDateString();
                //ValTglAdd.MaximumValue = Session["tglBatas"];
                TextBox txtNip = (TextBox)Fvceremony_manual.FindControl("txtItem0FormView");
                txtNip.Focus();
            }
            else if (Fvceremony_manual.CurrentMode == FormViewMode.Edit)
            {
                if (isEntryUseNIP())
                {
                    ((Label)Fvceremony_manual.FindControl("lblPIN")).Visible            = false;
                    ((Label)Fvceremony_manual.FindControl("lblItem0_FormView")).Visible = false;
                }
                else
                {
                    ((Label)Fvceremony_manual.FindControl("lblNip")).Visible           = false;
                    ((Label)Fvceremony_manual.FindControl("lblItem0FormView")).Visible = false;
                }
            }
        }
 protected void Gvceremony_manual_RowEditing(object sender, GridViewEditEventArgs e)
 {
     if (Page.IsValid)
     {
         dsceremony_manual.SelectCommand = "SELECT NIP, PIN , NAMA, TGL_MASUK, KODE_RANGE, JAM_MASUK, JAM_KELUAR FROM q_Absen";
         if (isEntryUseNIP())
         {
             dsceremony_manual.SelectCommand += " WHERE NIP = '" + Gvceremony_manual.Rows[e.NewEditIndex].Cells[0].Text + "' AND TGL_MASUK = '" + DateTime.Parse(((Label)Gvceremony_manual.Rows[e.NewEditIndex].Cells[2].FindControl("lblCol2Item")).Text).ToString("MM/dd/yyyy") + "'";
         }
         else
         {
             dsceremony_manual.SelectCommand += " WHERE PIN = '" + Gvceremony_manual.Rows[e.NewEditIndex].Cells[0].Text + "' AND TGL_MASUK = '" + DateTime.Parse(((Label)Gvceremony_manual.Rows[e.NewEditIndex].Cells[2].FindControl("lblCol2Item")).Text).ToString("MM/dd/yyyy") + "'";
         }
         e.Cancel = true;
         Fvceremony_manual.DefaultMode = FormViewMode.Edit;
         Fvceremony_manual.ChangeMode(FormViewMode.Edit);
         showGridView(false);
     }
     else
     {
         e.Cancel = true;
     }
 }
        protected void dsceremony_manualEdit_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
        {
            try
            {
                ViewState["TglHadir"] = ((TextBox)Fvceremony_manual.FindControl("txtItem2FormView")).Text;

                TextBox jam_awal  = (TextBox)Fvceremony_manual.FindControl("txtItem3FormView");
                TextBox jam_akhir = (TextBox)Fvceremony_manual.FindControl("txtItem4FormView");

                bool TimeSpanValidation = false;

                try
                {
                    TimeSpan tsJamAwal  = TimeSpan.Parse(jam_awal.Text);
                    TimeSpan tsJamAkhir = TimeSpan.Parse(jam_akhir.Text);

                    TimeSpanValidation = true;
                }
                catch (Exception ex)
                {
                    ExceptionDetails.Text = lblJamSalah2.Text;
                    e.Cancel = true;
                }

                if (TimeSpanValidation)
                {
                    string   sNIP;
                    DateTime Tanggal_Fix = DateTime.Parse(((TextBox)Fvceremony_manual.FindControl("txtItem2FormView")).Text);
                    CheckBox ganti_hari  = (CheckBox)Fvceremony_manual.FindControl("cbGantiHari");
                    string   TanggalFix  = "";

                    if (Session["strlang"].ToString() == "en")
                    {
                        TanggalFix = Tanggal_Fix.ToString("MM/dd/yyyy");
                    }
                    else
                    {
                        TanggalFix = Tanggal_Fix.ToString("dd/MM/yyyy");
                    }

                    string jamAwal;
                    string jamAkhir;

                    if ((TimeSpan.Parse(jam_awal.Text) <= TimeSpan.Parse(jam_akhir.Text)) && (!ganti_hari.Checked))
                    {
                        jamAwal  = TanggalFix + " " + jam_awal.Text + ":00";
                        jamAkhir = TanggalFix + " " + jam_akhir.Text + ":00";
                    }
                    else
                    {
                        string TanggalFix2 = "";

                        if (Session["strlang"].ToString() == "en")
                        {
                            TanggalFix2 = Tanggal_Fix.AddDays(1).ToString("MM/dd/yyyy");
                        }
                        else
                        {
                            TanggalFix2 = Tanggal_Fix.AddDays(1).ToString("dd/MM/yyyy");
                        }

                        jamAwal  = TanggalFix + " " + jam_awal.Text + ":00";
                        jamAkhir = TanggalFix2 + " " + jam_akhir.Text + ":00";
                    }

                    if (isEntryUseNIP())
                    {
                        sNIP = ((TextBox)Fvceremony_manual.FindControl("txtItem0FormView")).Text;
                    }
                    else
                    {
                        sNIP = azlib.getNIP(((TextBox)Fvceremony_manual.FindControl("txtItem0FormView")).Text, Application["strCn"].ToString());
                    }
                    e.Command.Parameters["@NIP"].Value        = sNIP;
                    e.Command.Parameters["@TGL_MASUK"].Value  = Tanggal_Fix;
                    e.Command.Parameters["@JAM_MASUK"].Value  = DateTime.Parse(jamAwal);
                    e.Command.Parameters["@JAM_KELUAR"].Value = DateTime.Parse(jamAkhir);
                }
            }
            catch (Exception ex)
            {
                ExceptionDetails.Text = lblCannotUpdate.Text;
                e.Cancel = true;
            }
        }