示例#1
0
 /// <summary>
 /// 给顶级代理添加助理角色 zky 2017-09-01 /crm
 /// </summary>
 /// <param name="agentList"></param>
 /// <param name="count"></param>
 /// <returns></returns>
 public bool AddHelperRole(IList <bx_agent> agentList, out int count)
 {
     foreach (var agent in agentList)
     {
         manager_role_db role = new manager_role_db();
         role.role_name         = "助理";
         role.role_status       = 0;
         role.creator_name      = agent.AgentName;
         role.creator_time      = DateTime.Now;
         role.creator_full_name = agent.AgentName;
         role.top_agent_id      = agent.Id;
         role.modifi_full_name  = agent.AgentName;
         role.modifi_name       = agent.AgentName;
         role.modifi_time       = DateTime.Now;
         role.role_type         = 5;
         role.yunYingRole       = 2;//表示批量插入的角色
         db.manager_role_db.Add(role);
     }
     count = db.SaveChanges();
     return(count == agentList.Count);
 }
示例#2
0
 /// <summary>
 /// 删除角色
 /// </summary>
 /// <param name="role"></param>
 /// <returns></returns>
 public bool DeleteRole(manager_role_db role)
 {
     DataContextFactory.GetDataContext().manager_role_db.Remove(role);
     return(DataContextFactory.GetDataContext().SaveChanges() > 0);
 }
示例#3
0
 /// <summary>
 /// 更新角色信息 zky 2017-08-03
 /// </summary>
 /// <param name="role"></param>
 /// <returns></returns>
 public bool UpdateRole(manager_role_db role)
 {
     this.db.manager_role_db.Attach(role);
     this.db.Entry(role).State = EntityState.Modified;
     return(this.db.SaveChanges() > 0);
 }