示例#1
0
        public static ResponseDTO IsProfileFill(IApartmenthostContext context, string userId, bool checkPhone = false)
        {
            var user    = context.Users.SingleOrDefault(x => x.Id == userId);
            var profile = context.Profile.SingleOrDefault(x => x.Id == userId);

            if (user == null || profile == null)
            {
                return(RespH.Create(RespH.SRV_USER_NOTFOUND));
            }
            if (user.Blocked)
            {
                return(RespH.Create(RespH.SRV_USER_BLOCKED));
            }
            if (!user.EmailConfirmed)
            {
                return(RespH.Create(RespH.SRV_USER_NOT_CONFIRMED));
            }
            if (string.IsNullOrWhiteSpace(profile.FirstName))
            {
                return(RespH.Create(RespH.SRV_USER_NO_NAME));
            }
            if (checkPhone)
            {
                if (user.PhoneStatus != ConstVals.PConf)
                {
                    return(RespH.Create(RespH.SRV_CARD_PHONE_UNCONF));
                }
            }
            return(null);
        }
示例#2
0
 public static ResponseDTO IsNull(double item, string itemName, string errType)
 {
     if (item <= 0)
     {
         var respList = new List <string>();
         respList.Add(itemName);
         return(RespH.Create(errType, respList));
     }
     return(null);
 }
示例#3
0
 public static ResponseDTO IsNull(string item, string itemName, string errType)
 {
     if (string.IsNullOrWhiteSpace(item))
     {
         var respList = new List <string>();
         respList.Add(itemName);
         return(RespH.Create(errType, respList));
     }
     return(null);
 }
示例#4
0
        public static ResponseDTO IsCardNameExist(IApartmenthostContext context, string name, string errType)
        {
            var currentAdvertCount = context.Cards.Count(a => a.Name == name);

            if (currentAdvertCount > 0)
            {
                var respList = new List <string>();
                respList.Add(name);
                return(RespH.Create(RespH.SRV_CARD_EXISTS, respList));
            }
            return(null);
        }
示例#5
0
 public static ResponseDTO IsValidDates(DateTime dateFrom, DateTime dateTo, string errType)
 {
     // Check Dates
     if (string.IsNullOrEmpty(dateFrom.ToString()) && string.IsNullOrEmpty(dateTo.ToString()))
     {
         if (DateTimeOffset.Compare(dateFrom, dateTo) >= 0)
         {
             var respList = new List <string>();
             respList.Add(dateFrom.ToString());
             respList.Add(dateTo.ToString());
             return(RespH.Create(errType, respList));
         }
     }
     return(null);
 }