/// <summary> /// 将专题信息添加到数据库中 /// </summary> /// <param name="info">专题信息实例对象</param> void ID_SpecInfo.Add(M_SpecInfo info) { string strSql = "PR_SpecInfo_Add"; SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@SpecialID", SqlDbType.Int), new SqlParameter("@InfoID", SqlDbType.Int) }; parameter[0].Value = info.SpecialID; parameter[1].Value = info.InfoID; SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, strSql, parameter); }
protected void BtnBacthSet_Click(object sender, EventArgs e) { string InfoID = this.TxtGeneralID.Text; string[] Infos = InfoID.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < this.LstSpec.Items.Count; i++) { if (this.LstSpec.Items[i].Selected) { int SpecID = DataConverter.CLng(this.LstSpec.Items[i].Value); for (int t = 0; t < Infos.Length; t++) { if (!this.bll.IsExist(SpecID, DataConverter.CLng(Infos[t]))) { M_SpecInfo specinfo = new M_SpecInfo(); specinfo.SpecInfoID = 0; specinfo.SpecialID = SpecID; specinfo.InfoID = DataConverter.CLng(Infos[t]); this.bll.Add(specinfo); } } } } Response.Write("<script language=\"javascript\">alert('批量添加操作执行完成!')</script>"); }
private M_SpecInfo GetInfoFromReader(SqlDataReader rdr) { M_SpecInfo info = new M_SpecInfo(); info.SpecInfoID = DataConverter.CLng(rdr["SpecInfoID"].ToString()); info.SpecialID = DataConverter.CLng(rdr["SpecialID"].ToString()); info.InfoID = DataConverter.CLng(rdr["InfoID"].ToString()); return info; }
private static SqlParameter[] GetParameters(M_SpecInfo info) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@SpecInfoID", SqlDbType.Int), new SqlParameter("@SpecialID", SqlDbType.Int), new SqlParameter("@InfoID", SqlDbType.Int) }; parameter[0].Value = info.SpecInfoID; parameter[1].Value = info.SpecialID; parameter[2].Value = info.InfoID; return parameter; }
/// <summary> /// 将专题信息添加到数据库中 /// </summary> /// <param name="info">专题信息实例对象</param> public void Add(M_SpecInfo info) { dal.Add(info); }
/// <summary> /// 将指定内容ID的内容所属专题更换成指定的专题组 /// </summary> /// <param name="SpecID">专题ID组</param> /// <param name="ItemID">内容ID</param> public void UpdateSpec(string SpecID, int ItemID) { dal.DelItemSpec(SpecID, ItemID); string[] SpecArr = SpecID.Split(new char[] { ',' }); M_SpecInfo info=new M_SpecInfo(); info.InfoID=ItemID; for (int i = 0; i < SpecArr.Length; i++) { if (!IsExist(DataConverter.CLng(SpecArr[i]), ItemID)) { info.SpecialID = DataConverter.CLng(SpecArr[i]); dal.Add(info); } } }
protected void EBtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { this.ModelID = DataConverter.CLng(this.HdnModel.Value); this.NodeID = DataConverter.CLng(this.HdnNode.Value); DataTable dt = this.bfield.GetModelFieldList(this.ModelID).Tables[0]; DataTable table = new DataTable(); table.Columns.Add(new DataColumn("FieldName", typeof(string))); table.Columns.Add(new DataColumn("FieldType", typeof(string))); table.Columns.Add(new DataColumn("FieldValue", typeof(string))); foreach (DataRow dr in dt.Rows) { if (DataConverter.CBool(dr["IsNotNull"].ToString())) { if (string.IsNullOrEmpty(this.Page.Request.Form["txt_" + dr["FieldName"].ToString()])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "不能为空!"); } } if (dr["FieldType"].ToString() == "FileType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { DataRow row2 = table.NewRow(); row2[0] = sizefield; row2[1] = "FileSize"; row2[2] = this.Page.Request.Form["txt_" + sizefield]; table.Rows.Add(row2); } } if (dr["FieldType"].ToString() == "MultiPicType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { if (string.IsNullOrEmpty(this.Page.Request.Form["txt_" + sizefield])) { function.WriteErrMsg(dr["FieldAlias"].ToString() + "的缩略图不能为空!"); } DataRow row1 = table.NewRow(); row1[0] = sizefield; row1[1] = "ThumbField"; row1[2] = this.Page.Request.Form["txt_" + sizefield]; table.Rows.Add(row1); } } DataRow row = table.NewRow(); row[0] = dr["FieldName"].ToString(); row[1] = dr["FieldType"].ToString(); row[2] = this.Page.Request.Form["txt_" + dr["FieldName"].ToString()]; table.Rows.Add(row); } M_CommonData CData = new M_CommonData(); CData.NodeID = this.NodeID; CData.ModelID = this.ModelID; CData.TableName = this.bmode.GetModelById(this.ModelID).TableName; CData.Title = this.txtTitle.Text; CData.Status = 99; CData.Inputer = "admin"; CData.EliteLevel = this.ChkAudit.Checked ? 1 : 0; CData.InfoID = ""; CData.SpecialID = ""; CData.Template = this.TxtTemplate.Text; int newID = this.bll.AddContent(table, CData); string specialid = this.HdnSpec.Value; if (!string.IsNullOrEmpty(specialid)) { string[] arr = specialid.Split(new char[] { ',' }); M_SpecInfo info = new M_SpecInfo(); info.InfoID = newID; for (int i = 0; i < arr.Length; i++) { info.SpecialID = DataConverter.CLng(arr[i]); this.bspec.Add(info); } } Response.Write("<script>alert('内容添加成功!请继续添加')</script>"); //Response.Redirect("ContentManage.aspx?NodeID="+this.NodeID); } }