Пример #1
0
        private ActionResult <IEnumerable <UserReportInfo> > GetUserReportsFunction(List <UserReport> userReports)
        {
            List <UserReportInfo> urInfoList = new List <UserReportInfo>();

            foreach (var item in userReports)
            {
                UserReportInfo urInfo = new UserReportInfo();

                var user = _context.UserDatas.Include(x => x.City).Include(x => x.Rank).FirstOrDefault(x => x.ID == item.ReportedUserID);

                urInfo.ID             = item.ID;
                urInfo.FullName       = user.Name + " " + user.Lastname;
                urInfo.Email          = user.Email;
                urInfo.Eko            = 0;
                urInfo.Photo          = user.Photo;
                urInfo.CityName       = user.City.Name;
                urInfo.ReportedUserID = item.ReportedUserID;
                urInfo.Description    = item.Description;
                urInfo.RankName       = user.Rank.Name;

                urInfo.Eko = _context.PostLikes.Where(x => x.PostID == x.Post.ID && x.Post.UserDataID == user.ID && x.Post.UserDataID != x.UserDataID).Count()
                             + _context.CommentLikes.Where(x => x.CommentID == x.Comment.ID && x.Comment.UserDataID == user.ID && x.Comment.UserDataID != x.UserDataID && x.LikeOrDislike == 1).Count()
                             - _context.CommentLikes.Where(x => x.CommentID == x.Comment.ID && x.Comment.UserDataID == user.ID && x.Comment.UserDataID != x.UserDataID && x.LikeOrDislike == -1).Count();

                if (urInfo.Eko < 0)
                {
                    urInfo.Eko = 0;
                }

                urInfoList.Add(urInfo);
            }

            return(urInfoList);
        }
Пример #2
0
        private static void FillReportToInfo(IUser user, string propertyName, Control parent, string labelID)
        {
            HyperLink    lbl      = (HyperLink)parent.FindControl(labelID);
            UserPresence presence = (UserPresence)parent.FindControl("reportTouserPresence");

            if (lbl != null)
            {
                UserReportInfo reportInfo = GetUserProperty(user, "ReportTo", (UserReportInfo)null);

                if (reportInfo != null)
                {
                    presence.UserID          = reportInfo.ReportTo.ID;
                    presence.UserDisplayName = reportInfo.ReportTo.DisplayName;

                    lbl.Text        = HttpUtility.HtmlEncode(reportInfo.ReportTo.DisplayName);
                    lbl.NavigateUrl = "editUserReportToInfo.aspx?userID=" + HttpUtility.UrlEncode(reportInfo.User.ID);
                }
                else
                {
                    lbl.Style[HtmlTextWriterStyle.PaddingLeft] = "16px";
                    lbl.Text        = HttpUtility.HtmlEncode("增加");
                    lbl.NavigateUrl = "editUserReportToInfo.aspx?userID=" + HttpUtility.UrlEncode(user.ID);
                }
            }
        }
Пример #3
0
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            string userId = Request.QueryString.GetValue("userId", string.Empty);

            try
            {
                UserReportInfo userReport = UserReportInfoAdapter.Instance.LoadUserReportToInfo(userId);
                if (userReport != null)
                {
                    userReport.ReportTo = (IUser)OuUserInputControl.SelectedSingleData;
                }
                else
                {
                    userReport          = new UserReportInfo();
                    userReport.User     = new OguUser(userId);
                    userReport.ReportTo = (IUser)OuUserInputControl.SelectedSingleData;
                }

                UserReportInfoAdapter.Instance.Update(userReport);

                Page.ClientScript.RegisterStartupScript(this.GetType(), "returnProcesses",
                                                        string.Format("window.returnValue = true; top.close();"),
                                                        true);
            }
            catch (Exception ex)
            {
                WebUtility.ShowClientError(ex.Message, ex.StackTrace, "错误");
            }
        }
		protected void btnConfirm_Click(object sender, EventArgs e)
		{
			string userId = Request.QueryString.GetValue("userId", string.Empty);
			try
			{
				UserReportInfo userReport = UserReportInfoAdapter.Instance.LoadUserReportToInfo(userId);
				if (userReport != null)
				{
					userReport.ReportTo = (IUser)OuUserInputControl.SelectedSingleData;
				}
				else
				{
					userReport = new UserReportInfo();
					userReport.User = new OguUser(userId);
					userReport.ReportTo = (IUser)OuUserInputControl.SelectedSingleData;
				}
				
				UserReportInfoAdapter.Instance.Update(userReport);
				
				Page.ClientScript.RegisterStartupScript(this.GetType(), "returnProcesses",
					string.Format("window.returnValue = true; top.close();"),
					true);
			}
			catch (Exception ex)
			{
				WebUtility.ShowClientError(ex.Message, ex.StackTrace, "错误");
			}
		}
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReportInfo"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="innerInfo">The inner info.</param>
 /// <param name="categoryId">The category id.</param>
 /// <param name="categoryName">Name of the category.</param>
 internal ReportInfo(int id, UserReportInfo innerInfo, int categoryId, string categoryName)
 {
     _id        = id;
     _innerInfo = innerInfo;
     if (categoryName != null)
     {
         _category = new ReportCategoryInfo(categoryId, categoryName);
     }
 }
Пример #6
0
        /// <summary>
        /// Gets the report.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public ReportInfo GetReport(int id)
        {
            ReportInfo retVal = null;

            using (IDataReader reader = DBReport.GetById(this.ContainerKey, id))
            {
                if (reader.Read())
                {
                    UserReportInfo info = UserReportConfig.GetConfig().Reports[(string)reader["Name"]];
                    if (info != null)
                    {
                        retVal = new ReportInfo((int)reader["ReportId"], info,
                                                (int)SqlHelper.DBNull2Null(reader["ReportCategoryId"], -1),
                                                (string)SqlHelper.DBNull2Null(reader["ReportCategoryName"]));
                    }
                }
            }

            return(retVal);
        }
Пример #7
0
        public OguObjectCollection <IUser> GetIUserWithCount(string userName, string departmentId, ref int totalCount)
        {
            IOrganization dept = OguMechanismFactory.GetMechanism().GetObjects <IOrganization>(SearchOUIDType.Guid, departmentId)[0];

            OguObjectCollection <IUser> users = null;

            if (userName.Equals("@SearchAll@"))
            {
                users = dept.QueryChildren <IUser>(userName, true, SearchLevel.OneLevel, 100);
            }
            else
            {
                users = dept.QueryChildren <IUser>(userName, true, SearchLevel.SubTree, 100);
            }

            UserInfoExtendCollection extendCollection =
                UserInfoExtendDataObjectAdapter.Instance.GetUserInfoExtendInfoCollectionByUsers(users);

            UserReportInfoCollection reportLines =
                UserReportInfoAdapter.Instance.LoadUsersReportInfo(users);

            foreach (IUser extend in users)
            {
                UserInfoExtendDataObject ogu = extendCollection.Find(e => string.Compare(e.ID, extend.ID, true) == 0);

                if (ogu != null)
                {
                    FillUserExtendProperties(extend, ogu);
                }

                UserReportInfo reportInfo = reportLines.Find(r => string.Compare(r.User.ID, extend.ID, true) == 0);

                if (reportInfo != null)
                {
                    extend.Properties["ReportTo"] = reportInfo;
                }
            }

            totalCount = users.Count;
            return(new OguObjectCollection <IUser>(users.ToList().OrderBy(u => !u.IsSideline).ToArray()));
        }