protected override void InitializeSkin(System.Web.UI.Control Skin) { LogIdTex = (TextBox)Skin.FindControl("LogId"); Title = (TextBox)Skin.FindControl("title"); CateName = (TextBox)Skin.FindControl("Cate_Name"); Add = (Button)Skin.FindControl("Add"); AddDraft = (Button)Skin.FindControl("AddDraft"); Cansel = (Button)Skin.FindControl("Cansel"); AddCategory = (Button)Skin.FindControl("AddCategory"); Editor = (LionSky.WebControls.WebHtmlEditor)Skin.FindControl("WebHtmlEditor1"); if(blogContext.Action!=null&& blogContext.Action.ToLower()=="edit") if ((!Page.IsPostBack)&&(blogContext.LogId!=-1)) { Add.Text = "发表修改"; CDES1 c=new CDES1(); LogIdTex.Text = c.Encrypt1(blogContext.LogId.ToString()); //加密以免有人修改 Weblog_Log l = BWeblog_log.GetWithDraftByID(blogContext.LogId); Title.Text = l.Log_Title; Editor.Html = l.Log_Content; } DataBind(); }
void Add_Click(object sender, EventArgs e) { if (LogIdTex.Text != "") { CDES1 c = new CDES1(); LogId = Convert.ToInt32(c.Decrypt1(LogIdTex.Text)); } LogTitle = Title.Text; LogContext = Editor.Html; if (LogId == 0)//添加 { Weblog_Log WL = new Weblog_Log(); WL.Log_CommentCount = 0; WL.Log_IsTop = false; WL.Log_IsVisible = true; WL.Log_ViewCount = 0; WL.Log_IP = Globals.IPAddress; WL.Log_IsDraft = false; WL.Log_CreateTime = DateTime.Now; WL.Log_LastModiTime = DateTime.Now; WL.Log_Title = LogTitle; WL.Log_Content = LogContext; WL.Log_UserId = blogContext.User.BlogUserID; BWeblog_log.Insert(WL); PageRedirct(true); } else //修改 { Weblog_Log WL = new Weblog_Log(); WL.Log_IsDraft = false; WL.Log_Id = LogId; WL.Log_LastModiTime = DateTime.Now; WL.Log_Title = LogTitle; WL.Log_Content = LogContext; BWeblog_log.Update(WL); PageRedirct(true); } }