public void BindData() { if (view_action == "notify") { Model.Company_Profile cp = Factory.GetExecution().SelectByID <Model.Company_Profile>(requestID); if (cp != null) { txtTitle.Text = cp.Title; XiangQing = cp.Content; if (cp.Language == 1) { Chinese.Checked = true; } else if (cp.Language == 3) { English.Checked = true; } else if (cp.Language == 2) { Traditional.Checked = true; } txtCreatePeople.Text = cp.CreatePeople; HomePageUploadImg.ImageUrl = WebSite.IMAGESERVER_WEBPATH + photoPath + cp.LogoUrl; HomePageUploadFileName.Text = cp.LogoUrl; TextUploadImg.ImageUrl = WebSite.IMAGESERVER_WEBPATH + photoPath + cp.TextUrl; TextUploadFileName.Text = cp.TextUrl; txtKeywords.Text = cp.Keywords; txtDescription.Text = cp.Description; } } }
protected void btnSave_Click(object sender, EventArgs e) { try { XiangQing = Request.Form["editorValue"]; //获取umeditor的值 if (string.IsNullOrEmpty(XiangQing)) { Common.MessageBox.ShowLayer(this, "正文内容不能为空", 2); return; } if (view_action == "notify") { Model.Company_Profile cp = Factory.GetExecution().SelectByID <Model.Company_Profile>(requestID); if (cp != null) { cp.Title = txtTitle.Text; cp.Language = Convert.ToInt32(Request.Form["language"]); cp.Content = XiangQing; cp.CreatePeople = txtCreatePeople.Text; cp.LogoUrl = HomePageUploadFileName.Text; cp.TextUrl = TextUploadFileName.Text; cp.CreatePeople = txtCreatePeople.Text; cp.UpdateTime = DateTime.Now; cp.Keywords = txtKeywords.Text.Trim(); cp.Description = txtDescription.Text.Trim(); bool flag = Factory.GetExecution().Update <Model.Company_Profile>(cp); if (flag) { Common.MessageBox.ShowRedirect(this, "/AboutUs/CompanyProfile.aspx"); } } } else { Model.Company_Profile cp = new Model.Company_Profile(); cp.Title = txtTitle.Text; cp.Content = XiangQing; cp.Language = Convert.ToInt32(Request.Form["language"]); cp.CreatePeople = txtCreatePeople.Text; cp.LogoUrl = HomePageUploadFileName.Text; cp.TextUrl = TextUploadFileName.Text; cp.CreatePeople = txtCreatePeople.Text; cp.UpdateTime = DateTime.Now; cp.CreateTime = DateTime.Now; cp.Keywords = txtKeywords.Text.Trim(); cp.Description = txtDescription.Text.Trim(); bool flag = Factory.GetExecution().Add <Model.Company_Profile>(cp); if (flag) { Common.MessageBox.ShowRedirect(this, "/AboutUs/CompanyProfile.aspx"); } } } catch (Exception ex) { Common.MessageBox.ShowLayer(this, "添加失败!" + ex.Message, 2); } finally { BindData(); } }