155 lines
6.0 KiB
C#
155 lines
6.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace Mtxfw.shop._Admin
|
|
{
|
|
public partial class admin_gong_add : Mtxfw.Utility.AdminPage
|
|
{
|
|
public Mtxfw.DAL.Article daoArt = new Mtxfw.DAL.Article();
|
|
public String TitName, strtitle, strBody = "";
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
Hidd_Url.Value = Request.UrlReferrer.ToString();
|
|
if (Request.QueryString["ParentID"] != null)
|
|
{
|
|
|
|
if (Request.QueryString["action"] == "add")
|
|
{
|
|
TitName = "添加";
|
|
Btn_Update.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
TitName = "更新";
|
|
Btn_Insert.Visible = false;
|
|
|
|
Mtxfw.Model.Article model = daoArt.GetModel(int.Parse(Request.QueryString["ID"]));
|
|
Text_Title.Text = model.Title;
|
|
strBody = model.Content;
|
|
Hidd_C.Value = model.CategoryId;
|
|
}
|
|
if (Request.QueryString["ParentID"].ToString() == "9")
|
|
{
|
|
strtitle = "商城公告";
|
|
}
|
|
if (Request.QueryString["ParentID"].ToString() == "10")
|
|
{
|
|
strtitle = "会员公告";
|
|
}
|
|
if (Request.QueryString["ParentID"].ToString() == "11")
|
|
{
|
|
strtitle = "行业新闻";
|
|
}
|
|
if (Request.QueryString["ParentID"].ToString() == "16")
|
|
{
|
|
strtitle = "英文版公司新闻";
|
|
}
|
|
if (Request.QueryString["ParentID"].ToString() == "17")
|
|
{
|
|
strtitle = "英文版行业新闻";
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
Btn_Insert.Click += delegate(object s, EventArgs ex)
|
|
{
|
|
Mtxfw.Model.Article model = new Mtxfw.Model.Article();
|
|
model.senderid = 0;
|
|
model.receiverid = 0;
|
|
model.Title = Text_Title.Text;
|
|
model.ParentID = int.Parse(Request.QueryString["ParentID"].ToString());
|
|
model.CategoryId = "0";
|
|
model.AddTime = DateTime.Now;
|
|
model.Author = IdentityName;
|
|
model.Content = Hidd_myEditor.Value;
|
|
model.Paths = "";
|
|
model.Seef = 1;
|
|
model.wtype = 0;
|
|
model.LinkID = 0;
|
|
model.Content2 = "";
|
|
model.KeyWords = "";
|
|
model.Paths2 = "";
|
|
model.media_id = "";
|
|
model.thumb_media_id = "";
|
|
daoArt.Add(model);
|
|
if (Session["UploadFileIng"] != null)
|
|
{
|
|
string[] stra = Session["UploadFileIng"].ToString().Split(',');
|
|
foreach (string str in stra)
|
|
{
|
|
if (str.Trim() != "")
|
|
{
|
|
if ( model.Content.IndexOf(str.Trim()) == -1)
|
|
{
|
|
if (System.IO.File.Exists(Server.MapPath(str.Trim())))
|
|
{
|
|
System.IO.File.Delete(Server.MapPath(str.Trim()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Session.Remove("UploadFileIng");
|
|
System.Collections.IDictionaryEnumerator CacheEnum = Cache.GetEnumerator();
|
|
while (CacheEnum.MoveNext())
|
|
{
|
|
Cache.Remove(CacheEnum.Key.ToString());
|
|
}
|
|
new admin_Product_list().Createtopproduct();
|
|
Response.Redirect(Hidd_Url.Value);
|
|
};
|
|
|
|
Btn_Update.Click += delegate(object s, EventArgs ex)
|
|
{
|
|
Int32 ID = int.Parse(Request.QueryString["ID"]);
|
|
Mtxfw.Model.Article model = daoArt.GetModel(ID);
|
|
model.senderid = 0;
|
|
model.receiverid = 0;
|
|
model.Title = Text_Title.Text;
|
|
model.ParentID = int.Parse(Request.QueryString["ParentID"].ToString());
|
|
model.CategoryId = Hidd_C.Value;
|
|
model.AddTime = DateTime.Now;
|
|
model.Author = IdentityName;
|
|
model.Content = Hidd_myEditor.Value;
|
|
model.Paths = "";
|
|
model.Seef = 1;
|
|
model.id = ID;
|
|
daoArt.Update(model);
|
|
if (Session["UploadFileIng"] != null)
|
|
{
|
|
string[] stra = Session["UploadFileIng"].ToString().Split(',');
|
|
foreach (string str in stra)
|
|
{
|
|
if (str.Trim() != "")
|
|
{
|
|
if ( model.Content.IndexOf(str.Trim()) == -1)
|
|
{
|
|
if (System.IO.File.Exists(Server.MapPath(str.Trim())))
|
|
{
|
|
System.IO.File.Delete(Server.MapPath(str.Trim()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Session.Remove("UploadFileIng");
|
|
System.Collections.IDictionaryEnumerator CacheEnum = Cache.GetEnumerator();
|
|
while (CacheEnum.MoveNext())
|
|
{
|
|
Cache.Remove(CacheEnum.Key.ToString());
|
|
}
|
|
new admin_Product_list().Createtopproduct();
|
|
Response.Redirect(Hidd_Url.Value);
|
|
};
|
|
}
|
|
}
|
|
} |