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; } } } }
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); } }
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 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) { classSpd cspd = new classSpd(); if (!IsPostBack) { pnlForm.Visible = false; hfmode.Value = "add"; fillGV(); } }
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 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) { 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 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 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); } }
private void ubahStatusSPD(string strNoSpd, string stat, string subject, HttpContext ctx) { string role = string.Empty, Approver = string.Empty; bool sending = false; dsSPDDataContext data = new dsSPDDataContext(); trSPD oSpd = (from spd in data.trSPDs where spd.noSPD == strNoSpd select spd).FirstOrDefault(); msKaryawan kary = new msKaryawan(); if (oSpd.nrp != "99999999") { kary = (from kar in data.msKaryawans where kar.nrp == oSpd.nrp select kar).FirstOrDefault(); } //Ditambahkan oleh martha else if (oSpd.nrp == "2950") { kary.EMail = "*****@*****.**"; kary.nrp = oSpd.nrp; kary.namaLengkap = oSpd.namaLengkap; kary.golongan = "III"; kary.Job = oSpd.jabatan; kary.posisi = oSpd.jabatan; kary.coCd = "1"; kary.kodePSubArea = "1"; kary.kodePA = "1"; } else { kary.EMail = oSpd.email; kary.nrp = oSpd.nrp; kary.namaLengkap = oSpd.namaLengkap; kary.golongan = "III"; kary.Job = oSpd.jabatan; kary.posisi = oSpd.jabatan; kary.coCd = "1"; kary.kodePSubArea = "1"; kary.kodePA = "1"; } if (subject.ToLower().Trim() == "atasan") { if (stat.ToLower().Trim() == "approve") { if (oSpd.status.Split('-')[0] == "2") { oSpd.status = "3-Atasan Approve"; ctx.Response.Write("Berhasil di approve"); sending = true; } else { ctx.Response.Write("SPD Sudah Diapprove sebelumnya"); sending = false; } } else { if (oSpd.status.Split('-')[0] == "2") { oSpd.status = "12-SPD Tolak (Atasan)"; ctx.Response.Write("Berhasil di reject"); sending = true; } else { ctx.Response.Write("SPD Sudah di tolak sebelumnya"); sending = false; } } role = "1"; Approver = oSpd.nrpAtasan; } else if (subject.ToLower().Trim() == "tujuan") { if (oSpd.tglBerangkat.Date > DateTime.Now.Date) { ctx.Response.Write("SPD belum bisa approve/reject karena tanggal berangkat harus sesudah atau sama dengan hari ini"); sending = false; return; } if (stat.ToLower().Trim() == "approve") { if (oSpd.status.Split('-')[0] == "3") { oSpd.status = "7-Tempat Tujuan Approve"; ctx.Response.Write("Berhasil di approve"); sending = true; } else { ctx.Response.Write("SPD Sudah Diapprove sebelumnya"); sending = false; } } else { if (oSpd.status.Split('-')[0] == "3") { oSpd.status = "13-SPD Tolak (Tujuan)"; ctx.Response.Write("Berhasil di reject"); sending = true; } else { ctx.Response.Write("SPD sudah ditolak sebelumnya"); sending = false; } } role = "2"; Approver = oSpd.nrpApprovalTujuan; } if (sending) { trApprovalHistory ah = new trApprovalHistory(); ah.noSPD = strNoSpd; ah.idRole = role; ah.statusApproval = oSpd.status; ah.nrpApprover = Approver; ah.approvalDatetime = DateTime.Now; data.trApprovalHistories.InsertOnSubmit(ah); data.SubmitChanges(); classSpd oClassSPD = new classSpd(); switch (oSpd.status.Split('-')[0]) { case "2": oClassSPD.sendMail(oSpd, "Atasan", kary); break; case "3": oClassSPD.sendMail(oSpd, "Pembuat", kary); oClassSPD.sendMail(oSpd, "Tujuan", kary); oClassSPD.sendMail(oSpd, "GA", kary); break; case "6": oClassSPD.sendMail(oSpd, "Pembuat", kary); oClassSPD.sendMail(oSpd, "Tujuan", kary); oClassSPD.sendMail(oSpd, "GA", kary); break; case "7": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "8": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "9": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "12": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "13": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; } } data.Dispose(); }
private void ubahStatusClaim(string strNoSpd, string stat, string subject, HttpContext ctx) { string role = string.Empty, Approver = string.Empty; dsSPDDataContext data = new dsSPDDataContext(); bool sending = false; trSPD oSpd = (from spd in data.trSPDs where spd.noSPD == strNoSpd select spd).First(); trClaim oClaim = (from spd in data.trClaims where spd.noSPD == strNoSpd select spd).First(); msKaryawan kary = new msKaryawan(); if (oSpd.nrp != "99999999") { kary = (from kar in data.msKaryawans where kar.nrp == oSpd.nrp select kar).FirstOrDefault(); } else { kary.EMail = oSpd.email; kary.nrp = oSpd.nrp; kary.namaLengkap = oSpd.namaLengkap; kary.golongan = "III"; kary.Job = oSpd.jabatan; kary.posisi = oSpd.jabatan; kary.coCd = "1"; kary.kodePSubArea = "1"; kary.kodePA = "1"; } if (subject.ToLower().Trim() == "atasan") { if (stat.ToLower().Trim() == "approve") { if (oSpd.status.Split('-')[0] == "11") { oClaim.status = "16-Claim Approve (Atasan)"; oSpd.status = "16-Claim Approve (Atasan)"; ctx.Response.Write("Berhasil di approve"); sending = true; } else { ctx.Response.Write("Claim sudah berhasil Di approve sebelumnya"); sending = false; } } else { if (oSpd.status.Split('-')[0] == "11") { oClaim.status = "14-Claim Tolak (Atasan)"; oSpd.status = "14-Claim Tolak (Atasan)"; ctx.Response.Write("Berhasil di reject"); sending = true; } else { ctx.Response.Write("Claim sudah berhasil ditolak sebelumnya"); sending = false; } } role = "1"; Approver = oSpd.nrpAtasan; } else if (subject.ToLower().Trim() == "ga") { if (stat.ToLower().Trim() == "approve") { if (oSpd.status.Split('-')[0] == "16") { oClaim.status = "17-Claim Approve (GA)"; oSpd.status = "17-Claim Approve (GA)"; ctx.Response.Write("Berhasil di approve"); sending = true; } else { ctx.Response.Write("Claim sudah berhasil di-approve sebelumnya"); sending = false; } } else { if (oSpd.status.Split('-')[0] == "16") { oClaim.status = "15-Claim Tolak (GA)"; oSpd.status = "15-Claim Tolak (GA)"; ctx.Response.Write("Berhasil di reject"); sending = true; } else { ctx.Response.Write("Claim sudah berhasil di-reject sebelumnya"); sending = false; } } role = "17"; Approver = oSpd.nrpAtasan; } else if (subject.ToLower().Trim() == "finance") { if (stat.ToLower().Trim() == "approve") { if (oSpd.status.Split('-')[0] == "17") { oClaim.status = "26-Finance Approve"; oSpd.status = "26-Finance Approve"; ctx.Response.Write("Berhasil di approve"); sending = true; } else { ctx.Response.Write("Claim sudah berhasil di-Approve sebelumnya"); sending = false; } } else { if (oSpd.status.Split('-')[0] == "17") { oClaim.status = "27-Finance Tolak"; oSpd.status = "27-Finance Tolak"; ctx.Response.Write("Berhasil di reject"); sending = true; } else { ctx.Response.Write("Claim sudah berhasil di-reject sebelumnya"); sending = false; } } role = "19"; Approver = oSpd.nrpAtasan; } else if (subject.ToLower().Trim() == "kasir") { if (oSpd.status.Split('-')[0] == "26") { oClaim.status = "20-Claim Close"; oSpd.status = "20-Claim Close"; ctx.Response.Write("Berhasil di Close"); sending = true; } else { ctx.Response.Write("Claim sudah berhasil di-Close sebelumnya"); sending = false; } role = "20"; Approver = oSpd.nrpAtasan; } //data.SubmitChanges(); if (sending) { classSpd oClassSPD = new classSpd(); trApprovalHistory ah = new trApprovalHistory(); ah.noSPD = strNoSpd; ah.idRole = role; ah.statusApproval = oSpd.status; ah.nrpApprover = Approver; ah.approvalDatetime = DateTime.Now; data.trApprovalHistories.InsertOnSubmit(ah); data.SubmitChanges(); switch (oSpd.status.Split('-')[0]) { case "2": oClassSPD.sendMail(oSpd, "Atasan", kary); break; case "3": oClassSPD.sendMail(oSpd, "Pembuat", kary); oClassSPD.sendMail(oSpd, "GA", kary); oClassSPD.sendMail(oSpd, "Tujuan", kary); break; case "6": oClassSPD.sendMail(oSpd, "Pembuat", kary); oClassSPD.sendMail(oSpd, "GA", kary); oClassSPD.sendMail(oSpd, "Tujuan", kary); break; case "8": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "9": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "12": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "13": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "14": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "16": oClassSPD.sendMail(oSpd, "GA", kary); oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "15": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "17": oClassSPD.sendMail(oSpd, "finance", kary); oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "27": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "26": //oClassSPD.sendMail(oSpd, "kasir", kary); oClassSPD.sendMail(oSpd, "Pembuat", kary); break; case "20": oClassSPD.sendMail(oSpd, "Pembuat", kary); break; } } data.Dispose(); }
protected void btnSave_Click(object sender, EventArgs e) { using (var ctx = new dsSPDDataContext()) { List <string> errorMessageHidden = new List <string>(); trSPD spd = ctx.trSPDs.FirstOrDefault(o => o.noSPD == hiddenSPD.Value); if (spd == null) { errorMessageHidden.Add("Data SPD tidak ditemukan"); } if (string.IsNullOrEmpty(hiddenNrpAtasan.Value)) { errorMessageHidden.Add("Data approval atasan tidak ditemukan"); } trClaim claim = ctx.trClaims.FirstOrDefault(o => o.noSPD == spd.noSPD); if (claim != null) { claim.ApprovedAtasanBy = spd.trClaim.ApprovedAtasanBy; claim.ApprovedGABy = spd.trClaim.ApprovedGABy; claim.ApprovedFinanceBy = spd.trClaim.ApprovedFinanceBy; claim.isApprovedAtasan = spd.trClaim.isApprovedAtasan; claim.isApprovedAtasanDate = spd.trClaim.isApprovedAtasanDate; claim.isApprovedFinance = spd.trClaim.isApprovedFinance; claim.isApprovedFinanceDate = spd.trClaim.isApprovedFinanceDate; claim.isApprovedGA = spd.trClaim.isApprovedGA; claim.isApprovedGADate = spd.trClaim.isApprovedGADate; claim.isCancel = spd.trClaim.isCancel; claim.isCancelDate = spd.trClaim.isCancelDate; claim.isSubmit = spd.trClaim.isSubmit; claim.isSubmitDate = spd.trClaim.isSubmitDate; claim.status = spd.trClaim.status; } if (errorMessageHidden.Count == 0 && claim == null) { claim = new trClaim(); claim.noSPD = hiddenSPD.Value; claim.dibuatOleh = karyawan.nrp; claim.dibuatTanggal = DateTime.Now; claim.status = "Saved"; claim.nrpAtasan = hiddenNrpAtasan.Value; ctx.trClaims.InsertOnSubmit(claim); } // convert ke integer var kursInt = Convert.ToInt32(txtKurs.Text); var uangMakan = Convert.ToInt32(UangMakan.Text); var uangSaku = Convert.ToInt32(UangSaku.Text); var tiket = Convert.ToInt32(Tiket.Text); var hotel = Convert.ToInt32(Hotel.Text); var laundry = Convert.ToInt32(Laundry.Text); var komunikasi = Convert.ToInt32(Komunikasi.Text); var airPortTax = Convert.ToInt32(AirPortTax.Text); var bbm = Convert.ToInt32(BBM.Text); var tol = Convert.ToInt32(Tol.Text); var taxi = Convert.ToInt32(Taxi.Text); var parkir = Convert.ToInt32(Parkir.Text); var tunjanganKejauhan = Convert.ToInt32(Tunjangankejauhan.Text);//9 oktober 2018 var biayaLainlain = Convert.ToInt32(BiayaLainlain.Text); var total = uangMakan + uangSaku + tiket + hotel + laundry + komunikasi + airPortTax + bbm + tol + taxi + parkir + tunjanganKejauhan + biayaLainlain; var uangMuka = Convert.ToInt64(UangMuka.Text); claim.biayaMakan = uangMakan; claim.uangSaku = uangSaku; claim.tiket = tiket; claim.hotel = hotel; claim.BBM = bbm; claim.tol = tol; claim.taxi = taxi; claim.airportTax = airPortTax; claim.laundry = laundry; claim.parkir = parkir; claim.komunikasi = komunikasi; claim.UangTunjanganKejauhan = tunjanganKejauhan; // 9 oktober 2018 claim.ketLainLain = txtKeteranganBiayaLainlain.Text; claim.biayaLainLain = biayaLainlain; claim.total = total; claim.kurs = kursInt; claim.diubahOleh = karyawan.nrp; claim.diubahTanggal = DateTime.Now; spd.uangMuka = uangMuka.ToString(); if (ifga(karyawan.nrp)) { spd.costCenter = DdlCostCenter.SelectedValue; } //update 26 september 2018 claim.uangSaku_cek = cbUangSaku.Checked; claim.hotelTanpaPenginapan_cek = cbHotelTanpaPenginapan.Checked;// claim.tiket_cek = cbTiket.Checked; claim.hotel_cek = cbHotel.Checked; claim.laundry_cek = cbLaundry.Checked; claim.komunikasi_cek = cbKomunikasi.Checked; claim.airportTax_cek = cbAirPortTax.Checked; claim.BBM_cek = cbBBM.Checked; claim.tol_cek = cbTol.Checked; claim.taxi_cek = cbTaxi.Checked; claim.parkir_cek = cbParkir.Checked; string rgPattern = "[\\\\\\/:\\*\\?\"\'<>|]"; Regex objRegEx = new Regex(rgPattern); if (fuDoc.HasFile) { string uploadDirbpkb = spd.noSPD + "_1_" + System.IO.Path.GetFileName(fuDoc.PostedFile.FileName); string strBaseLocation = Server.MapPath("Attach") + "\\" + objRegEx.Replace(uploadDirbpkb, ""); fuDoc.PostedFile.SaveAs(strBaseLocation); string nama = objRegEx.Replace(uploadDirbpkb, ""); claim.urlBoardingPass = nama; } if (fuDoc1.HasFile) { string uploadDirbpkb1 = spd.noSPD + "_2_" + System.IO.Path.GetFileName(fuDoc1.PostedFile.FileName); string strBaseLocation1 = Server.MapPath("Attach") + "\\" + objRegEx.Replace(uploadDirbpkb1, ""); fuDoc1.PostedFile.SaveAs(strBaseLocation1); string nama1 = objRegEx.Replace(uploadDirbpkb1, ""); claim.urlBoardingPass1 = nama1; } try { ctx.SubmitChanges(); } catch (Exception ex) { errorMessageHidden.Add("Gagal save claim|" + ex.Message.ToString()); errorMessageHidden.Add(ex.Message); } finally { pnlSuccess.Visible = true; pnlError.Visible = false; lblSuccess.Text += "Claim Berhasil di Save" + Environment.NewLine; if (ifga(karyawan.nrp)) { lblSuccess.Text += "Jika submit diclick (GA), maka proses approval akan diulang dari awal."; } btnSave.Enabled = false; btnReset.Disabled = true; //ian 2015-04-10 if (claim != null) { if (claim.isSubmit == true) { btnSubmit.Enabled = false; } if (claim.isSubmit == null) { btnSubmit.Enabled = true; } } else { btnSubmit.Enabled = true; } //end if (ifga(karyawan.nrp)) { if (claim.uangSaku_cek == true || claim.tiket_cek == true || claim.hotel_cek == true || claim.laundry_cek == true || claim.komunikasi_cek == true || claim.airportTax_cek == true || claim.BBM_cek == true || claim.tol_cek == true || claim.taxi_cek == true || claim.parkir_cek == true) { msKaryawan kary = new msKaryawan(); if (spd.nrp == "99999999") { kary.EMail = spd.email; kary.nrp = spd.nrp; kary.namaLengkap = spd.namaLengkap; kary.golongan = "III"; kary.Job = spd.jabatan; kary.posisi = spd.jabatan; kary.coCd = "1"; kary.kodePSubArea = "1"; kary.kodePA = "1"; } else { kary = (from kar in ctx.msKaryawans where kar.nrp == spd.nrp select kar).First(); } classSpd oSpd = new classSpd(); oSpd.sendMailClaim(claim, kary, spd); } } } if (errorMessageHidden.Count() > 0) { errorMessage.DataSource = errorMessageHidden; errorMessage.DataBind(); pnlError.Visible = true; pnlSuccess.Visible = false; btnSubmit.Enabled = 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 btnSave_Click(object sender, EventArgs e) { if (Session["noSPDc"] == null) { Response.Redirect("frmClaimApproval.aspx"); } else { using (dsSPDDataContext data = new dsSPDDataContext()) { trClaim claim = new trClaim(); if (!string.IsNullOrEmpty(txtNoSPD.Text)) { trSPD spd = data.trSPDs.FirstOrDefault(o => o.noSPD == txtNoSPD.Text); if (spd != null) { if (spd.isApproved == true && spd.isCancel == null) { try { claim = (from c in data.trClaims where c.noSPD == txtNoSPD.Text select c).FirstOrDefault(); bool flagCeklisControl = false; if (claim == null) { trClaim claimNew = new trClaim(); getFromForm(ref claimNew); claimNew.status = "Saved"; claimNew.dibuatOleh = karyawan.nrp; claimNew.dibuatTanggal = DateTime.Now; data.trClaims.InsertOnSubmit(claimNew); data.SubmitChanges(); if (claimNew.tiket_cek == true || claimNew.hotel_cek == true || claimNew.laundry_cek == true || claimNew.komunikasi_cek == true || claimNew.airportTax_cek == true || claimNew.BBM_cek == true || claimNew.tol_cek == true || claimNew.taxi_cek == true || claimNew.parkir_cek == true) { flagCeklisControl = true; } } else { getFromForm(ref claim); if (FLDgamode.Value.ToString().ToLower() == "false") { claim.status = "Saved"; } claim.diubahOleh = karyawan.nrp; claim.diubahTanggal = DateTime.Now; data.SubmitChanges(); if (claim.tiket_cek == true || claim.hotel_cek == true || claim.laundry_cek == true || claim.komunikasi_cek == true || claim.airportTax_cek == true || claim.BBM_cek == true || claim.tol_cek == true || claim.taxi_cek == true || claim.parkir_cek == true) { flagCeklisControl = true; } } #region SendMail Checking Data if (flagCeklisControl) { msKaryawan kary = new msKaryawan(); if (spd.nrp == "99999999") { kary.EMail = spd.email; kary.nrp = spd.nrp; kary.namaLengkap = spd.namaLengkap; kary.golongan = "III"; kary.Job = spd.jabatan; kary.posisi = spd.jabatan; kary.coCd = "1"; kary.kodePSubArea = "1"; kary.kodePA = "1"; } else { kary = (from kar in data.msKaryawans where kar.nrp == spd.nrp select kar).First(); } classSpd oSpd = new classSpd(); oSpd.sendMailClaim(claim, kary, spd); } #endregion btnSave.Enabled = true; if (FLDgamode.Value.ToString().ToLower() == "false") { btnSubmit.Enabled = true; } lblKet.Text = "Claim berhasil di-Save"; } catch (Exception ex) { Response.Write(ex.Message); } } else { lblKet.Text = "SPD belum di approve atau direject atau juga dicancel"; } } else { lblKet.Text = "SPD tidak ditemukan"; } } else { lblKet.Text = "Isi no spd"; } } } }
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"); } } }