private void Fill() { btnlog.Attributes["onclick"] = "location.href='LogPk.aspx?Tb=MS_ANONIM_LOG&Pk=" + NoAnonim.ToString().PadLeft(5, '0') + "'"; btndel.Attributes["onclick"] = "location.href='TransferAnonimDel.aspx?NoAnonim=" + NoAnonim + "'"; string strSql = "SELECT * " + " FROM MS_ANONIM WHERE NoAnonim = " + NoAnonim; DataTable rs = Db.Rs(strSql); if (rs.Rows.Count == 0) { Response.Redirect("/CustomError/Deleted.html"); } else { no.InnerHtml = NoAnonim.ToString().PadLeft(5, '0'); tgl.Text = Cf.Day(rs.Rows[0]["Tgl"]); bank.SelectedValue = rs.Rows[0]["AccountID"].ToString(); nilai.Text = Cf.Num(rs.Rows[0]["Nilai"]); nokontrak.Text = rs.Rows[0]["NoKontrak"].ToString(); customer.Text = rs.Rows[0]["Customer"].ToString(); unit.Text = rs.Rows[0]["Unit"].ToString(); ket.Text = rs.Rows[0]["Ket"].ToString(); project.SelectedValue = rs.Rows[0]["Project"].ToString(); if (rs.Rows[0]["Status"].ToString() == "ID") { trunit.Visible = trcs.Visible = true; } else { trunit.Visible = trcs.Visible = true; } //kalo udah solve(udah dipake anonimnya) ga bisa ganti customer if (rs.Rows[0]["Status"].ToString() == "S") { nokontrak.Enabled = false; customer.Enabled = false; btnpop.Disabled = true; } } }
protected void delbtn_Click(object sender, System.EventArgs e) { DataTable rs = Db.Rs( "SELECT * FROM MS_ANONIM WHERE NoAnonim = " + NoAnonim); if (rs.Rows.Count == 0) { Response.Redirect("/CustomError/Deleted.html"); } else { string Ket = "***Alasan Delete :<br>" + Cf.Str(ket.Text) + "<br><br>***Data Sebelum Delete :<br>" + Cf.LogCapture(rs); Db.Execute("DELETE FROM MS_ANONIM WHERE NoAnonim = " + NoAnonim); int c = Db.SingleInteger( "SELECT COUNT(*) FROM MS_ANONIM WHERE NoAnonim = " + NoAnonim); if (c == 0) { //Log Db.Execute("EXEC spLogAnonim " + " 'DELETE'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + Ket + "'" + ",'" + NoAnonim.ToString().PadLeft(5, '0') + "'" ); decimal LogID = Db.SingleDecimal("SELECT TOP 1 LogID FROM MS_ANONIM_LOG ORDER BY LogID DESC"); string Project = Db.SingleString("SELECT Project FROM MS_ANONIM WHERE NoAnonim = '" + NoAnonim + "'"); Db.Execute("UPDATE MS_ANONIM_LOG SET Project = '" + Project + "' WHERE LogID = " + LogID); Js.Close(this); } else { //Tidak bisa dihapus frm.Visible = false; nodel.Visible = true; } } }
private bool Save() { if (valid()) { DateTime Tgl = Convert.ToDateTime(tgl.Text); string Bank = Db.SingleString("SELECT Bank FROM REF_ACC WHERE Acc = '" + bank.SelectedValue + "'"); string Rekening = Db.SingleString("SELECT Rekening FROM REF_ACC WHERE Acc = '" + bank.SelectedValue + "'"); decimal Nilai = Convert.ToDecimal(nilai.Text); string Ket = Cf.Str(ket.Text); string NoKontrak = Cf.Str(nokontrak.Text); string Unit = Db.SingleString("SELECT NoUnit FROM ISC064_MARKETINGJUAL..MS_KONTRAK WHERE NoKontrak = '" + NoKontrak + "'"); string Customer = Db.SingleString("SELECT Nama FROM ISC064_MARKETINGJUAL..MS_CUSTOMER WHERE NoCustomer = (SELECT NoCustomer FROM ISC064_MARKETINGJUAL..MS_KONTRAK WHERE NoKontrak = '" + NoKontrak + "')"); DataTable rs = Db.Rs("SELECT " + " NoAnonim AS [No.]" + " FROM MS_ANONIM" + " WHERE NoAnonim = " + NoAnonim ); DataTable rsBef = Db.Rs("SELECT " + " NoAnonim AS [No.]" + ",CONVERT(varchar,Tgl,106) AS Tgl" + ",AccountID" + ",Bank" + ",Rekening" + ",Nilai" + ",Unit" + ",Customer" + ",Ket AS [Keterangan Pembayaran]" + ",Status" + ",Project" + " FROM MS_ANONIM" + " WHERE NoAnonim = " + NoAnonim ); Db.Execute("UPDATE MS_ANONIM SET" + " Tgl = '" + Tgl + "'" + ",Nilai = " + Nilai + ",AccountID = '" + bank.SelectedValue + "'" + ",Bank = '" + Bank + "'" + ",Rekening = '" + Rekening + "'" + ",Unit = '" + Unit + "'" + ",Customer = '" + Customer + "'" + ",NoKontrak = '" + NoKontrak + "'" + ",Ket = '" + Ket + "'" + ",Project = '" + project.SelectedValue + "'" + " WHERE NoAnonim = " + NoAnonim ); if (Unit != "" || Customer != "" || Ket != "") { Db.Execute("UPDATE MS_ANONIM SET" + " Status = 'ID'" + " WHERE NoAnonim = " + NoAnonim + " AND Status = 'BARU'" ); } DataTable rsAft = Db.Rs("SELECT " + " NoAnonim AS [No.]" + ",CONVERT(varchar,Tgl,106) AS Tgl" + ",AccountID" + ",Bank" + ",Rekening" + ",Nilai" + ",NoKontrak" + ",Unit" + ",Customer" + ",Ket AS [Keterangan Pembayaran]" + ",Status" + ",Project" + " FROM MS_ANONIM" + " WHERE NoAnonim = " + NoAnonim ); //Logfile string ketlog = Cf.LogCapture(rs) + Cf.LogCompare(rsBef, rsAft); Db.Execute("EXEC spLogAnonim" + " 'EDIT'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + ketlog + "'" + ",'" + NoAnonim.ToString().PadLeft(5, '0') + "'" ); decimal LogID = Db.SingleDecimal("SELECT TOP 1 LogID FROM MS_ANONIM_LOG ORDER BY LogID DESC"); string Project = Db.SingleString("SELECT Project FROM MS_ANONIM WHERE NoAnonim = '" + NoAnonim + "'"); Db.Execute("UPDATE MS_ANONIM_LOG SET Project = '" + Project + "' WHERE LogID = " + LogID); return(true); } else { return(false); } }