public static int DeleteUnreadStudent(string userID, string FlagGrp, string Sender = "-1") { DataTable dt = null; if (userID != null && userID != "" && FlagGrp != "") { int FlagGrpB = bool.Parse(FlagGrp) == false ? 0 : 1; dt = MsgUnReadStudentBuisnes.DeleteUnReadMsgStudent(userID, FlagGrpB, int.Parse(Sender == "" ? "-1" : Sender)); } if (dt != null && dt.Rows.Count > 0) { return(int.Parse(dt.Rows[0]["CountUnRead"].ToString())); } else { return(0); } }
protected void Page_Init(object sender, EventArgs e) { if (Session[sessionNames.userID_StudentOstad] == null) { Response.Redirect("~/CommonUI/login.aspx"); } else { Session["CountUnRead"] = null; Session["ContactUnread"] = null; LoginBusiness logBusiness = new LoginBusiness(); System.Data.DataTable dt = new System.Data.DataTable(); string userId = Session[sessionNames.userID_StudentOstad].ToString(); user.Text = userId; //if (Request.QueryString["Flag_Grp"] != null ) //{ MessageJs.DeleteUnreadStudent(userId, Request.QueryString["Flag_Grp"] != null? Request.QueryString["Flag_Grp"]: "True", Request.QueryString["Flag_Grp"] != null && Request.QueryString["Flag_Grp"].Trim() != "True" && Request.QueryString["IdGrpOrPerson"] != null ? Request.QueryString["IdGrpOrPerson"] :"-1"); // } if (!IsPostBack) { StuImg st = logBusiness.User_Img(Session[sessionNames.userID_StudentOstad].ToString()); PersonalImage.DataValue = st.img; LoginDTO stInfo = logBusiness.Get_StInfo(Session[sessionNames.userID_StudentOstad].ToString()); stName.InnerText = stInfo.Name + " " + stInfo.LastName; DataTable dtCountUnread; DataTable dtUnReadContact; dtCountUnread = MsgUnReadStudentBuisnes.GetUnReadMsgCountStudent(userId); if (dtCountUnread != null && dtCountUnread.Rows.Count > 0) { Session["CountUnRead"] = dtCountUnread.Rows[0]["CountUnRead"].ToString(); dtUnReadContact = MsgUnReadStudentBuisnes.GetUnReadMsgStudent(userId); Session.Add("ContactUnread", dtUnReadContact); } } } }