コード例 #1
0
ファイル: GA.cs プロジェクト: jiaqi-xu/HitachiStore
        /// <summary>
        /// 三级类目名称获取三级类目ID
        /// </summary>
        /// <param name="thirdclassdm">三级类目对象</param>
        /// <returns>三级类目ID</returns>
        public string TcNameGetID(ThirdClassDm thirdclassdm)
        {
            string Sqlstring = "select ThirdClassDmID from ThirdClassDm where ThirdClassDmName=N'" + thirdclassdm.ThirdClassDmName + "'";
            Object obj       = SqlHelper.ReadSclar(Sqlstring);

            return((string)obj);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
ファイル: GA.cs プロジェクト: jiaqi-xu/HitachiStore
        /// <summary>
        /// 添加三级类目和属性绑定关系
        /// </summary>
        /// <param name="property">属性对象</param>
        /// <param name="thirdclassdm">三级类目对象</param>
        /// <returns>是否添加成功</returns>
        public bool AddTcPoComb(Property property, ThirdClassDm thirdclassdm)
        {
            string Sql = "insert PropertyClassDm(PropertyID,ThirdClassDmID)values('" + property.PropertyID + "','" + thirdclassdm.ThirdClassDmID + "')";

            if (SqlHelper.ExecuteNonQuery(Sql) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
ファイル: GA.cs プロジェクト: jiaqi-xu/HitachiStore
        /// <summary>
        /// 是否三级类目与属性有对应关系
        /// </summary>
        /// <param name="property">属性对象</param>
        /// <param name="thirdclassdm">三级类目对象</param>
        /// <returns>是或否</returns>
        public bool IsTcPoComb(Property property, ThirdClassDm thirdclassdm)
        {
            string Sqlstring = "select PropertyID from PropertyClassDm where PropertyID='" + property.PropertyID + "'and ThirdClassDmID='" + thirdclassdm.ThirdClassDmID + "' ";
            Object obj       = SqlHelper.ReadSclar(Sqlstring);

            if (obj == null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        /// <summary>
        /// 由三级类目ID获取属性ID
        /// </summary>
        /// <param name="thirdclassdm">三级类目对象</param>
        /// <returns>对象表</returns>
        public static List <Property> TcIDGetPoID(ThirdClassDm thirdclassdm)
        {
            List <Property> prolist   = new List <Property>();
            string          Sqlstring = "select PropertyID from PropertyClassDm where ThirdClassDmID='" + thirdclassdm.ThirdClassDmID + "'";

            SqlHelper.ReadDateReadBegin(Sqlstring);
            while (SqlHelper.SqlReader.Read())
            {
                Property property = new Property();
                property.PropertyID = SqlHelper.SqlReader["PropertyID"].ToString();
                prolist.Add(property);
            }
            SqlHelper.ReadDateReadEnd();
            return(prolist);
        }
コード例 #6
0
ファイル: GA.cs プロジェクト: jiaqi-xu/HitachiStore
        /// <summary>
        /// 添加的三级类目是否重复
        /// </summary>
        /// <param name="thirdclassdm">三级类目对象</param>
        /// <returns>是或否</returns>
        public bool TcIsRepeat(ThirdClassDm thirdclassdm)
        {
            string Sqlstring = "select ThirdClassDmID from ThirdClassDm where ThirdClassDmName=N'" + thirdclassdm.ThirdClassDmName + "'";
            Object obj       = SqlHelper.ReadSclar(Sqlstring);
            string str       = (string)obj;

            if (str == null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #7
0
ファイル: GA.cs プロジェクト: jiaqi-xu/HitachiStore
        /// <summary>
        /// 添加属性
        /// </summary>
        /// <param name="thirdclassdm">三级类目对象</param>
        /// <param name="property">属性对象</param>
        /// <returns>成功或失败</returns>
        public bool AddProperty(ThirdClassDm thirdclassdm, Property property)
        {
            string c    = null;
            string sql1 = "select top 1 * from Property order by PropertyID 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 Sql1 = "insert Property(PropertyID,PropertyName)values('" + c + "',N'" + property.PropertyName + "') ";
            string Sql2 = "insert PropertyClassDm(PropertyID,ThirdClassDmID)values('" + c + "','" + thirdclassdm.ThirdClassDmID + "')";

            if ((SqlHelper.ExecuteNonQuery(Sql1) > 0) && (SqlHelper.ExecuteNonQuery(Sql2) > 0))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #8
0
ファイル: ThirdClassDm.cs プロジェクト: jiaqi-xu/HitachiStore
        /// <summary>
        /// 由二级类目ID获取三级类目的字段
        /// </summary>
        /// <param name="str">传入的二级类目ID</param>
        /// <returns>三级类目表</returns>
        public static List <ThirdClassDm> Getlist(string str)
        {
            List <ThirdClassDm> ThirdClumList = new List <ThirdClassDm>();
            string Sqlstring = "select * from ThirdClassDm where SecondClassDmID='" + str + "'";

            SqlHelper.ReadDateReadBegin(Sqlstring);
            while (SqlHelper.SqlReader.Read())
            {
                ThirdClassDm thirdclassdm = new ThirdClassDm();
                thirdclassdm.ThirdClassDmName = SqlHelper.SqlReader["ThirdClassDmName"].ToString();
                thirdclassdm.ThirdClassDmID   = SqlHelper.SqlReader["ThirdClassDmID"].ToString();
                ThirdClumList.Add(thirdclassdm);
            }
            SqlHelper.ReadDateReadEnd();
            return(ThirdClumList);
        }
コード例 #9
0
        /// <summary>
        /// 在三级类目中进行模糊搜索
        /// </summary>
        /// <param name="textBox">对应搜索框中的字符串</param>
        /// <returns>三级类目表</returns>
        public List <ThirdClassDm> ThirdClassSelect(string textBox)
        {
            List <ThirdClassDm> lThirdList = new List <ThirdClassDm>();
            string lTextBox             = this.CutTbxText1(textBox);
            string sqlSecondClassSelect = "select * from ThirdClassDm where ThirdClassDmName like N'%" + lTextBox + "%'";

            SqlHelper.ReadDateReadBegin(sqlSecondClassSelect);
            while (SqlHelper.SqlReader.Read())
            {
                ThirdClassDm lThirdClassDm = new ThirdClassDm();
                lThirdClassDm.ThirdClassDmID   = SqlHelper.SqlReader["ThirdClassDmID"].ToString();
                lThirdClassDm.ThirdClassDmName = SqlHelper.SqlReader["ThirdClassDmName"].ToString();
                lThirdList.Add(lThirdClassDm);
            }
            SqlHelper.ReadDateReadEnd();
            return(lThirdList);
        }
コード例 #10
0
ファイル: GA.cs プロジェクト: jiaqi-xu/HitachiStore
        /// <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));
        }
コード例 #11
0
ファイル: GA.cs プロジェクト: jiaqi-xu/HitachiStore
        public bool DeleteThirddm(ThirdClassDm third)
        {
            string       SelectSingeID = null, DeleteOrder = null, DeleteGood = null, DeleteSingle = null, DeleteImageinfo = null, DeleteGoodEva = null, DeleteGoodproCom = null;
            Object       obj2          = null;
            ThirdClassDm thirdclassdm  = new ThirdClassDm();
            string       str           = third.ThirdClassDmName;
            string       SelectThirdID = this.TcNameGetID(third);

            thirdclassdm.ThirdClassDmID = SelectThirdID;
            string SelectGoodID = "select GoodID from Good where ThirdClassDmID=N'" + SelectThirdID + "'";
            Object obj1         = SqlHelper.ReadSclar(SelectGoodID);

            if (obj1 != null)
            {
                SelectSingeID    = "select SingleGoodID from SingleGoodInfo where GoodID='" + obj1.ToString() + "'";
                obj2             = SqlHelper.ReadSclar(SelectSingeID);
                DeleteOrder      = "delete  from Orders  where SingleGoodID='" + obj2.ToString() + "'";
                DeleteGood       = "delete  from Good  where GoodID='" + obj1.ToString() + "'";
                DeleteSingle     = "delete  from SingleGoodInfo  where GoodID='" + obj1.ToString() + "'";
                DeleteImageinfo  = "delete  from ImgInfo  where GoodID='" + obj1.ToString() + "'";
                DeleteGoodEva    = "delete  from GoodEvaluate  where GoodID='" + obj1.ToString() + "'";
                DeleteGoodproCom = "delete  from GoodPropertyComb  where GoodID='" + obj1.ToString() + "'";
            }
            string          SelectProperID = "select PropertyID from PropertyClassDm where ThirdClassDm='" + SelectThirdID + "'";
            string          DeleteProcla   = "delete  from PropertyClassDm  where ThirdClassDmID=N'" + SelectThirdID + "'";
            string          DeleteThirdCla = "delete  from ThirdClassDm where ThirdClassDmName=N'" + str + "'";
            List <Property> prolist        = new List <Property>();

            prolist = PropertyClassDm.TcIDGetPoID(thirdclassdm);
            if (prolist.Count == 0)
            {
                int b = 0, c = 0, d = 0, i = 0, h = 0, g = 0;
                if (obj2 != null)
                {
                    c = SqlHelper.ExecuteNonQuery(DeleteOrder);
                }
                if (obj1 != null)
                {
                    i = SqlHelper.ExecuteNonQuery(DeleteGoodproCom);
                    h = SqlHelper.ExecuteNonQuery(DeleteGoodEva);
                    g = SqlHelper.ExecuteNonQuery(DeleteImageinfo);
                    b = SqlHelper.ExecuteNonQuery(DeleteGood);
                    d = SqlHelper.ExecuteNonQuery(DeleteSingle);
                }
                int a = SqlHelper.ExecuteNonQuery(DeleteThirdCla);
                if (a > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                int b = 0, c = 0, d = 0, i = 0, h = 0, g = 0;
                if (obj2 != null)
                {
                    c = SqlHelper.ExecuteNonQuery(DeleteOrder);
                }
                if (obj1 != null)
                {
                    i = SqlHelper.ExecuteNonQuery(DeleteGoodproCom);
                    h = SqlHelper.ExecuteNonQuery(DeleteGoodEva);
                    g = SqlHelper.ExecuteNonQuery(DeleteImageinfo);
                    b = SqlHelper.ExecuteNonQuery(DeleteGood);
                    d = SqlHelper.ExecuteNonQuery(DeleteSingle);
                }
                int f = SqlHelper.ExecuteNonQuery(DeleteProcla);
                int a = SqlHelper.ExecuteNonQuery(DeleteThirdCla);
                if (a > 0 && f > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }