Beispiel #1
0
        public static void UpdateWaiting(OnlineUser user, int no, int time) // 0~1~2
        {
            // 수신 금지 목록에 등록
            OnlineUser.receive_waiting_user.Add(user.id);
            user.Message("소중한 정보 감사합니다.");

            MysqlNode node = new MysqlNode(Program.mysqlOption, "INSERT INTO waiting_data (restaurant_no, user_id, waiting) VALUES (?restaurant_no, ?user_id, ?waiting)");

            node["restaurant_no"] = no;
            node["user_id"]       = user.id;
            if (time < 2)
            {
                node["waiting"] = time * 5;
            }
            else
            {
                node["waiting"] = 15;
            }
            node.ExecuteNonQuery();
            int?result = AutoWaitingComputing.Update(no);

            foreach (int id in GetWaitingListener(no))
            {
                OnlineUser.Notify(id, "waiting", no, GetTitle(no) + " 대기 시간 수신", "예상 시간 : " + result.Value + "분");
            }
        }
Beispiel #2
0
        public static bool WriteArticle(OnlineUser user, string content, int parent_no = 0)
        {
            if (string.IsNullOrEmpty(content))
            {
                user.Message("내용을 입력해주세요.");
                return(false);
            }
            MysqlNode menu_update = new MysqlNode(Program.mysqlOption, "INSERT INTO board (user_id, content, parent_no) VALUES (?user_id, ?content, ?parent_no)");

            menu_update["user_id"] = user.id;
            menu_update["content"] = content;
            if (parent_no == 0)
            {
                menu_update["parent_no"] = null;
            }
            else
            {
                menu_update["parent_no"] = parent_no;
            }
            long result = menu_update.ExecuteInsertQuery();

            if (result > 0)
            {
                if (parent_no == 0)
                {
                    JObject json = new JObject();
                    json["type"] = PacketType.WriteBoardItem;
                    json["item"] = ((JArray)GetList((int)result)["list"])[0];
                    OnlineUser.SendAll(json);
                }
                else
                {
                    user.Send(GetCommentList(parent_no));
                    List <int> RelatedUser = GetRelatedUser(parent_no);
                    foreach (int id in RelatedUser)
                    {
                        if (id != user.id) // 올린 사람은 제외
                        {
                            OnlineUser.Notify(id, "comment", (int)result, "내가 올린 게시글에 답변이 등록되었습니다.", "(" + user.name + ") " + content);
                        }
                    }
                }
                user.Message("등록에 성공했습니다.");
                return(true);
            }
            else
            {
                user.Message("등록에 실패했습니다.");
                return(false);
            }
        }