Ejemplo n.º 1
0
        public static int UpdateUserCategory(string tableName, int id, int pid, int uid, string name, string pinyin = null, string pinyinabbr = null, string ename = null)
        {
            if (pinyin == null)
            {
                pinyin = HZ.ToPinYin(name, true);
            }
            if (pinyinabbr == null)
            {
                pinyinabbr = PinYin.GetInitial(name);
            }
            if (ename == null)
            {
                ename = pinyin;
            }

            //check pid & uid
            if (pid != 0 && !DBH.GetBoolean(QA.DBCS_CMS, CommandType.Text, "SELECT COUNT(id) FROM " + tableName + " WHERE pid=@pid AND uid=@uid", new SqlParameter("@pid", pid), new SqlParameter("@uid", uid)))
            {
                return(-1);
            }

            return(EB <UserCategoryEntity> .Update(QA.DBCS_CMS, new UserCategoryEntity()
            {
                id = id,
                uid = uid,
                pid = pid,
                name = name,
                pinyin = pinyin,
                pinyinabbr = pinyinabbr,
                ename = ename
            }, tableName));
        }
Ejemplo n.º 2
0
        public static int CreateUserCategory(string tableName, int pid, int uid, string name, string pinyin = null, string pinyinabbr = null, string ename = null)
        {
            if (pinyin == null)
            {
                pinyin = HZ.ToPinYin(name, true);
            }
            if (pinyinabbr == null)
            {
                pinyinabbr = PinYin.GetInitial(name);
            }
            if (ename == null)
            {
                ename = pinyin;
            }

            return(EB <UserCategoryEntity> .Create(QA.DBCS_CMS, new UserCategoryEntity()
            {
                uid = uid,
                pid = pid,
                name = name,
                pinyin = pinyin,
                pinyinabbr = pinyinabbr,
                ename = ename
            }, tableName));
        }
Ejemplo n.º 3
0
        public static int RenameUserCategory(string tableName, int id, string name)
        {
            string pinyin     = HZ.ToPinYin(name, true);
            string pinyinabbr = PinYin.GetInitial(name);

            return(DBH.ExecuteText(QA.DBCS_CMS, "UPDATE " + tableName + " SET name=@name,pinyin=@pinyin,pinyinabbr=@pinyinabbr,ename=@ename WHERE id=@id",
                                   new SqlParameter("@name", name), new SqlParameter("@pinyin", pinyin), new SqlParameter("@pinyinabbr", pinyinabbr), new SqlParameter("@ename", pinyin), new SqlParameter("@id", id)));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///  获取用户的个性域名
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static string GetWWW(string name)
        {
            string www = HZ.ToPinYin(name);

            if (www.Length > 20)
            {
                PinYin.GetInitial(name);
            }

            if (Keyword.Reserve(www) || UserData.ExistWWW(www))
            {
                int    i = 1;
                string w = www + "_" + i;
                while (Keyword.Reserve(w) || UserData.ExistWWW(w))
                {
                    i++;
                    w = www + "_" + i;
                }
                www = w;
            }

            return(www);
        }