private void SaveBookCover(string bookid) { string strBookUrl = "../AssistBook/" + bookid + "/cover.htm"; BookBLL objBill = new BookBLL(); objBill.UpdateBookUrl(Convert.ToInt32(bookid), strBookUrl); string srcPath = "../Online/AssistBook/" + bookid + "/cover.htm"; OracleAccess db = new OracleAccess(); string strSql = "select * from Information where Information_ID=" + bookid; DataSet ds = db.RunSqlDataSet(strSql); if (File.Exists(Server.MapPath(srcPath))) { File.Delete(Server.MapPath(srcPath)); } if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; string str = "<link href='book.css' type='text/css' rel='stylesheet' />" + "<body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' oncopy='document.selection.empty()' onbeforecopy='return false'>" + "<br><br><br><br><br><br><br>" + "<div id='booktitle'>" + dr["Information_Name"] + "</div>" + "<br>" + "<br><br><br><br><br><br><br><br><br><br><br>" + "<div id='orgtitle'>" + dr["Publish_Org"] + "</div>" + "<br>" + "<div id='authortitle'></div>" + "</body>"; File.AppendAllText(Server.MapPath(srcPath), str, System.Text.Encoding.UTF8); InformationShow show = new InformationShow(); show.GetIndex(bookid); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strInformationId = Request.QueryString.Get("id"); ViewState["InformationID"] = strInformationId; if (!string.IsNullOrEmpty(strInformationId)) { hfBookID.Value = strInformationId; BindTree(); } string strPath = Server.MapPath("../Online/AssistBook/" + ViewState["InformationID"].ToString()); if (!Directory.Exists(strPath)) { Directory.CreateDirectory(strPath); Directory.CreateDirectory(strPath + "/Upload"); CopyTemplate(Server.MapPath("../Online/AssistBook/template/"), Server.MapPath("../Online/AssistBook/" + ViewState["InformationID"].ToString() + "/")); } } string strRefresh = Request.Form.Get("Refresh"); if (strRefresh != null & strRefresh != "") { OracleAccess db = new OracleAccess(); string strPath = "../Online/AssistBook/" + ViewState["InformationID"] + "/" + strRefresh + ".htm"; string strSql = "update Information_Chapter set url='" + strPath + "' where Chapter_ID=" + strRefresh; db.ExecuteNonQuery(strSql); strSql = "select * from Information_Chapter where Chapter_ID=" + strRefresh; DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0]; string strChapterName = dr["Chapter_Name"].ToString(); string str = File.ReadAllText(Server.MapPath(strPath), Encoding.UTF8); if (str.IndexOf("chaptertitle") < 0) { if (Convert.ToInt32(dr["Level_Num"].ToString()) < 3) { str = "<link href='book.css' type='text/css' rel='stylesheet' />" + "<body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' oncopy='document.selection.empty()' onbeforecopy='return false'>" + "<div id='chaptertitle" + dr["Level_Num"] + "'>" + strChapterName + "</div>" + "<br>" + str + "</body>"; } else { str = "<link href='book.css' type='text/css' rel='stylesheet' />" + "<body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' oncopy='document.selection.empty()' onbeforecopy='return false'>" + "<div id='chaptertitle3'>" + strChapterName + "</div>" + "<br>" + str + "</body>"; } File.WriteAllText(Server.MapPath(strPath), str, Encoding.UTF8); } strSql = "update Information set version=version+1 where Information_ID=" + ViewState["InformationID"]; db.ExecuteNonQuery(strSql); InformationShow show = new InformationShow(); show.GetIndex(ViewState["InformationID"].ToString()); } }
protected void SaveButton_Click(object sender, EventArgs e) { if (DescriptionTextBox.Text.Length > 200) { SessionSet.PageMessage = "ÃèÊö²»Äܳ¬¹ý200¸ö×Ö·û£¡"; return; } if (txtMemo.Text.Length > 50) { SessionSet.PageMessage = "ÃèÊö²»Äܳ¬¹ý50¸ö×Ö·û£¡"; return; } OracleAccess db = new OracleAccess(); string strInformationId = Request.QueryString.Get("BookID"); string strSql; if (!string.IsNullOrEmpty(Request.QueryString.Get("id"))) { strSql = @"update Information_Chapter set Chapter_Name='" + txtName.Text.Trim() + @"', Description='" + DescriptionTextBox.Text + @"', Memo ='" + txtMemo.Text + @"', LAST_UPDATE_PERSON = '" + PrjPub.CurrentLoginUser.EmployeeName + @"', LAST_UPDATE_DATE=sysdate where Chapter_ID=" + Request.QueryString.Get("id"); db.ExecuteNonQuery(strSql); InformationShow show = new InformationShow(); show.GetIndex(strInformationId); Response.Write("<script>window.opener.tvBookChapterChangeCallBack.callback(" + Request.QueryString.Get("id") + ", 'edit');window.close();</script>"); } else { string strparent = Request.QueryString.Get("ParentID"); int levelNum = 0, orderindex; string idpath = string.Empty; strSql = "select Information_Chapter_Seq.nextval from dual"; DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0]; string strKey = dr[0].ToString(); if (strparent == "0") { idpath = "/" + strKey; levelNum = 1; strSql = "select * from Information_Chapter where Parent_ID=0 and Information_ID=" + strInformationId + " order by Order_Index desc"; DataSet dsParent = db.RunSqlDataSet(strSql); if (dsParent.Tables[0].Rows.Count > 0) { orderindex = Convert.ToInt32(dsParent.Tables[0].Rows[0]["Order_Index"]) + 1; } else { orderindex = 1; } } else { strSql = "select * from Information_Chapter where Chapter_ID=" + strparent; DataSet dsParent = db.RunSqlDataSet(strSql); if (dsParent.Tables[0].Rows.Count > 0) { levelNum = Convert.ToInt32(dsParent.Tables[0].Rows[0]["Level_Num"]) + 1; idpath = dsParent.Tables[0].Rows[0]["ID_Path"] + "/" + strKey; } strSql = "select * from Information_Chapter where Parent_ID=" + strparent + " order by order_Index desc"; dsParent = db.RunSqlDataSet(strSql); if (dsParent.Tables[0].Rows.Count > 0) { orderindex = Convert.ToInt32(dsParent.Tables[0].Rows[0]["Order_Index"]) + 1; } else { orderindex = 1; } } strSql = @"insert into Information_Chapter(Information_ID,Chapter_ID,Parent_ID,ID_Path, Level_NUM,Order_Index,Chapter_Name,Description,Memo, LAST_UPDATE_PERSON,LAST_UPDATE_DATE) values(" + strInformationId + @"," + strKey + @"," + strparent + @",'" + idpath + @"', " + levelNum + @"," + orderindex + @", '" + txtName.Text.Trim() + @"', '" + DescriptionTextBox.Text + @"', '" + txtMemo.Text + @"', '" + PrjPub.CurrentLoginUser.EmployeeName + @"', sysdate)"; db.ExecuteNonQuery(strSql); InformationShow show = new InformationShow(); show.GetIndex(strInformationId); Response.Write("<script>window.opener.tvBookChapterChangeCallBack.callback(" + strparent + ", 'Insert');window.close();</script>"); } }
protected void tvBookChapterChangeCallBack_Callback(object sender, CallBackEventArgs e) { OracleAccess db = new OracleAccess(); if (e.Parameters[1] == "MoveUp") { string strSql = "select * from Information_Chapter where Chapter_ID=" + e.Parameters[0]; DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0]; int cout = tvBookChapter.FindNodeById(dr["Parent_ID"].ToString()).Nodes.Count; int orderIndex = Convert.ToInt32(dr["Order_Index"].ToString()); if (orderIndex <= cout && orderIndex >= 2) { if (e.Parameters[2] == "Edit") { strSql = "update Information set version=version+1 where Information_ID=" + dr["Information_ID"]; db.ExecuteNonQuery(strSql); } strSql = "update Information_Chapter set Order_Index=Order_Index-1 where Chapter_ID=" + e.Parameters[0]; db.ExecuteNonQuery(strSql); strSql = "update Information_Chapter set Order_Index=Order_Index+1 where Chapter_ID=" + int.Parse(tvBookChapter.FindNodeById(e.Parameters[0]).PreviousSibling.ID); db.ExecuteNonQuery(strSql); } } if (e.Parameters[1] == "MoveDown") { string strSql = "select * from Information_Chapter where Chapter_ID=" + e.Parameters[0]; DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0]; int cout = tvBookChapter.FindNodeById(dr["Parent_ID"].ToString()).Nodes.Count; int orderIndex = Convert.ToInt32(dr["Order_Index"].ToString()); if (orderIndex <= cout - 1 && orderIndex >= 1) { if (e.Parameters[2] == "Edit") { strSql = "update Information set version=version+1 where Information_ID=" + dr["Information_ID"]; db.ExecuteNonQuery(strSql); } strSql = "update Information_Chapter set Order_Index=Order_Index+1 where Chapter_ID=" + e.Parameters[0]; db.ExecuteNonQuery(strSql); strSql = "update Information_Chapter set Order_Index=Order_Index-1 where Chapter_ID=" + int.Parse(tvBookChapter.FindNodeById(e.Parameters[0]).NextSibling.ID); db.ExecuteNonQuery(strSql); } } if (e.Parameters[1] == "Insert") { string strSql = "select Max(Chapter_Id) from Information_Chapter where Information_ID=" + hfBookID.Value + " and Parent_ID=" + e.Parameters[0]; DataSet ds = db.RunSqlDataSet(strSql); hfMaxID.Value = ds.Tables[0].Rows[0][0].ToString(); hfMaxID.RenderControl(e.Output); } if (e.Parameters[1] == "delete") { string strSql = "select * from Information_Chapter where Chapter_ID=" + e.Parameters[0]; DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0]; strSql = "delete from Information_Chapter where Chapter_ID=" + e.Parameters[0]; db.ExecuteNonQuery(strSql); InformationShow show = new InformationShow(); show.GetIndex(dr["Information_ID"].ToString()); hfMaxID.Value = e.Parameters[2]; hfMaxID.RenderControl(e.Output); } if (e.Parameters[1] == "edit") { hfMaxID.Value = e.Parameters[0]; hfMaxID.RenderControl(e.Output); } tvBookChapter.Nodes.Clear(); BindTree(); tvBookChapter.RenderControl(e.Output); }