private void Tampil() { list.Visible = true; reprint.Visible = false; Js.AutoPrint(this); //increment Db.Execute("UPDATE MS_PJT SET PrintPJT = PrintPJT + 1 WHERE NoPJT = '" + NoPJT + "'"); //Logfile 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" + " 'P-PJT'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + Cf.LogCapture(rs) + "'" + ",'" + NoPJT.ToString() + "'" ); 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); }
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"); }
private bool Save() { if (valid()) { DateTime TglPJT = Convert.ToDateTime(tgl.Text); string Unit = Cf.Str(unit.Text); string Customer = Cf.Str(customer.Text); string NoTelp = Cf.Str(notelp.Text); string NoHP = Cf.Str(hp.Text); string Alamat1 = Cf.Str(alamat1.Text); string Alamat2 = Cf.Str(alamat2.Text); string Alamat3 = Cf.Str(alamat3.Text); DataTable rs = Db.Rs("SELECT " + " CONVERT(varchar, TglPJT, 106) AS [Tanggal]" + ",Tipe" + ",Ref AS [Ref.]" + ",Total" + " FROM MS_PJT" + " WHERE NoPJT = '" + NoPJT + "'" ); DataTable rsBef = Db.Rs("SELECT " + " Unit" + ",Customer" + ",NoTelp AS [No. Telepon]" + ",Alamat1 AS [Alamat #1]" + ",Alamat2 AS [Alamat #2]" + ",Alamat3 AS [Alamat #3]" + ",TglPJT AS [Tgl]" + " FROM MS_PJT" + " WHERE NoPJT = '" + NoPJT + "'" ); Db.Execute("EXEC spPJTEdit" + " '" + NoPJT + "'" + ",'" + Unit + "'" + ",'" + Customer + "'" + ",'" + NoTelp + "'" + ",'" + Alamat1 + "'" + ",'" + Alamat2 + "'" + ",'" + Alamat3 + "'" ); string REP = Db.SingleString("SELECT Ref FROM MS_PJT WHERE NoPJT = '" + NoPJT + "'"); int NOCUS = Db.SingleInteger("SELECT NOCUSTOMER FROM " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK WHERE NOKONTRAK='" + REP + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_CUSTOMER" + " SET ALAMAT1 ='" + Alamat1 + "'" + ", ALAMAT2 ='" + Alamat2 + "'" + ", ALAMAT3 ='" + Alamat3 + "'" + ", NoTelp ='" + NoTelp + "'" + ", NoHP ='" + NoHP + "'" + " WHERE NoCustomer=" + NOCUS ); string strSql = "SELECT NoKontrak FROM " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK WHERE NoCustomer = " + NOCUS; DataTable rs1 = Db.Rs(strSql); for (int i = 0; i < rs1.Rows.Count; i++) { if (!Response.IsClientConnected) { break; } Db.Execute("UPDATE " + Mi.DbPrefix + "FINANCEAR..MS_TUNGGAKAN" + " SET ALAMAT1 ='" + Alamat1 + "'" + ", ALAMAT2 ='" + Alamat2 + "'" + ", ALAMAT3 ='" + Alamat3 + "'" + ", NoTelp ='" + NoTelp + "'" + " WHERE REF='" + rs1.Rows[i]["NoKontrak"] + "'" ); Db.Execute("UPDATE " + Mi.DbPrefix + "FINANCEAR..MS_PJT" + " SET ALAMAT1 ='" + Alamat1 + "'" + ", ALAMAT2 ='" + Alamat2 + "'" + ", ALAMAT3 ='" + Alamat3 + "'" + ", NoTelp ='" + NoTelp + "'" + " WHERE REF='" + rs1.Rows[i]["NoKontrak"] + "'" ); } Db.Execute("UPDATE MS_PJT SET TglPJT = '" + TglPJT + "' WHERE NoPJT = '" + NoPJT + "'"); DataTable rsAft = Db.Rs("SELECT " + " Unit" + ",Customer" + ",NoTelp AS [No. Telepon]" + ",Alamat1 AS [Alamat #1]" + ",Alamat2 AS [Alamat #2]" + ",Alamat3 AS [Alamat #3]" + ",TglPJT AS [Tgl]" + " FROM MS_PJT" + " WHERE NoPJT = '" + NoPJT + "'" ); //Logfile string ketlog = Cf.LogCapture(rs) + Cf.LogCompare(rsBef, rsAft); Db.Execute("EXEC spLogPJT" + " 'EDIT'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + ketlog + "'" + ",'" + NoPJT.ToString() + "'" ); 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); return(true); } else { return(false); } }