Example #1
0
        public ActionResult DeleteForm(string keyValue)
        {
            var orgAge     = agentApp.GetForm(keyValue);
            int firstCount = AgentRelationLogic.GetFirstCustomer(keyValue).Count();

            if (orgAge.c_state != 0 || firstCount > 0)
            {
                return(Error("删除失败,审核已通过或伞下有会员。"));
            }
            agentApp.DeleteForm(keyValue);
            return(Success("删除成功。"));
        }
Example #2
0
        public ActionResult DisabledAccount(string keyValue)
        {
            int firstCount = AgentRelationLogic.GetFirstCustomer(keyValue).Count();

            if (firstCount > 0)
            {
                return(Error("禁用失败,伞下有会员。"));
            }
            AgentEntity userEntity = new AgentEntity();

            userEntity.F_Id    = keyValue;
            userEntity.c_state = 0;//0:未审核   1:审核通过
            agentApp.UpdateForm(userEntity);
            return(Success("账户禁用成功。"));
        }
        /// <summary>
        /// 获取客户关系数据
        /// </summary>
        /// <returns></returns>
        public string data()
        {
            string ageId = agentInfo.agent.c_id;


            RelationModel relation = new RelationModel();

            relation.name   = agentInfo.agent.c_name;
            relation.number = agentInfo.agent.c_mobile;
            List <RelationModel> children = new List <RelationModel>();
            var list = AgentRelationLogic.GetFirstCustomer(ageId);

            foreach (var item in list)
            {
                if (item != null)
                {
                    RelationModel m = new RelationModel();
                    m.name   = item.c_name;
                    m.number = item.c_mobile;
                    m.level  = CommConfigLogic.GetValueFromConfig((int)ConfigCategory.PostitionLevel, item.c_levle);
                    List <RelationModel> secondList = new List <RelationModel>();
                    var sList = AgentRelationLogic.GetFirstCustomer(item.c_id);
                    if (sList.Count() > 0)
                    {
                        foreach (var second in sList)
                        {
                            if (second != null)
                            {
                                RelationModel m2 = new RelationModel();
                                m2.name   = second.c_name;
                                m2.number = second.c_mobile;
                                m2.level  = CommConfigLogic.GetValueFromConfig((int)ConfigCategory.PostitionLevel, second.c_levle);
                                secondList.Add(m2);
                            }
                        }
                        m.children = secondList;
                    }
                    children.Add(m);
                }
            }
            relation.children = children;

            string json = relation.ToJson();

            return(json);
        }