人员导入 alluser
This commit is contained in:
		
							parent
							
								
									b130d3dc46
								
							
						
					
					
						commit
						a02ed37e98
					
				@ -803,7 +803,7 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
            List<T_PF_APPROVAL_ROLE> listApproveRole = GetEntities<T_PF_APPROVAL_ROLE>(null, null).ToList();//导入自动添加
 | 
					            List<T_PF_APPROVAL_ROLE> listApproveRole = GetEntities<T_PF_APPROVAL_ROLE>(null, null).ToList();//导入自动添加
 | 
				
			||||||
            List<T_FM_USER_BELONG_ROLE> listUserRole = GetEntities<T_FM_USER_BELONG_ROLE>(null, null).ToList();
 | 
					            List<T_FM_USER_BELONG_ROLE> listUserRole = GetEntities<T_FM_USER_BELONG_ROLE>(null, null).ToList();
 | 
				
			||||||
            List<T_FM_ROLE> listRole = GetEntities<T_FM_ROLE>(null, null).ToList();//不做添加 平台类型前端不好改
 | 
					            List<T_FM_ROLE> listRole = GetEntities<T_FM_ROLE>(null, null).ToList();//不做添加 平台类型前端不好改
 | 
				
			||||||
 | 
					            List<T_OP_ALLUSER> listAll = new List<T_OP_ALLUSER>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            List<T_FM_DEPARTMENT> listDepAdd = new List<T_FM_DEPARTMENT>();//需要新增的组织
 | 
					            List<T_FM_DEPARTMENT> listDepAdd = new List<T_FM_DEPARTMENT>();//需要新增的组织
 | 
				
			||||||
            List<T_FM_USER> listUserAdd = new List<T_FM_USER>();//新增用户
 | 
					            List<T_FM_USER> listUserAdd = new List<T_FM_USER>();//新增用户
 | 
				
			||||||
@ -1322,6 +1322,15 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                            modelUser.CREATE_TIME = dtNow;
 | 
					                            modelUser.CREATE_TIME = dtNow;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        listAll.Add(new T_OP_ALLUSER()
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            ID = Guid.NewGuid(),
 | 
				
			||||||
 | 
					                            CODE = strCODE,
 | 
				
			||||||
 | 
					                            TENANT = telnetCode,
 | 
				
			||||||
 | 
					                            ORG_ID = OrgID,
 | 
				
			||||||
 | 
					                            PHONE = strPHONE
 | 
				
			||||||
 | 
					                        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        //if (modelUser == null)
 | 
					                        //if (modelUser == null)
 | 
				
			||||||
                        //{
 | 
					                        //{
 | 
				
			||||||
                        //    isAddUser = true;
 | 
					                        //    isAddUser = true;
 | 
				
			||||||
@ -1559,6 +1568,11 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                    BantchSaveEntityNoCommit(listUserRoleAdd);
 | 
					                    BantchSaveEntityNoCommit(listUserRoleAdd);
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var conndefault = ConfigurationManager.ConnectionStrings["default"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            #region  总部
 | 
					            #region  总部
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1569,8 +1583,16 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                //人员的岗位ID变成null
 | 
					                //人员的岗位ID变成null
 | 
				
			||||||
                string conn = string.Empty;
 | 
					                string conn = string.Empty;
 | 
				
			||||||
                List<string> listConn = new List<string>();
 | 
					                List<string> listConn = new List<string>();
 | 
				
			||||||
                using (var context = new MigrationContext(ConfigurationManager.ConnectionStrings["default"]))
 | 
					                using (var context = new MigrationContext(conndefault))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    try
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        context.AddEntities(listAll);
 | 
				
			||||||
 | 
					                        context.SaveChanges();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    catch { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    List<Guid> listConnID = context.GetEntities<T_OP_TENANT>(e => e.DB_CONN_ID.HasValue && e.CODE != telnetCode, null, null).Select(e => e.DB_CONN_ID.Value).ToList();
 | 
					                    List<Guid> listConnID = context.GetEntities<T_OP_TENANT>(e => e.DB_CONN_ID.HasValue && e.CODE != telnetCode, null, null).Select(e => e.DB_CONN_ID.Value).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var listDbConn = context.GetEntities<T_OP_TENANT_DB_CONN>(e => listConnID.Contains(e.ID), null, null);
 | 
					                    var listDbConn = context.GetEntities<T_OP_TENANT_DB_CONN>(e => listConnID.Contains(e.ID), null, null);
 | 
				
			||||||
@ -1625,7 +1647,19 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                using (var context = new MigrationContext(conndefault))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    try
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        context.AddEntities(listAll);
 | 
				
			||||||
 | 
					                        context.SaveChanges();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    catch { }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            #endregion
 | 
					            #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user