Esempio n. 1
0
        public ActionResult SubmitScore(string keyValue, int score, string reason)
        {
            var orgAge = agentApp.GetForm(keyValue);

            ScoreDetailLogic.UpdateAgentScore(keyValue, score, reason);
            return(Success("操作成功。"));
        }
Esempio n. 2
0
        public ActionResult ScoreManager(ScoreManageModel model)
        {
            var pageIndex = Request.QueryString["pageindex"];
            int index     = 0;
            int pageSize  = 15;

            Int32.TryParse(pageIndex, out index);
            if (index == 0)
            {
                index = 1;
            }
            var UserInfo = NFine.Code.OperatorProvider.Provider.GetCurrent();

            if (UserInfo == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            ScoreManageModel viewModel = new ScoreManageModel();

            if (base.agentInfo != null)
            {
                CommLogic.DeepClone <AgentInfoModel>(viewModel, agentInfo);
                List <ScoreDetail> list = ScoreDetailLogic.GetList().Where(t => t.c_user_id == agentInfo.agent.c_id).ToList();
                var dataList            = list.OrderByDescending(t => t.c_create_date).Skip <ScoreDetail>((index - 1) * pageSize).Take(pageSize).ToList();
                viewModel.scoreList            = new PagerResult <ScoreDetail>();
                viewModel.scoreList.DataList   = dataList;
                viewModel.scoreList.Code       = 0;
                viewModel.scoreList.Total      = list.Count();
                viewModel.scoreList.PageIndex  = index;
                viewModel.scoreList.PageSize   = pageSize;
                viewModel.scoreList.RequestUrl = "ScoreManager?pageindex=" + index;
            }
            return(View(viewModel));
        }
Esempio n. 3
0
        public ActionResult SubmitForm(AgentEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue)
        {
            var orgAge = agentApp.GetForm(keyValue);

            if (orgAge != null && userEntity.c_score != orgAge.c_score)
            {
                int changeScore = (int)(userEntity.c_score - orgAge.c_score);
                ScoreDetailLogic.UpdateAgentScore(keyValue, changeScore, "管理员后台变更积分");
            }
            agentApp.SubmitForm(userEntity, userLogOnEntity, keyValue);

            return(Success("操作成功。"));
        }
Esempio n. 4
0
        public ActionResult CheckApply(string keyValue)
        {
            ExpApplyEntity entity = entityApp.GetForm(keyValue);

            AgentApp    agApp = new AgentApp();
            AgentEntity ag    = agApp.GetForm(entity.c_agent_id);

            //更新申请表
            entity.c_apply_state = 1;
            entityApp.SubmitForm(entity, keyValue);

            //更新代理商表

            ag.c_agnet_type = (int)AgentType.Fran;
            agApp.SubmitForm(ag, null, ag.F_Id);

            #region 推荐奖励
            //积分奖励
            ScoreLogic.DealRewardScore(ag.F_Id, RewartType.Recommend);

            Agent ag2 = AgentLogic.GetEnityById(entity.c_agent_id);
            #endregion

            //扣减积分
            int score = Convert.ToInt32(CommConfigLogic.GetValueFromConfig((int)ConfigCategory.ScoreConfigCate, (int)RewardConfigKey.expLevelUpScore));
            ScoreDetailLogic.UpdateAgentScore(entity.c_agent_id, -score, "体验店升级扣除");

            //升级
            AgentRelation ar        = AgentRelationLogic.FindEntity(t => t.c_child_id == ag.F_Id);
            Agent         recomm_ag = AgentLogic.GetEnityById(ar.c_parent_id);
            LevelLogic.IsLevelUpWithCondition(recomm_ag);

            #region 生成代理商订单
            Order order = new Order();
            order.c_agent_id   = ag.F_Id;
            order.c_mobile     = ag.c_mobile;
            order.c_state      = (int)OrderState.NoDeliver;
            order.c_remark     = "代理商订单";
            order.c_order_num  = DateTime.Now.ToString("yyyyMMddHHmmss-") + Guid.NewGuid().ToString().Substring(0, 6);
            order.c_order_type = (int)OrderType.Agent;
            OrderLogic.InsertNewEntiy(order);
            #endregion


            return(Success("审核成功。"));
        }
        public ActionResult DealScoreCash(string keyValue, int state)
        {
            ScoreCashEntity entity = scoreApp.GetForm(keyValue);

            entity.F_Id = keyValue;
            if (state == 1)
            {
                entity.c_cash_state = (int)Distribution.Model.CashScoreState.Succ;//0:未审核   1:审核通过
                ScoreDetailLogic.UpdateAgentScore(entity.c_user_id, -entity.c_amount, "积分提现");
            }
            else if (state == 2)
            {
                entity.c_cash_state = (int)Distribution.Model.CashScoreState.Back;//0:未审核   1:审核通过
            }
            scoreApp.UpdateForm(entity);
            return(Success("处理成功。"));
        }
        public ActionResult PostOrder(string OrderId)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                Order order = OrderLogic.GetEnityById(OrderId);
                if (order == null)
                {
                    throw new Exception("未找到订单");
                }
                order.c_total      = OrderDetailLogic.SumOrderTotal(OrderId);
                order.c_order_num  = DateTime.Now.ToString("yyyyMMddHHmmss-") + Guid.NewGuid().ToString().Substring(0, 6);
                order.c_state      = (int)OrderState.NoDeliver;
                order.c_rec_person = agentInfo.agent.c_rec_person;
                order.c_mobile     = agentInfo.agent.c_rec_mobile;
                order.c_address    = agentInfo.agent.c_address;
                if (agentInfo.CanCashScore < order.c_total)
                {
                    throw new Exception("剩余积分不足以支付订单内所有商品");
                }
                OrderLogic.UpdateEntity(order);
                int changeScore = 0 - (int)order.c_total;
                ScoreDetailLogic.UpdateAgentScore(agentInfo.agent.c_id, changeScore, "购买产品");
                var detailList = OrderDetailLogic.GetList().Where(t => t.c_order_id == order.F_Id);
                if (detailList.Count() > 0)
                {
                    int totalAmount = (int)detailList.Sum(t => t.c_amount);
                    ScoreLogic.DealRewardScore(agentInfo.agent.c_id, RewartType.Purchase, totalAmount);
                }

                result.state   = ResultType.success.ToString();
                result.message = "成功";
                return(Content(result.ToJson()));
            }
            catch (Exception ex)
            {
                result.state   = ResultType.error.ToString();
                result.message = string.Format("提交失败({0})", ex.Message);
                return(Content(result.ToJson()));

                throw;
            }
        }
        public BasicController()
        {
            var UserInfo = NFine.Code.OperatorProvider.Provider.GetCurrent();

            ViewBag.UserId = "";
            ViewBag.User   = "";
            if (agentInfo == null)
            {
                agentInfo = new AgentInfoModel();
                if (UserInfo != null)
                {
                    ViewBag.UserId = UserInfo.UserId;
                    ViewBag.User   = UserInfo.UserCode;
                    Agent ag = AgentLogic.GetEnityById(UserInfo.UserId);
                    if (ag == null)
                    {
                        return;
                    }
                    agentInfo.agent = ag;
                    AgentRelation ar = AgentRelationLogic.FindEntity(t => t.c_child_id == ag.c_id);
                    if (ag.c_levle != null)
                    {
                        agentInfo.Level = CommConfigLogic.GetValueFromConfig(1, ag.c_levle);
                    }
                    if (ag.c_agent_level != null)
                    {
                        agentInfo.AgLevel = CommConfigLogic.GetValueFromConfig(2, ag.c_agent_level);
                    }
                    if (ar != null)
                    {
                        agentInfo.RecomAgentName = AgentLogic.GetEnityById(ar.c_parent_id).c_name;
                    }
                    int totalScore = ScoreDetailLogic.GetTotalScore(ag.c_id);
                    int fisrtCount = 0, secondCount = 0, otherCount = 0, expCount = 0;
                    var readSessionAgent = OperatorProvider.Provider.GetAgentInfo(agentInfo.agent.c_id);
                    if (readSessionAgent != null)
                    {
                        fisrtCount  = readSessionAgent.FirstCount;
                        secondCount = readSessionAgent.SecondCount;
                        otherCount  = readSessionAgent.DeptCount;
                        expCount    = readSessionAgent.ExpCount;
                    }
                    else
                    {
                        fisrtCount = AgentRelationLogic.GetFirstCount(ag.c_id, out secondCount, out otherCount, out expCount);
                        AgentInfo sInfo = new AgentInfo();
                        sInfo.AgeId       = agentInfo.agent.c_id;
                        sInfo.FirstCount  = fisrtCount;
                        sInfo.SecondCount = secondCount;
                        sInfo.DeptCount   = otherCount;
                        sInfo.ExpCount    = expCount;
                        OperatorProvider.Provider.AddCurrentAgentInfo(sInfo, agentInfo.agent.c_id);
                    }
                    agentInfo.FirstCount  = fisrtCount;
                    agentInfo.SecondCount = secondCount;
                    agentInfo.OtherCount  = otherCount;
                    agentInfo.ExpCount    = expCount;
                    agentInfo.TotalScore  = totalScore.ToString();
                    int dealingScore = ScoreCashLogic.GetTotalCashScoreByState(ag.c_id, CashScoreState.Dealing);
                    agentInfo.CanCashScore    = ((int)agentInfo.agent.c_score - dealingScore);
                    agentInfo.expLevelUpScore = Convert.ToInt32(CommConfigLogic.GetValueFromConfig((int)ConfigCategory.ScoreConfigCate, (int)RewardConfigKey.expLevelUpScore));;
                    agentInfo.prodStartAmount = Convert.ToInt32(CommConfigLogic.GetValueFromConfig((int)ConfigCategory.ScoreConfigCate, (int)RewardConfigKey.productAmount));
                }
            }
        }