protected void Page_Load(object sender, EventArgs e) { if (Session["IDLogin"] == null) { Response.Redirect("frmHome.aspx"); } strID = (string)Session["IDLogin"]; karyawan = oSPD.getKaryawan(strID); Session["nrpLogin"] = karyawan.nrp; if (string.IsNullOrEmpty(karyawan.nrp)) { Response.Redirect("frmHome.aspx"); } if (!IsPostBack) { if (ifga(karyawan.nrp)) { bindFindSPDGa(); spdGA.Visible = true; BindAtasan(); } header.Text = "List Approval SPD"; bindFind(); bindFindTujuan(); BindAtasan(); BindSPDViewForADH(); if (Session["IDLogin"].ToString() == "siska90000308") { PnlChange.Visible = true; } } }
protected void txtLogin_TextChanged(object sender, EventArgs e) { using (var ctx = new dsSPDDataContext()) { if (String.IsNullOrEmpty(txtLogin.Text)) { txtLogin.Text = SetLabelWelcome(); } strLoginID = txtLogin.Text; Session["IDLogin"] = strLoginID; classSpd oSPD = new classSpd(); karyawan = oSPD.getKaryawan(strLoginID); Session["nrpLogin"] = karyawan.nrp; dsSPDDataContext data = new dsSPDDataContext(); msUser sekretaris = (from u in data.msUsers where u.nrp == karyawan.nrp && u.roleId == Konstan.SEKRETARIS select u).FirstOrDefault(); if (sekretaris != null) { Session["sekretaris"] = true; } else { Session["sekretaris"] = false; } } }
protected void Page_Load(object sender, EventArgs e) { pnlView.Visible = false;//param(); string strLoginID = SetLabelWelcome(); if (strLoginID.ToLower() == "wawan010193") { //!! debug Only //strLoginID = "Putu005001"; //strLoginID = "rika009692"; } Session["IDLogin"] = strLoginID; classSpd oSPD = new classSpd(); //untuk non karyawan Panel1.Visible = false; if (strLoginID.ToUpper() != "SPD") { karyawan = oSPD.getKaryawan(strLoginID); // msUser user = new msUser; dsSPDDataContext data = new dsSPDDataContext(); var user = from r in data.msUsers where r.nrp == karyawan.nrp select r; foreach (msUser item in user) { if (item.roleId == 17 || item.roleId == 19 || item.roleId == 20) { Panel1.Visible = true; } } } }
private bool cek_su(string LoginID) { dsSPDDataContext data = new dsSPDDataContext(); classSpd oSPD = new classSpd(); msKaryawan karyawan = new msKaryawan();; string t_nrp = oSPD.getKaryawan(LoginID).nrp; var user = (from u in data.msUsers join k in data.msKaryawans on u.nrp equals k.nrp where u.roleId == 24 && k.nrp == t_nrp orderby k.namaLengkap select new { namaLengkap = k.namaLengkap, nrp = k.nrp }).Distinct(); if (user.Count() > 0) { return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Session["noSPD"] = string.Empty; //Session["editable"] = false; AD ad = new AD(); //ArrayList al = ad.Groups("trac\\"+LoginID,true); ArrayList o = ad.Groups(); string strLoginID = string.Empty; if (Session["IDLogin"] != null) { strLoginID = (string)Session["IDLogin"]; } else { strLoginID = SetLabelWelcome(); } if (strLoginID.ToLower() == "wawan010193") { //strLoginID = "spd"; // strLoginID = "Putu005001"; // strLoginID = "arum00003359"; //!!!!!! debug Only"; } Session["IDLogin"] = strLoginID; classSpd oSPD = new classSpd(); karyawan = oSPD.getKaryawan(strLoginID); btnListFind_Click(null, null); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["IDLogin"] == null) { Response.Redirect("frmHome.aspx"); } string noSPD = Encrypto.Decrypt(Request.QueryString["encrypt"]); Id.Value = noSPD; strID = (string)Session["IDLogin"]; karyawan = oSPD.getKaryawan(strID); Session["nrpLogin"] = karyawan.nrp; if (string.IsNullOrEmpty(karyawan.nrp)) { Response.Redirect("frmHome.aspx"); } using (var ctx = new dsSPDDataContext()) { var spd = ctx.trSPDs.FirstOrDefault(o => o.noSPD == Id.Value); // jika sekertaris if ((spd.dibuatOleh == karyawan.nrp && spd.isSubmit != true) || (isSec(karyawan.nrp, spd.nrp) && spd.isSubmit != true)) { btnSubmit.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { classSpd cspd = new classSpd(); string strLoginID = string.Empty; classSpd oSPD = new classSpd(); if (Session["IDLogin"] != null) { strLoginID = (string)Session["IDLogin"]; } else { strLoginID = SetLabelWelcome(); } msKaryawan karyawan = oSPD.getKaryawan(strLoginID); dsSPDDataContext data = new dsSPDDataContext(); Int32 roleid = (from k in data.msUsers where k.nrp == karyawan.nrp && (k.roleId == Konstan.SYSADMIN || k.roleId == Konstan.GA) select k.roleId).FirstOrDefault(); if (!IsPostBack) { pnlForm.Visible = false; } if (roleid == Konstan.GA || strLoginID.Contains("yudisss") || roleid == Konstan.SYSADMIN) { //trSPD SPD = new trSPD(); //Calendar1.StartDate = ctx.AddWorkDaysToGetdate().Value;CalculateFutureDate // Calendar1.StartDate = GetPreviousWorkDay(DateTime.Now); Calendar1.StartDate = GetPreviousWorkDay(DateTime.Now); Calendar1.EndDate = (DateTime.Now); CalendarExtendersabtu.StartDate = GetPreviousWorkDay(DateTime.Now.AddDays(-4)); CalendarExtendersabtu.EndDate = (DateTime.Now.AddDays(-4)); CalendarExtenderMinggu.StartDate = GetPreviousWorkDay(DateTime.Now.AddDays(-3)); CalendarExtenderMinggu.EndDate = (DateTime.Now.AddDays(-3)); CalendarExtenderSenin.StartDate = GetPreviousWorkDay(DateTime.Now.AddDays(-2)); CalendarExtenderSenin.EndDate = (DateTime.Now.AddDays(-2)); CalendarExtenderSelasa.StartDate = GetPreviousWorkDay(DateTime.Now.AddDays(-1)); CalendarExtenderSelasa.EndDate = (DateTime.Now.AddDays(-1)); pnlForm.Visible = true; } else { pnlForm.Visible = false; } userLoginID = !String.IsNullOrEmpty(strLoginID) ? strLoginID.Length > 10 ? strLoginID.Substring(0, 10).ToString() : strLoginID : ""; }
protected void lbListClaimCancel_Click(object sender, EventArgs e) { if (cek_ga(Session["IDLogin"].ToString())) { //cr : 2015-01-30 ian try { var lb = (Control)sender; GridViewRow row = (GridViewRow)lb.NamingContainer; classSpd oSPD = new classSpd(); karyawan = oSPD.getKaryawan(Session["IDLogin"].ToString()); string noSPD = row.Cells[0].Text; string nrpApproval = karyawan.nrp; string emailApproval = karyawan.EMail; string action = "cancel"; string claimApprove = "ga"; ClaimApprovalUrl claimApprovalUrl = new ClaimApprovalUrl(); lblStat2.Text = claimApprovalUrl.ChangeStatus(noSPD, action, nrpApproval, claimApprove); //bool approvalMethod = claimApprovalUrl.ChangeStatus(noSPD, action, nrpApproval, claimApprove); //if (approvalMethod) //{ // lblStat2.Text = noSPD + " berhasil di" + action + " oleh " + nrpApproval + " " + emailApproval; //} //else //{ // lblStat2.Text = noSPD + " gagal di" + action + " oleh " + nrpApproval + " " + emailApproval; //} } catch (Exception ex) { Response.Write(ex.Message); } #region changed //string status = "29-SPD Cancel"; //cek_claim(sender, status); //historyApproval(sender, status); #endregion btnFind_Click(null, null); } }
protected void Page_Load(object sender, EventArgs e) { classSpd cspd = new classSpd(); string strLoginID = string.Empty; classSpd oSPD = new classSpd(); if (Session["IDLogin"] != null) { strLoginID = (string)Session["IDLogin"]; } else { strLoginID = SetLabelWelcome(); } msKaryawan karyawan = oSPD.getKaryawan(strLoginID); dsSPDDataContext data = new dsSPDDataContext(); Int32 roleid = (from k in data.msUsers where k.nrp == karyawan.nrp && (k.roleId == Konstan.SYSADMIN || k.roleId == Konstan.GA) select k.roleId).FirstOrDefault(); if (roleid == Konstan.GA || strLoginID.Contains("yudisss") || roleid == Konstan.SYSADMIN) { pnlFilter.Visible = true; } else { pnlFilter.Visible = false; pnlView.Visible = false; } if (!Page.IsPostBack) { dsSPDDataContext dsp = new dsSPDDataContext(); //var query = (from k in dsp.msKaryawans where k.statusKaryawan.Trim() == "Active" select k); var query = (from k in dsp.msKaryawans orderby k.namaLengkap select k); checkBoxes1.DataTextField = "namaLengkap"; checkBoxes1.DataValueField = "namaLengkap"; checkBoxes1.DataSource = query.ToList(); checkBoxes1.DataBind(); //checkBoxes1.Items.Add(new ListItem("Test", "Test")); } }
protected void Page_Load(object sender, EventArgs e) { classSpd cspd = new classSpd(); string strLoginID = string.Empty; classSpd oSPD = new classSpd(); if (Session["IDLogin"] != null) { strLoginID = (string)Session["IDLogin"]; } else { strLoginID = SetLabelWelcome(); } msKaryawan karyawan = oSPD.getKaryawan(strLoginID); dsSPDDataContext data = new dsSPDDataContext(); Int32 roleid = (from k in data.msUsers where k.nrp == karyawan.nrp && (k.roleId == Konstan.SYSADMIN || k.roleId == Konstan.GA) select k.roleId).FirstOrDefault(); if (!IsPostBack) { pnlForm.Visible = false; fillGV(txtFilterName.Text.Trim()); } if (roleid == Konstan.GA || strLoginID.Contains("yudisss") || strLoginID.Contains("Syam005812") || roleid == Konstan.SYSADMIN) { pnlGrid.Visible = true; gvRole.Visible = true; } else { pnlGrid.Visible = false; gvRole.Visible = false; } userLoginID = !String.IsNullOrEmpty(strLoginID) ? strLoginID.Length > 10 ? strLoginID.Substring(0, 10).ToString() : strLoginID : ""; }
protected void Page_Load(object sender, EventArgs e) { if (Session["IDLogin"] == null) { Response.Redirect("frmHome.aspx"); } strID = (string)Session["IDLogin"]; karyawan = oSPD.getKaryawan(strID); Session["nrpLogin"] = karyawan.nrp; if (string.IsNullOrEmpty(karyawan.nrp)) { Response.Redirect("frmHome.aspx"); } if (!IsPostBack) { ClaimGA.Visible = false; finance.Visible = false; switch (userType(karyawan.nrp)) { case 17: // GA BindGA(); ClaimGA.Visible = true; break; case 19: // GA BindFinance(); finance.Visible = true; break; default: break; } } }
protected void Page_Load(object sender, EventArgs e) { classSpd cspd = new classSpd(); string strLoginID = string.Empty; classSpd oSPD = new classSpd(); if (Session["IDLogin"] != null) { strLoginID = (string)Session["IDLogin"]; } else { strLoginID = SetLabelWelcome(); } msKaryawan karyawan = oSPD.getKaryawan(strLoginID); dsSPDDataContext data = new dsSPDDataContext(); Int32 roleid = (from k in data.msUsers where k.nrp == karyawan.nrp && (k.roleId == Konstan.SYSADMIN || k.roleId == Konstan.GA) select k.roleId).FirstOrDefault(); if (roleid == Konstan.GA || strLoginID.Contains("yudisss") || roleid == Konstan.SYSADMIN) { gvMasterHardship.Visible = true; btnTambah.Visible = true; } else { gvMasterHardship.Visible = false; btnTambah.Visible = false; } if (!IsPostBack) { inputForm.Visible = false; hfmode.Value = "add"; BindDropdowListPropinsi(); BindGridMasterHardship(); } }
protected void btnView_Click(object sender, EventArgs e) { if (tbNoSPD.Text == "") { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", string.Format("alert('Isi no SPD');"), true); return; } //this.CrystalReportSource1.Report.FileName = "~/UserControls/Reports/DriverAbsence.rpt"; //validasi spd punya user login string strLoginID = ""; if (Session["IDLogin"] == null) { Response.Redirect("frmHome.aspx"); } else { strLoginID = (string)Session["IDLogin"]; } dsSPDDataContext dsp = new dsSPDDataContext(); classSpd oSPD = new classSpd(); msKaryawan karyawan = oSPD.getKaryawan(strLoginID); var trSpd = (from k in dsp.trSPDs where k.nrp == karyawan.nrp select k).First(); if (trSpd == null) { ScriptManager.RegisterStartupScript(this, typeof(Page), "alertAkses", string.Format("alert('Akses di tolak');"), true); } else { this.CrystalReportSource1.ReportDocument.SetParameterValue("noSPDClaim", tbNoSPD.Text); LogonReport(this.CrystalReportSource1.ReportDocument); pnlView.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string strLoginID = string.Empty; bool ga = false; if (Session["IDLogin"] != null) { strLoginID = (string)Session["IDLogin"]; } else { strLoginID = SetLabelWelcome(); } ga = cek_ga(strLoginID); if (cek_ga(strLoginID) == false && cek_su(strLoginID) == false) { Response.Redirect("frmHome.aspx"); } classSpd oSPD = new classSpd(); karyawan = oSPD.getKaryawan(strLoginID); if (ddlTipe.SelectedValue == "spd") { PanelSPD.Visible = false; PanelClaim.Visible = false; } else { PanelSPD.Visible = false; PanelClaim.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { string strLoginID = string.Empty; classSpd oSPD = new classSpd(); if (Session["IDLogin"] != null) { strLoginID = (string)Session["IDLogin"]; } else { strLoginID = SetLabelWelcome(); } msKaryawan karyawan = oSPD.getKaryawan(strLoginID); dsSPDDataContext data = new dsSPDDataContext(); Int32 roleid = (from k in data.msUsers where k.nrp == karyawan.nrp && (k.roleId == Konstan.SYSADMIN || k.roleId == Konstan.GA) select k.roleId).FirstOrDefault(); if (roleid == Konstan.SYSADMIN || roleid == Konstan.GA || strLoginID.Contains("yudi")) { cmbxUser.Visible = true; cmbxUserRole.Visible = true; gvRole.Visible = true; btnAdd.Visible = true; Label1.Visible = true; Label2.Visible = false; } else { cmbxUser.Visible = false; cmbxUserRole.Visible = false; gvRole.Visible = false; btnAdd.Visible = false; Label1.Visible = false; Label2.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["IDLogin"] == null) { Response.Redirect("frmHome.aspx"); } strID = (string)Session["IDLogin"]; karyawan = oSPD.getKaryawan(strID); Session["nrpLogin"] = karyawan.nrp; if (string.IsNullOrEmpty(karyawan.nrp)) { Response.Redirect("frmHome.aspx"); } nrp.Value = karyawan.nrp; if ((bool)Session["sekretaris"]) { if (!IsPostBack) { spdDirector.Visible = true; bindDirect(); ddlstatus.Visible = false; txtcari.Visible = false; } } else { if (!IsPostBack) { bindGvlist(); } } }
protected void lbListSPDCancel_Click(object sender, EventArgs e) { if (cek_ga(Session["IDLogin"].ToString())) { //cr : 2015-1-30 ian try { var lb = (Control)sender; GridViewRow row = (GridViewRow)lb.NamingContainer; classSpd oSPD = new classSpd(); karyawan = oSPD.getKaryawan(Session["IDLogin"].ToString()); string noSPD = row.Cells[0].Text; string nrpApproval = karyawan.nrp; string emailApproval = karyawan.EMail; string action = "cancel"; ApprovalUrl1 approvalUrl = new ApprovalUrl1(); lblStat.Text = approvalUrl.ChangeStatus(noSPD, action, nrpApproval); } catch (Exception ex) { Response.Write(ex.Message); } #region changed //string status = "29-SPD Cancel"; //cek_spd(sender, status); //historyApproval(sender, status); #endregion btnFind_Click(null, null); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["IDLogin"] == null || Session["noSPD"] == null) { Response.Redirect("frmHome.aspx"); } strID = (string)Session["IDLogin"]; karyawan = oSPD.getKaryawan(strID); Session["nrpLogin"] = karyawan.nrp; if (string.IsNullOrEmpty(karyawan.nrp)) { Response.Redirect("frmHome.aspx"); } using (var ctx = new dsSPDDataContext()) { var spd = ctx.trSPDs.FirstOrDefault(o => o.noSPD == Session["noSPD"].ToString()); var spdApprovals = ctx.ApprovalStatus .Where(m => m.NoSPD == spd.noSPD) .OrderBy(m => m.IndexLevel); var spdApproval = new ApprovalStatus(); foreach (var approval in spdApprovals) { var msKaryawan = ctx.msKaryawans .Where(m => m.nrp == approval.NrpApproval) .Where(m => m.statusKaryawan == "Active") .FirstOrDefault(); if (msKaryawan != null) { spdApproval = approval; break; } } if (spdApproval == null) { lblEmpty.Text += "Data approval tidak ditemukan ," + Environment.NewLine; } if (spd == null) { lblEmpty.Text += "Data tidak ditemukan ," + Environment.NewLine; } else { if (spd.isApproved != true) { lblEmpty.Text += "Spd rejected ," + Environment.NewLine; } if (spd.isCancel == true) { lblEmpty.Text += "Spd Canceled ," + Environment.NewLine; } } if (string.IsNullOrEmpty(lblEmpty.Text)) { lblEmpty.Visible = false; DetailSPD.Visible = true; if (!IsPostBack) { switch (userType(karyawan.nrp)) { case 17: // GA PnlCostCenter.Visible = true; break; default: break; } hiddenSPD.Value = spd.noSPD; hiddenNrpAtasan.Value = spdApproval.NrpApproval; isLuarNegeri.Checked = false; kurs.Visible = false; HideResult(false); // kalo tujuan keluar negeri result dalam rupiah dan juga input kurs dimunculin, // input kurs default nilainya 1, karena akan dikalikan untuk hasil yang akan di entri ke database if (spd.Tujuan.ToLower().Contains("luar negeri")) { isLuarNegeri.Checked = true; kurs.Visible = true; HideResult(true); } GenerateContent(spd); } } else { lblEmpty.Visible = true; DetailSPD.Visible = false; } } }
private void historyApproval(object sender, string status) { if (Session["IDLogin"] == null) { Response.Redirect("frmHome.aspx"); } else { string strLoginID = (string)Session["IDLogin"]; classSpd oSPD = new classSpd(); msKaryawan karyawan = new msKaryawan(); karyawan = oSPD.getKaryawan(strLoginID); LinkButton link = (LinkButton)sender; GridViewRow gv = (GridViewRow)(link.NamingContainer); dsSPDDataContext data = new dsSPDDataContext(); string strNoSpd = gv.Cells[0].Text; string strNRP = strLoginID; string strStatus = status; //var role = (from msUser in data.msUsers.AsEnumerable() // where msUser.nrp == karyawan.nrp // select msUser).First(); //var role = (from msRole in data.msRoles.AsEnumerable() // where msRole.namaRole == karyawan.posisi // select msRole).First(); //string strRole = Convert.ToString(role.id); //string strRole = Convert.ToString(role.roleId); string strRole = ""; var role = (from msRole in data.msRoles.AsEnumerable() where msRole.namaRole == karyawan.posisi select msRole).First(); if (role != null) { strRole = Convert.ToString(role.id); } else { var user = (from msUser in data.msUsers.AsEnumerable() where msUser.nrp == karyawan.nrp select msUser).First(); if (user != null) { strRole = Convert.ToString(user.roleId); } else { strRole = "1"; } } DateTime dateApproval = DateTime.Now; trApprovalHistory AppHistory = new trApprovalHistory(); AppHistory.noSPD = strNoSpd; AppHistory.nrpApprover = strNRP; AppHistory.statusApproval = strStatus; AppHistory.idRole = strRole; AppHistory.approvalDatetime = dateApproval; data.trApprovalHistories.InsertOnSubmit(AppHistory); data.SubmitChanges(); data.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { try { using (var ctx = new dsSPDDataContext()) { if (!Page.IsPostBack) { //strLoginID = SetLabelWelcome();//production //strLoginID = "benny00002704"; //strLoginID = "titin008704"; //strLoginID = "siska90000308"; //strLoginID = "HP"; strLoginID = ConfigurationManager.AppSettings["DevstrLoginID"].ToString();//development Session["IDLogin"] = strLoginID; classSpd oSPD = new classSpd(); karyawan = oSPD.getKaryawan(strLoginID); Session["nrpLogin"] = karyawan.nrp; if (string.IsNullOrEmpty(karyawan.nrp)) { errorLogin += "User (karyawan) tidak ditemukan, session login kosong, silahkan close browser anda, lalu login ulang."; } msUser sekretaris = (from u in ctx.msUsers where u.nrp == karyawan.nrp && u.roleId == Konstan.SEKRETARIS select u).FirstOrDefault(); if (sekretaris != null) { Session["sekretaris"] = true; } else { Session["sekretaris"] = false; } } } ////debug //txtLogin.Visible = true; //if (Page.IsPostBack) txtLogin_TextChanged(null, null); } catch (Exception) { // sorry broo saya cuman ngakal2in crash loginnya soalnya minta login ke server laen -_-" bool recIt = ApplicationPoolRecycle.RecycleCurrentApplicationPool(); HttpRuntime.UnloadAppDomain(); Response.Redirect("~/FormError.aspx?e=Applikasi sedang merefresh, silahkan close browser anda, lalu login ulang."); } finally { ////debug only //if (Page.IsPostBack) //{ // Response.Redirect("~/newFormHome.aspx"); //} //production if (!string.IsNullOrEmpty(errorLogin)) { Response.Redirect("~/FormError.aspx?e=" + errorLogin); } else { Response.Redirect("~/newFormHome.aspx"); } } }