protected void lbledit_Click(object sender, EventArgs e) { DropDownList ddlKodeUnit = (DropDownList)FvKaryawan.FindControl("ddlKodeUnit"); DropDownList ddlKodeDeputi = (DropDownList)FvKaryawan.FindControl("ddlKodeDeputi"); DropDownList ddlKodeBiro = (DropDownList)FvKaryawan.FindControl("ddlBiro"); DropDownList ddlBagian = (DropDownList)FvKaryawan.FindControl("ddlBagian"); DropDownList ddlSubBagian = (DropDownList)FvKaryawan.FindControl("ddlSubBagian"); DropDownList ddlJabatan = (DropDownList)FvKaryawan.FindControl("ddlJabatan"); DropDownList ddlGolongan = (DropDownList)FvKaryawan.FindControl("ddlGolongan"); DropDownList ddlGrade = (DropDownList)FvKaryawan.FindControl("ddlGrade"); DropDownList ddlEselon = (DropDownList)FvKaryawan.FindControl("ddlEselon"); DropDownList ddlStatusPegawai = (DropDownList)FvKaryawan.FindControl("ddlStatusPegawai"); //DropDownList ddlShift = (DropDownList)FvKaryawan.FindControl("ddlShift"); TextBox Tahun = (TextBox)FvKaryawan.FindControl("txtTahunEdit"); TextBox Bulan = (TextBox)FvKaryawan.FindControl("txtBulanEdit"); TextBox NIP = (TextBox)FvKaryawan.FindControl("txtNIPEdit"); TextBox NoRekBank = (TextBox)FvKaryawan.FindControl("txtNoRek"); CheckBox LapKeuangan = (CheckBox)FvKaryawan.FindControl("lapKeuEdit"); bool lapKeuVal = LapKeuangan.Checked; CheckBox um = (CheckBox)FvKaryawan.FindControl("CheckBox2"); bool umVal = um.Checked; Label tracing = (Label)FvKaryawan.FindControl("Label36"); string query = ""; try { query = "UPDATE taRiwayatKaryawan SET KODE_UNIT='" + ddlKodeUnit.SelectedValue + "',KODE_BIRO='" + ddlKodeBiro.SelectedValue + "',KODE_DEPUTI='" + ddlKodeDeputi.SelectedValue + "',KODE_BAGIAN='" + ddlBagian.SelectedValue + "',KODE_SUBBAGIAN='" + ddlSubBagian.SelectedValue + "',KODE_JABATAN='" + ddlJabatan.SelectedValue + "',KODE_ESELON='" + ddlEselon.SelectedValue + "',KODE_STATUS_PEGAWAI ='" + ddlStatusPegawai.SelectedValue + "',KODE_GRADE='" + ddlGrade.SelectedValue + "',KODE_GOLONGAN='" + ddlGolongan.SelectedValue + "',NOREK_BANK='" + NoRekBank.Text + "',LAP_KEUANGAN='" + lapKeuVal + "',UM='" + umVal + "' WHERE NIP='" + NIP.Text + "' AND BULAN = '" + Bulan.Text + "' AND TAHUN = '" + Tahun.Text + "' AND BULAN='" + Bulan.Text + "'"; SqlConnection con = new SqlConnection(Application["strCn"].ToString()); SqlCommand cmd = new SqlCommand(query, con); con.Open(); // tracing.Text = query; cmd.ExecuteNonQuery(); con.Close(); } catch (SqlException ex) { // Label Error = (Label)FvKaryawan.FindControl("Label36"); // Error.Text = ex.Message; // (Label)FvKaryawan.FindControl("Label36").ToString() = Error; //M // FvKaryawan.Visible = false; // NIP.Text = query; tracing.Text = query; } }
protected void ddlBagian_DataBound(object sender, EventArgs e) { DropDownList ddlBagian = (DropDownList)FvKaryawan.FindControl("ddlBagian"); DropDownList ddlSubBagian = (DropDownList)FvKaryawan.FindControl("ddlSubBagian"); if (ddlBagian.SelectedValue.Trim() != "00000") { dsSubBagian.SelectCommand += " WHERE KODE_BAGIAN = '" + ddlBagian.SelectedValue + "' or KODE_SUBBAGIAN = '000000'"; } ddlSubBagian.DataBind(); }
protected void ddlKodeDeputi_DataBound(object sender, EventArgs e) { DropDownList ddlKodeDeputi = (DropDownList)FvKaryawan.FindControl("ddlKodeDeputi"); DropDownList ddlBiro = (DropDownList)FvKaryawan.FindControl("ddlBiro"); if (ddlKodeDeputi.SelectedValue.Trim() != "000") { dsBiroManajemen.SelectCommand += " WHERE KODE_DEPUTI = '" + ddlKodeDeputi.SelectedValue + "' or KODE_BIRO = '0000'"; } ddlBiro.DataBind(); }
protected void ddlKodeUnit_DataBound(object sender, EventArgs e) { DropDownList ddlKodeUnit = (DropDownList)FvKaryawan.FindControl("ddlKodeUnit"); DropDownList ddlKodeDeputi = (DropDownList)FvKaryawan.FindControl("ddlKodeDeputi"); if (ddlKodeUnit.SelectedValue.Trim() != "-") { dsDeputi.SelectCommand += " WHERE KODE_UNIT = '" + ddlKodeUnit.SelectedValue + "' or KODE_DEPUTI = '000'"; } ddlKodeDeputi.DataBind(); }
protected void HiddenShift_DataBinding(object sender, EventArgs e) { HiddenField HiddenShift = (HiddenField)(FvKaryawan.FindControl("HiddenShift")); if (HiddenShift.Value.Trim() != "") { ((DropDownList)(FvKaryawan.FindControl("ddlShift"))).SelectedValue = HiddenShift.Value; } else { ((DropDownList)(FvKaryawan.FindControl("ddlShift"))).SelectedValue = "0"; } }
protected void FvKaryawan_DataBound(object sender, EventArgs e) { if (FvKaryawan.CurrentMode == FormViewMode.Insert) { ((DropDownList)FvKaryawan.FindControl("ddlStatusPegawai")).SelectedValue = "5"; ((DropDownList)FvKaryawan.FindControl("ddlStatusPegawai")).Enabled = false; } else if (FvKaryawan.CurrentMode == FormViewMode.Edit) { if (((DropDownList)FvKaryawan.FindControl("ddlStatusPegawai")).SelectedValue == "5") { ((DropDownList)FvKaryawan.FindControl("ddlStatusPegawai")).Enabled = false; } } //if (Session["GradeID"].ToString() == "1a") //{ // if (FvKaryawan.CurrentMode == FormViewMode.Edit) // { // ((TextBox)FvKaryawan.FindControl("txtPIN")).Enabled = false; // ((TextBox)FvKaryawan.FindControl("txtNAMA")).Enabled = false; // ((TextBox)FvKaryawan.FindControl("txtTMT")).Enabled = false; // ((TextBox)FvKaryawan.FindControl("txtAktif")).Enabled = false; // ((TextBox)FvKaryawan.FindControl("txtNonAktif")).Enabled = false; // ((TextBox)FvKaryawan.FindControl("txtTglLahir")).Enabled = false; // ((TextBox)FvKaryawan.FindControl("txtNipBaru")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlKodeUnit")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlKodeDeputi")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlBiro")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlBagian")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlSubBagian")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlJabatan")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlGolongan")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlGrade")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlEselon")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlStatusPegawai")).Enabled = false; // ((DropDownList)FvKaryawan.FindControl("ddlShift")).Enabled = false; // } //} else if ((Session["GradeID"].ToString() == "3") || (Session["GradeID"].ToString() == "3a") || (Session["GradeID"].ToString() == "4")) { if (FvKaryawan.CurrentMode == FormViewMode.ReadOnly) { ((ImageButton)FvKaryawan.FindControl("btnEdit")).Visible = false; ((LinkButton)FvKaryawan.FindControl("lbedit")).Visible = false; } } }
protected void FvKaryawan_ItemCommand(object sender, FormViewCommandEventArgs e) { if ((e.CommandName == "Cancel_Detail") || (e.CommandName == "Cancel_Edit")) { showGridView(true); } else if (e.CommandName == "Cancel_Insert") { setInitialComponent(); showGridView(true); } else if (e.CommandName == "Edit_Detail") { if (Page.IsValid) { dsKaryawanManajemen.FilterExpression = "NIP = '" + ((Label)FvKaryawan.FindControl("lblNIP")).Text + "' AND BULAN= '" + ((Label)FvKaryawan.FindControl("Label42")).Text + "'"; FvKaryawan.DefaultMode = FormViewMode.Edit; FvKaryawan.ChangeMode(FormViewMode.Edit); } } }
private void setInitialComponent() { ((TextBox)FvKaryawan.FindControl("txtNIP")).Text = ""; ((TextBox)FvKaryawan.FindControl("txtPIN")).Text = ""; ((TextBox)FvKaryawan.FindControl("txtNAMA")).Text = ""; ((TextBox)FvKaryawan.FindControl("txtTMT")).Text = ""; ((TextBox)FvKaryawan.FindControl("txtAktif")).Text = ""; ((TextBox)FvKaryawan.FindControl("txtNonAktif")).Text = ""; ((TextBox)FvKaryawan.FindControl("txtTglLahir")).Text = ""; ((TextBox)FvKaryawan.FindControl("txtNoRek")).Text = ""; ((TextBox)FvKaryawan.FindControl("txtNipBaru")).Text = ""; ((DropDownList)FvKaryawan.FindControl("ddlKodeUnit")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlKodeDeputi")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlBiro")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlBagian")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlSubBagian")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlJabatan")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlGolongan")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlGrade")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlEselon")).SelectedIndex = 0; //((DropDownList)FvKaryawan.FindControl("ddlStatusPegawai")).SelectedIndex = 0; ((DropDownList)FvKaryawan.FindControl("ddlShift")).SelectedIndex = 0; }
protected void dsKaryawanManajemen_Updating(object sender, SqlDataSourceCommandEventArgs e) { DropDownList ddlKodeUnit = (DropDownList)FvKaryawan.FindControl("ddlKodeUnit"); DropDownList ddlKodeDeputi = (DropDownList)FvKaryawan.FindControl("ddlKodeDeputi"); DropDownList ddlBiro = (DropDownList)FvKaryawan.FindControl("ddlBiro"); DropDownList ddlBagian = (DropDownList)FvKaryawan.FindControl("ddlBagian"); DropDownList ddlSubBagian = (DropDownList)FvKaryawan.FindControl("ddlSubBagian"); DropDownList ddlJabatan = (DropDownList)FvKaryawan.FindControl("ddlJabatan"); DropDownList ddlGolongan = (DropDownList)FvKaryawan.FindControl("ddlGolongan"); DropDownList ddlGrade = (DropDownList)FvKaryawan.FindControl("ddlGrade"); DropDownList ddlEselon = (DropDownList)FvKaryawan.FindControl("ddlEselon"); DropDownList ddlStatusPegawai = (DropDownList)FvKaryawan.FindControl("ddlStatusPegawai"); //DropDownList ddlShift = (DropDownList)FvKaryawan.FindControl("ddlShift"); SqlConnection con = new SqlConnection(Application["strCn"].ToString()); con.Open(); SqlCommand pcom = new SqlCommand(); SqlDataReader rdr; pcom = con.CreateCommand(); pcom.CommandText = "select KODE_CABANG,KODE_INSTANSI FROM taUNIT where KODE_UNIT = '" + ddlKodeUnit.SelectedValue + "'"; rdr = pcom.ExecuteReader(); rdr.Read(); e.Command.Parameters["@KODE_CABANG"].Value = rdr["KODE_CABANG"].ToString(); e.Command.Parameters["@KODE_INSTANSI"].Value = rdr["KODE_INSTANSI"].ToString(); rdr.Close(); con.Close(); e.Command.Parameters["@KODE_UNIT"].Value = ddlKodeUnit.SelectedValue; e.Command.Parameters["@KODE_DEPUTI"].Value = ddlKodeDeputi.SelectedValue; e.Command.Parameters["@KODE_BIRO"].Value = ddlBiro.SelectedValue; e.Command.Parameters["@KODE_BAGIAN"].Value = ddlBagian.SelectedValue; e.Command.Parameters["@KODE_SUBBAGIAN"].Value = ddlSubBagian.SelectedValue; e.Command.Parameters["@KODE_JABATAN"].Value = ddlJabatan.SelectedValue; e.Command.Parameters["@KODE_GOLONGAN"].Value = ddlGolongan.SelectedValue; e.Command.Parameters["@KODE_GRADE"].Value = ddlGrade.SelectedValue; e.Command.Parameters["@KODE_ESELON"].Value = ddlEselon.SelectedValue; e.Command.Parameters["@KODE_STATUS_PEGAWAI"].Value = ddlStatusPegawai.SelectedValue; //e.Command.Parameters["@KODE_SHIFT"].Value = ddlShift.SelectedValue; { TextBox txtTMT = (TextBox)FvKaryawan.FindControl("txtTMT"); TextBox txtAktif = (TextBox)FvKaryawan.FindControl("txtAktif"); TextBox txtNonAktif = (TextBox)FvKaryawan.FindControl("txtNonAktif"); TextBox txtTglLahir = (TextBox)FvKaryawan.FindControl("txtTglLahir"); try { if (txtTMT.Text.Trim() != "") { DateTime TMT = DateTime.Parse(txtTMT.Text); e.Command.Parameters["@TMT"].Value = TMT; } if (txtAktif.Text.Trim() != "") { DateTime Aktif = DateTime.Parse(txtAktif.Text); e.Command.Parameters["@AKTIF"].Value = Aktif; } if (txtNonAktif.Text.Trim() != "") { DateTime NON_AKTIF = DateTime.Parse(txtNonAktif.Text); e.Command.Parameters["@NON_AKTIF"].Value = NON_AKTIF; } if (txtTglLahir.Text.Trim() != "") { DateTime TGL_LAHIR = DateTime.Parse(txtTglLahir.Text); e.Command.Parameters["@TGL_LAHIR"].Value = TGL_LAHIR; } } catch (Exception ex) { ExceptionDetails.Text = lblerrorEdit.Text; e.Cancel = true; } } }