protected void save_Click(object sender, EventArgs e) { if (valid) { DataTable rs = Db.Rs("SELECT * FROM Numerator WHERE SN = '" + SN + "'"); if (rs.Rows.Count == 0) { Response.Redirect("/CustomError/Deleted.html"); } Db.Execute("UPDATE Numerator SET " + " Prefix = '" + prefix.Text + "'" + ",ResetNum = " + Convert.ToInt16(resetnum.SelectedValue) + ",DigitNum = " + Convert.ToInt16(digitnum.Text) + ",FormatBulan = " + Convert.ToInt16(formatbulan.Text) + ",FormatTahun = " + Convert.ToInt16(formattahun.Text) + ",Pemisah = '" + pemisah.Text + "'" + ",Komposisi = '" + komposisi.Text + "'" + " WHERE SN = '" + SN + "'" ); Js.CloseAndReload(this); } }
protected void Save(bool close) { if (valid()) { int ada = Db.SingleInteger("SELECT COUNT(*) FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_LOKASI WHERE Lokasi='" + lokasi.Text + "' AND Project = '" + project.SelectedValue + "' AND SN != " + NoLokasi); if (ada > 0) { string s = ""; Js.Alert( this , "Input Tidak Valid.\\n\\n" + "Aturan Proses :\\n" + "1. Lokasi Unit Properti tidak boleh kosong.\\n" + "2. Nama Lokasi Unit tidak boleh kosong.\\n" + "3. Lokasi Unit Duplikat.\\n" , "document.getElementById('" + s + "').focus();" + "document.getElementById('" + s + "').select();" ); } else { string strSql = "SELECT * FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_LOKASI WHERE SN = '" + NoLokasi + "'"; DataTable rs = Db.Rs(strSql); DataTable rsBef = Db.Rs("SELECT " + " Lokasi" + ",Nama" + ",Project" + ",SN" + " FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_LOKASI " + " WHERE SN = '" + NoLokasi + "'"); //relasi Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_UNIT SET Lokasi='" + lokasi.Text + "' WHERE Lokasi='" + rs.Rows[0]["Lokasi"] + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK SET Lokasi='" + lokasi.Text + "' WHERE Lokasi='" + rs.Rows[0]["Lokasi"] + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_RESERVASI SET Lokasi='" + lokasi.Text + "' WHERE Lokasi='" + rs.Rows[0]["Lokasi"] + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_RESERVASI_OBS SET Lokasi='" + lokasi.Text + "' WHERE Lokasi='" + rs.Rows[0]["Lokasi"] + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..REF_LOKASI SET Lokasi='" + lokasi.Text + "',Nama='" + namalokasi.Text + "',Project='" + project.SelectedValue + "' WHERE SN = '" + NoLokasi + "'"); DataTable rsAft = Db.Rs("SELECT " + " Lokasi" + ",Nama" + ",Project" + ",SN" + " FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_LOKASI " + " WHERE SN = '" + NoLokasi + "'"); //Logfile string Ket = "Lokasi: " + lokasi.Text + "<br>" + Cf.LogCompare(rsBef, rsAft); Db.Execute("EXEC " + Mi.DbPrefix + "MARKETINGJUAL..spLogLokasi" + " 'EDIT'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + Ket + "'" + ",'" + NoLokasi + "'" ); decimal LogID = Db.SingleDecimal("SELECT TOP 1 LogID FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_LOKASI_LOG ORDER BY LogID DESC"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..REF_LOKASI_LOG SET Project = '" + project.SelectedValue + "' WHERE LogID = " + LogID); if (close) { Js.CloseAndReload(this); } else { Response.Redirect("LokasiEdit.aspx?done=1&NoLokasi=" + NoLokasi); } } } }
protected void ok_Click(object sender, System.EventArgs e) { //if (Save()) Js.Close(this); if (valid()) { int ada = Db.SingleInteger("SELECT COUNT(*) FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_BERKAS_PPJB WHERE Nama='" + namaberkas.Text + "' AND SN != " + NoBerkas); if (ada > 0) { string s = ""; Js.Alert( this , "Input Tidak Valid.\\n\\n" + "Aturan Proses :\\n" + "1. Lokasi Unit Properti tidak boleh kosong.\\n" + "2. Nama Lokasi Unit tidak boleh kosong.\\n" + "3. Lokasi Unit Duplikat.\\n" , "document.getElementById('" + s + "').focus();" + "document.getElementById('" + s + "').select();" ); } else { string strSql = "SELECT * FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_BERKAS_PPJB WHERE SN = '" + NoBerkas + "'"; DataTable rs = Db.Rs(strSql); DataTable rsBef = Db.Rs("SELECT " + " Nama" + ",SN" + " FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_BERKAS_PPJB " + " WHERE SN = '" + NoBerkas + "'"); //relasi //Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_PPJB SET Lokasi='" + lokasi.Text + "' WHERE Lokasi='" + rs.Rows[0]["Lokasi"] + "'"); //Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK SET Lokasi='" + lokasi.Text + "' WHERE Lokasi='" + rs.Rows[0]["Lokasi"] + "'"); //Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_RESERVASI SET Lokasi='" + lokasi.Text + "' WHERE Lokasi='" + rs.Rows[0]["Lokasi"] + "'"); //Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_RESERVASI_OBS SET Lokasi='" + lokasi.Text + "' WHERE Lokasi='" + rs.Rows[0]["Lokasi"] + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..REF_BERKAS_PPJB SET Nama='" + namaberkas.Text + "' WHERE SN = '" + NoBerkas + "'"); DataTable rsAft = Db.Rs("SELECT " + " Nama" + ",SN" + " FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_BERKAS_PPJB " + " WHERE SN = '" + NoBerkas + "'"); //Logfile string Ket = "Nama Berkas: " + namaberkas.Text + "<br>" + Cf.LogCompare(rsBef, rsAft); Db.Execute("EXEC " + Mi.DbPrefix + "MARKETINGJUAL..spLogBerkasPPJB" + " 'EDIT'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + Ket + "'" + ",'" + NoBerkas + "'" ); decimal LogID = Db.SingleDecimal("SELECT TOP 1 LogID FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_BERKAS_PPJB_LOG ORDER BY LogID DESC"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..REF_BERKAS_PPJB_LOG SET Project = '" + project.SelectedValue + "' WHERE LogID = " + LogID); Js.CloseAndReload(this); } } }
protected void ok_Click(object sender, System.EventArgs e) { if (Save()) Js.CloseAndReload(this); }
protected void Save(bool close) { if (valid()) { int ada = Db.SingleInteger("SELECT COUNT(*) FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_JENIS WHERE Jenis='" + jenis.Text + "' AND Project = '" + project.SelectedValue + "' AND SN != " + NoJenis); if (ada > 0) { string s = ""; Js.Alert( this , "Input Tidak Valid.\\n\\n" + "Aturan Proses :\\n" + "1. Tipe Unit Properti tidak boleh kosong.\\n" + "2. Nama Tipe Unit tidak boleh kosong.\\n" + "3. Tipe Unit Duplikat.\\n" , "document.getElementById('" + s + "').focus();" + "document.getElementById('" + s + "').select();" ); } else { string save = ""; if (file.PostedFile.FileName.Length != 0) { string path = "D:\\ISC\\ISC064\\app\\settings\\gambar\\" + Act.UserID + ".png"; save = "settings\\gambar\\" + Act.UserID + ".png"; Dfc.UploadFile(".jpg", path, file); } string strSql = "SELECT * FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_JENIS WHERE SN = '" + NoJenis + "'"; DataTable rs = Db.Rs(strSql); DataTable rsBef = Db.Rs("SELECT " + " Jenis" + ",Project" + ",Nama" + ",SN" + ",Gambar" + " FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_JENIS " + " WHERE SN = '" + NoJenis + "'"); //relasi Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_UNIT SET Jenis='" + jenis.Text + "' WHERE Jenis='" + rs.Rows[0]["Jenis"] + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK SET Jenis='" + jenis.Text + "' WHERE Jenis='" + rs.Rows[0]["Jenis"] + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_RESERVASI SET Jenis='" + jenis.Text + "' WHERE Jenis='" + rs.Rows[0]["Jenis"] + "'"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..MS_RESERVASI_OBS SET Jenis='" + jenis.Text + "' WHERE Jenis='" + rs.Rows[0]["Jenis"] + "'"); if (save != "") { Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..REF_JENIS SET Jenis='" + jenis.Text + "',Nama='" + namajenis.Text + "',Project='" + project.SelectedValue + "',Gambar='" + save + "' WHERE SN = '" + NoJenis + "'"); } else { Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..REF_JENIS SET Jenis='" + jenis.Text + "',Nama='" + namajenis.Text + "',Project='" + project.SelectedValue + "' WHERE SN = '" + NoJenis + "'"); } DataTable rsAft = Db.Rs("SELECT " + " Jenis" + ",Project" + ",Nama" + ",SN" + ",Gambar" + " FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_JENIS " + " WHERE SN = '" + NoJenis + "'"); //Logfile string Ket = "Jenis: " + jenis.Text + "<br>" + Cf.LogCompare(rsBef, rsAft); Db.Execute("EXEC " + Mi.DbPrefix + "MARKETINGJUAL..spLogJenis" + " 'EDIT'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + Ket + "'" + ",'" + NoJenis + "'" ); decimal LogID = Db.SingleDecimal("SELECT TOP 1 LogID FROM " + Mi.DbPrefix + "MARKETINGJUAL..REF_JENIS_LOG ORDER BY LogID DESC"); Db.Execute("UPDATE " + Mi.DbPrefix + "MARKETINGJUAL..REF_JENIS_LOG SET Project = '" + project.SelectedValue + "' WHERE LogID = " + LogID); if (close) { Js.CloseAndReload(this); } else { Response.Redirect("JenisEdit.aspx?done=1&NoJenis=" + NoJenis); } } } }