📄 news_add.aspx.cs
字号:
IDataReader dr = rd.sel_NameID(ClassID,1);
if (dr.Read())
{
_Str += "<img src=\"../../sysImages/folder/navidot.gif\" border=\"0\" /><a href=\"News_list.aspx?ClassID=" + dr["ClassID"].ToString() + "\" class=\"topnavichar\">" + dr["ClassCName"] + "</a>(<a href=\"news_add.aspx?ClassID=" + dr["ClassID"].ToString() + "&EditAction=Add\" title=\"添加此栏目下的内容\" class=\"list_link\"><img src=\"../../sysImages/folder/addnews.gif\" border=\"0\" /></a>)";
if (dr["ParentID"] != DBNull.Value && dr["ParentID"].ToString() != "0")
{
IDataReader dr2 = rd.sel_NameID(dr["ParentID"].ToString(),1);
while (dr2.Read())
{
_Str = "<a href=\"News_list.aspx?ClassID=" + dr2["ClassID"].ToString() + "\" class=\"topnavichar\">" + dr2["ClassCName"] + "</a>(<a href=\"news_add.aspx?ClassID=" + dr2["ClassID"].ToString() + "&EditAction=Add\" title=\"添加此栏目下的内容\" class=\"list_link\"><img src=\"../../sysImages/folder/addnews.gif\" border=\"0\" /></a>)" + _Str;
_Str = getNaviClassName(dr2["ParentID"].ToString()) + "<img src=\"../../sysImages/folder/navidot.gif\" border=\"0\" />" + _Str;
}
dr2.Close();
}
}
dr.Close();
return _Str;
}
/// <summary>
/// 保存数据
/// </summary>
protected void Buttonsave_Click(object sender, EventArgs e)
{
if (Page.IsValid == true) //判断是否验证成功
{
string NewsID = "";
string EditAction = this.EditAction.Value;
string ClassID = this.ClassID.Value;
string SpecialID = this.SpecialID.Value;
#region 获取栏目数据库表
string getDataLibStr = "";
DataTable obj=rd.getClassContent(ClassID, 3);
if (obj != null)
{
if (obj.Rows.Count > 0)
{
getDataLibStr = obj.Rows[0]["DataLib"].ToString();
}
}
if (getDataLibStr == null || getDataLibStr.Trim() == string.Empty)
{
PageError("找不到栏目数据!", "");
}
#endregion 获取栏目数据库表
if (EditAction == "Edit")
{
NewsID = this.NewsID.Value;
}
else
{
NewsID = NetCMS.Common.Rand.Number(12);
#region 检查编号是否存在
RandFirst: string RandInt = NewsID;
DataTable rTF = rd.sel_infoByStr(RandInt, getDataLibStr,0);
if (rTF.Rows.Count > 0)
goto RandFirst;
rTF.Clear(); rTF.Dispose();
#endregion 检查编号是否存在结束
}
string gFileURL = Request.Form["FileUrl"];
string gFileOrderID = Request.Form["FileOrderID"];
string gURLName = Request.Form["URLName"];
string _NewsType = Request.Form["NewsType"];
#region 获取表单值
int NewsType = 0;
if (_NewsType.ToString() == "at1RandButton") { NewsType = 1; }
if (_NewsType.ToString() == "at2RandButton") { NewsType = 2; }
string URLaddress = "";
if (NewsType != 2)
{
//if (((this.Content.Content.Trim())).Length < 3) { PageError("请正确填写内容.长度不能小于3字符!", ""); }
if (((this.FileContent.Value.Trim())).Length < 3) { PageError("请正确填写内容.长度不能小于3字符!", ""); }
if (((this.Templet.Text).Trim()).Length < 2) { PageError("模板路径错误!", ""); }
//if (((this.SavePath.Text).Trim()).Length < 2) { PageError("保存路径参数错误!", ""); }
if (((this.FileName.Text).Trim()).Length < 2) { PageError("文件名参数错误!", ""); }
if (((this.FileEXName.Text).Trim()).Length < 4) { PageError("扩展名参数错误!", ""); }
}
else
{
URLaddress = this.URLaddress.Text;
if ((URLaddress.Trim()).Length < 5) { PageError("请正确填写外部连接地址!", ""); }
}
if (NewsType == 1)
{
if (((this.PicURL.Text).Trim()).Length < 5) { PageError("图片请填写图片地址!", ""); }
}
string NewsTitle = this.NewsTitle.Text;
if ((NewsTitle.Trim()).Length < 3) { PageError("请正确填写标题!", ""); }
#region 得到SiteID
string site = pd.getSiteIDFromClass(ClassID);
#endregion 得到SiteID
if (pd.CheckNewsTitle() == 1)
{
if (rd.newsTitletf(NewsTitle, getDataLibStr, EditAction, NewsID) == 1)
{
PageError("新闻标题[<span style=\"color:red\">" + NewsTitle + "</span>]重复!<li>如果需要重复,请在控制面版的参数中设置。</li>", "");
}
}
string TitleColor = this.TitleColor.Value;
int TitleITF = 0;
if (this.TitleITF.Checked) { TitleITF = 1; }
int TitleBTF = 0;
if (this.TitleBTF.Checked) { TitleBTF = 1; }
int CommLinkTF = 0;
if (this.CommLinkTF.Checked) { CommLinkTF = 1; }
int OrderID = int.Parse(this.OrderIDDropDownList.SelectedValue);
string sNewsTitle = this.sNewsTitle.Text;
int SubNewsTF = 0;
if (this.SubTF.Checked) { SubNewsTF = 1; }
string PicURL = this.PicURL.Text;
int SPicURLTF = 0;
if (this.SPicURLTF.Checked) { SPicURLTF = 1; }
string naviContent = this.naviContent.Text;
if (naviContent.Length > 255)
{
PageError("导读最大长度为255个中文字符或者英文字符", "javascript:history.back()", true);
}
if (this.sNaviContentFromContent.Checked)
{
string LostResultStr = NetCMS.Common.Input.LostHTML(naviContent);
LostResultStr = NetCMS.Common.Input.LostPage(LostResultStr);
LostResultStr = NetCMS.Common.Input.LostVoteStr(LostResultStr);
naviContent = NetCMS.Common.Input.GetSubString(LostResultStr, 200);
}
string Templet = this.Templet.Text;
int CommTF = 0;
if (this.NewsProperty_CommTF1.Checked) { CommTF = 1; }
int DiscussTF = 0;
if (this.NewsProperty_DiscussTF1.Checked) { DiscussTF = 1; }
string NewsProperty_RECTF1 = "0";
if (this.NewsProperty_RECTF1.Checked) { NewsProperty_RECTF1 = "1"; }
string NewsProperty_MARTF1 = "0";
if (this.NewsProperty_MARTF1.Checked) { NewsProperty_MARTF1 = "1"; }
string NewsProperty_HOTTF1 = "0";
if (this.NewsProperty_HOTTF1.Checked) { NewsProperty_HOTTF1 = "1"; }
string NewsProperty_FILTTF1 = "0";
if (this.NewsProperty_FILTTF1.Checked) { NewsProperty_FILTTF1 = "1"; }
string NewsProperty_TTTF1 = "0";
if (this.NewsProperty_TTTF1.Checked) { NewsProperty_TTTF1 = "1"; }
string NewsProperty_ANNTF1 = "0";
if (this.NewsProperty_ANNTF1.Checked) { NewsProperty_ANNTF1 = "1"; }
string NewsProperty_JCTF1 = "0";
if (this.NewsProperty_JCTF1.Checked) { NewsProperty_JCTF1 = "1"; }
string NewsProperty_WAPTF1 = "0";
if (this.NewsProperty_WAPTF1.Checked) { NewsProperty_WAPTF1 = "1"; }
//推荐,滚动,热点,幻灯,头条,公告,WAP,精彩
string NewsProperty = NewsProperty_RECTF1 + "," + NewsProperty_MARTF1 + "," + NewsProperty_HOTTF1 + "," + NewsProperty_FILTTF1 + "," + NewsProperty_TTTF1 + "," + NewsProperty_ANNTF1 + "," + NewsProperty_WAPTF1 + "," + NewsProperty_JCTF1;
string Souce = this.Souce.Text;
//插入常规表,来源
if (this.SouceTF.Checked)
{
if (Souce.Trim() != string.Empty)
{
rd.iGen(Souce, "", "", 1);
}
}
string Author = this.Author.Text;
//插入常规表,作者
if (this.AuthorTF.Checked)
{
if (Author.Trim() != string.Empty)
{
rd.iGen(Author, "", "", 2);
}
}
string Tags = this.Tags.Text;
if (Tags == "")
{
Tags = NewsTitle.Substring(0, 3).ToString();
}
//插入常规表,tags
if (this.TagsTF.Checked)
{
if (Tags.IndexOf("|") > -1)
{
string[] TagsARR = Tags.Split('|');
for (int mt = 0; mt < TagsARR.Length; mt++)
{
rd.iGen(TagsARR[mt], "", "", 0);
}
}
else
{
if (Tags.Trim() != string.Empty)
{
rd.iGen(Tags, "", "", 0);
}
}
}
int Click = int.Parse(this.Click.Text);
string Metakeywords = this.Metakeywords.Text;
string Metadesc = this.Metadesc.Text;
string SavePath = this.SavePath.Text;
string FileName = this.FileName.Text;
string FileEXName = this.FileEXName.SelectedValue;
string vURL = this.vURL.Text;
if (vURL != string.Empty)
{
if (vURL.Length < 5) { PageError("请正确填写视频文件!", ""); }
}
string _CheckStat = this.CheckStat.SelectedValue;
string CheckStat = "0|0|0|0";
int isLock = 0;
if (_CheckStat == "0") { CheckStat = "0|0|0|0"; isLock = 0; }
if (_CheckStat == "1") { CheckStat = "1|1|0|0"; isLock = 1; }
if (_CheckStat == "2") { CheckStat = "2|1|1|0"; isLock = 1; }
if (_CheckStat == "3") { CheckStat = "3|1|1|1"; isLock = 1; }
int VoteTF = 0;
string VoteContent = "";
if (this.VoteTF.Checked)
{
if (NewsType != 2)
{
VoteTF = 1;
if ((this.VoteContent.Text).Trim() != null && (this.VoteContent.Text).Trim() != "") { VoteContent = this.VoteContent.Text; }
else { PageError("请填写投票项目!", ""); }
}
}
int ContentPicTF = 0;
string ContentPicURL = "";
string ContentPicSize = "300|300";
if (this.ContentPicTF.Checked)
{
if (NewsType != 2)
{
ContentPicTF = 1;
//插入画中画记录
ContentPicURL = this.ContentPicURL.Text;
if ((ContentPicURL).Length < 5 || (ContentPicURL).Length > 200) { PageError("画中画内容请正确填写!长度为5-200个字符", ""); }
ContentPicSize = this.tHight.Text + "|" + this.tWidth.Text;
}
}
#region 获得权限开始
int isDelPoint = this.UserPop1.AuthorityType;
int Gpoint = this.UserPop1.Gold;
int iPoint = this.UserPop1.Point;
string[] _GroupNumber = this.UserPop1.MemberGroup;
string GroupNumber = "";
foreach (string gnum in _GroupNumber)
{
if (GroupNumber != "")
GroupNumber += ",";
GroupNumber += gnum;
}
#endregion 获得权限结束
//string _Content = this.Content.Content;
string _Content = this.FileContent.Value;
string __Content = "";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -