private void Fill() { cancel.Attributes["onclick"] = "location.href='PJTEdit.aspx?NoPJT=" + NoPJT + "'"; cancel2.Attributes["onclick"] = "location.href='PJTEdit.aspx?NoPJT=" + NoPJT + "'"; string strSql = "SELECT PrintPJT FROM MS_PJT WHERE NoPJT = '" + NoPJT + "'"; DataTable rs = Db.Rs(strSql); if (rs.Rows.Count == 0) { Response.Redirect("/CustomError/NoPrint.html"); } else { count.Text = rs.Rows[0]["PrintPJT"].ToString(); if ((int)rs.Rows[0]["PrintPJT"] == 0) { Tampil(); //langsung tampil ConvertPdf(); Response.Redirect(Param.PathLinkFilePDFCollection + NoPJT.Replace("/", "_").Replace("\\", "_") + Project + "_PJT.pdf"); } else { //mekanisme reprint list.Visible = false; reprint.Visible = true; Js.Focus(this, username); if (Session["SalahPass"] == null) { Session["SalahPass"] = "******"; //Hitung password salah berapa kali } else { if (Session["SalahPass"].ToString() != "0") { salah.Text = Session["SalahPass"] + "x salah"; } } } } }
private void Valid(string Username) { Session["SalahPass"] = null; //Logfile otorisasi DataTable rs = Db.Rs("SELECT " + " CONVERT(varchar, TglPJT, 106) AS [Tanggal]" + ",Tipe" + ",Ref AS [Ref.]" + ",Unit" + ",Customer" + ",Total" + " FROM MS_PJT WHERE NoPJT = '" + NoPJT + "'"); Db.Execute("EXEC spLogPJT" + " 'R-PJT'" + ",'" + Username + "'" + ",'" + Act.IP + "'" + ",'" + Cf.LogCapture(rs) + "'" + ",'" + NoPJT.ToString().PadLeft(7, '0') + "'" ); decimal LogID = Db.SingleDecimal("SELECT TOP 1 LogID FROM MS_PJT_LOG ORDER BY LogID DESC"); string Project = Db.SingleString("SELECT Project FROM " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK WHERE NoKontrak = (SELECT Ref FROM MS_PJT WHERE NoPJT = '" + NoPJT + "') "); Db.Execute("UPDATE MS_PJT_LOG SET Project = '" + Project + "' WHERE LogID = " + LogID); Tampil(); string file = Param.PathFilePDFCollection + NoPJT.Replace("/", "_").Replace("\\", "_") + Project + "_PJT.pdf"; bool exist = System.IO.File.Exists(file); if (exist) { System.IO.File.Delete(file); } ConvertPdf(); Response.Redirect(Param.PathLinkFilePDFCollection + NoPJT.Replace("/", "_").Replace("\\", "_") + Project + "_PJT.pdf"); }