コード例 #1
0
ファイル: ManageGroupEditModel.cs プロジェクト: x1987624/SNS
        /// <summary>
        /// 获取Query
        /// </summary>
        /// <returns></returns>
        public GroupEntityQuery GetGroupQuery()
        {
            long?userIdLong = null;

            if (!string.IsNullOrEmpty(UserId))
            {
                long id;
                long.TryParse(UserId.Replace(",", ""), out id);
                userIdLong = id;
            }

            if (this.StartDate.HasValue && this.EndDate.HasValue && this.StartDate.Value > this.EndDate.Value)
            {
                DateTime temp = this.StartDate.Value;
                this.EndDate   = this.StartDate.Value;
                this.StartDate = temp;
            }


            return(new GroupEntityQuery
            {
                GroupId = this.GroupId,
                UserId = userIdLong,
                GroupNameKeyword = this.GroupNameKeyword,
                CategoryId = this.CategoryId,
                AuditStatus = this.AuditStatus,
                StartDate = this.StartDate,
                EndDate = this.EndDate,
                minMemberCount = this.minMemberCount,
                maxMemberCount = this.maxMemberCount
            });
        }
コード例 #2
0
        /// <summary>
        /// 将Edit转换成对应的Query
        /// </summary>
        /// <returns></returns>
        public BarPostQuery AsBarPostQuery()
        {
            long?userIdLong = null;

            if (!string.IsNullOrEmpty(UserId))
            {
                long id;
                long.TryParse(UserId.Replace(",", ""), out id);
                userIdLong = id;
            }

            if (this.StartDate.HasValue && this.EndDate.HasValue && this.StartDate.Value > this.EndDate.Value)
            {
                DateTime temp = this.StartDate.Value;
                this.StartDate = this.EndDate;
                this.EndDate   = temp;
            }

            return(new BarPostQuery
            {
                AuditStatus = this.AuditStatus,
                EndDate = this.EndDate,
                SectionId = this.SectionId,
                StartDate = this.StartDate,
                PostKeyword = this.PostKeyword,
                UserId = userIdLong
            });
        }
コード例 #3
0
        /// <summary>
        /// 获取Query
        /// </summary>
        /// <returns></returns>
        public BarThreadQuery GetBarThreadQuery()
        {
            long?userIdLong = null;

            if (!string.IsNullOrEmpty(UserId))
            {
                long id;
                long.TryParse(UserId.Replace(",", ""), out id);
                userIdLong = id;
            }

            if (this.StartDate.HasValue && this.EndDate.HasValue && this.StartDate.Value > this.EndDate.Value)
            {
                DateTime temp = this.StartDate.Value;
                this.StartDate = this.EndDate;
                this.EndDate   = temp;
            }

            return(new BarThreadQuery
            {
                AuditStatus = this.AuditStatus,
                EndDate = this.EndDate,
                SectionId = this.SectionId,
                StartDate = this.StartDate,
                SubjectKeyword = this.SubjectKeyword,
                UserId = userIdLong,
                CategoryId = this.CategoryId,
                IsEssential = this.IsEssential,
                IsSticky = this.IsSticky
            });
        }
コード例 #4
0
 private string getUserEndPoint()
 {
     AppClient = AppClient ?? new AppClient();
     return(string.Format("{0}/users/{1}{2}{3}",
                          MSGraphServiceEndPoint,
                          UserId.Replace("@" + AppClient.TenanId, "") + "@" + AppClient.TenanId,
                          EndPoint,
                          ODataQuery));
 }
コード例 #5
0
        public static bool SplitByModel(string data)
        {
            try
            {
                string temp = string.Empty;

                if (data.Split('$').Length < 4)
                {
                    MenuId = (data.Split('$'))[0].ToString();
                    UserId = (data.Split('$'))[1].ToString();
                }
                else
                {
                    MenuId   = (data.Split('$'))[0].ToString();
                    Location = (data.Split('$'))[1].ToString();
                    UserId   = (data.Split('$'))[2].ToString();
                    temp     = (data.Split('$'))[3];
                }

                if (UserId.Contains("*"))
                {
                    UserId = UserId.Replace("*", "");
                }

                GenericObject = new T();

                foreach (var prop in GenericObject.GetType().GetProperties())
                {
                    if (prop.PropertyType == typeof(string))
                    {
                        string t = temp.Split('@')[0];
                        prop.SetValue(GenericObject, t);
                        temp = temp.Remove(temp.IndexOf(t), temp.IndexOf(t) + t.Length + 1);
                    }
                    else
                    {
                        prop.SetValue(GenericObject, temp.Split('@').ToList <string>());
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                GenericObject = new T();
                return(false);
            }
        }