private void setIntoForm(trClaim claim) { txtNoSPD.Text = claim.noSPD; txtSTMakan.Text = claim.biayaMakan.ToString(); txtSTUangSk.Text = claim.uangSaku.ToString(); txtTiket.Text = claim.tiket.ToString(); chkTiket.Checked = claim.tiket_cek == null ? false : Convert.ToBoolean(claim.tiket_cek); txtHotel.Text = claim.hotel.ToString(); chkPenginapan.Checked = claim.hotel_cek == null ? false : Convert.ToBoolean(claim.hotel_cek); txtBBM.Text = claim.BBM.ToString(); chkBBM.Checked = claim.BBM_cek == null ? false : Convert.ToBoolean(claim.BBM_cek); txtTol.Text = claim.tol.ToString(); chkTol.Checked = claim.tol_cek == null ? false : Convert.ToBoolean(claim.tol_cek); txtTaxi.Text = claim.taxi.ToString(); chkTaxi.Checked = claim.taxi_cek == null ? false : Convert.ToBoolean(claim.taxi_cek); txtAirPortTax.Text = claim.airportTax.ToString(); chkAirportTax.Checked = claim.airportTax_cek == null ? false : Convert.ToBoolean(claim.airportTax_cek); txtLaundry.Text = claim.laundry.ToString(); chkLaundry.Checked = claim.laundry_cek == null ? false : Convert.ToBoolean(claim.laundry_cek); txtParkir.Text = claim.parkir.ToString(); chkParkir.Checked = claim.parkir_cek == null ? false : Convert.ToBoolean(claim.parkir_cek); txtLainlain.Text = claim.ketLainLain; txtLainlain.Text = claim.biayaLainLain.ToString(); txtTotal.Text = claim.total.ToString(); lblAtasan.Text = claim.nrpAtasan.Trim(); txtKomunikasi.Text = claim.komunikasi.ToString(); chkKomunikasi.Checked = claim.komunikasi_cek == null ? false : Convert.ToBoolean(claim.komunikasi_cek); kurs.Text = claim.kurs.ToString(); }
private void getFromForm(ref trClaim claim) { claim.noSPD = txtNoSPD.Text; claim.biayaMakan = int.Parse(txtSTMakan.Text); claim.uangSaku = int.Parse(txtSTUangSk.Text); claim.tiket = int.Parse(txtTiket.Text); claim.tiket_cek = chkTiket.Checked; claim.hotel = int.Parse(txtHotel.Text); claim.hotel_cek = chkPenginapan.Checked; claim.BBM = int.Parse(txtBBM.Text); claim.BBM_cek = chkBBM.Checked; claim.tol = int.Parse(txtTol.Text); claim.tol_cek = chkTol.Checked; claim.taxi = int.Parse(txtTaxi.Text); claim.taxi_cek = chkTaxi.Checked; claim.airportTax = int.Parse(txtAirPortTax.Text); claim.airportTax_cek = chkAirportTax.Checked; claim.laundry = int.Parse(txtLaundry.Text); claim.laundry_cek = chkLaundry.Checked; claim.parkir = int.Parse(txtParkir.Text); claim.parkir_cek = chkParkir.Checked; claim.ketLainLain = txtLainlainDetail.Text; claim.biayaLainLain = int.Parse(txtLainlain.Text); claim.total = int.Parse(txtTotal.Text); claim.nrpAtasan = lblAtasan.Text.Trim(); claim.komunikasi = int.Parse(txtKomunikasi.Text); claim.komunikasi_cek = chkKomunikasi.Checked; claim.kurs = int.Parse(kurs.Text); //claim.status = "10-Claim Simpan"; }
protected void btnSubmit_Click(object sender, EventArgs e) { using (var ctx = new dsSPDDataContext()) { List <string> errorMessageHidden = new List <string>(); trClaim claim = ctx.trClaims.FirstOrDefault(o => o.noSPD == hiddenSPD.Value); trSPD spd = ctx.trSPDs.FirstOrDefault(o => o.noSPD == claim.noSPD); if (claim == null) { errorMessageHidden.Add("Data claim tidak ditemukan, submit tidak bisa diproses"); } if (spd == null) { errorMessageHidden.Add("Data spd tidak ditemukan, submit tidak bisa diproses"); } if (errorMessageHidden.Count == 0) { claim.status = "Menunggu approval atasan"; claim.isSubmit = true; claim.isSubmitDate = DateTime.Now; claim.diubahOleh = karyawan.nrp; claim.diubahTanggal = DateTime.Now; try { ctx.SubmitChanges(); } catch (Exception) { errorMessageHidden.Add("Error submit, gagal merubah data"); } } if (errorMessageHidden.Count == 0) { EmailCore.ApprovalClaim(claim.nrpAtasan, spd.noSPD, spd, "Atasan", claim.status); lblSuccess.Text = "Claim Berhasil di Submit"; pnlError.Visible = false; pnlSuccess.Visible = true; btnSave.Enabled = false; btnSubmit.Enabled = false; btnReset.Disabled = true; } if (errorMessageHidden.Count() > 0) { errorMessage.DataSource = errorMessageHidden; errorMessage.DataBind(); pnlError.Visible = true; pnlSuccess.Visible = false; } } }
private StringBuilder ContentBodymail(StringBuilder emailMessage, trSPD spd, trClaim claim, msKaryawan kar) { //System.Net.Mail.MailMessage email = new System.Net.Mail.MailMessage(); //StringBuilder Content = new StringBuilder(); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b>Detail Karyawan </b>")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("No. SPD : {0}", spd.noSPD)); emailMessage.Append("<br />"); emailMessage.Append(string.Format("NRP : {0}", spd.nrp)); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Nama Lengkap : {0}", spd.namaLengkap)); emailMessage.Append("<br />"); emailMessage.Append(string.Format("No Handphone : {0}", spd.NoHP != null ? spd.NoHP : "-")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Jabatan : {0}", kar.posisi)); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Organisasi Unit : {0}", kar.organisasiUnit != null ? kar.organisasiUnit : "-")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Company Code : {0}", kar.companyCode != null ? kar.companyCode : "-")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Personel Area : {0}", kar.personelArea != null ? kar.personelArea : "-")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Personel Sub Area : {0}", kar.pSubArea != null ? kar.pSubArea : "-")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Cost Center Pembebanan : {0}", spd.costCenter != null ? spd.costCenter : "-")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b>Detail SPD </b>")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Tempat Tujuan : {0}", spd.tempatTujuanLain != null ? spd.tempatTujuanLain : spd.companyCodeTujuan + " - " + spd.personelAreaTujuan + " - " + spd.pSubAreaTujuan)); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Keperluan : {0}", spd.keperluanLain != null ? spd.keperluanLain : spd.msKeperluan.keperluan)); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Tanggal Berangkat : {0} ", String.Format("{0:MM/dd/yyyy}", spd.tglBerangkat))); emailMessage.Append(string.Format("Jam Berangkat : {0} ", spd.jamBerangkat)); emailMessage.Append(string.Format("Menit Berangkat : {0} ", spd.menitBerangkat)); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Tanggal Kembali : {0} ", String.Format("{0:MM/dd/yyyy}", spd.tglKembali))); emailMessage.Append(string.Format("Jam Kembali : {0} ", spd.jamKembali)); emailMessage.Append(string.Format("Menit Kembali : {0} ", spd.menitKembali)); if (claim != null) { emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b>Total Claim : {0} </b>", claim.total)); } emailMessage.Append("<br />"); emailMessage.Append("<br />"); return(emailMessage); }
private void BindClaim(trClaim claim) { if (isLuarNegeri.Checked) { txtKurs.Text = claim.kurs.ToString(); txtUangMakan.Text = (claim.biayaMakan / claim.kurs).ToString(); txtUangSaku.Text = (claim.uangSaku / claim.kurs).ToString(); txtTiket.Text = (claim.tiket / claim.kurs).ToString(); txtHotel.Text = (claim.hotel / claim.kurs).ToString(); txtLaundry.Text = (claim.laundry / claim.kurs).ToString(); txtKomunikasi.Text = (claim.komunikasi / claim.kurs).ToString(); txtAirPortTax.Text = (claim.airportTax / claim.kurs).ToString(); txtBBM.Text = (claim.BBM / claim.kurs).ToString(); txtTol.Text = (claim.tol / claim.kurs).ToString(); txtTaxi.Text = (claim.taxi / claim.kurs).ToString(); txtParkir.Text = (claim.parkir / claim.kurs).ToString(); txtBiayaLainlain.Text = (claim.biayaLainLain / claim.kurs).ToString(); txtTotal.Text = (claim.total / claim.kurs).ToString(); } else { txtKurs.Text = claim.kurs.ToString(); txtUangMakan.Text = claim.biayaMakan.ToString(); txtUangSaku.Text = claim.uangSaku.ToString(); txtTiket.Text = claim.tiket.ToString(); txtHotel.Text = claim.hotel.ToString(); txtLaundry.Text = claim.laundry.ToString(); txtKomunikasi.Text = claim.komunikasi.ToString(); txtAirPortTax.Text = claim.airportTax.ToString(); txtBBM.Text = claim.BBM.ToString(); txtTol.Text = claim.tol.ToString(); txtTaxi.Text = claim.taxi.ToString(); txtParkir.Text = claim.parkir.ToString(); txtBiayaLainlain.Text = claim.biayaLainLain.ToString(); txtTunjanganKejauhan.Text = claim.UangTunjanganKejauhan.ToString(); //9 oktober 2018 txtTotal.Text = claim.total.ToString(); } txtKeteranganBiayaLainlain.Text = claim.ketLainLain; }
void cek_spd(object sender, string status) { LinkButton link = (LinkButton)sender; GridViewRow gv = (GridViewRow)(link.NamingContainer); string strNoSpd = gv.Cells[0].Text; dsSPDDataContext data = new dsSPDDataContext(); trClaim claim = new trClaim(); var cekSPD = (from spd in data.trSPDs where spd.noSPD == strNoSpd select spd).First(); if (cekSPD == null) { } else { cekSPD.status = status; data.SubmitChanges(); } }
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(); }
internal void sendMail(trSPD spd, string To, msKaryawan kar) { System.Net.Mail.MailMessage email = new System.Net.Mail.MailMessage(); StringBuilder emailMessage = new StringBuilder(); StringBuilder emailMessageFrom = new StringBuilder(); StringBuilder Content = new StringBuilder(); dsSPDDataContext data = new dsSPDDataContext(); var Atasan = (from k in data.msKaryawans where k.nrp == spd.nrpAtasan select k); //nrp ilang msKaryawan Tujuan = new msKaryawan(); Tujuan = (from k in data.msKaryawans where k.nrp == spd.nrpApprovalTujuan select k).SingleOrDefault(); msKaryawan Pengirim = new msKaryawan(); Pengirim = (from k in data.msKaryawans where k.nrp == spd.nrp select k).FirstOrDefault(); if (kar.nrp == "99999999") { Pengirim = kar; //Pengirim.nrp = kar.nrp; //Pengirim.job = kar.job; //Pengirim.golongan = kar.golongan; Pengirim.email = spd.email; } //hardcode untuk TRAC HO yang melakukan SPD, GAnya masi ke yulia if (Pengirim.kodePA == "1000") { Pengirim.kodePA = "1"; } if (Pengirim.kodePSubArea == "1000") { Pengirim.kodePSubArea = "1"; } var gaAsal = (from k in data.msKaryawans join u in data.msUsers on k.nrp equals u.nrp where u.roleId == 17 && k.coCd == Pengirim.coCd && k.kodePA == Pengirim.kodePA && k.kodePSubArea == Pengirim.kodePSubArea select k); //msKaryawan atasanGaAsal = (from k in data.msKaryawans // where k.nrp == gaAsal.nrpAtasan // select k).SingleOrDefault(); var KasirAsal = (from k in data.msKaryawans join u in data.msUsers on k.nrp equals u.nrp where u.roleId == 20 && k.coCd == Pengirim.coCd && k.kodePA == Pengirim.kodePA && k.kodePSubArea == Pengirim.kodePSubArea select k); var FinanceAsal = (from k in data.msKaryawans join u in data.msUsers on k.nrp equals u.nrp where u.roleId == 19 && k.coCd == Pengirim.coCd && k.kodePA == Pengirim.kodePA && k.kodePSubArea == Pengirim.kodePSubArea select k); trClaim claim = new trClaim(); claim = (from c in data.trClaims where c.noSPD == spd.noSPD select c).FirstOrDefault(); if (To == "Extend") { email.Subject = "Extend SPD " + spd.noSPD + "-" + spd.namaLengkap; string mailAddress = string.Empty; string NamaLengkap = string.Empty; foreach (msKaryawan item in Atasan) { mailAddress += item.email.Trim() + ","; NamaLengkap += item.namaLengkap + "/"; } mailAddress = mailAddress.Remove(mailAddress.Length - 1); NamaLengkap = NamaLengkap.Remove(NamaLengkap.Length - 1); email.To.Add(mailAddress); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", NamaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0} telah melakukan <b>Extend SPD</b> dengan rincian sebagai berikut : ", spd.namaLengkap)); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, null, kar); emailMessage.Append(Content); emailMessage.Append("Terima kasih."); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); //send extend mail here } else { if (spd.status.Split('-')[0] == "2") { email.Subject = "Approval SPD " + spd.noSPD + "-" + spd.namaLengkap; string mailAddress = string.Empty; string NamaLengkap = string.Empty; foreach (var item in gaAsal) { mailAddress += item.email.Trim() + ","; NamaLengkap += item.namaLengkap + "/"; } foreach (msKaryawan item in Atasan) { mailAddress += item.email.Trim() + ","; NamaLengkap += item.namaLengkap + "/"; } mailAddress = mailAddress.Remove(mailAddress.Length - 1); NamaLengkap = NamaLengkap.Remove(NamaLengkap.Length - 1); email.To.Add(mailAddress); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", NamaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0} telah mengirim <b>Request Approval SPD</b> dengan rincian sebagai berikut : ", spd.namaLengkap)); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, null, kar); emailMessage.Append(Content); emailMessage.Append("Apabila Bapak/ Ibu berada di kantor bisa menggunakan link dibawah ini untuk melakukan approve/reject Request Claim SPD tersebut"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "atasan", "spd")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "atasan", "spd")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2} ", spd.noSPD, "atasan", "spd")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2} ", spd.noSPD, "atasan", "spd")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Apabila Bapak/ Ibu berada di luar kantor bisa menggunakan link dibawah ini "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "atasan", "spd")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "atasan", "spd")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2} ", spd.noSPD, "atasan", "spd")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2} ", spd.noSPD, "atasan", "spd")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } else if ((spd.status.Split('-')[0] == "3" || spd.status.Split('-')[0] == "6" || spd.status.Split('-')[0] == "7" || spd.status.Split('-')[0] == "8" || spd.status.Split('-')[0] == "9" || spd.status.Split('-')[0] == "12" || spd.status.Split('-')[0] == "13") && To == "Pembuat") { email.Subject = "Informasi SPD " + spd.noSPD + "-" + spd.namaLengkap; email.To.Add(Pengirim.email.Trim()); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", Pengirim.namaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Status Request SPD Bapak/Ibu {0} adalah <b>{1}</b>.Berikut ini rincian SPD tersebut : ", spd.namaLengkap, spd.status.Split('-')[1])); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, null, kar); emailMessage.Append(Content); emailMessage.Append("Terima kasih."); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } else if ((spd.status.Split('-')[0] == "3" || spd.status.Split('-')[0] == "6") && To == "GA") { email.Subject = "Informasi SPD " + spd.noSPD + "-" + spd.namaLengkap; string mailAddress = string.Empty; string NamaLengkap = string.Empty; foreach (var item in gaAsal) { mailAddress += item.email.Trim() + ","; NamaLengkap += item.namaLengkap + "/"; } mailAddress = mailAddress.Remove(mailAddress.Length - 1); NamaLengkap = NamaLengkap.Remove(NamaLengkap.Length - 1); email.To.Add(mailAddress); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", NamaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Status Request SPD Bapak/Ibu {0} <b>Sudah Disetujui atasan</b>. Mohon bantuannya untuk mencarikan tiket dengan rincian sebagai berikut : ", spd.namaLengkap, spd.status.Split('-')[1])); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, null, kar); emailMessage.Append(Content); emailMessage.Append("Terima kasih."); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } else if ((spd.status.Split('-')[0] == "3" || spd.status.Split('-')[0] == "6") && To == "Tujuan") { email.Subject = "Approval SPD " + spd.noSPD + "-" + spd.namaLengkap; email.To.Add(Tujuan.email.Trim()); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", Tujuan.namaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}, telah mengirim <b>Request Approval SPD atasan tempat tujuan</b> dengan rincian sebagai berikut : ", spd.namaLengkap)); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, null, kar); emailMessage.Append(Content); emailMessage.Append("Apabila Bapak/ Ibu berada di kantor bisa menggunakan link dibawah ini untuk melakukan approve/reject Request Claim SPD tersebut"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "tujuan", "spd")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "tujuan", "spd")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2} ", spd.noSPD, "tujuan", "spd")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2} ", spd.noSPD, "tujuan", "spd")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Apabila Bapak/ Ibu berada di luar kantor bisa menggunakan link dibawah ini "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "tujuan", "spd")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "tujuan", "spd")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}", spd.noSPD, "tujuan", "spd")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}", spd.noSPD, "tujuan", "spd")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("*Catatan : Mohon lakukan approval apabila karyawan yang melakukan SPD sudah tiba di tempat tujuan"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>**Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } else if (spd.status.Split('-')[0] == "11") { string mailAddress = string.Empty; string NamaLengkap = string.Empty; foreach (var item in Atasan) { mailAddress += item.email.Trim() + ","; NamaLengkap += item.namaLengkap + "/"; } mailAddress = mailAddress.Remove(mailAddress.Length - 1); NamaLengkap = NamaLengkap.Remove(NamaLengkap.Length - 1); email.Subject = "Approval Claim " + spd.noSPD + "-" + spd.namaLengkap; email.To.Add(mailAddress); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", NamaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0} telah mengirim <b>Request Approval Claim SPD</b> dengan rincian sebagai berikut : ", spd.namaLengkap)); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, claim, kar); emailMessage.Append(Content); emailMessage.Append("Apabila Bapak/ Ibu berada di kantor bisa menggunakan link dibawah ini untuk melakukan approve/reject Request Claim SPD tersebut"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "atasan", "claim")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "atasan", "claim")); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}", spd.noSPD, "atasan", "claim")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}", spd.noSPD, "atasan", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Apabila Bapak/ Ibu berada di luar kantor bisa menggunakan link dibawah ini "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "atasan", "claim")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "atasan", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}", spd.noSPD, "atasan", "claim")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}", spd.noSPD, "atasan", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } else if ((spd.status.Split('-')[0] == "14" || spd.status.Split('-')[0] == "15" || spd.status.Split('-')[0] == "16" || spd.status.Split('-')[0] == "17" || spd.status.Split('-')[0] == "18" || spd.status.Split('-')[0] == "19" || spd.status.Split('-')[0] == "20" || spd.status.Split('-')[0] == "26" || spd.status.Split('-')[0] == "27") && To == "Pembuat") { email.Subject = "Info Claim " + spd.noSPD + "-" + spd.namaLengkap; email.To.Add(Pengirim.email.Trim()); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", Pengirim.namaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Status Request Claim SPD Bapak/Ibu {0} adalah <b>{1}</b>.Berikut ini rincian Claim SPD tersebut: ", spd.namaLengkap, spd.status.Split('-')[1])); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, claim, kar); emailMessage.Append(Content); emailMessage.Append("Terima kasih."); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } else if ((spd.status.Split('-')[0] == "16") && To == "GA") { string mailAddress = string.Empty; string NamaLengkap = string.Empty; foreach (var item in gaAsal) { mailAddress += item.email.Trim() + ","; NamaLengkap += item.namaLengkap + "/"; } mailAddress = mailAddress.Remove(mailAddress.Length - 1); NamaLengkap = NamaLengkap.Remove(NamaLengkap.Length - 1); email.Subject = "Approval Claim " + spd.noSPD + "-" + spd.namaLengkap; email.To.Add(mailAddress); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", NamaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Status Request SPD Bapak/Ibu {0} <b>Sudah Di-Approve atasan</b> dengan rincian sebagai berikut : ", spd.namaLengkap, spd.status.Split('-')[1])); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, claim, kar); emailMessage.Append(Content); emailMessage.Append("Apabila Bapak/ Ibu berada di kantor bisa menggunakan link dibawah ini untuk melakukan approve/reject Request Claim SPD tersebut"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "ga", "claim")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "ga", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}", spd.noSPD, "ga", "claim")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}", spd.noSPD, "ga", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Apabila Bapak/ Ibu berada di luar kantor bisa menggunakan link dibawah ini "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "ga", "claim")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "ga", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}", spd.noSPD, "ga", "claim")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}", spd.noSPD, "ga", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } else if ((spd.status.Split('-')[0] == "17") && To == "finance") { string mailAddress = string.Empty; string NamaLengkap = string.Empty; foreach (var item in FinanceAsal) { mailAddress += item.email.Trim() + ","; NamaLengkap += item.namaLengkap + "/"; } mailAddress = mailAddress.Remove(mailAddress.Length - 1); NamaLengkap = NamaLengkap.Remove(NamaLengkap.Length - 1); email.Subject = "Approval Claim " + spd.noSPD + "-" + spd.namaLengkap; email.To.Add(mailAddress); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", NamaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Status Request SPD Bapak/Ibu {0} <b>Sudah Di-Approve GA</b> dengan rincian sebagai berikut : ", spd.namaLengkap, spd.status.Split('-')[1])); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, claim, kar); emailMessage.Append(Content); emailMessage.Append("Apabila Bapak/ Ibu berada di kantor bisa menggunakan link dibawah ini untuk melakukan approve/reject Request Claim SPD tersebut"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "finance", "claim")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "finance", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://trac54/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}", spd.noSPD, "finance", "claim")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://trac54/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}", spd.noSPD, "finance", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Apabila Bapak/ Ibu berada di luar kantor bisa menggunakan link dibawah ini "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}'>Approve</a>", spd.noSPD, "finance", "claim")); emailMessage.Append(" "); emailMessage.Append("|"); emailMessage.Append(" "); emailMessage.Append(string.Format("<a href='http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}'>Reject</a>", spd.noSPD, "finance", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append("Jika link di atas tidak dapat diklik, copy dan gunakan URL dibawah ini di browser: "); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Approve : http://118.97.80.12/SPD/approvalSPD.ashx?conf=approve&nospd={0}&subject={1}&type={2}", spd.noSPD, "finance", "claim")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Reject : http://118.97.80.12/SPD/approvalSPD.ashx?conf=reject&nospd={0}&subject={1}&type={2}", spd.noSPD, "finance", "claim")); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } else if ((spd.status.Split('-')[0] == "26") && To == "kasir") { string mailAddress = string.Empty; string NamaLengkap = string.Empty; foreach (var item in KasirAsal) { mailAddress += item.email.Trim() + ","; NamaLengkap += item.namaLengkap + "/"; } mailAddress = mailAddress.Remove(mailAddress.Length - 1); NamaLengkap = NamaLengkap.Remove(NamaLengkap.Length - 1); email.Subject = "Approval Claim " + spd.noSPD + "-" + spd.namaLengkap; email.To.Add(mailAddress); email.Bcc.Add("*****@*****.**"); emailMessage.Append(string.Format("Kepada Yth, ")); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Bapak/Ibu {0}", NamaLengkap)); emailMessage.Append("<br />"); emailMessage.Append("<br />"); emailMessage.Append(string.Format("Status Request SPD Bapak/Ibu {0} <b>Sudah Di-Approve Finance</b> dengan rincian sebagai berikut : ", spd.namaLengkap, spd.status.Split('-')[1])); emailMessage.Append("<br />"); Content = ContentBodymail(Content, spd, claim, kar); emailMessage.Append(Content); emailMessage.Append("Terima kasih."); emailMessage.Append("<br />"); emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); } } #region Unused //else if ((spd.status.Split('-')[0] == "17") && To == "GA") //{ // email.Subject = "Informasi Claim"; // //next to do // //email.To.Add(Atasan.email); // emailMessage.Append(string.Format("Kepada Yth, ")); // emailMessage.Append("<br />"); // emailMessage.Append(string.Format("Bapak/Ibu {0}", Atasan.namaLengkap)); // emailMessage.Append("<br />"); // emailMessage.Append("<br />"); // emailMessage.Append(string.Format("Status Request SPD Bapak/Ibu {0} Sudah Di-Approve atasan dengan rincian sebagai berikut : ", spd.namaLengkap, spd.status.Split('-')[1])); // emailMessage.Append("<br />"); // Content = ContentBodymail(Content, spd, null); // emailMessage.Append(Content); // emailMessage.Append("Terima kasih."); // emailMessage.Append("<br />"); // emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); //} //else if ((spd.status.Split('-')[0] == "20") && To == "GA") //{ // email.Subject = "Informasi Claim"; // //next to do // //email.To.Add(Atasan.email); // emailMessage.Append(string.Format("Kepada Yth, ")); // emailMessage.Append("<br />"); // emailMessage.Append(string.Format("Bapak/Ibu {0}", Atasan.namaLengkap)); // emailMessage.Append("<br />"); // emailMessage.Append("<br />"); // emailMessage.Append(string.Format("Status Request SPD Bapak/Ibu {0} Sudah Di-Approve atasan dengan rincian sebagai berikut : ", spd.namaLengkap, spd.status.Split('-')[1])); // emailMessage.Append("<br />"); // Content = ContentBodymail(Content, spd, null); // emailMessage.Append(Content); // emailMessage.Append("Terima kasih."); // emailMessage.Append("<br />"); // emailMessage.Append(string.Format("<b style='color: red;'>Catatan : E-mail ini dikirim otomatis oleh Sistem Pembuatan SPD.Tidak perlu membalas E-mail ini </b>")); //} #endregion email.From = new System.Net.Mail.MailAddress("*****@*****.**"); email.Priority = System.Net.Mail.MailPriority.High; email.Body = emailMessage.ToString(); email.IsBodyHtml = true; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(); smtp.Send(email); }
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; } } }
protected void btnSubmit_Click(object sender, EventArgs e) { #region submit old if (Session["noSPDc"] == null) { Response.Redirect("frmClaimApproval.aspx"); } else { if (txtNoSPD.Text != string.Empty) { dsSPDDataContext data = new dsSPDDataContext(); trClaim claim = data.trClaims.FirstOrDefault(o => o.noSPD == txtNoSPD.Text); trSPD spd = data.trSPDs.FirstOrDefault(o => o.noSPD == claim.noSPD); if (spd.isApproved == true && spd.isCancel == null) { getFromForm(ref claim); try { btnSubmit.Enabled = false; btnSave.Enabled = false; claim.nrpAtasan = spd.nrpAtasan; claim.status = "Menunggu approval atasan"; claim.isSubmit = true; claim.isSubmitDate = DateTime.Now; claim.diubahOleh = karyawan.nrp; claim.diubahTanggal = DateTime.Now; 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(); } data.SubmitChanges(); EmailCore.ApprovalClaim(claim.nrpAtasan, spd.noSPD, spd, "Atasan", claim.status); lblKet.Text = "Claim berhasil di Submit"; data.Dispose(); } catch (Exception ex) { Response.Write(ex.Message); } } } } #endregion }
protected void txtNoSPD_TextChanged(object sender, EventArgs e) { dsSPDDataContext data = new dsSPDDataContext(); trSPD spd = new trSPD(); try { trClaim claimQ = (from p in data.trClaims where p.noSPD.Equals(txtNoSPD.Text) select p).FirstOrDefault(); trSPD query = (from p in data.trSPDs where p.noSPD.Equals(txtNoSPD.Text) select p).FirstOrDefault(); query.penginapan = "Disediakan"; lblAtasan.Text = query.nrpAtasan; if (query != null) { txtNamaLengkap.Text = query.namaLengkap; txtTglBerangkat.Text = query.tglBerangkat.ToShortDateString(); txtTglKembali.Text = query.tglKembali.ToShortDateString(); ddlJamBerangkat0.SelectedValue = query.jamBerangkat; ddlMenitBerangkat0.SelectedValue = query.menitBerangkat; ddlJamKembali.SelectedValue = query.jamKembali; ddlMenitKembali.SelectedValue = query.menitKembali; txtUangMuka.Text = query.uangMuka != string.Empty ? query.uangMuka : "0"; kurs.Text = "1"; txtKeperluan.Text = query.idKeperluan == 6 ? query.ketKeperluan : getKeperluan(int.Parse(query.idKeperluan.ToString())); } msGolonganPlafon golongan = new msGolonganPlafon(); var hasil = (from q in data.msGolonganPlafons where q.golongan.Equals(query.idGolongan) && q.jenisSPD.ToLower().Equals(query.Tujuan) && q.wilayah.ToLower().Equals(query.WilayahTujuan) select q); TimeSpan Jumlahhari = (query.tglKembali - query.tglBerangkat); TimeSpan tambahan = TimeSpan.FromDays(1); Jumlahhari += tambahan; lblJumlahhari.Text = Jumlahhari.Days.ToString(); try { var jumlahPenginapan = hasil.FirstOrDefault(o => o.idPlafon == 6) != null?hasil.FirstOrDefault(o => o.idPlafon == 6).harga.Value *Jumlahhari.Days : 0; #region CR ian 2015-03-02 if (query.isHotel == false) { txtHotel.Text = jumlahPenginapan.ToString(); txtHotel.Enabled = true; } else { txtHotel.Text = "0"; txtHotel.Enabled = false; } #endregion } catch (Exception ex) { ex.ToString(); } List <msGolonganPlafon> plafon = hasil.Where(p => p.idPlafon == 1).ToList <msGolonganPlafon>(); int makan = 0; if (plafon.Count > 0 && (query.idKeperluan != 2 || query.idKeperluan != 1)) { makan = isNull((int)plafon.First().harga); } txtMakan.Text = makan.ToString(); //msGolonganPlafon plafon2 = hasil.Where(p => p.idPlafon == 2).FirstOrDefault(); plafon = hasil.Where(p => p.idPlafon == 2).ToList <msGolonganPlafon>(); int UangSaku = 0; if (plafon.Count > 0) { UangSaku = isNull((int)plafon.First().harga); } txtUangSaku.Text = UangSaku.ToString(); plafon = hasil.Where(p => p.idPlafon == 7).ToList <msGolonganPlafon>(); int laundri = 0; if (plafon.Count > 0) { laundri = isNull((int)plafon.First().harga); txtJmlHariLaundri.Text = (laundri * (Jumlahhari.Days - 2)).ToString(); if (plafon.First().deskripsi == "Aktual") { txtJmlHariLaundri.Text = "Aktual"; } } if (int.Parse(query.jamKembali) > 12) { txtSTMakan.Text = (makan * Jumlahhari.Days * int.Parse(kurs.Text)).ToString(); } else { txtSTMakan.Text = (makan * (Jumlahhari.Days - 1) * int.Parse(kurs.Text)).ToString(); } txtSTUangSk.Text = (UangSaku * Jumlahhari.Days * int.Parse(kurs.Text)).ToString(); if (Jumlahhari.Days < 3) { txtLaundry.Text = "0"; txtLaundry.Enabled = false; } if (claimQ != null) { setIntoForm(claimQ); if (claimQ.kurs > 0) { kurs.Text = claimQ.kurs.ToString(); } else { kurs.Text = (int.Parse(txtSTUangSk.Text) / (Jumlahhari.Days * UangSaku)).ToString(); } if (claimQ.status.Split('-')[0] == "10") { btnSave.Enabled = true; btnSubmit.Enabled = true; } } int total = int.Parse(txtSTMakan.Text) + int.Parse(txtSTUangSk.Text) + int.Parse(txtTiket.Text) + int.Parse(txtHotel.Text) + int.Parse(txtBBM.Text) + int.Parse(txtTol.Text); total += int.Parse(txtTaxi.Text) + int.Parse(txtAirPortTax.Text) + int.Parse(txtLaundry.Text) + int.Parse(txtParkir.Text) + int.Parse(txtLainlain.Text) + int.Parse(txtKomunikasi.Text); txtTotal.Text = total.ToString(); //if (spd.penginapan == "Disediakan") //{ // txtHotel.Enabled = false; //} //else txtHotel.Enabled = true; if (spd.tiket == "Dicarikan") { txtTiket.Enabled = false; } int penyelesaian = total - int.Parse(txtUangMuka.Text); txtPenyelesaian.Text = penyelesaian.ToString(); FLDTujuan.Value = query.Tujuan; if (query.Tujuan == "Luar Negeri") { LKurs.Visible = true; kurs.Visible = true; ldlr.Visible = true; txtAirPortTaxDLR.Visible = true; txtAirPortTax.Enabled = false; txtBBMDLR.Visible = true; txtBBM.Enabled = false; txtHotelDLR.Visible = true; txtHotel.Enabled = false; txtKomunikasiDLR.Visible = true; txtKomunikasi.Enabled = false; txtLainlainDLR.Visible = true; txtLainlain.Enabled = false; txtLaundryDLR.Visible = true; txtLaundry.Enabled = false; txtParkirDLR.Visible = true; txtParkir.Enabled = false; txtPenyelesaianDLR.Visible = true; txtPenyelesaian.Enabled = false; txtSTMakanDLR.Visible = true; txtSTMakan.Enabled = false; txtSTUangSkDLR.Visible = true; txtSTUangSk.Enabled = false; txtTaxiDLR.Visible = true; txtTaxi.Enabled = false; txtTiketDLR.Visible = true; txtTiket.Enabled = false; txtTolDLR.Visible = true; txtTol.Enabled = false; txtTotalDLR.Visible = true; txtUangMukaDLR.Visible = true; } else { LKurs.Visible = false; kurs.Visible = false; ldlr.Visible = false; txtAirPortTaxDLR.Visible = false; txtBBMDLR.Visible = false; txtHotelDLR.Visible = false; txtKomunikasiDLR.Visible = false; txtLainlainDLR.Visible = false; txtLaundryDLR.Visible = false; txtParkirDLR.Visible = false; txtPenyelesaianDLR.Visible = false; txtSTMakanDLR.Visible = false; txtSTUangSkDLR.Visible = false; txtTaxiDLR.Visible = false; txtTiketDLR.Visible = false; txtTolDLR.Visible = false; txtTotalDLR.Visible = false; txtUangMukaDLR.Visible = false; } GetDolar(); } catch (Exception ex) { //clearForm(); Response.Write(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["IDLogin"] == null) { Response.Redirect("frmClaimApproval.aspx"); } karyawan = oSPD.getKaryawan(Session["IDLogin"].ToString()); visibleFile(false); string strNoSpd = string.Empty, strRole = string.Empty; bool editable = true; bool gamode = false; if (!IsPostBack) { resetCHK(false); txtHotel.Enabled = false; strNoSpd = (string)Session["noSPD"]; Session["noSPDc"] = Session["noSPD"]; Session["noSPD"] = string.Empty; strRole = (string)Session["Role"]; editable = (bool)Session["editable"]; if (Session["gamode"] != null) { gamode = (bool)Session["gamode"]; Session["gamode"] = false; } FLDgamode.Value = gamode.ToString().ToLower(); if (strRole == "GA") { txtSTMakan.Enabled = true; txtSTUangSk.Enabled = true; txtSTMakanDLR.Enabled = true; txtSTUangSkDLR.Enabled = true; txtLaundry.Enabled = true; resetCHK(true); } //jika di trClaim ada if (strNoSpd != string.Empty && !editable) { txtNoSPD.Text = strNoSpd; btnSave.Enabled = false; btnSubmit.Enabled = false; btnReset.Enabled = false; txtNoSPD_TextChanged(null, null); if (gamode) { //if (Convert.ToInt32(lblJumlahhari.Text) >= 3) if (Convert.ToInt32(lblJumlahhari.Text) >= 5) { //txtUangMuka.Text = string.Empty; txtUangMuka.Enabled = true; } else { txtUangMuka.Enabled = false; } } } //jika di trClaim tidak ada if (strNoSpd != string.Empty && editable) { txtNoSPD.Text = strNoSpd; btnSave.Enabled = true; btnSubmit.Enabled = true; txtNoSPD_TextChanged(null, null); if (gamode) { //if (Convert.ToInt32(lblJumlahhari.Text) >= 3) if (Convert.ToInt32(lblJumlahhari.Text) >= 5) { //txtUangMuka.Text = string.Empty; txtUangMuka.Enabled = true; } else { txtUangMuka.Enabled = false; } } } //GA bisa mengedit uang saku dan uang makan dsSPDDataContext data = new dsSPDDataContext(); trClaim claim = (from c in data.trClaims where c.noSPD.Equals(txtNoSPD.Text) select c).FirstOrDefault(); if (claim == null) { btnSubmit.Enabled = false; } //trSPD spd = new trSPD(); //trSPD query = (from p in data.trSPDs // where p.noSPD.Equals(txtNoSPD.Text) // select p).FirstOrDefault(); //msGolonganPlafon golPlaf = new msGolonganPlafon(); //msGolonganPlafon query2 = (from a in data.msGolonganPlafons // where a.idPlafon.Equals(6) // select a).FirstOrDefault(); //if (query != null && query.penginapan == "Tidak Disediakan") //{ // //txtHotel.ReadOnly = false; // //lblJumlahhari * query2.har // //txtHotel.Text = //} ////ix cr //#region set penginapan //try //{ // if (claim == null) // { // var hasil = (from q in data.msGolonganPlafons // where q.golongan.Equals(query.idGolongan) && q.jenisSPD.ToLower().Equals(query.Tujuan) && q.wilayah.ToLower().Equals(query.WilayahTujuan) // select q); // if (query.isHotel == false) // { // TimeSpan Jumlahhari = (query.tglKembali - query.tglBerangkat); // TimeSpan tambahan = TimeSpan.FromDays(1); // Jumlahhari += tambahan; // var jumlahPenginapan = hasil.FirstOrDefault(o => o.idPlafon == 6) != null ? hasil.FirstOrDefault(o => o.idPlafon == 6).harga.Value * Jumlahhari.Days : 0; // if (jumlahPenginapan >= 5) // { // txtUangMuka.ReadOnly = true; // } // txtHotel.Text = jumlahPenginapan.ToString(); // } // else { txtHotel.Text = "0"; txtHotel.ReadOnly = true; } // } //} //catch (Exception) { } //#endregion if (gamode) { btnSubmit.Enabled = false; } //if (claim.isSubmit == null) //{ // btnSubmit.Enabled = true; //} } }
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"; } } } }