protected void save_Click(object sender, EventArgs e) { if (Valid) { Db.Execute("update ms_siteplan set Nama='" + nama.Text + "' where ID='" + IDx + "'"); string NamaLama = Db.SingleString("Select Nama from ms_siteplan where id='" + IDx + "'"); string ProjectPeta = Db.SingleString("Select Project from ms_siteplan where Nama = '" + NamaLama + "'"); string ProjectUnit = Db.SingleString("Select DISTINCT Project from ms_unit where Peta = '" + nama.Text + "'"); if (ProjectPeta == ProjectUnit) { Db.Execute("update ms_siteplan set Nama='" + nama.Text + "' where ID='" + IDx + "'"); Db.Execute("update ms_unit set Peta='" + nama.Text + "' where Peta='" + NamaLama + "'"); } string NamaPeta = "PETA_" + IDx; string pdasar = Request.PhysicalApplicationPath.ToLower().Replace("admin", "marketing") + "FP\\Base\\" + NamaPeta + ".jpg"; //file dasar string ptransparent = Request.PhysicalApplicationPath.ToLower().Replace("admin", "marketing") + "FP\\Base\\" + NamaPeta + ".png"; //file dasar string pstatus = Request.PhysicalApplicationPath.ToLower().Replace("admin", "marketing") + "FP\\" + NamaPeta + ".jpg"; //file status string urlpdasar = @"\marketingjual\FP\Base\" + NamaPeta + ".jpg"; //file dasar string urlptransparent = @"\marketingjual\FP\Base\" + NamaPeta + ".png"; //file dasar string urlpstatus = @"\marketingjual\FP\" + NamaPeta + ".jpg"; //file status if (file1.HasFile) { if (File.Exists(pdasar)) { File.Delete(pdasar); } if (File.Exists(pstatus)) { File.Delete(pstatus); } Dfc.UploadFilePeta(".jpg", pdasar, file1); Dfc.CopyFile(pdasar, pstatus); Db.Execute("update ms_siteplan set PathGambarDasar='" + urlpdasar + "' where ID='" + IDx + "'"); } //if (file2.HasFile) //{ // if (File.Exists(ptransparent)) // File.Delete(ptransparent); // Dfc.UploadFile(".png", ptransparent, file2); // Db.Execute("update ms_siteplan set PathGambarTransparent='" + urlptransparent + "' where ID='" + IDx + "'"); //} Response.Redirect("PetaEdit.aspx?done=1&id=" + IDx); } else { feed.Text = "<img src='/Media/db.gif' align=absmiddle> " + "Proses Gagal..."; } }
protected void save_Click(object sender, EventArgs e) { if (Valid) { byte aaa = 0; if (tipe.SelectedIndex == 0) { aaa = 1; } Db.Execute("EXEC spSitePlanDaftar" + " '" + ParentID + "'" + ",'" + namapeta.Text + "'" + ", " + aaa + ",''" + ",''" ); //ExecMkt.spSitePlanDaftar(ParentID, namapeta.Text,tipe.SelectedIndex == 0, "", ""); var ID = Db.SingleInteger("Select ISNULL(Max(ID),0) from MS_Siteplan"); Db.Execute("UPDATE MS_SITEPLAN SET Project='" + project.SelectedValue + "' WHERE ID = '" + ID + "'"); var Project = Db.SingleString("Select Project from MS_Siteplan WHERE ParentID = '" + ParentID + "'"); string NamaPeta = "PETA_" + ID; string pdasar = Request.PhysicalApplicationPath.ToLower().Replace("admin", "marketing") + "FP\\Base\\" + NamaPeta + ".jpg"; //file dasar string ptransparent = Request.PhysicalApplicationPath.ToLower().Replace("admin", "marketing") + "FP\\Base\\" + NamaPeta + ".png"; //file dasar string pstatus = Request.PhysicalApplicationPath.ToLower().Replace("admin", "marketing") + "FP\\" + NamaPeta + ".jpg"; //file status string urlpdasar = @"\marketingjual\FP\Base\" + NamaPeta + ".jpg"; //file dasar string urlptransparent = @"\marketingjual\FP\Base\" + NamaPeta + ".png"; //file dasar string urlpstatus = @"\marketingjual\FP\" + NamaPeta + ".jpg"; //file status if (file1.HasFile) { Dfc.UploadFilePeta(".jpg", pdasar, file1); Dfc.CopyFile(pdasar, pstatus); Db.Execute("update ms_siteplan set PathGambarDasar='" + urlpdasar + "' where ID='" + ID + "'"); Db.Execute("update ms_siteplan set Project='" + Project + "' where ID='" + ID + "'"); } //if (file2.HasFile) //{ // Dfc.UploadFile(".png", ptransparent, file2); // Db.Execute("update ms_siteplan set PathGambarTransparent='" + urlptransparent + "' where ID='" + ID + "'"); //} Js.Close(this); } }