/// <summary> /// 二级类目名称获取二级类目ID /// </summary> /// <param name="secondclassdm">二级类目对象</param> /// <returns>二级类目ID</returns> public string ScNameGetID(SecondClassDm secondclassdm) { string Sqlstring = "select SecondClassDmID from SecondClassDm where SecondClassDmName=N'" + secondclassdm.SecondClassDmName + "'"; Object obj = SqlHelper.ReadSclar(Sqlstring); return((string)obj); }
/// <summary> /// 由二级类目名称获取二级类目ID进而获取三级类目名称 /// </summary> /// <param name="thirdclassdm">三级类目对象</param> /// <param name="secondclassdm">二级类目对象</param> /// <returns>三级类目表</returns> public static List <ThirdClassDm> FcShowContent(ThirdClassDm thirdclassdm, SecondClassDm secondclassdm) { string Sqlstring = "select SecondClassDmID from SecondClassDm where SecondClassDmName=N'" + secondclassdm.SecondClassDmName + "'"; Object obj = SqlHelper.ReadSclar(Sqlstring); string str = (string)obj; List <ThirdClassDm> thirdClumList = new List <ThirdClassDm>(); thirdClumList = ThirdClassDm.Getlist(str); return(thirdClumList); }
/// <summary> /// 通过一级类目名称搜索二级类目名称 /// </summary> /// <param name="firstclassdm">一级类目对象</param> /// <param name="secondclassdm">二级类目对象</param> /// <returns>二级类目名称表</returns> public static List <SecondClassDm> FcShowContent(FirstClassDm firstclassdm, SecondClassDm secondclassdm) { string Sqlstring = "select FirstClassDmID from FirstClassDm where FirstClassDmName=N'" + firstclassdm.FirstClassDmName + "'"; Object obj = SqlHelper.ReadSclar(Sqlstring); string str = (string)obj; List <SecondClassDm> secondCluList = new List <SecondClassDm>(); secondCluList = SecondClassDm.Getlist(str); return(secondCluList); }
/// <summary> /// 删除二级类目 /// </summary> /// <returns>是否删除成功</returns> public bool DeleteSecondclassdm(SecondClassDm second) { string str = second.SecondClassDmName; string Sql = "delete from SecondClassDm where SecondClassDmName=N'" + str + "'"; if (SqlHelper.ExecuteNonQuery(Sql) > 0) { return(true); } else { return(false); } }
/// <summary> /// 选出服装城的二级类目 /// </summary> /// <returns>返回服装城的二级类目名</returns> public List <SecondClassDm> GetSecondClothes() { List <SecondClassDm> mSecondNameList = new List <SecondClassDm>(); string SqlString = "select SecondClassDmName from SecondClassDm where FirstClassDmID='003'"; SqlHelper.ReadDateReadBegin(SqlString); while (SqlHelper.SqlReader.Read()) { SecondClassDm mSecondClassDm = new SecondClassDm(); mSecondClassDm.SecondClassDmName = SqlHelper.SqlReader["SecondClassDmName"].ToString(); mSecondNameList.Add(mSecondClassDm); } SqlHelper.ReadDateReadEnd(); return(mSecondNameList); }
/// <summary> /// 判断二级类目是否重复 /// </summary> /// <param name="secondclassdm">二级类目对象</param> /// <returns>是或否</returns> public bool ScIsRepeat(SecondClassDm secondclassdm) { string Sqlstring = "select SecondClassDmID from SecondClassDm where SecondClassDmName=N'" + secondclassdm.SecondClassDmName + "'"; Object obj = SqlHelper.ReadSclar(Sqlstring); string str = (string)obj; if (str == null) { return(true); } else { return(false); } }
/// <summary> /// 电器城左侧二级类目 /// </summary> /// <returns>二级类目</returns> public List <SecondClassDm> SecondclassDm(string firstClassID) { List <SecondClassDm> lSecondClassDm = new List <SecondClassDm>(); string lSelectSecClass = "select SecondClassDmName from SecondClassDm where FirstClassDmID='" + firstClassID + "'"; SqlHelper.ReadDateReadBegin(lSelectSecClass); while (SqlHelper.SqlReader.Read()) { SecondClassDm SecondClass = new SecondClassDm(); SecondClass.SecondClassDmName = SqlHelper.SqlReader["SecondClassDmName"].ToString(); lSecondClassDm.Add(SecondClass); } SqlHelper.ReadDateReadEnd(); return(lSecondClassDm); }
/// <summary> /// 一级类目名字获取二级类目名字 /// </summary> /// <param name="firstclassdm">一级类目对象</param> /// <returns>二级类目名字表</returns> public static List <SecondClassDm> FcNameGetScName(FirstClassDm firstclassdm) { List <SecondClassDm> Sclist = new List <SecondClassDm>(); string sqlstring = "select SecondClassDmName from SecondClassDm where FirstClassDmID=(select FirstClassDmID from FirstClassDm where FirstClassDmName=N'" + firstclassdm.FirstClassDmName + "')"; SqlHelper.ReadDateReadBegin(sqlstring); while (SqlHelper.SqlReader.Read()) { SecondClassDm secondclassdm = new SecondClassDm(); secondclassdm.SecondClassDmName = SqlHelper.SqlReader["SecondClassDmName"].ToString(); Sclist.Add(secondclassdm); } SqlHelper.ReadDateReadEnd(); return(Sclist); }
/// <summary> /// 获取二级类目名称 /// </summary> /// <returns>一个对象表</returns> public static List <SecondClassDm> Getlist() { List <SecondClassDm> SecondClumlist = new List <SecondClassDm>(); string Sqlstring = "select * from SecondClassDm "; SqlHelper.ReadDateReadBegin(Sqlstring); while (SqlHelper.SqlReader.Read()) { SecondClassDm secondclassdm = new SecondClassDm(); secondclassdm.SecondClassDmName = SqlHelper.SqlReader["SecondClassDmName"].ToString(); secondclassdm.SecondClassDmID = SqlHelper.SqlReader["SecondClassDmID"].ToString(); SecondClumlist.Add(secondclassdm); } SqlHelper.ReadDateReadEnd(); return(SecondClumlist); }
/// <summary> /// 在二级类目中进行模糊搜索 /// </summary> /// <param name="textBox">对应搜索框中的字符串</param> /// <returns>二级类目表</returns> public List <SecondClassDm> SecondClassSelect(string textBox) { List <SecondClassDm> lSecondList = new List <SecondClassDm>(); string lTextBox = this.CutTbxText1(textBox); string sqlSecondClassSelect = "select * from SecondClassDm where SecondClassDmName like N'%" + lTextBox + "%'"; SqlHelper.ReadDateReadBegin(sqlSecondClassSelect); while (SqlHelper.SqlReader.Read()) { SecondClassDm lSecondClassDm = new SecondClassDm(); lSecondClassDm.SecondClassDmID = SqlHelper.SqlReader["SecondClassDmID"].ToString(); lSecondClassDm.SecondClassDmName = SqlHelper.SqlReader["SecondClassDmName"].ToString(); lSecondList.Add(lSecondClassDm); } SqlHelper.ReadDateReadEnd(); return(lSecondList); }
/// <summary> /// 添加三级类目 /// </summary> /// <param name="thirdclassdm">三级类目对象</param> /// <param name="secondclassdm">对应二级类目对象</param> /// <returns></returns> public int AddClum(ThirdClassDm thirdclassdm, SecondClassDm secondclassdm) { string c = null; string sql1 = "select top 1 * from ThirdClassDm order by ThirdClassDmID desc"; Object obj = SqlHelper.ReadSclar(sql1); if (obj == null) { c = "001"; } else { string a = obj.ToString(); int b1 = Convert.ToInt32(a.Substring(2, 1)); int b2 = Convert.ToInt32(a.Substring(1, 1)); int b3 = Convert.ToInt32(a.Substring(0, 1)); if (b1 < 9) { b1 = b1 + 1; c = a.Substring(0, 1) + a.Substring(1, 1) + b1.ToString(); } if (b1 == 9 && b2 < 9) { b1 = 0; b2 = b2 + 1; c = a.Substring(0, 1) + b2.ToString() + b1.ToString(); } if (b1 == 9 && b2 == 9) { b3 = b3 + 1; b2 = 0; b1 = 0; c = b3.ToString() + b2.ToString() + b1.ToString(); } } string Sqlstring = "insert ThirdClassDm(ThirdClassDmID,SecondClassDmID,ThirdClassDmName)values('" + c + "','" + secondclassdm.SecondClassDmID + "',N'" + thirdclassdm.ThirdClassDmName + "')"; return(SqlHelper.ExecuteNonQuery(Sqlstring)); }