public ActionResult ScoreCash(string agentId, int amount, string bankAccount, string bankPerson, string bankName)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                ScoreCash sc = new ScoreCash();
                sc.c_user_id      = agentId.ToString();
                sc.c_cash_state   = 0;
                sc.c_amount       = amount;
                sc.c_bank_name    = bankName;
                sc.c_bank_person  = bankPerson;
                sc.c_bank_account = bankAccount;
                sc.F_CreatorTime  = DateTime.Now;
                ScoreCashLogic.InsertNewEntiy(sc);
                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 ActionResult ScoreCashManager(ScoreCashModel 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"));
            }
            ScoreCashModel viewModel = new ScoreCashModel();

            if (base.agentInfo != null)
            {
                CommLogic.DeepClone <AgentInfoModel>(viewModel, agentInfo);
                List <ScoreCash> list = ScoreCashLogic.GetList().Where(t => t.c_user_id == agentInfo.agent.c_id).ToList();
                viewModel.cashList            = new PagerResult <ScoreCash>();
                viewModel.cashList.DataList   = list.OrderByDescending(t => t.F_CreatorTime).Skip <ScoreCash>((index - 1) * pageSize).Take(pageSize);
                viewModel.cashList.Code       = 0;
                viewModel.cashList.Total      = list.Count();
                viewModel.cashList.PageIndex  = index;
                viewModel.cashList.PageSize   = pageSize;
                viewModel.cashList.RequestUrl = "ScoreCashManager?pageindex=" + index;
            }
            return(View(viewModel));
        }
        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));
                }
            }
        }