public void Add(M_Special model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@ParentID", SqlDbType.Int, 4), new SqlParameter("@SiteID", SqlDbType.Int, 4), new SqlParameter("@SpecialCName", SqlDbType.NVarChar, 30), new SqlParameter("@SpecialEName", SqlDbType.NVarChar, 20), new SqlParameter("@SpecialDomain", SqlDbType.NVarChar, 100), new SqlParameter("@SpecialRemark", SqlDbType.NVarChar, 200), new SqlParameter("@IsLock", SqlDbType.Bit, 1), new SqlParameter("@IsCommand", SqlDbType.Bit, 1), new SqlParameter("@SpecialAddTime", SqlDbType.DateTime), new SqlParameter("@MetaKeyWord", SqlDbType.NVarChar, 200), new SqlParameter("@MetaRemark", SqlDbType.NVarChar, 200), new SqlParameter("@SpecialTemplet", SqlDbType.NVarChar, 200), new SqlParameter("@SpecialItemNum", SqlDbType.Int, 4), new SqlParameter("@SpecialContent", SqlDbType.NText), new SqlParameter("@SaveDirType", SqlDbType.NVarChar, 200), new SqlParameter("@Extension", SqlDbType.VarChar, 50), new SqlParameter("@PicSavePath", SqlDbType.NVarChar, 200), new SqlParameter("@IsDeleted", SqlDbType.Bit, 1) }; commandParameters[0].Value = model.ParentID; commandParameters[1].Value = model.SiteID; commandParameters[2].Value = model.SpecialCName; commandParameters[3].Value = model.SpecialEName; commandParameters[4].Value = model.SpecialDomain; commandParameters[5].Value = model.SpecialRemark; commandParameters[6].Value = model.IsLock; commandParameters[7].Value = model.IsCommand; commandParameters[8].Value = model.SpecialAddTime; commandParameters[9].Value = model.MetaKeyWord; commandParameters[10].Value = model.MetaRemark; commandParameters[11].Value = model.SpecialTemplet; commandParameters[12].Value = model.SpecialItemNum; commandParameters[13].Value = model.SpecialContent; commandParameters[14].Value = model.SaveDirType; commandParameters[15].Value = model.Extension; commandParameters[16].Value = model.PicSavePath; commandParameters[17].Value = model.IsDeleted; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Special_Add", commandParameters); }
/// <summary> /// 添加/修改专题 /// </summary> protected void btnAdd_Click(object sender, EventArgs e) { M_Special model = new M_Special(); if (txtCName.Text.Trim() == "" || txtEName.Text.Trim() == "") { Function.ShowSysMsg(0, "<li>专题中文名和英文名不能为空</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else { model.SpecialCName = txtCName.Text; model.SpecialEName = txtEName.Text; } string content = string.Empty; for (int i = 1; i <= 10; i++) { TextBox ctt = (TextBox)Page.FindControl("txtItemContent" + i); if (ctt.Text.Trim() != "") { content += ctt.Text; } content += "|"; } content = content.Substring(0, content.Length - 1); model.IsCommand = rblIsRcmd.SelectedValue == "1"; model.IsLock = rblIsLock.SelectedValue == "1"; model.MetaKeyWord = ""; model.MetaRemark = ""; model.ParentID = int.Parse(ddlSpeacil.SelectedValue); model.SaveDirType = ddlDirType.SelectedValue; model.SiteID = int.Parse(ddlChannel.SelectedValue); model.SpecialAddTime = DateTime.Now; model.SpecialDomain = txtDomain.Text; B_SiteInfo site = new B_SiteInfo(); model.SpecialRemark = site.GetFiltering(txtRemark.Text); model.SpecialContent = site.GetFiltering(content); model.SpecialItemNum = int.Parse(ddlItemNum.SelectedValue); model.Extension = rblExtension.SelectedValue; model.PicSavePath = "/" + txtPic.Text; if (txtTemplet.Text.Trim() == "") { Function.ShowSysMsg(0, "<li>专题模板路径不能为空</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else { model.SpecialTemplet = txtTemplet.Text; } if (Key != 0) { model.ID = Key; model.SpecialAddTime = DateTime.Parse(txtAddTime.Text); model.IsDeleted = Boolean.Parse(txtIsdelete.Text); special.Update(model); Response.Redirect("SpecialList.aspx"); } else { B_KyCommon kycomm = new B_KyCommon(); if (kycomm.CheckHas(txtEName.Text, "SpecialEName", "KySpecial")) { Function.ShowSysMsg(0, "<li>专题英文名重复,请修改</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else { special.Add(model); Response.Redirect("SpecialList.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["SId"])) { try { SId = int.Parse(Request.QueryString["SId"]); } catch { } } SpeacilModel = SpeacilBll.GetSpecial(SId); if (SId <= 0 || SpeacilModel == null) { Response.Write("<script type='text/javascript'>alert('所选专题不存在或已经被删除');history.back();</script>"); Response.End(); return; } litSpeacilName.Text = SpeacilModel.SpecialCName+"的内容列表"; if (!IsPostBack) { SetDataSource(); Bind(); } }
public void Update(M_Special model) { this.isp.Update(model); B_Log.Add(LogType.Update, "修改专题成功 编号:" + model.ID); }
public void Add(M_Special model) { this.isp.Add(model); B_Log.Add(LogType.Add, "新增专题成功 专题名:" + model.SpecialCName); }
protected void Page_Load(object sender, EventArgs e) { AdminGroupBll.Power_Judge(48); AjaxPro.Utility.RegisterTypeForAjax(typeof(system_collection_EditObject)); if (!IsPostBack) { if (!(Request.QueryString["Id"] == null || Request.QueryString["Id"].Length == 0)) { #region 边辑赋值 BindSuperior(); int id = int.Parse(Request.QueryString["Id"].ToString()); CollectionM = CollectionBll.GetIdByCollection(id); BindTable(CollectionM.ColId); txtObjectName.Text = CollectionM.ObjectName; txtWebSite.Text = CollectionM.WebSite; ColumnM = ColumnBll.GetColumn(CollectionM.ColId); txtColumnId.Text = ColumnM.ColName; hidColumnId.Value = CollectionM.ColId.ToString(); if (CollectionM.SpecialId != null && CollectionM.SpecialId.Length!=0) { string[] specialIdArr = CollectionM.SpecialId.Split('|'); string notNullSpIdStr = string.Empty; for (int i = 0; i < specialIdArr.Length;i++ ) { if (specialIdArr[i].Length != 0) notNullSpIdStr = notNullSpIdStr + specialIdArr[i]+"|"; } string[] SpecialArr = notNullSpIdStr.Split('|'); string SpecialName = string.Empty; for (int i = 0; i < SpecialArr.Length - 1; i++) { SpecialM = SpecialBll.GetSpecial(int.Parse(SpecialArr[i])); if (i == SpecialArr.Length - 2) SpecialName = SpecialName + SpecialM.SpecialCName; else SpecialName = SpecialName + SpecialM.SpecialCName + ","; } txtSpecialId.Text = SpecialName; hidSpecialId.Value = CollectionM.SpecialId.ToString(); } string charSet = CollectionM.CharSet; if (charSet == "0") rdoCharSet.Items[0].Selected = true; else if (charSet == "1") rdoCharSet.Items[1].Selected = true; txtListUrl.Text = CollectionM.ListPageUrl; txtObjectDemo.Text = CollectionM.ObjectDemo; txtListStart.Text = CollectionM.ListStartCode; txtListEnd.Text = CollectionM.ListEndCode; txtLinkStart.Text = CollectionM.LinkStartCode; txtLinkEnd.Text = CollectionM.LinkEndCode; //分页设置 string pageSet = CollectionM.PageSet; if (pageSet != "") { string[] pageArr = pageSet.Split('|'); int rdoId = int.Parse(pageArr[0].Split('┃')[1]); switch (rdoId) { case 0: rdoPage0.Checked = true; break; case 1: rdoPage1.Checked = true; txtNextPageStart.Text = pageArr[1].Split('┃')[1]; txtNextPageEnd.Text = pageArr[2].Split('┃')[1]; break; case 2: rdoPage2.Checked = true; txtUrlStr.Text = pageArr[1].Split('┃')[1]; txtStartId.Text = pageArr[2].Split('┃')[1]; txtEndId.Text = pageArr[3].Split('┃')[1]; break; case 3: rdoPage3.Checked = true; txtUrlList.Text = pageArr[1].Split('┃')[1]; break; } } //内容分页设置 string conPageSet = CollectionM.ContentPageSet; if (conPageSet != "") { string[] pageArr = conPageSet.Split('|'); int rdoId = int.Parse(pageArr[0].Split('┃')[1]); switch (rdoId) { case 0: rdoConPage1.Checked = true; break; case 1: rdoConPage2.Checked = true; txtConPageStart.Text = pageArr[1].Split('┃')[1]; txtConPageEnd.Text = pageArr[2].Split('┃')[1]; break; case 2: rdoConPage3.Checked = true; txtConAddress.Text = pageArr[1].Split('┃')[1]; txtConStartId.Text = pageArr[2].Split('┃')[1]; txtConEndId.Text = pageArr[3].Split('┃')[1]; break; case 3: rdoConPage4.Checked = true; txtConPageAddress.Text = pageArr[1].Split('┃')[1]; break; } } //字段设置 string fieldList = CollectionM.FieldListSet; if (fieldList != "") { string[] fieldArr = fieldList.Split('|'); for (int i = 0; i < fieldArr.Length - 1; i++) { for (int j = 0; j < lbFildList.Items.Count; j++) { if (lbFildList.Items[j].Value == fieldArr[i].ToString().Split(',')[0].ToString()) lbFildList.Items[j].Selected = true; } } hidFieldValue.Value = fieldList; } //简单过滤规则 string simpleFilterRule = CollectionM.SimpleFilterRule; if (simpleFilterRule != "") { string[] simFilRuleArr = simpleFilterRule.Split(','); for (int i = 0; i < simFilRuleArr.Length - 1; i++) { for (int j = 0; j < chkSimpleFilter.Items.Count; j++) { if (chkSimpleFilter.Items[j].Value == simFilRuleArr[i]) { chkSimpleFilter.Items[j].Selected = true; } } } } //复杂过滤规则 string complexityFilterRule = CollectionM.ComplexityFilterRule; string[] superiorArr = complexityFilterRule.Split(','); if (complexityFilterRule != "") { for (int j = 0; j < superiorArr.Length; j++) { for (int i = 0; i < lbFilterRule.Items.Count; i++) { if (lbFilterRule.Items[i].Value == superiorArr[j]) { lbFilterRule.Items[i].Selected = true; } } } } //属性设置 string protery = CollectionM.ProterySet; if (protery != "") { string[] proteryArr = protery.Split(','); for (int i = 0; i < proteryArr.Length - 1; i++) { for (int j = 0; j < chkPropetry.Items.Count; j++) { if (chkPropetry.Items[j].Value == proteryArr[i]) chkPropetry.Items[j].Selected = true; } } } //评分等级 for (int i = 0; i < ddlStarLevel.Items.Count; i++) { if (ddlStarLevel.Items[i].Value == CollectionM.StarLevel) ddlStarLevel.Items[i].Selected = true; } txtHitCout.Text = CollectionM.HiteCount.ToString(); #endregion } } }
public M_Special GetSpecial(int id) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Int, 4) }; commandParameters[0].Value = id; M_Special special = new M_Special(); DataSet set = new DataSet(); DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Special_GetSpecial", commandParameters); if (table != null) { set.Tables.Add(table.Copy()); } special.ID = id; if (set.Tables[0].Rows.Count > 0) { if (set.Tables[0].Rows[0]["ParentID"].ToString() != "") { special.ParentID = int.Parse(set.Tables[0].Rows[0]["ParentID"].ToString()); } if (set.Tables[0].Rows[0]["SiteID"].ToString() != "") { special.SiteID = int.Parse(set.Tables[0].Rows[0]["SiteID"].ToString()); } special.SpecialCName = set.Tables[0].Rows[0]["SpecialCName"].ToString(); special.SpecialEName = set.Tables[0].Rows[0]["SpecialEName"].ToString(); special.Extension = set.Tables[0].Rows[0]["Extension"].ToString(); special.PicSavePath = set.Tables[0].Rows[0]["PicSavePath"].ToString(); special.SpecialDomain = set.Tables[0].Rows[0]["SpecialDomain"].ToString(); special.SpecialRemark = set.Tables[0].Rows[0]["SpecialRemark"].ToString(); if (set.Tables[0].Rows[0]["IsLock"].ToString() != "") { if ((set.Tables[0].Rows[0]["IsLock"].ToString() == "1") || (set.Tables[0].Rows[0]["IsLock"].ToString().ToLower() == "true")) { special.IsLock = true; } else { special.IsLock = false; } } if (set.Tables[0].Rows[0]["IsCommand"].ToString() != "") { if ((set.Tables[0].Rows[0]["IsCommand"].ToString() == "1") || (set.Tables[0].Rows[0]["IsCommand"].ToString().ToLower() == "true")) { special.IsCommand = true; } else { special.IsCommand = false; } } if (set.Tables[0].Rows[0]["IsDeleted"].ToString() != "") { if ((set.Tables[0].Rows[0]["IsDeleted"].ToString() == "1") || (set.Tables[0].Rows[0]["IsDeleted"].ToString().ToLower() == "true")) { special.IsDeleted = true; } else { special.IsDeleted = false; } } if (set.Tables[0].Rows[0]["SpecialAddTime"].ToString() != "") { special.SpecialAddTime = DateTime.Parse(set.Tables[0].Rows[0]["SpecialAddTime"].ToString()); } special.MetaKeyWord = set.Tables[0].Rows[0]["MetaKeyWord"].ToString(); special.MetaRemark = set.Tables[0].Rows[0]["MetaRemark"].ToString(); special.SpecialTemplet = set.Tables[0].Rows[0]["SpecialTemplet"].ToString(); if (set.Tables[0].Rows[0]["SpecialItemNum"].ToString() != "") { special.SpecialItemNum = int.Parse(set.Tables[0].Rows[0]["SpecialItemNum"].ToString()); } special.SpecialContent = set.Tables[0].Rows[0]["SpecialContent"].ToString(); special.SaveDirType = set.Tables[0].Rows[0]["SaveDirType"].ToString(); return special; } return null; }