Example #1
0
        public async Task <HttpStatusCode> EditPublicChatMessage(PublicChat publicChat)
        {
            PublicChatsController publicChatsController = new PublicChatsController();
            var status = await publicChatsController.UpdatePublicChatAsync(publicChat);

            return(status);
        }
Example #2
0
    private void LoadInitMessage()
    {
        PublicChat pObj = new PublicChat();

        pObj.Chat_r_id = long.Parse(HiddenCid.Value);
        DataTable dTable = new DataTable();

        dTable = pObj.GetInitChat();
        if (dTable != null)
        {
            object val = null;
            val = dTable.Rows[0]["msg_id"];
            if (val != null)
            {
                HiddenMsgid.Value = val.ToString();
            }
            else
            {
                HiddenMsgid.Value = "0";
            }
        }
        else
        {
            HiddenMsgid.Value = "0";
        }

        repeatChat.DataSource = dTable;
        repeatChat.DataBind();
    }
Example #3
0
        public async Task <IHttpActionResult> PutPublicChat(int id, PublicChat publicChat)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != publicChat.Id)
            {
                return(BadRequest());
            }

            db.Entry(publicChat).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PublicChatExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #4
0
        public async Task <HttpStatusCode> UpdatePublicChatAsync(PublicChat publicChat)
        {
            HttpResponseMessage response = await PublicResources.client.PutAsJsonAsync(
                $"api/PublicChatsAPI/{publicChat.Id}", publicChat);

            response.EnsureSuccessStatusCode();
            return(response.StatusCode);
        }
Example #5
0
    private void LoadChatData()
    {
        PublicChat pObj = new PublicChat();

        pObj.Chat_r_id = long.Parse(HiddenCid.Value);
        pObj.Msg_id    = long.Parse(HiddenMsgid.Value);

        repeatChat.DataSource = pObj.GetChats();
        repeatChat.DataBind();
    }
Example #6
0
        public async Task <IHttpActionResult> GetPublicChat(int id)
        {
            PublicChat publicChat = await db.PublicChats.FindAsync(id);

            if (publicChat == null)
            {
                return(NotFound());
            }

            return(Ok(publicChat));
        }
    public override IPublicChat GetPublicChat()
    {
        if (publicChat == null)
        {
            publicChat = new PublicChat();
            publicChat.Init();
            publicChat.Dispose();
        }

        return(publicChat);
    }
Example #8
0
        public async Task <IHttpActionResult> PostPublicChat(PublicChat publicChat)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PublicChats.Add(publicChat);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = publicChat.Id }, publicChat));
        }
Example #9
0
 private void JoinChatRoom()
 {
     try
     {
         PublicChat pObj = new PublicChat();
         pObj.Chat_r_id = long.Parse(HiddenCid.Value);
         pObj.User_id   = uInfo.UserId;
         pObj.JoinChatRoom();
     }
     catch (Exception ex)
     {
     }
 }
Example #10
0
 private void LoadMessages()
 {
     try
     {
         PublicChat pObj = new PublicChat();
         pObj.User_id             = long.Parse(HiddenUId.Value);
         gvUserMessage.DataSource = pObj.GetUserChats();
         gvUserMessage.DataBind();
     }
     catch (Exception ex)
     {
     }
 }
Example #11
0
        public async Task <IHttpActionResult> DeletePublicChat(int id)
        {
            PublicChat publicChat = await db.PublicChats.FindAsync(id);

            if (publicChat == null)
            {
                return(NotFound());
            }

            db.PublicChats.Remove(publicChat);
            await db.SaveChangesAsync();

            return(Ok(publicChat));
        }
Example #12
0
    private void JoinChatRoom()
    {
        try
        {
            PublicChat pObj = new PublicChat();
            pObj.Chat_r_id = long.Parse(HiddenCid.Value);
            pObj.User_id = uInfo.UserId;
            pObj.JoinChatRoom();
        }
        catch (Exception ex)
        {

        }
    }
Example #13
0
    private void LoadMessages()
    {
        try
        {
            PublicChat pObj = new PublicChat();
            pObj.User_id = long.Parse(HiddenUId.Value);
            gvUserMessage.DataSource = pObj.GetUserChats();
            gvUserMessage.DataBind();
        }
        catch (Exception ex)
        {

        }
    }
Example #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         uInfo = (userInfo)Session["_di09USR"];
         PublicChat pObj = new PublicChat();
         pObj.User_id = uInfo.UserId;
         pObj.LeaveChatRoom();
     }
     finally
     {
         Response.Redirect("~/home.aspx");
     }
 }
Example #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         uInfo = (userInfo)Session["_di09USR"];
         PublicChat pObj = new PublicChat();
         pObj.User_id = uInfo.UserId;
         pObj.LeaveChatRoom();
     }
     finally
     {
         Response.Redirect("~/home.aspx");
     }
 }
