Пример #1
0
        public JsonResult AddNumber(PaymentNoModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单验证成功
            if (ModelState.IsValid)
            {
                IPropertyExpenseNoBLL expenseNoBLL = BLLFactory <IPropertyExpenseNoBLL> .GetBLL("PropertyExpenseNoBLL");

                T_PropertyExpenseNo expenseNo = new T_PropertyExpenseNo()
                {
                    ExpenseNumber  = model.ExpenseNumber,
                    ExpenseTypeId  = model.ExpenseTypeId,
                    Memo           = model.Memo,
                    BuildCompanyId = model.BuildCompanyId,
                    BuildDoorId    = model.DoorId,
                    CreatedDate    = DateTime.Now
                };
                //保存
                expenseNoBLL.Save(expenseNo);

                //日志记录
                jm.Content = PropertyUtils.ModelToJsonString(model);
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public JsonResult Paying(ExpenseDetailsModel model)
        {
            JsonModel jm = new JsonModel();
            //获取要去缴费的缴费明细
            IHouseUserExpenseDetailsBLL expenseDetailsBLL = BLLFactory <IHouseUserExpenseDetailsBLL> .GetBLL("HouseUserExpenseDetailsBLL");

            var expenseDetails = expenseDetailsBLL.GetEntity(u => u.Id == model.Id);

            if (expenseDetails == null)
            {
                jm.Msg = "该缴费记录不存在";
            }
            else if (expenseDetails.IsPayed == ConstantParam.PAYED_TRUE)
            {
                jm.Msg = "该缴费记录已缴费";
            }
            else
            {
                expenseDetails.IsPayed     = ConstantParam.PAYED_TRUE;
                expenseDetails.PaymentType = 1;
                expenseDetails.PayedDate   = DateTime.Now;
                expenseDetails.Operator    = GetSessionModel().UserID;
                expenseDetails.InvoiceType = model.InvoiceType;

                //编辑成功
                if (expenseDetailsBLL.Update(expenseDetails))
                {
                    //记录操作日志
                    jm.Content = PropertyUtils.ModelToJsonString(model);
                }
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult ReceiveMassTextingDetail(int id)
        {
            WeixinApiInit();
            var Owner = GetCurrentUser();

            //将该圈子发给当前用户的群发消息改为已读
            IUserSocialCircleMassTextingBLL usMassTextingBll = BLLFactory <IUserSocialCircleMassTextingBLL> .GetBLL("UserSocialCircleMassTextingBLL");

            var usMassTextings = usMassTextingBll.GetList(um => um.UserId == Owner.Id && um.SocialCircleMassTexting.SocialCircleId == id && um.IsNoRead).ToList();

            foreach (var texting in usMassTextings)
            {
                texting.IsNoRead = false;
                usMassTextingBll.Update(texting);
            }
            //获取指定圈子的信息
            ISocialCircleBLL socialCircleBll = BLLFactory <ISocialCircleBLL> .GetBLL("SocialCircleBLL");

            var sc = socialCircleBll.GetEntity(s => s.Id == id);

            SocialCircleChatModel model = new SocialCircleChatModel()
            {
                Id   = sc.Id,
                Name = sc.Name
            };

            ViewBag.TimeInterval = Convert.ToInt32(PropertyUtils.GetConfigParamValue("ChatTimeInterval"));
            return(View(model));
        }
Пример #4
0
        public JsonResult AddCategory(TopicTypeModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单模型验证成功
            if (ModelState.IsValid)
            {
                //模型赋值
                T_PostBarTopicType category = new T_PostBarTopicType()
                {
                    Name            = model.CategoryName,
                    PropertyPlaceId = GetSessionModel().PropertyPlaceId.Value
                };
                //调用BLL层进行添加处理
                IPostBarTopicTypeBLL categoryBll = BLLFactory <IPostBarTopicTypeBLL> .GetBLL("PostBarTopicTypeBLL");

                categoryBll.Save(category);
                //记录日志
                jm.Content = PropertyUtils.ModelToJsonString(model);
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        protected ArrayList ExecuteSQL(string sql)
        {
            SqlConnection conn = new SqlConnection(DBUtils.GetDBConnectionString());
            //DateTime time = DateTime.Now;
            //log.Debug(sql);
            //log.Debug("Start query at " + time);

            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = sql;
            cmd.CommandType = CommandType.Text;
            SqlDataReader reader = null;

            try
            {
                conn.Open();
                reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                ArrayList result = new ArrayList();
                while (reader.Read())
                {
                    result.Add(PropertyUtils.PopulateModel(reader, className));
                }
                //log.Debug("finish query at " + time + ", duration(s) = " + (DateTime.Now - time));
                return(result);
            }
            catch (Exception ex)
            {
                throw new FacadeException(ex);
            }
            finally
            {
                conn.Close();
            }
        }
Пример #6
0
        public ActionResult AddDoor(BuildDoorSearchModel model)
        {
            JsonModel     jm      = new JsonModel();
            IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            if (doorBll.Exist(m => m.DoorName == model.DoorName && m.Id != model.DoorId && m.UnitId == model.UnitId))
            {
                jm.Msg = "该单元户名称已经存在";
            }
            //如果表单模型验证成功
            else if (ModelState.IsValid)
            {
                T_BuildDoor newDoor = new T_BuildDoor()
                {
                    DoorName = model.DoorName,
                    UnitId   = model.UnitId
                };
                // 保存到数据库
                doorBll.Save(newDoor);

                //日志记录
                jm.Content = PropertyUtils.ModelToJsonString(model);
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Пример #7
0
 //修改2 按需修改
 public static void UpdateEntity <TEntity>(this DbContext db, Expression <Func <TEntity, TEntity> > propertyExpression) where TEntity : class, new()
 {
     try
     {
         var memberInitExpression = propertyExpression.Body as MemberInitExpression;
         var entity = PropertyUtils.CreateEntity(propertyExpression);
         DbEntityEntry <TEntity> entry = db.Entry(entity);
         entry.State = EntityState.Unchanged;
         if (memberInitExpression != null)
         {
             foreach (var memberInfo in memberInitExpression.Bindings)
             {
                 string propertyName = memberInfo.Member.Name;
                 entry.Property(propertyName).IsModified = true;
             }
         }
         db.Configuration.ValidateOnSaveEnabled = false;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
         db.Configuration.AutoDetectChangesEnabled = true;
     }
 }
Пример #8
0
        protected BaseModel FindModel(string sql)
        {
            SqlConnection conn = new SqlConnection(Global.ConnectionString);
            //log.Debug(sql);
            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandType = CommandType.Text;

            cmd.CommandText = sql;
            SqlDataReader reader = null;

            try
            {
                conn.Open();
                reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                if (reader.Read())
                {
                    return(PropertyUtils.PopulateModel(reader, className));
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
Пример #9
0
        public ApiPageResultModel DisposeFeedbackList([FromUri] PagedSearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //根据用户ID查找业主
                IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果业主存在
                if (owner != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    owner.LatelyLoginTime  = DateTime.Now;
                    owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    ownerBll.Update(owner);

                    //获取要公示的问题解决反馈 总个数和分页数据
                    IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL");

                    //条件已处理和要公示
                    var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId);
                    Expression <Func <T_Question, bool> > where = u => u.Status == ConstantParam.DISPOSED && u.IsPublish == ConstantParam.PUBLISHED_TRUE &&
                                                                  placeList.Contains(u.PropertyPlaceId);
                    resultModel.Total  = questionBll.Count(where);
                    resultModel.result = questionBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(q => new
                    {
                        Id              = q.Id,
                        Title           = q.Title,
                        Desc            = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc,
                        UploadUserName  = q.UploadUser.UserName,
                        UploadTime      = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        Imgs            = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Split(';'),
                        AudioPath       = q.AudioPath,
                        VoiceDuration   = q.VoiceDuration,
                        PlaceName       = q.PropertyPlace.Name,
                        DisposeDesc     = q.QuestionDisposes.FirstOrDefault().DisposeDesc,
                        DisposeUserName = string.IsNullOrEmpty(q.QuestionDisposes.FirstOrDefault().DisposeUser.TrueName) ?
                                          q.QuestionDisposes.FirstOrDefault().DisposeUser.UserName : q.QuestionDisposes.FirstOrDefault().DisposeUser.TrueName,
                        DisposesTime = q.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss")
                    });
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
Пример #10
0
        public ActionResult EditDoor(BuildDoorSearchModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单模型验证成功
            if (ModelState.IsValid)
            {
                IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

                T_BuildDoor doorInfo = doorBll.GetEntity(m => m.Id == model.DoorId);
                if (doorInfo != null)
                {
                    doorInfo.DoorName = model.DoorName;
                    // 保存到数据库
                    doorBll.Update(doorInfo);

                    //日志记录
                    jm.Content = PropertyUtils.ModelToJsonString(model);
                }
                else
                {
                    jm.Msg = "该单元户不存在";
                }
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Пример #11
0
        public ActionResult AddBuildCompany(BuildCompanyModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单模型验证成功
            if (ModelState.IsValid)
            {
                IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

                T_BuildCompany buildCompany = new T_BuildCompany()
                {
                    Name            = model.Name,
                    Phone           = model.Phone,
                    Desc            = model.Desc,
                    PayDesc         = model.PayDesc,
                    ServiceDesc     = model.ServiceDesc,
                    PropertyPlaceId = GetSessionModel().PropertyPlaceId.Value
                };
                // 保存
                buildCompanyBll.Save(buildCompany);

                //日志记录
                jm.Content = PropertyUtils.ModelToJsonString(model);
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Пример #12
0
        public ApiResultModel DeleteReply(DeleteReplyModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //根据用户ID查找业主
                IUserBLL userBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                T_User user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

                if (user != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }

                    //更新最近登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));

                    userBll.Update(user);

                    //获取要删除的回复内容
                    IPostBarTopicDiscussBLL postBarTopicDiscussBll = BLLFactory <IPostBarTopicDiscussBLL> .GetBLL("PostBarTopicDiscussBLL");

                    T_PostBarTopicDiscuss reply = postBarTopicDiscussBll.GetEntity(u => u.Id == model.Id);

                    //如果该回复存在
                    if (reply == null)
                    {
                        resultModel.Msg = "该回复不存在";
                    }
                    else
                    {
                        if (reply.ParentId == null)
                        {
                            postBarTopicDiscussBll.DeleteLevelOneDiscuss(reply.Id);
                        }
                        else
                        {
                            postBarTopicDiscussBll.Delete(reply);
                        }
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
Пример #13
0
        public ApiPageResultModel GetAllTopicListByType([FromUri] AllTopicPagedSearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //根据用户ID查找业主
                IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果业主存在
                if (owner != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    owner.LatelyLoginTime  = DateTime.Now;
                    owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    ownerBll.Update(owner);

                    var collectedTopicIds = owner.UserPostBarTopics.Select(o => o.PostBarTopicId).ToList();

                    IPostBarTopicBLL topicBLL = BLLFactory <IPostBarTopicBLL> .GetBLL("PostBarTopicBLL");

                    // 获取小区某分类下的所有主题列表
                    var list = topicBLL.GetSetTopPageList(m => m.PropertyPlaceId == model.PropertyPlaceId && m.TopicTypeId == model.TopicTypeId, model.PageIndex, ConstantParam.PAGE_SIZE).Select(m => new
                    {
                        Id           = m.Id,
                        PostDate     = m.PostDate.ToString("yyyy-MM-dd HH:mm:ss"),
                        IsTop        = m.IsTop,
                        UserImage    = m.PostUser.HeadPath,
                        UserName     = m.PostUser.UserName,
                        Title        = m.Title,
                        Content      = m.Content,
                        PicList      = m.ImgPath,
                        CommentCount = m.PostBarTopicDiscusss.Count(),
                        IsCollected  = collectedTopicIds.Contains(m.Id) ? 1 : 0,
                        TopicType    = m.PostBarTopicType.Name,
                        PostUserId   = m.PostUserId
                    }).ToList();

                    resultModel.result = list;
                    resultModel.Total  = topicBLL.Count(m => m.PropertyPlaceId == model.PropertyPlaceId && m.TopicTypeId == model.TopicTypeId);
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
Пример #14
0
        public ActionResult CompanyPlatformLogin(AccountModel model)
        {
            //判断提交模型数据是否正确
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            string code = (string)Session["ValidateCode"];

            if (model.CheckCode != code)
            {
                ModelState.AddModelError("CheckCode", "验证码不正确");
                return(View(model));
            }

            //根据用户名查找用户
            ICompanyUserBLL companyUserBll = BLLFactory <ICompanyUserBLL> .GetBLL("CompanyUserBLL");

            T_CompanyUser user = companyUserBll.GetEntity(u => u.UserName == model.UserName.Trim() &&
                                                          u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //1.判断用户名是否正确
            if (user == null)
            {
                ModelState.AddModelError("UserName", "用户名不存在");
                return(View(model));
            }

            //2.判断密码是否正确
            string md5Str = PropertyUtils.GetMD5Str(model.Password);

            if (user.Password != md5Str)
            {
                ModelState.AddModelError("Password", "密码不正确");
                return(View(model));
            }

            //3.如果未设置角色
            if (user.CompanyUserRoles.Count == 0)
            {
                ModelState.AddModelError("UserName", "该用户未设置角色,请联系管理员");
                return(View(model));
            }
            //4.获取用户对象信息(权限菜单,Action等)保存基本信息到session中
            this.SetUserSessiong(user, companyUserBll);

            //5.判断是否拥有访问首页的权限
            UserSessionModel session = (UserSessionModel)Session[ConstantParam.SESSION_USERINFO];

            if (session.IsMgr == ConstantParam.USER_ROLE_DEFAULT && !session.ActionDic.ContainsKey("/CompanyPlatform/Index"))
            {
                ModelState.AddModelError("UserName", "该用户无访问权限,请联系管理员");
                return(View(model));
            }
            BreadCrumb.ClearState();
            //5.跳转到
            return(RedirectToAction("Index", "CompanyPlatform"));
        }
Пример #15
0
        public ApiResultModel DeleteOrder(DetailSearchModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //获取当前商家用户
                IShopUserBLL shopUserBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                var user = shopUserBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                if (user == null)
                {
                    resultModel.Msg = APIMessage.NO_USER;
                    return(resultModel);
                }
                //如果验证Token不通过或已过期
                if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                {
                    resultModel.Msg = APIMessage.TOKEN_INVALID;
                    return(resultModel);
                }
                //更新最近登录时间和Token失效时间
                user.LatelyLoginTime  = DateTime.Now;
                user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                shopUserBll.Update(user);

                //获取指定订单
                IOrderBLL orderBll = BLLFactory <IOrderBLL> .GetBLL("OrderBLL");

                var order = orderBll.GetEntity(o => o.Id == model.Id && o.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && o.IsStoreHided == ConstantParam.DEL_FLAG_DEFAULT);

                if (order != null)
                {
                    if (order.OrderStatus == ConstantParam.OrderStatus_FINISH || order.OrderStatus == ConstantParam.OrderStatus_EXIT || order.OrderStatus == ConstantParam.OrderStatus_CLOSE)
                    {
                        order.IsStoreHided = ConstantParam.DEL_FLAG_DELETE;
                        //删除订单
                        if (!orderBll.Update(order))
                        {
                            resultModel.Msg = "订单删除失败";
                        }
                    }
                    else
                    {
                        resultModel.Msg = "当前状态的订单不能被删除";
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.ORDER_NOEXIST;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
Пример #16
0
        /// <summary>
        /// 编辑小区信息
        /// </summary>
        public JsonModel EditPlace(PropertyPlaceModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单模型验证成功
            if (ModelState.IsValid)
            {
                IPropertyCompanyBLL companyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL");

                //如果对应的公司不存在(被删除)
                if (!companyBll.Exist(c => c.Id == model.CompanyId && c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT))
                {
                    jm.Msg = "当前物业总公司不存在";
                }
                else
                {
                    //获取指定ID且未删除的小区
                    IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

                    T_PropertyPlace place = placeBll.GetEntity(m => m.Id == model.PlaceId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

                    if (place != null)
                    {
                        //重新给数据实体赋值
                        place.Name       = model.PlaceName;
                        place.CompanyId  = model.CompanyId;
                        place.ProvinceId = model.ProvinceId;
                        place.CityId     = model.CityId;
                        place.CountyId   = model.CountyId;
                        place.Address    = model.Address;
                        place.Longitude  = model.Longitude;
                        place.Latitude   = model.Latitude;
                        place.Tel        = model.Tel;
                        place.Content    = model.Content;
                        place.PlaceType  = model.PlaceType;
                        place.IsValidate = model.IsValidate ? 0 : 1;
                        //编辑
                        if (placeBll.Update(place))
                        {
                            //日志记录
                            jm.Content = PropertyUtils.ModelToJsonString(model);
                        }
                        else
                        {
                            jm.Msg = "编辑失败";
                        }
                    }
                    else
                    {
                        jm.Msg = "该物业小区不存在";
                    }
                }
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(jm);
        }
Пример #17
0
        public ApiPageResultModel OwnInspectionExceptionList([FromUri] PagedSearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL");

                T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

                if (user != null)
                {
                    //验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }

                    //更新登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    userBll.Update(user);

                    Expression <Func <T_InspectionResult, bool> > where = u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.InspectionTimePlan.InspectionPlan.PropertyPlaceId == user.PropertyPlaceId && u.Status == ConstantParam.EXCEPTION && u.DisposerId == user.Id;

                    //获取巡检异常总个数和分页数据
                    IInspectionResultBLL resultBll = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL");

                    resultModel.Total  = resultBll.Count(where);
                    resultModel.result = new
                    {
                        ExceptionList = resultBll.GetOwnInspectionResultPageList(where, model.PageIndex, ConstantParam.PAGE_SIZE).Select(r => new
                        {
                            Id            = r.Id,
                            PlanName      = r.InspectionTimePlan.InspectionPlan.PlanName,
                            PointName     = r.InspectionPoint.PointName,
                            Desc          = string.IsNullOrEmpty(r.Desc) ? "" : r.Desc,
                            DisposeStatus = r.DisposeStatus == null ? ConstantParam.NO_DISPOSE : r.DisposeStatus.Value,
                            UploadTime    = r.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"),
                            Uploader      = r.UploadUser.UserName,
                            Imgs          = string.IsNullOrEmpty(r.Imgs) ? new string[] { } : r.Imgs.Split(';'),
                            DisposeDesc   = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeDesc : "",
                            DisposeTime   = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") : "",
                            DisposeUser   = r.DisposeStatus == ConstantParam.DISPOSED ? r.ExceptionDisposes.FirstOrDefault().DisposeUser.UserName : (r.DisposerId != null ? r.Disposer.UserName : "")
                        })
                    };
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
Пример #18
0
 public void GenerateEntryID_Invalid_NodeID_Not_Null()
 {
     using (var mockPst = IntegrationUtil.GetMockPst())
     {
         EntryID entryId = PropertyUtils.GenerateEntryID(PropertyUtilsMockConstants.PROPERTY_UTILS_INVALID_NODE, mockPst.DatabaseAccessor);
         Assert.IsNotNull(entryId);
     }
 }
Пример #19
0
 public void GenerateEntryID_EntryID_Not_Empty()
 {
     using (var mockPst = IntegrationUtil.GetMockPst())
     {
         EntryID entryId = PropertyUtils.GenerateEntryID(PropertyUtilsMockConstants.PROPERTY_UTILS_VALID_NODE, mockPst.DatabaseAccessor);
         Assert.AreNotEqual(entryId, EntryID.Empty);
     }
 }
Пример #20
0
 /// <summary>
 /// Resets the property value on all selected objects.</summary>
 public virtual void ResetValue()
 {
     m_transactionContext.DoTransaction(delegate
     {
         PropertyUtils.ResetProperty(new object[] { m_object }, m_descriptor);
     },
                                        string.Format("Reset: {0}".Localize(), m_descriptor.DisplayName));
 }
Пример #21
0
 /// <summary>
 /// Sets the property value on all selected objects</summary>
 /// <param name="newValue">New property value</param>
 public virtual void SetValue(object newValue)
 {
     m_transactionContext.DoTransaction(delegate
     {
         PropertyUtils.SetProperty(m_object, m_descriptor, newValue);
     },
                                        string.Format("Edit: {0}".Localize(), m_descriptor.DisplayName));
 }
Пример #22
0
        public ActionResult GetValidateCode()
        {
            string code = PropertyUtils.CreateValidateCode(5);

            Session["ValidateCode"] = code;
            byte[] bytes = this.CreateValidateGraphic(code);
            return(File(bytes, @"image/jpeg"));
        }
Пример #23
0
        public JsonResult AddShopSales(ShopSaleModel model)
        {
            JsonModel Jm = new JsonModel();

            if (ModelState.IsValid)
            {
                var currentShopId = GetCurrentShopId();
                //如果门店已创建
                if (currentShopId != null)
                {
                    T_ShopSale ShopSale = new T_ShopSale();
                    ShopSale.Title           = model.Title;
                    ShopSale.Phone           = model.Phone;
                    ShopSale.Content         = model.Content;
                    ShopSale.GoodsCategoryId = model.GoodsCategoryId.Value;
                    ShopSale.RemainingAmout  = model.RemainingAmout;
                    ShopSale.Price           = model.Price;
                    ShopSale.CreateTime      = DateTime.Now;
                    ShopSale.InSales         = 1;
                    //促销BLL
                    IShopSaleBLL SaleBLL = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                    //保存
                    SaleBLL.Save(ShopSale);

                    //绿色直供推送
                    if (model.IsPush)
                    {
                        IShopBLL shopBLL = BLLFactory <IShopBLL> .GetBLL("ShopBLL");

                        string shopName = shopBLL.GetEntity(s => s.Id == currentShopId).ShopName;

                        //推送给业主客户端
                        IUserPushBLL userPushBLL = BLLFactory <IUserPushBLL> .GetBLL("UserPushBLL");

                        var registrationIds = userPushBLL.GetList(p => !string.IsNullOrEmpty(p.RegistrationId)).Select(p => p.RegistrationId).ToArray();

                        string alert = shopName + "的商品" + model.Title + "上架了";
                        bool   flag  = PropertyUtils.SendPush("商品上架", alert, ConstantParam.MOBILE_TYPE_OWNER, registrationIds);
                        if (!flag)
                        {
                            Jm.Msg = "推送发生异常";
                        }
                    }
                    //记录 Log
                    Jm.Content = Property.Common.PropertyUtils.ModelToJsonString(model);
                }
                else
                {
                    Jm.Msg = "门店还未创建";
                }
            }
            else
            {
                Jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(Jm, JsonRequestBehavior.AllowGet));
        }
Пример #24
0
        public ApiResultModel GetVersionInfo([FromUri] TokenModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //获取当前用户
                IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL");

                T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                if (user != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    userBll.Update(user);

                    //调用版本信息BLL层获取最新的版本信息
                    IMobileVersionBLL versionBll = BLLFactory <IMobileVersionBLL> .GetBLL("MobileVersionBLL");

                    var Versions = versionBll.GetList(v => v.Type == ConstantParam.MOBILE_TYPE_PROPERTY, "VersionCode", false);
                    //如果版本信息不为空
                    if (Versions != null && Versions.Count() > 0)
                    {
                        var highestVersion = Versions.First();
                        if (highestVersion != null)
                        {
                            resultModel.result = new
                            {
                                VersionCode = highestVersion.VersionCode,
                                VersionName = highestVersion.VersionName,
                                Desc        = highestVersion.Desc,
                                ApkFilePath = highestVersion.ApkFilePath
                            };
                        }
                    }
                    else
                    {
                        resultModel.Msg = APIMessage.NO_APP;
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
Пример #25
0
        public ApiPageResultModel GetSaleList([FromUri] GoodsSearchModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //根据用户ID查找业主
                IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果业主存在
                if (owner != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    owner.LatelyLoginTime  = DateTime.Now;
                    owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    ownerBll.Update(owner);

                    //该门店销售中的商品
                    Expression <Func <T_ShopSale, bool> > where = s => s.GoodsCategory.ShopId == model.ShopId && s.InSales == 1;
                    //如果选择了商品分类
                    if (model.GoodsCategoryId > 0)
                    {
                        where = PredicateBuilder.And(where, s => s.GoodsCategoryId == model.GoodsCategoryId);
                    }
                    //获取指定门店指定类别的商品列表
                    IShopSaleBLL SaleBll = BLLFactory <IShopSaleBLL> .GetBLL("ShopSaleBLL");

                    resultModel.Total  = SaleBll.Count(where);
                    resultModel.result = SaleBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(s => new
                    {
                        GoodsId        = s.Id,
                        GoodsName      = s.Title,
                        GoodsDesc      = s.Content,
                        RemainingAmout = s.RemainingAmout,
                        SellAmout      = s.OrderDetails.Where(od => od.Order.OrderStatus == ConstantParam.OrderStatus_FINISH).Select(od => od.SaledAmount).ToArray().Sum(),
                        GoodsCoverImg  = string.IsNullOrEmpty(s.ImgThumbnail) ? "" : s.ImgThumbnail.Split(';')[0],
                        GoodsOtherImg  = string.IsNullOrEmpty(s.ImgPath) ? "" : s.ImgPath,
                        Price          = s.Price
                    });
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }
            return(resultModel);
        }
Пример #26
0
        private void AssignNumericHeaderProperties()
        {
            PropertyUtils.PopulateIntProperties(ReplayHeader.Game);

            foreach (var player in ReplayHeader.Players)
            {
                PropertyUtils.PopulateIntProperties(player);
            }
        }
Пример #27
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Environment.CurrentDirectory: " + Environment.CurrentDirectory);
            Console.WriteLine("Directory.GetCurrentDirectory(): " + Directory.GetCurrentDirectory());

            //加载全局配置
            GlobalProperties = PropertyUtils.Load("include=*.properties", Environment.CurrentDirectory);
            BuildWebHost(args, GlobalProperties["server.urls"].Split(';')).Run();
        }
Пример #28
0
        public ApiPageResultModel GetMyLevel2RepliesList([FromUri] Level2RepliedListModel model)
        {
            ApiPageResultModel resultModel = new ApiPageResultModel();

            try
            {
                //根据用户ID查找业主
                IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果业主存在
                if (owner != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    owner.LatelyLoginTime  = DateTime.Now;
                    owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    ownerBll.Update(owner);


                    IPostBarTopicDiscussBLL topicDiscussBLL = BLLFactory <IPostBarTopicDiscussBLL> .GetBLL("PostBarTopicDiscussBLL");

                    var level1Disscuss = topicDiscussBLL.GetEntity(m => m.Id == model.Id);
                    // 获取我的二级回复列表
                    var list = topicDiscussBLL.GetPageList(m => m.ParentId == model.Id && m.TopicId == model.TopicId, "PostTime", true, model.PageIndex, ConstantParam.PAGE_SIZE).Select(m => new
                    {
                        Id              = m.Id,
                        PostDate        = m.PostTime.ToString("yyyy-MM-dd HH:mm:ss"),
                        UserId          = m.PostUserId,
                        UserImage       = m.PostUser.HeadPath,
                        UserName        = m.PostUser.UserName,
                        Content         = m.Content,
                        PicList         = m.ImgPath,
                        RepliedUserName = m.ReplyUser.UserName,
                        Level2ParentId  = m.ParentId
                    }).ToList();

                    resultModel.result = list;
                    resultModel.Total  = topicDiscussBLL.Count(m => m.ParentId == model.Id && m.TopicId == model.TopicId);
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
Пример #29
0
        public ApiResultModel DelGoodsCategory(GoodsCategoryInfoModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //获取当前商家用户
                IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                //如果商家用户存在
                if (user != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    userBll.Update(user);

                    if (model.Id.HasValue)
                    {
                        IGoodsCategoryBLL goodsBLL = BLLFactory <IGoodsCategoryBLL> .GetBLL("GoodsCategoryBLL");

                        var goodsCategory = goodsBLL.GetEntity(g => g.Id == model.Id.Value);

                        if (goodsCategory == null)
                        {
                            resultModel.Msg = "该商品分类不存在";
                        }
                        else if (goodsCategory.ShopSales.Count() > 0)
                        {
                            resultModel.Msg = "已有该商品分类的商品,无法删除";
                        }
                        else
                        {
                            goodsBLL.Delete(goodsCategory);
                        }
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }
Пример #30
0
        public ApiResultModel GetShopUserInfo([FromUri] TokenModel model)
        {
            ApiResultModel resultModel = new ApiResultModel();

            try
            {
                //获取当前用户
                IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL");

                T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

                if (user != null)
                {
                    //如果验证Token不通过或已过期
                    if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token)
                    {
                        resultModel.Msg = APIMessage.TOKEN_INVALID;
                        return(resultModel);
                    }
                    //更新最近登录时间和Token失效时间
                    user.LatelyLoginTime  = DateTime.Now;
                    user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid")));
                    userBll.Update(user);

                    var shop = user.Shops.FirstOrDefault();
                    //如果商家信息不为空
                    if (shop != null)
                    {
                        resultModel.result = new
                        {
                            ShopUserName  = user.UserName,
                            ShopUserImage = user.HeadPath,
                            ShopName      = shop.ShopName,
                            TrueName      = user.TrueName,
                            UserGender    = user.Gender.HasValue ? user.Gender.Value == 1 ? "男" : "女" : "",
                            PhoneNumber   = user.Phone,
                            Email         = user.Email
                        };
                    }
                    else
                    {
                        resultModel.Msg = APIMessage.SHOP_NOEXIST;
                    }
                }
                else
                {
                    resultModel.Msg = APIMessage.NO_USER;
                }
            }
            catch
            {
                resultModel.Msg = APIMessage.REQUEST_EXCEPTION;
            }

            return(resultModel);
        }