protected void Button2_Click(object sender, EventArgs e) { CheckValidate(); ChannelId = int.Parse(Request.QueryString["ChId"]); int sColId = int.Parse(Request.Form["ddlColId"]); int sId = int.Parse(Request.QueryString["Id"]); #region 系统字段获取值 string sTitle = txtTitle.Text; string sTitleColor = txtTitleColor.Text; string sTitleFontType = ddlTitleFontType.SelectedValue; int sTitleType = 1; if (rbImg.Checked == true) { sTitleType = 2; } string sTitleImgPath = txtTitleImgPath.Text; //int sUId = AdminModel.UserId; //string sUName = AdminModel.LoginName; //string sUserType = "1"; //int sAdminUId = AdminModel.UserId; //string sAdminUName = AdminModel.LoginName; //int sStatus = 3; int sHitCount = int.Parse(txtHitCount.Text); DateTime sAddTime = DateTime.Now; DateTime sUpdateTime = DateTime.Now; string sTemplatePath = txtTemplatePath.Text; int sPageType = int.Parse(rdBtnPageType.SelectedValue); int sIsCreated = 0; if (chkBoxIsCreate.Checked) { sIsCreated = 1; } int sUserCateId = 0; int sPointCount = int.Parse(txtPointCount.Text); string rdBtnChargeType = Request.Form["ChargeType"]; int sChargeType = 0; if (rdBtnChargeType == "rdBtnChargeType1") { sChargeType = 1; } else if (rdBtnChargeType == "rdBtnChargeType2") { sChargeType = 2; } else if (rdBtnChargeType == "rdBtnChargeType3") { sChargeType = 3; } else if (rdBtnChargeType == "rdBtnChargeType4") { sChargeType = 4; } else if (rdBtnChargeType == "rdBtnChargeType5") { sChargeType = 5; } else if (rdBtnChargeType == "rdBtnChargeType6") { sChargeType = 6; } int sChargeHourCount = int.Parse(txtChargeHourCount.Text); int sChargeViewCount = int.Parse(txtChargeViewCount.Text); int sIsOpened = int.Parse(rdBtnIsOpened.SelectedValue); string sGroupIdStr = ""; if (sIsOpened == 0) { sGroupIdStr = "|"; foreach (ListItem li in chkBoxGroupIdStr.Items) { if (li.Selected) { sGroupIdStr += li.Value + "|"; } } } int sIsDeleted = 0; int sIsRecommend = 0; if (chkBoxIsRecommend.Checked) { sIsRecommend = 1; } int sIsTop = 0; if (chkBoxIsTop.Checked) { sIsTop = 1; } int sIsFocus = 0; if (chkBoxIsFocus.Checked) { sIsFocus = 1; } int sIsSideShow = 0; if (chkBoxIsSideShow.Checked) { sIsSideShow = 1; } #region 关键字 string sTagIdStr = string.Empty; string sTagNameStr = txtTagNameStr.Text.Trim(); sTagNameStr = Regex.Replace(sTagNameStr, @"\s+", "|", RegexOptions.IgnoreCase); if (sTagNameStr.Length != 0) { if (sTagNameStr.StartsWith("|")) sTagNameStr = sTagNameStr.Substring(1, sTagNameStr.Length - 1); if (sTagNameStr.EndsWith("|")) sTagNameStr = sTagNameStr.Substring(0, sTagNameStr.Length - 1); B_Tag tagBll = new B_Tag(); DataRow dr = tagBll.AddTagStr(sTagNameStr, ChannelModel.ModelType, 0, "后台管理员"); if (dr != null) { sTagIdStr = "|" + dr[0] + "|"; sTagNameStr = "|" + dr[1] + "|"; } else { sTagIdStr = ""; sTagNameStr = ""; } } #endregion int sIsAllowComment = 0; if (chkBoxIsAllowComment.Checked) { sIsAllowComment = 1; } string idStr = ""; string sSpecialIdStr = ""; for (int i = 0; i < lBoxTopicIdStr.Items.Count; i++) { if (lBoxTopicIdStr.Items[i].Selected) { idStr += lBoxTopicIdStr.Items[i].Value + "|"; } } if (idStr != "") { sSpecialIdStr = "|" + idStr; } //if (sIsCreated) //{ //} #endregion //获取表字段 ChannelModel = ChannelId <= 0 ? null : ChannelBll.GetChannel(ChannelId); MInfoModel = BInfoModel.GetModel(ChannelModel.ModelType); //定义DataTable DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("FieldName", typeof(string))); dt.Columns.Add(new DataColumn("FieldValue", typeof(string))); #region DataRow dr99 = dt.NewRow(); dr99[0] = "Id"; dr99[1] = sId; dt.Rows.Add(dr99); DataRow dr0 = dt.NewRow(); dr0[0] = "ColId"; dr0[1] = sColId; dt.Rows.Add(dr0); DataRow dr1 = dt.NewRow(); dr1[0] = "Title"; dr1[1] = sTitle; dt.Rows.Add(dr1); DataRow dr2 = dt.NewRow(); dr2[0] = "TitleColor"; dr2[1] = sTitleColor; dt.Rows.Add(dr2); DataRow dr3 = dt.NewRow(); dr3[0] = "TitleFontType"; dr3[1] = sTitleFontType; dt.Rows.Add(dr3); DataRow dr4 = dt.NewRow(); dr4[0] = "TitleType"; dr4[1] = sTitleType; dt.Rows.Add(dr4); DataRow dr5 = dt.NewRow(); dr5[0] = "TitleImgPath"; dr5[1] = sTitleImgPath; dt.Rows.Add(dr5); //DataRow dr6 = dt.NewRow(); //dr6[0] = "UId"; //dr6[1] = sUId; //dt.Rows.Add(dr6); //DataRow dr7 = dt.NewRow(); //dr7[0] = "UName"; //dr7[1] = sUName; //dt.Rows.Add(dr7); //DataRow dr8 = dt.NewRow(); //dr8[0] = "UserType"; //dr8[1] = sUserType; //dt.Rows.Add(dr8); //DataRow dr9 = dt.NewRow(); //dr9[0] = "AdminUId"; //dr9[1] = sAdminUId; //dt.Rows.Add(dr9); //DataRow dr10 = dt.NewRow(); //dr10[0] = "AdminUName"; //dr10[1] = sAdminUName; //dt.Rows.Add(dr10); //DataRow dr11 = dt.NewRow(); //dr11[0] = "Status"; //dr11[1] = sStatus; //dt.Rows.Add(dr11); DataRow dr12 = dt.NewRow(); dr12[0] = "HitCount"; dr12[1] = sHitCount; dt.Rows.Add(dr12); DataRow dr13 = dt.NewRow(); dr13[0] = "AddTime"; dr13[1] = sAddTime; dt.Rows.Add(dr13); DataRow dr14 = dt.NewRow(); dr14[0] = "UpdateTime"; dr14[1] = sUpdateTime; dt.Rows.Add(dr14); DataRow dr15 = dt.NewRow(); dr15[0] = "TemplatePath"; dr15[1] = sTemplatePath; dt.Rows.Add(dr15); DataRow dr16 = dt.NewRow(); dr16[0] = "PageType"; dr16[1] = sPageType; dt.Rows.Add(dr16); DataRow dr17 = dt.NewRow(); dr17[0] = "IsCreated"; dr17[1] = sIsCreated; dt.Rows.Add(dr17); DataRow dr18 = dt.NewRow(); dr18[0] = "UserCateId"; dr18[1] = sUserCateId; dt.Rows.Add(dr18); DataRow dr19 = dt.NewRow(); dr19[0] = "PointCount"; dr19[1] = sPointCount; dt.Rows.Add(dr19); DataRow dr20 = dt.NewRow(); dr20[0] = "ChargeType"; dr20[1] = sChargeType; dt.Rows.Add(dr20); DataRow dr21 = dt.NewRow(); dr21[0] = "ChargeHourCount"; dr21[1] = sChargeHourCount; dt.Rows.Add(dr21); DataRow dr22 = dt.NewRow(); dr22[0] = "ChargeViewCount"; dr22[1] = sChargeViewCount; dt.Rows.Add(dr22); DataRow dr23 = dt.NewRow(); dr23[0] = "IsOpened"; dr23[1] = sIsOpened; dt.Rows.Add(dr23); DataRow dr24 = dt.NewRow(); dr24[0] = "GroupIdStr"; dr24[1] = sGroupIdStr; dt.Rows.Add(dr24); DataRow dr25 = dt.NewRow(); dr25[0] = "IsDeleted"; dr25[1] = sIsDeleted; dt.Rows.Add(dr25); DataRow dr26 = dt.NewRow(); dr26[0] = "IsRecommend"; dr26[1] = sIsRecommend; dt.Rows.Add(dr26); DataRow dr27 = dt.NewRow(); dr27[0] = "IsTop"; dr27[1] = sIsTop; dt.Rows.Add(dr27); DataRow dr28 = dt.NewRow(); dr28[0] = "IsFocus"; dr28[1] = sIsFocus; dt.Rows.Add(dr28); DataRow dr29 = dt.NewRow(); dr29[0] = "IsSideShow"; dr29[1] = sIsSideShow; dt.Rows.Add(dr29); DataRow dr30 = dt.NewRow(); dr30[0] = "TagIdStr"; dr30[1] = sTagIdStr; dt.Rows.Add(dr30); DataRow dr31 = dt.NewRow(); dr31[0] = "TagNameStr"; dr31[1] = sTagNameStr; dt.Rows.Add(dr31); DataRow dr32 = dt.NewRow(); dr32[0] = "IsAllowComment"; dr32[1] = sIsAllowComment; dt.Rows.Add(dr32); DataRow dr33 = dt.NewRow(); dr33[0] = "SpecialIdStr"; dr33[1] = sSpecialIdStr; dt.Rows.Add(dr33); #endregion //以下是自动添加字段获得值 DataTable dt1 = new DataTable(); dt1 = BModelField.GetList(ChannelModel.ModelType); for (int i = 0; i < dt1.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr[0] = dt1.Rows[i]["Name"].ToString(); //联动获取数据开始 //二级联动 if (dt1.Rows[i]["Type"].ToString() == "ErLinkageType") { dr[1] = Request.Form["txt_" + dt1.Rows[i]["Name"].ToString()]; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = dt1.Rows[i]["Name"].ToString() + "_Id"; dr[1] = Request.Form["txt_" + dt1.Rows[i]["Name"].ToString() + "_Id"]; dt.Rows.Add(dr); string SmallName = BModelField.GetFieldContent(dt1.Rows[i]["Content"].ToString(), 2, 1); dr = dt.NewRow(); dr[0] = SmallName; dr[1] = Request.Form["txt_" + SmallName]; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = SmallName + "_Id"; dr[1] = Request.Form["txt_" + SmallName + "_Id"]; dt.Rows.Add(dr); } else { switch (dt1.Rows[i]["Type"].ToString()) { case "ListBoxType": if (Request.Form["txt_" + dt1.Rows[i]["Name"].ToString() + ""] == "" || Request.Form["txt_" + dt1.Rows[i]["Name"].ToString() + ""] == null) { dr[1] = Request.Form["txt_" + dt1.Rows[i]["Name"].ToString() + ""]; } else { dr[1] = Request.Form["txt_" + dt1.Rows[i]["Name"].ToString() + ""].Replace(" ", "").ToString(); } dr[1] = "," + dr[1] + ","; break; case "MultipleTextType": dr[1] = Request.Form["txt_" + dt1.Rows[i]["Name"].ToString() + ""]; break; default: dr[1] = Request.Form["txt_" + dt1.Rows[i]["Name"].ToString() + ""]; break; } dt.Rows.Add(dr); } } //添加信息 BInfoModel.UpdateInfoModel(dt, MInfoModel.TableName); if(chkBoxIsCreate.Checked) { DataRow dr = CreateBll.GetInfoById(MInfoModel.TableName, Id); CreateBll.CreateSingleInfo(dr); } Function.ShowSysMsg(1, "<li>成功修改信息</li><li><a href='info/InfoList.aspx?ChId=" + ChannelId + "&ColId=" + sColId + "'>返回信息列表</a> <a href='info/UpdateInfo.aspx?ChId=" + ChannelId + "&ColId=" + sColId + "&Id="+sId+"'>重新修改</a></li>"); }
protected void btnSoftSaveAs_Click(object sender, EventArgs e) { bool flag = CheckValidate(); if (flag) { #region //添加软件 DownLoadmodel.Id = Id; if(Id>0) { DownLoadmodel = DownLoadBll.GetDownLoadData(Id); } if (!string.IsNullOrEmpty(Request.Form["ddlColId"])) DownLoadmodel.ColId = int.Parse(Request.Form["ddlColId"]); DownLoadmodel.Title = txtSoftName.Text.Trim(); DownLoadmodel.UserCateId = int.Parse(ddlUserCate.SelectedValue); DownLoadmodel.TitleFontType = 0; DownLoadmodel.TitleType = 1; DownLoadmodel.Edition = txtSoftEdition.Text.Trim(); DownLoadmodel.PlayAddress = txtSoftPlayAddress.Text.Trim(); DownLoadmodel.UId = UserModel.UserID; DownLoadmodel.UName = UserModel.LogName; DownLoadmodel.UserType = 0; #region 关键字 string tagIdStr = string.Empty; string nameStr = txtTagName.Text.Trim(); if (nameStr.Length != 0) { if (nameStr.StartsWith("|")) nameStr = nameStr.Substring(1, nameStr.Length - 1); if (nameStr.EndsWith("|")) nameStr = nameStr.Substring(0, nameStr.Length - 1); B_Tag tagBll = new B_Tag(); DataRow dr = tagBll.AddTagStr(nameStr, ChannelModel.ModelType, 0, "后台管理员"); if (dr != null) { tagIdStr = "|" + dr[0] + "|"; nameStr = "|" + dr[1] + "|"; } else { tagIdStr = ""; nameStr = ""; } } DownLoadmodel.TagIdStr = tagIdStr; DownLoadmodel.TagNameStr = nameStr; #endregion DownLoadmodel.AddTime = DateTime.Now; DownLoadmodel.UpdateTime = DateTime.Now; if (txtSoftOS.Text.Trim().Length == 0) DownLoadmodel.DownLoadOS = ""; else DownLoadmodel.DownLoadOS = "|" + txtSoftOS.Text.Trim() + "|"; DownLoadmodel.Language = ddlSoftLanguage.SelectedValue; DownLoadmodel.WarrantType = ddlSoftWarrantType.SelectedValue; DownLoadmodel.RegAddress = txtSoftRegAddress.Text.Trim(); if (ChannelModel.VerifyType == 0) DownLoadmodel.Status = 3; else DownLoadmodel.Status = 0; DownLoadmodel.Content = txtSoftRemark.Text.Trim(); DownLoadmodel.PointCount = int.Parse(txtSoftPoint.Text.Trim()); DownLoadmodel.IsDeleted = false; DownLoadmodel.DownLoadDisplePwd = txtSoftDisplePwd.Text.Trim(); DownLoadmodel.DownLoadType = ddlSoftType.SelectedValue; DownLoadmodel.DownLoadSize = txtSoftSize.Text.Trim(); if (Id <= 0) DownLoadmodel.IsOpened = 2; #region 继承栏目相关设置 if (Id <= 0) { if (!string.IsNullOrEmpty(Request.Form["ddlColId"]) && Request.Form["ddlColId"] != "-1") { ColumnModel = ColumnBll.GetColumn(int.Parse(Request.Form["ddlColId"].ToString())); DownLoadmodel.TemplatePath = ColumnModel.InfoTemplatePath; DownLoadmodel.PageType = ColumnModel.InfoPageType; DownLoadmodel.ChargeType = ColumnModel.ChargeType; DownLoadmodel.ChargeHourCount = ColumnModel.ChargeHourCount; DownLoadmodel.ChargeViewCount = ColumnModel.ChargeViewCount; } } #endregion #endregion if (Id > 0) Id = DownLoadBll.Update(DownLoadmodel); else Id = DownLoadBll.Add(DownLoadmodel); AddressModel.AddressId = Convert.ToInt32(hfAddressId.Value); AddressModel.AddressName = "下载地址1"; AddressModel.AddressNum = 1; AddressModel.AddressPath = txtSoftAddressPath.Text.Trim(); AddressModel.DownLoadDataId = Id; AddressModel.DownLoadServerID = -1; if (AddressModel.AddressId > 0) { AddressBll.Update(AddressModel); } else { AddressBll.Add(AddressModel); #region 增加积分 //如果频道不需要审核,添加积分 if (ChannelModel.VerifyType == 0) { if (UserModel == null) return; if (UserGroupBll == null) return; string scale = UserGroupBll.Power_UserGroup("Contribute", 0, UserGroupModel.GroupPower); int score = int.Parse(scale) * ColumnModel.ScoreReward; B_Money moneyBll = new B_Money(); moneyBll.Integral(score, UserModel.UserID); } #endregion } Response.Redirect("InfoList.aspx?ChId=" + ChId + "&ColId=" + DownLoadmodel.ColId); } }
protected void AddNewsBtn_Click(object sender, EventArgs e) { bool checkForm = CheckValidate(); if (checkForm) { M_Article Articlemodel = new M_Article(); Articlemodel.Id = ArticleId; #region 所有情况下 Articlemodel.Author = txtAuthor.Text.Trim(); if (!string.IsNullOrEmpty(Request.Form["ddlColId"])) Articlemodel.ColId = int.Parse(Request.Form["ddlColId"]); //添加时间 if (txtAddTime.Text.Trim().Length != 0) { if (Function.IsDate(txtAddTime.Text.Trim().ToString())) Articlemodel.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString()); else Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else Articlemodel.AddTime = DateTime.Now; Articlemodel.ExpireTime = Convert.ToDateTime(txtExpireTime.Text.Trim()); Articlemodel.ViewEndTime = txtViewEndTime.Text.Trim(); Articlemodel.UpdateTime = DateTime.Now; Articlemodel.ShortContent = SiteBll.GetFiltering(txtShortContent.Text.Trim()); Articlemodel.Source = txtSource.Text.Trim(); #region 关键字 string tagIdStr = string.Empty; string nameStr = txtTagNameStr.Text.Trim(); nameStr = Regex.Replace(nameStr, @"\s+", "|", RegexOptions.IgnoreCase); if (nameStr.Length != 0) { if (nameStr.StartsWith("|")) nameStr = nameStr.Substring(1, nameStr.Length - 1); if (nameStr.EndsWith("|")) nameStr = nameStr.Substring(0, nameStr.Length - 1); B_Tag tagBll = new B_Tag(); DataRow dr = tagBll.AddTagStr(nameStr, ChannelModel.ModelType, 0, "后台管理员"); if (dr != null) { tagIdStr = "|" + dr[0] + "|"; nameStr = "|" + dr[1] + "|"; } else { tagIdStr = ""; nameStr = ""; } } Articlemodel.TagIdStr = tagIdStr; Articlemodel.TagNameStr = nameStr; #endregion Articlemodel.IsFocus = chkBoxIsFocus.Checked; Articlemodel.IsHeader = chkBoxIsHeader.Checked; Articlemodel.IsIrregular = chkBoxIsIrregular.Checked; Articlemodel.IsRecommend = chkBoxIsRecommend.Checked; Articlemodel.IsShowCommentLink = IsShowCommentLink.Checked; Articlemodel.IsSideShow = chkBoxIsSideShow.Checked; Articlemodel.IsTop = chkBoxIsTop.Checked; Articlemodel.Title = SiteBll.GetFiltering(txtTitle.Text.Trim()); Articlemodel.LongTitle = SiteBll.GetFiltering(txtLongTitle.Text.Trim()); Articlemodel.TitleColor = txtTitleColor.Text.Trim(); Articlemodel.TitleFontType = Int32.Parse(ddlTitleFontType.SelectedValue.Trim()); Articlemodel.UId = AdminModel.UserId; Articlemodel.UName = AdminModel.LoginName; Articlemodel.AdminUId = AdminModel.UserId; Articlemodel.AdminUName = AdminModel.AdminName; Articlemodel.UserType = 1; Articlemodel.Status = 3; //头条文章属性设置 Articlemodel.HeaderFont = txtHeaderFont.Text.Trim() + "|" + ddlHeaderProPerty.SelectedValue + "|" + ddlHeaderSize.SelectedValue + "|" + txtHeaderColor.Text.Trim(); Articlemodel.HeaderImgPath = txtHeaderImgPath.Value; #endregion if (rbOuter.Checked == true) { Articlemodel.OuterUrl = txtOuterUrl.Text.Trim(); } #region 不是外部链接地址情况 if (rbComm.Checked == true) { Articlemodel.TitleType = 1; } else if (rbImg.Checked == true) { Articlemodel.TitleType = 2; Articlemodel.TitleImgPath = Request.Form["txtTitleImgPath"].Trim(); } if (!rbOuter.Checked) { if (Request.Form["ChargeTypeRadioButtonList"] == "2") Articlemodel.ChargeHourCount = Int32.Parse(txtChargeHourCount.Text.Trim()); //重复收费方式 if (rdBtnChargeType1.Checked) Articlemodel.ChargeType = 1; if (rdBtnChargeType2.Checked) { Articlemodel.ChargeType = 2; Articlemodel.ChargeHourCount = Int32.Parse(txtChargeHourCount.Text.Trim()); } if (rdBtnChargeType3.Checked) { Articlemodel.ChargeType = 3; Articlemodel.ChargeViewCount = Int32.Parse(txtChargeViewCount.Text.Trim()); } if (rdBtnChargeType4.Checked) { Articlemodel.ChargeType = 4; Articlemodel.ChargeHourCount = Int32.Parse(txtChargeHourCount.Text.Trim()); Articlemodel.ChargeViewCount = Int32.Parse(txtChargeViewCount.Text.Trim()); } if (rdBtnChargeType5.Checked) { Articlemodel.ChargeType = 5; Articlemodel.ChargeHourCount = Int32.Parse(txtChargeHourCount.Text.Trim()); Articlemodel.ChargeViewCount = Int32.Parse(txtChargeViewCount.Text.Trim()); } if (rdBtnChargeType6.Checked) Articlemodel.ChargeType = 6; B_ConvertImage convertBll = new B_ConvertImage(SiteModel.Domain, InfoModel.UploadPath); if (chkBoxRemoteSaveImage.Checked) { txtContent.Value = convertBll.ConvertLocalImagePath(txtContent.Value); } else { txtContent.Value = convertBll.ConvertImgePath(txtContent.Value); } Articlemodel.Content = SiteBll.GetFiltering(txtContent.Value); Articlemodel.Content = Articlemodel.Content.Replace(@"<div style=""page-break-after: always""><span style=""display: none""> </span></div>", "{Ky:PAGE}"); //生成的格式 Articlemodel.PageType = int.Parse(rdBtnPageType.SelectedValue); Articlemodel.IsOpened = int.Parse(rdBtnIsOpened.SelectedValue.Trim()); if (Articlemodel.IsOpened == 0) { string groupIdstr = string.Empty; foreach (ListItem li in chkBoxGroupIdStr.Items) { if (li.Selected) { groupIdstr += li.Value + "|"; } } Articlemodel.GroupIdStr = "|" + groupIdstr; } else { Articlemodel.GroupIdStr = ""; } Articlemodel.HitCount = Int32.Parse(txtHitCount.Text.Trim()); Articlemodel.IsAllowComment = chkBoxIsAllowComment.Checked; Articlemodel.PointCount = Int32.Parse(txtPointCount.Text.Trim()); Articlemodel.StarLevel = ddlStarLevel.SelectedValue.Trim(); //文章所属数据表 Articlemodel.TableName=""; Articlemodel.TemplatePath = Request.Form["txtTemplatePath"].Trim(); //文章所属专题 string idStr = string.Empty; for (int i = 0; i < lBoxTopicIdStr.Items.Count; i++) { if (lBoxTopicIdStr.Items[i].Selected) { idStr += lBoxTopicIdStr.Items[i].Value + "|"; } } if (idStr != "") Articlemodel.SpecialIdStr = "|" + idStr; else Articlemodel.SpecialIdStr = ""; if (txtViewer.Text.Trim() != string.Empty) { Articlemodel.ViewUName = "|" + txtViewer.Text.Trim() + "|"; if (txtViewEndTime.Text.Trim() == "") { litMsg.Text = "<script>alert('签收结束时间必须填写');</script>"; return; } } else Articlemodel.ViewUName = string.Empty; } #endregion #region 保存 if (!CheckValidate()) { return; } B_Article AddArticle = new B_Article(); if (ArticleId > 0) { //返回文章ID ArticleId = AddArticle.Update(Articlemodel); } else { ArticleId = AddArticle.Add(Articlemodel); } if (chkBoxIsCreate.Checked) { DataRow dr = CreateBll.GetInfoById("kyarticle", ArticleId); CreateBll.CreateSingleInfo(dr); } Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Articlemodel.ColId); #endregion 保存 } }
/// <summary> /// 添加/修改 /// </summary> protected void btnAdd_Click(object sender, EventArgs e) { CheckInput(); if (flag != "Update")//说明是新增 { model = new M_Image(); //model.AddTime = DateTime.Now; //添加时间 if (txtAddTime.Text.Trim().Length != 0) { if (Function.IsDate(txtAddTime.Text.Trim().ToString())) model.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString()); else Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else model.AddTime = DateTime.Now; model.IsCreated = false; model.IsDeleted = false; model.Status = 3; } else { //添加时间 if (txtAddTime.Text.Trim().Length != 0) { if (Function.IsDate(txtAddTime.Text.Trim().ToString())) model.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString()); else Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else model.AddTime = DateTime.Now; } model.AdminUId = adminModel.UserId; model.AdminUName = adminModel.AdminName; model.ChargeHourCount = Function.CheckNumber(txtChargeHourCount.Text) == true ? int.Parse(txtChargeHourCount.Text) : 0; for (int i = 1; i < 7; i++) { RadioButton chargType = Page.FindControl("rdBtnChargeType" + i) as RadioButton; if (chargType.Checked) { model.ChargeType = i; break; } } model.ChargeViewCount = Function.CheckNumber(txtChargeViewCount.Text) == true ? int.Parse(txtChargeViewCount.Text) : 0; model.ColId = int.Parse(Request.Form["ddlColumn"]); B_SiteInfo site=new B_SiteInfo(); model.Content = site.GetFiltering(txtContent.Text); string GroupId=""; for (int i = 0; i < UserGroup.Items.Count; i++) { if (UserGroup.Items[i].Selected) { GroupId += "|"+UserGroup.Items[i].Value; } } model.GroupIdStr = GroupId == "" ? "" : GroupId + "|"; model.HitCount = Function.CheckNumber(txtHitCount.Text) == true ? int.Parse(txtHitCount.Text) : 0; model.ImgPath = string.IsNullOrEmpty(Request.Form["imgs"]) == true ? "" : "|" + Request.Form["imgs"].Replace(",", "|") + "|"; model.IsAllowComment = property.Items[4].Selected; model.IsFocus = property.Items[2].Selected; model.IsOpened = int.Parse(rblIsOpened.SelectedValue); model.IsRecommend = property.Items[0].Selected; model.IsSideShow = (!rbTextTitle.Checked) && property.Items[3].Selected; model.IsTop = property.Items[1].Selected; model.PageType = rblPageType.SelectedIndex + 1; model.PointCount = Function.CheckNumber(txtPointCount.Text) == true ? int.Parse(txtPointCount.Text) : 0; string spclId = ""; for (int i = 0; i < lBoxTopicIdStr.Items.Count; i++) { if (lBoxTopicIdStr.Items[i].Selected) { spclId += "|" + lBoxTopicIdStr.Items[i].Value + "|"; } } model.SpecialIdStr = spclId; #region 关键字 string tagIdStr = string.Empty; string nameStr = txtTagNameStr.Text.Trim(); nameStr = Regex.Replace(nameStr, @"\s+", "|", RegexOptions.IgnoreCase); if (nameStr.Length != 0) { if (nameStr.StartsWith("|")) nameStr = nameStr.Substring(1, nameStr.Length - 1); if (nameStr.EndsWith("|")) nameStr = nameStr.Substring(0, nameStr.Length - 1); B_Tag tagBll = new B_Tag(); DataRow dr = tagBll.AddTagStr(nameStr, ChannelModel.ModelType, 0, "后台管理员"); if (dr != null) { tagIdStr = "|" + dr[0] + "|"; nameStr = "|" + dr[1] + "|"; } else { tagIdStr = ""; nameStr = ""; } } model.TagIdStr = tagIdStr; model.TagNameStr = nameStr; #endregion model.TemplatePath = txtTemplatePath.Text; model.Title = site.GetFiltering(txtTitle.Text); model.TitleColor = txtHeaderColor.Text; model.TitleFontType = int.Parse(ddlFontType.SelectedValue); model.TitleImgPath = rbPicTitle.Checked ? txtPicTitlePath.Text : ""; model.TitleType = rbTextTitle.Checked ? 1 : 2; model.UId = adminModel.UserId; model.UName = adminModel.AdminName; model.UpdateTime = DateTime.Now; model.UserType = 1; if (flag != "Update") { ImgId = imageBll.Add(model); if (property.Items[5].Selected) { DataRow dr = CreateBll.GetInfoById("kyimage", ImgId); CreateBll.CreateInfo(dr); } Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Request.Form["ddlColumn"]); } else { imageBll.Update(model); if (property.Items[5].Selected) { DataRow dr = CreateBll.GetInfoById("kyimage", ImgId); CreateBll.CreateSingleInfo(dr); } Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Request.Form["ddlColumn"]); } }
protected void btnSoftSaveAs_Click(object sender, EventArgs e) { bool flag = CheckValidate(); if(flag) { #region //添加软件 DownLoadmodel.Id = Id; if (!string.IsNullOrEmpty(Request.Form["ddlColId"])) DownLoadmodel.ColId = int.Parse(Request.Form["ddlColId"]); DownLoadmodel.Title = txtSoftName.Text.Trim(); DownLoadmodel.TitleColor = txtTitleColor.Text.Trim(); DownLoadmodel.TitleFontType = int.Parse(ddlTitleFontType.SelectedValue.Trim()); if (rbImg.Checked) { DownLoadmodel.TitleType = 2; DownLoadmodel.TitleImgPath = Request.Form["txtTitleImgPath"].Trim(); } else if (rbComm.Checked) { DownLoadmodel.TitleType = 1; } DownLoadmodel.Edition = txtSoftEdition.Text.Trim(); DownLoadmodel.PlayAddress = txtSoftPlayAddress.Text.Trim(); DownLoadmodel.UId = AdminModel.UserId; DownLoadmodel.UName = AdminModel.LoginName; DownLoadmodel.UserType = 1; DownLoadmodel.AdminUId = AdminModel.UserId; DownLoadmodel.AdminUName = AdminModel.AdminName; DownLoadmodel.UserCateId = 0; //专题 string idStr = string.Empty; for (int i = 0; i < lBoxSpecialIdStr.Items.Count; i++) { if (lBoxSpecialIdStr.Items[i].Selected) { idStr += lBoxSpecialIdStr.Items[i].Value + "|"; } } if (idStr != "") DownLoadmodel.SpecialIdStr = "|" + idStr; else DownLoadmodel.SpecialIdStr = ""; #region 关键字 string tagIdStr = string.Empty; string nameStr = txtTagName.Text.Trim(); nameStr = Regex.Replace(nameStr, @"\s+", "|", RegexOptions.IgnoreCase); if (nameStr.Length != 0) { if (nameStr.StartsWith("|")) nameStr = nameStr.Substring(1, nameStr.Length - 1); if (nameStr.EndsWith("|")) nameStr = nameStr.Substring(0, nameStr.Length - 1); B_Tag tagBll = new B_Tag(); DataRow dr = tagBll.AddTagStr(nameStr, ChannelModel.ModelType, 0, "后台管理员"); if (dr != null) { tagIdStr = "|" + dr[0] + "|"; nameStr = "|" + dr[1] + "|"; } else { tagIdStr = ""; nameStr = ""; } } DownLoadmodel.TagIdStr = tagIdStr; DownLoadmodel.TagNameStr = nameStr; #endregion DownLoadmodel.DownLoadDownNum = int.Parse(txtSoftDownNum.Text.Trim()); DownLoadmodel.DownLoadDownDayNum = int.Parse(txtSoftDownDayNum.Text.Trim()); DownLoadmodel.DownLoadDownWeekNum = int.Parse(txtSoftDownWeekNum.Text.Trim()); DownLoadmodel.DownLoadDownMonthNum = int.Parse(txtSoftDownMonthNum.Text.Trim()); //添加时间 if (txtAddTime.Text.Trim().Length != 0) { if (Function.IsDate(txtAddTime.Text.Trim().ToString())) DownLoadmodel.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString()); else Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else DownLoadmodel.AddTime = DateTime.Now; DownLoadmodel.UpdateTime = DateTime.Now; if (txtSoftOS.Text.Trim().Length == 0) DownLoadmodel.DownLoadOS = ""; else DownLoadmodel.DownLoadOS = "|" + txtSoftOS.Text.Trim() + "|"; DownLoadmodel.Language = ddlSoftLanguage.SelectedValue; DownLoadmodel.WarrantType = ddlSoftWarrantType.SelectedValue; DownLoadmodel.DownLoadSize = txtSoftSize.Text.Trim(); DownLoadmodel.RegAddress = txtSoftRegAddress.Text.Trim(); DownLoadmodel.IsTop =chkBoxIsTop.Checked; DownLoadmodel.IsRecommend = chkBoxIsRecommand.Checked; DownLoadmodel.IsFocus = chkBoxIsFocus.Checked; DownLoadmodel.IsSideShow = chkBoxIsSideShow.Checked; DownLoadmodel.IsAllowComment = chkBoxIsAllowComment.Checked; DownLoadmodel.Status =3; DownLoadmodel.Content = txtSoftRemark.Value; DownLoadmodel.TitleImgPath = txtTitleImgPath.Text.Trim(); DownLoadmodel.Plugin = ddlSoftPlugin.SelectedValue; DownLoadmodel.PointCount = int.Parse(txtSoftPoint.Text.Trim()); DownLoadmodel.IsDeleted = false; DownLoadmodel.DownLoadStarLevel = ddlSoftGrade.SelectedValue; DownLoadmodel.DownLoadDisplePwd = txtSoftDisplePwd.Text.Trim(); DownLoadmodel.TemplatePath = txtSoftTemplatePath.Text.Trim(); DownLoadmodel.PageType = int.Parse(rdBtnPageType.SelectedValue); DownLoadmodel.IsOpened = int.Parse(rdBtnIsOpened.SelectedValue); DownLoadmodel.DownLoadType = ddlSoftType.SelectedValue; DownLoadmodel.HitCount = Convert.ToInt32(hfHitCount.Value); if (DownLoadmodel.IsOpened == 0) { string groupIdStr = ""; foreach (ListItem li in chkBoxGroupIdStr.Items) { if (li.Selected) { groupIdStr += li.Value + "|"; } } DownLoadmodel.GroupIdStr = "|" + groupIdStr; } else { DownLoadmodel.GroupIdStr = ""; } //重复收费方式 if (rdBtnChargeType1.Checked) DownLoadmodel.ChargeType = 1; if (rdBtnChargeType2.Checked) { DownLoadmodel.ChargeType = 2; DownLoadmodel.ChargeHourCount = Int32.Parse(txtChargeHourCount.Text.Trim()); } if (rdBtnChargeType3.Checked) { DownLoadmodel.ChargeType = 3; DownLoadmodel.ChargeViewCount = Int32.Parse(txtChargeViewCount.Text.Trim()); } if (rdBtnChargeType4.Checked) { DownLoadmodel.ChargeType = 4; DownLoadmodel.ChargeHourCount = Int32.Parse(txtChargeHourCount.Text.Trim()); DownLoadmodel.ChargeViewCount = Int32.Parse(txtChargeViewCount.Text.Trim()); } if (rdBtnChargeType5.Checked) { DownLoadmodel.ChargeType = 5; DownLoadmodel.ChargeHourCount = Int32.Parse(txtChargeHourCount.Text.Trim()); DownLoadmodel.ChargeViewCount = Int32.Parse(txtChargeViewCount.Text.Trim()); } if (rdBtnChargeType6.Checked) DownLoadmodel.ChargeType = 6; #endregion #region 保存 if (Id > 0) { Id = DownLoadBll.Update(DownLoadmodel); } else { Id = DownLoadBll.Add(DownLoadmodel); } #region 设置下载地址 int addressNum=int.Parse(Request.Form["AddressNum"]); string[] addressId = txtAddressIdstr.Text.Split(','); for(int i=1;i<addressNum+1;i++) { if (txtreturnNum.Text!="" && i<=addressId.Length) { AddressModel.AddressId = int.Parse(addressId[i - 1]); } if (Request.Form["nmDLId_" + i] == "1") AddressModel.AddressId = 0; AddressModel.DownLoadDataId=Id; AddressModel.AddressNum=addressNum; if (!string.IsNullOrEmpty(Request.Form["nmAddressName_" + i]) && !string.IsNullOrEmpty(Request.Form["ddlDownServerID_" + i]) && !string.IsNullOrEmpty(Request.Form["nmAddressPath_" + i])) { AddressModel.AddressName = Request.Form["nmAddressName_" + i]; AddressModel.DownLoadServerID = int.Parse(Request.Form["ddlDownServerID_" + i]); AddressModel.AddressPath = Request.Form["nmAddressPath_" + i]; } else { AddressModel.AddressName = ""; AddressModel.DownLoadServerID = -1; AddressModel.AddressPath = ""; } if (AddressModel.AddressId > 0 && Request.Form["nmDLId_" + i] == "0") AddressBll.Update(AddressModel); else if (AddressModel.AddressId == 0 || Request.Form["nmDLId_" + i] == "1") AddressBll.Add(AddressModel); } #endregion if (chkBoxIsCreate.Checked) { DataRow dr = CreateBll.GetInfoById("KyDownLoadData", Id); CreateBll.CreateSingleInfo(dr); } Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + DownLoadmodel.ColId); #endregion } }
protected void btnAddCateSave_Click(object sender, EventArgs e) { bool checkForm = CheckValidate(); if (checkForm) { if (Id > 0) { ArticleModel = ArticleBll.GetArticle(Id); } ArticleModel.Id = Id; ArticleModel.ShortContent = SiteBll.GetFiltering(txtShortContent.Text.Trim()); ArticleModel.ColId = Int32.Parse(Request.Form["ddlColId"].ToString()); ArticleModel.Title = txtTitle.Text.Trim(); ArticleModel.LongTitle = txtTitle.Text.Trim(); ArticleModel.UserCateId = Convert.ToInt32(ddlUserCate.SelectedValue.Trim()); #region 关键字 string tagIdStr = string.Empty; string nameStr = txtTagNameStr.Text.Trim(); if (nameStr.Length != 0) { if (nameStr.StartsWith("|")) nameStr = nameStr.Substring(1, nameStr.Length - 1); if (nameStr.EndsWith("|")) nameStr = nameStr.Substring(0, nameStr.Length - 1); B_Tag tagBll = new B_Tag(); DataRow dr = tagBll.AddTagStr(nameStr, ChannelModel.ModelType, UserBll.GetCookie().UserID, UserBll.GetCookie().LogName); if (dr != null) { tagIdStr = "|" + dr[0] + "|"; nameStr = "|" + dr[1] + "|"; } else { tagIdStr = ""; nameStr = ""; } } ArticleModel.TagIdStr = tagIdStr; ArticleModel.TagNameStr = nameStr; #endregion //保存状态Status if (((Button)sender).ID == "btnSaveCaoGao") { ArticleModel.Status = -1; } else if (((Button)sender).ID == "btnAddCateSave") { if (ChannelModel != null) { if (ChannelModel.VerifyType == 0) { ArticleModel.Status = 3; } } else { ArticleModel.Status = 0; } } ArticleModel.Author = txtAuthor.Text.Trim(); ArticleModel.Source = txtSource.Text.Trim(); ArticleModel.ShortContent = SiteBll.GetFiltering(txtShortContent.Text.Trim()); //录入者ID ,通过传值得到 ArticleModel.UId = UserModel.UserID; //录入者用户名,通过传值得到 ArticleModel.UName = UserModel.LogName; ArticleModel.UserType = 0; ArticleModel.TitleType = 1; ArticleModel.Content = SiteBll.GetFiltering(txtContent.Value); ArticleModel.Content = ArticleModel.Content.Replace(@"<div style=""page-break-after: always""><span style=""display: none""> </span></div>", "{Ky:PAGE}"); ArticleModel.PointCount = Convert.ToInt32(txtPoint.Text.Trim()); ArticleModel.AddTime = DateTime.Now; ArticleModel.UpdateTime = DateTime.Now; ArticleModel.ExpireTime = Convert.ToDateTime("9999-01-01"); ArticleModel.ViewEndTime = DateTime.Now.AddDays(10).ToString(); ArticleModel.IsOpened = Convert.ToInt32(hfIsOpened.Value); #region 继承栏目相关设置 if (Id <= 0) { if (!string.IsNullOrEmpty(Request.Form["ddlColId"]) && Request.Form["ddlColId"] != "-1") { ColumnModel = ColumnBll.GetColumn(int.Parse(Request.Form["ddlColId"].ToString())); ArticleModel.TemplatePath = ColumnModel.InfoTemplatePath; ArticleModel.PageType = ColumnModel.InfoPageType; ArticleModel.ChargeType = ColumnModel.ChargeType; ArticleModel.ChargeHourCount = ColumnModel.ChargeHourCount; ArticleModel.ChargeViewCount = ColumnModel.ChargeViewCount; ArticleModel.IsAllowComment = ColumnModel.IsAllowComment; } // ArticleModel.HitCount = 0; } #endregion //保存 if (Id > 0) ArticleBll.Update(ArticleModel); else { ArticleBll.Add(ArticleModel); #region 增加积分 //如果频道不需要审核,添加积分 if (ChannelModel.VerifyType == 0) { if (UserModel == null) return; if (UserGroupBll == null) return; string scale = UserGroupBll.Power_UserGroup("Contribute", 0, UserGroupModel.GroupPower); int score = int.Parse(scale) * ColumnModel.ScoreReward; B_Money moneyBll = new B_Money(); moneyBll.Integral(score, UserModel.UserID); } #endregion } Response.Redirect("InfoList.aspx?ChId=" + ChId + "&ColId=" + ArticleModel.ColId); } }
protected void btnMassSet_Click(object sender, EventArgs e) { string idStr = txtByArticleIdStr.Text.Trim(); string selectColId = "0"; bool groupIdStrFlag = false; bool chargeHourCountFlag = false; bool chargeViewCountFlag = false; string groupIdStr = ""; int hitCount = 0; int chargeType = 1; #region 指定ID if (rdBtnByArticleIdStr.Checked) { if (txtByArticleIdStr.Text.Trim().Length == 0) { Response.Write("<script>alert('请输入指定要批量设置的" + ChannelModel.TypeName + "ID');history.back();</script>"); return; } else { idStr = txtByArticleIdStr.Text.Trim(); if (idStr.IndexOf(",,") != -1) { Response.Write("<script>alert('指定的ID输入不合法');history.back();</script>"); return; } string[] arrayId = idStr.Split(','); for (int i = 0; i < arrayId.Length; i++) { if (arrayId[i].Length > 10) { Response.Write("<script>alert('指定的ID输入不合法');history.back();</script>"); return; } } if (idStr.StartsWith(",")) idStr = idStr.Substring(1, idStr.Length - 1); if (idStr.EndsWith(",")) idStr = idStr.Substring(0, idStr.Length - 1); } } #endregion 指定ID #region 指定栏目 else if (rdBtnByColumnIdStr.Checked) { selectColId = lsbColumnLeft.SelectedValue; if (selectColId.Length == 0) { Response.Write("<script>alert('请选择要指定" + ChannelModel.TypeName + "的栏目');history.back();</script>"); return; } if (selectColId == "0") { Response.Write("<script>alert('指定" + ChannelModel.TypeName + "能在频道下');history.back();</script>"); return; } } #endregion 指定栏目 #region 属性设置 #region 关键字 string tagIdStr = string.Empty; string tagNameStr = string.Empty; if (chkBoxPropterty1.Checked) { if (tagNameStr.Length != 0) { if (tagNameStr.StartsWith("|")) tagNameStr = tagNameStr.Substring(1, tagNameStr.Length - 1); if (tagNameStr.EndsWith("|")) tagNameStr = tagNameStr.Substring(0, tagNameStr.Length - 1); B_Tag tagBll = new B_Tag(); DataRow dr = tagBll.AddTagStr(tagNameStr, ChannelModel.ModelType, 0, "后台管理员"); if (dr != null) { tagIdStr = "|" + dr[0] + "|"; tagNameStr = "|" + dr[1] + "|"; } else { tagIdStr = ""; tagNameStr = ""; } } } #endregion #region 关键字 #endregion if (chkBoxPropterty5.Checked) { if (Request.Form["txtTemplatePath"].Trim() == "") { litMsg.Text = "<script>alert('模板路径必须选择');</script>"; return; } } if (chkBoxPropterty7.Checked) { if (txtHitsCount.Text.Trim() != "") { hitCount = Convert.ToInt32(txtHitsCount.Text.Trim()); } } if (chkBoxPropterty10.Checked) { if (txtPointCount.Text.Trim() == "") { litMsg.Text = "<script>alert('收取金币个数必须填写');</script>"; return; } } if (rdBtnIsOpened.SelectedValue == "0") { groupIdStrFlag = true; string groupIdstr = string.Empty; foreach (ListItem li in chkBoxGroupIdStr.Items) { if (li.Selected) { groupIdstr += li.Value + "|"; } } groupIdStr = "|" + groupIdstr; } else { groupIdStr = ""; } if (rdBtnChargeType2.Checked || rdBtnChargeType4.Checked || rdBtnChargeType5.Checked) { chargeHourCountFlag = true; if (txtChargeHourCount.Text.Trim() == "") txtChargeHourCount.Text = "0"; } if (rdBtnChargeType3.Checked || rdBtnChargeType4.Checked || rdBtnChargeType5.Checked) { chargeViewCountFlag = true; if (txtChargeViewCount.Text.Trim() == "") txtChargeViewCount.Text = "0"; } if (rdBtnChargeType1.Checked) chargeType = 1; else if (rdBtnChargeType2.Checked) chargeType = 2; else if (rdBtnChargeType3.Checked) chargeType = 3; else if (rdBtnChargeType4.Checked) chargeType = 4; else if (rdBtnChargeType5.Checked) chargeType = 5; else chargeType = 6; #endregion InfoOperBll.MassSetInfo(InfoModel.TableName, idStr, Convert.ToInt32(selectColId), chkBoxPropterty1.Checked, tagIdStr, tagNameStr, chkBoxPropterty4.Checked, chkBoxIsTop.Checked, chkBoxPropterty2.Checked, chkBoxIsRecommend.Checked, chkBoxPropterty3.Checked, chkBoxIsFocus.Checked, chkBoxPropterty5.Checked, txtTemplatePath.Text.Trim(), chkBoxPropterty7.Checked, hitCount, chkBoxPropterty8.Checked, Convert.ToInt32(rdBtnIsOpened.SelectedValue), groupIdStrFlag, groupIdStr, chkBoxPropterty10.Checked, Convert.ToInt32(txtPointCount.Text.Trim()), chkBoxPropterty9.Checked, chargeType, chargeHourCountFlag, Convert.ToInt32(txtChargeHourCount.Text.Trim()), chargeViewCountFlag, Convert.ToInt32(txtChargeViewCount.Text.Trim()), chkBoxPropterty6.Checked, Convert.ToInt32(rdBtnPageType.SelectedValue)); Function.ShowSysMsg(1, "<li>批量设置成功</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); }