Example #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     topPanel.Visible = !setUsername();
     LoadChatRooms();
     if (!Page.IsPostBack)
     {
         if (isLoggedIn())
         {
             //EXIT USER FROM ANY PRE CHATROOMS
             PublicChat pObj = new PublicChat();
             pObj.User_id = uInfo.UserId;
             pObj.LeaveChatRoom();
         }
     }
 }
Example #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     topPanel.Visible = !setUsername();
     LoadChatRooms();
     if (!Page.IsPostBack)
     {
         if (isLoggedIn())
         {
             //EXIT USER FROM ANY PRE CHATROOMS
             PublicChat pObj = new PublicChat();
             pObj.User_id = uInfo.UserId;
             pObj.LeaveChatRoom();
         }
     }
 }
Example #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        setUsername();
        LoadChatRooms();

        if (!Page.IsPostBack)
        {
            if (uInfo != null)
            {
                //EXIT USER FROM ANY PRE CHATROOMS
                PublicChat pObj = new PublicChat();
                pObj.User_id = uInfo.UserId;
                pObj.LeaveChatRoom();
            }
        }
    }
Example #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        setUsername();
        if (!Page.IsPostBack)
        {
            //EXIT USER FROM ANY PRE CHATROOMS
            PublicChat pObj = new PublicChat();
            pObj.User_id = uInfo.UserId;
            pObj.LeaveChatRoom();

            //LOAD ALL DETAILS
            Session[USER_SAVE_STRING] = USER_INIT_PATH;
            LoadUserDetails();
            imgUser.ImageUrl = Session[USER_SAVE_STRING].ToString();
        }
    }
Example #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        setUsername();
        LoadChatRooms();

        if (!Page.IsPostBack)
        {
            if (uInfo != null)
            {
                //EXIT USER FROM ANY PRE CHATROOMS
                PublicChat pObj = new PublicChat();
                pObj.User_id = uInfo.UserId;
                pObj.LeaveChatRoom();
            }
        }
    }
Example #21
0
    protected override void OnPreInit(EventArgs e)
    {
        if (Context.Session != null)
        {
            if (Session["_di09USR"] != null)
            {
                userInfo uInfo = (userInfo)Session["_di09USR"];

                //EXIT USER FROM ANY PRE CHATROOMS
                PublicChat pObj = new PublicChat();
                pObj.User_id = uInfo.UserId;
                pObj.LeaveChatRoom();

                LoginCls logoutObj = new LoginCls();
                logoutObj.LogOut(uInfo.UserId);
            }
        }

        Session.Abandon();
        Response.Redirect("~/home.aspx", true);
    }
Example #22
0
        if (Context.Session != null)
        {
            if (Session["_di09USR"] != null)
            {
                userInfo uInfo = (userInfo)Session["_di09USR"];

                //EXIT USER FROM ANY PRE CHATROOMS
                PublicChat pObj = new PublicChat();
                pObj.User_id = uInfo.UserId;
                pObj.LeaveChatRoom();

                LoginCls logoutObj = new LoginCls();
                logoutObj.LogOut(uInfo.UserId);
            }
        }

        Session.Abandon();
        Response.Redirect("~/home.aspx", true);
    }
}
Example #23
0
    private void LoadChatData()
    {
        PublicChat pObj = new PublicChat();
        pObj.Chat_r_id = long.Parse(HiddenCid.Value);
        pObj.Msg_id = long.Parse(HiddenMsgid.Value);

        repeatChat.DataSource = pObj.GetChats();
        repeatChat.DataBind();
    }
Example #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        setUsername();
        if (!Page.IsPostBack)
        {
            //EXIT USER FROM ANY PRE CHATROOMS
            PublicChat pObj = new PublicChat();
            pObj.User_id = uInfo.UserId;
            pObj.LeaveChatRoom();

            //LOAD ALL DETAILS
            Session[USER_SAVE_STRING] = USER_INIT_PATH;
            LoadUserDetails();
            imgUser.ImageUrl = Session[USER_SAVE_STRING].ToString();
        }
    }
Example #25
0
    private void LoadInitMessage()
    {
        PublicChat pObj = new PublicChat();
        pObj.Chat_r_id = long.Parse(HiddenCid.Value);
        DataTable dTable = new DataTable();
        dTable = pObj.GetInitChat();
        if (dTable != null)
        {
            object val = null;
            val = dTable.Rows[0]["msg_id"];
            if (val != null)
            {
                HiddenMsgid.Value = val.ToString();
            }
            else
            {
                HiddenMsgid.Value = "0";
            }
        }
        else
        {
            HiddenMsgid.Value = "0";
        }

        repeatChat.DataSource = dTable;
        repeatChat.DataBind();
    }