Exemple #1
0
        private void allLabels_Click(object sender, EventArgs e)
        {
            Label tempLabel = (Label)sender;

            tempLabel.Text = counter.ToString();
            SizeColorText tempSizeColorText = new SizeColorText();

            tempSizeColorText.mSize  = tempLabel.Size;
            tempSizeColorText.mColor = tempLabel.BackColor;
            tempSizeColorText.mText  = tempLabel.Text;
            myICommon.Add(tempSizeColorText);
        }
Exemple #2
0
        /// <summary>
        /// 农机手应大农户的需求(向大农户需求响应表添加记录)
        /// </summary>
        /// <param name="id">需求id</param>
        /// <param name="userId">农机手id</param>
        /// <returns>JsonResult.</returns>
        public JsonResult ReplyRequirement(long id, long userId)
        {
            using (ResponseResult <T_FARMER_DEMAND_RESPONSE_RELATION> result = new ResponseResult <T_FARMER_DEMAND_RESPONSE_RELATION>())
            {
                T_FARMER_PUBLISHED_DEMAND firstmodel = _commonRepository.GetById <T_FARMER_PUBLISHED_DEMAND>(f => f.Id == id);
                //验证需求是否存在于大农户需求表中
                if (firstmodel != null)
                {
                    //判断用户是否在骗积分
                    if (userId == firstmodel.CreateUserId)
                    {
                        result.IsSuccess = false;
                        result.Message   = ResponeString.YourSelfRequirement;
                        return(Json(result));
                    }
                    //验证是否是发布给农机手的需求
                    if (_commonRepository.CheckTypeid <T_SYS_DICTIONARY>(s => s.Code == firstmodel.DemandTypeId && s.ParentCode == 100100))
                    {
                        //验证userid是否是农机手id
                        if (_commonRepository.CheckUserId(userId, (int)RoleType.MachineryOperator))
                        {
                            //验证需求为待响应
                            if (firstmodel.PublishStateId == 100501)
                            {
                                //验证当前用户是否接受过此订单
                                if (!_commonRepository.CheckTypeid <T_FARMER_DEMAND_RESPONSE_RELATION>(f => f.DemandId == id && f.UserId == userId))
                                {
                                    T_FARMER_DEMAND_RESPONSE_RELATION model = new T_FARMER_DEMAND_RESPONSE_RELATION()
                                    {
                                        DemandId   = id,
                                        UserId     = userId,
                                        CreateTime = Utility.TimeHelper.GetChinaLocalTime(),
                                        ReplyTime  = Utility.TimeHelper.GetChinaLocalTime(),
                                        //增加新增字段ww
                                        ReplyTimeFarmer = Utility.TimeHelper.GetChinaLocalTime()
                                    };
                                    //添加响应记录
                                    _commonRepository.Add <T_FARMER_DEMAND_RESPONSE_RELATION>(model);
                                    //响应成功后更改需求状态为待评价(100502)
                                    firstmodel.PublishStateId = 100502;
                                    _commonRepository.Modify <T_FARMER_PUBLISHED_DEMAND>(firstmodel, f => f.Id == id);
                                    result.IsSuccess = true;
                                    result.Entity    = model;

                                    //给大农户发送一个通知
                                    _notificationService.Insert(new T_NOTIFICATION
                                    {
                                        MsgContent           = "您的需求有人响应啦,快去看看吧!",
                                        IsPublic             = false,
                                        TargetUserId         = firstmodel.CreateUserId,
                                        NotificationType     = 3,
                                        NotificationSource   = "",
                                        NotificationSourceId = firstmodel.Id
                                    });
                                    #region 调用E田接口,更新订单状态
                                    //接受订单
                                    Task taskasync = new Task(() => AcceptOrder(firstmodel, model.UserId, model, 0));
                                    taskasync.Start();
                                    #endregion
                                }
                                else
                                {
                                    result.IsSuccess = false;
                                    result.Message   = ResponeString.NotRepeatApplication;
                                }
                            }
                            else
                            {
                                result.IsSuccess = false;
                                result.Message   = ResponeString.RequirementOver;
                            }
                        }
                        else
                        {
                            result.IsSuccess = false;
                            result.Message   = string.Format("{0} - " + ResponeString.NoJurisdiction, userId.ToString());
                        }
                    }
                    else
                    {
                        result.IsSuccess = false;
                        result.Message   = ResponeString.NotFAccept;
                    }
                }
                else
                {
                    result.IsSuccess = false;
                    result.Message   = ResponeString.NoRequirement;
                }

                return(Json(result));
            }
        }