//获取总注册用户 和 当月注册用户
        public UserNum GetUserNum()
        {
            DateTime  ddddddd = DateTime.Now;
            var       dfdf    = ddddddd.Year + "-" + ddddddd.Month + "-" + "1";
            var       ggggg   = DateTime.Parse(dfdf);
            string    sql1    = "SELECT COUNT(ID) num FROM huangguan_user ";
            string    sql2    = "SELECT COUNT(ID) num FROM huangguan_user WHERE CreatedAt >='{0}' ".FormatStr(ggggg);
            DataTable dt1     = MySqlDbHelper.ExecuteQuery(connCommonsStr, sql1);
            DataTable dt2     = MySqlDbHelper.ExecuteQuery(connCommonsStr, sql2);
            UserNum   cr      = new UserNum();

            cr.TotalNum = Convert.ToInt32(dt1.Rows[0]["num"]);
            cr.MonthNum = Convert.ToInt32(dt2.Rows[0]["num"]);
            return(cr);
        }
Esempio n. 2
0
        public string chatState(List <string> temp)
        {
            string        tempString = null;
            List <string> tempList   = null;

            switch (int.Parse(temp[1]))
            {
            case 0:                                           //채팅방 목록 2|0
                tempList   = con.roomNum(int.Parse(temp[2])); // 2|0|유저번호
                tempString = "2|0|";
                if (tempList[0].Equals(""))
                {
                    tempString += "|";
                }
                else
                {
                    foreach (string roomNum in tempList)
                    {
                        if (roomNum.Equals(""))
                        {
                            tempString += "|";
                        }
                        else
                        {
                            tempString += roomNum + "/";
                        }
                    }
                }
                break;

            case 1:                                               //채팅방 생성.. 2|1
                string newRoomNo = con.newRoom(temp[2], temp[3]); // temp[2] = 유저번호, temp[3] = 친구목록
                if (newRoomNo.Equals(""))
                {
                    tempString = "2|1|0|";
                }
                else
                {
                    tempString = "2|1|1|";
                    int roomNum = con.selectNewRoom(newRoomNo);
                    tempString += roomNum + "|";
                    con.updateNewRoom(roomNum, int.Parse(temp[2]));
                    foreach (string UserNum in stSplit.comaCut(temp[3]))
                    {
                        if (!UserNum.Equals(""))
                        {
                            con.updateNewRoom(roomNum, int.Parse(UserNum));
                            tempString += UserNum + "?" + con.getNickName(int.Parse(UserNum)) + "/";
                        }
                    }
                }
                break;

            case 2:    //채팅방 글 불러오기  2|2
                tempString = "2|2|";
                foreach (string item in con.chattingMessageReader(int.Parse(temp[2])))
                {
                    tempString += item + "/";
                }
                break;

            case 3:    //채팅방 인원 추가 2|3
                con.updateRoomMember(int.Parse(temp[2]), temp[3]);
                tempString = "2|3|1|" + int.Parse(temp[2]) + "|";
                foreach (string item in stSplit.comaCut(temp[3]))
                {
                    if (item.Equals(""))
                    {
                        tempString += "|";
                        // tempString = "2|3|1|" + RoomNum + "|" + "추가멤버번호" + "|" + "추가멤버네임" + "|";
                    }
                    else
                    {
                        con.updateNewRoom(int.Parse(temp[2]), int.Parse(item));
                        tempString += item + "?" + con.getNickName(int.Parse(item)) + "/";
                    }
                }

                break;

            case 4:                                                                         // 채팅 메시지 전송 2|4
                if (con.chatMsgInsert(int.Parse(temp[2]), int.Parse(temp[3]), temp[4]) > 0) // 방번호|유저번호|메시지
                {
                    tempString = "2|4|1|" + temp[2] + "|" + temp[3] + "|" + temp[4] + "|" +
                                 con.chatTimesel(int.Parse(temp[3]), temp[4]) + "|" + con.selectChatMem(int.Parse(temp[2])) + "|";
                }
                // 채팅 보낸 User가 참여하고 있는 RoomNum 찾는다.
                //SocketByUser.TryGetValue(소켓을 통해서, UserNum을 얻는다) -> userNum -> roomNum
                break;

            default:
                break;
            }
            return(tempString);
        }