Ejemplo n.º 1
0
        public int getMaxUserID()
        {
            int maxUserId = 1;

            try
            {
                string querry1 = "SELECT MAX(userId) from tbl_login;";
                maxUserId = CONN.getMaxId(querry1);

                //create userId for the first time
                if (maxUserId <= 1)
                {
                    //maxUserId += 1000;
                    string querry2 = "SELECT prefixValue FROM tbl_prefix WHERE prefixName = 'userId';";
                    maxUserId = CONN.getPrefix(querry2);
                    int tmp = Convert.ToInt32(string.Concat(maxUserId.ToString(), "0000")) + 1;
                    maxUserId = tmp;
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(maxUserId);
        }
Ejemplo n.º 2
0
        public int getMaxItemId()
        {
            int maxItemId = 1;

            try
            {
                string querry = "SELECT MAX(itemId) from tbl_item;";
                maxItemId = CONN.getMaxId(querry);

                //create ItemId for the first time
                if (maxItemId <= 1)
                {
                    //maxId += 40000;
                    string querry2 = "SELECT prefixValue FROM tbl_prefix WHERE prefixName = 'itemId';";
                    maxItemId = CONN.getPrefix(querry2);
                    int tmp = Convert.ToInt32(string.Concat(maxItemId.ToString(), "0000")) + 1;
                    maxItemId = tmp;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(maxItemId);
        }