/// <summary> /// Hàm cập nhập nhân viên theo mã nhân viên /// </summary> /// <param name="employee"> Đối tượng nhân viên được cập nhập </param> /// <returns> Giá trị trả về là số lượng các dòng bị tác động bởi câu lệnh , nếu 0 là cập nhập thất bại </returns> public int UpdateEmployeeFromID(dtoEmployee employee) { int count = 0; try { string sql = "UPDATE [dbo].[Employee] SET [EmployeeFullName] = @Name, [EmployeeBirthDay] = @BirthDay, [EmployeeAddress] = @Address, [EmployeePhoneNumber] = @PhoneNumber, [EmployeeEmail] = @Email, [BasicSalary] = @BasicSalary, [JobTitleID] = @JobTitleID, [StartDay] = @StartDay WHERE [EmployeeID] = @EmployeeID"; SqlParameter parameterID = new SqlParameter("@EmployeeID", SqlDbType.Int); parameterID.Value = employee.EmployeeID; SqlParameter parameterName = new SqlParameter("@Name", SqlDbType.NVarChar); parameterName.Value = employee.FullName; SqlParameter parameterBirthDay = new SqlParameter("@BirthDay", SqlDbType.DateTime); parameterBirthDay.Value = employee.BirthDay; SqlParameter parameterAddress = new SqlParameter("@Address", SqlDbType.NVarChar); parameterAddress.Value = employee.Address; SqlParameter parameterPhoneNumber = new SqlParameter("@PhoneNumber", SqlDbType.Char); parameterPhoneNumber.Value = employee.PhoneNumber; SqlParameter parameterEmail = new SqlParameter("@Email", SqlDbType.NVarChar); parameterEmail.Value = employee.Email; SqlParameter parameterBasicSalary = new SqlParameter("@BasicSalary", SqlDbType.Money); parameterBasicSalary.Value = employee.BasicSalary; SqlParameter parameterJobTitleID = new SqlParameter("@JobTitleID", SqlDbType.Int); parameterJobTitleID.Value = employee.JobTitleID; SqlParameter parameterStartDay = new SqlParameter("@Name", SqlDbType.DateTime); parameterStartDay.Value = employee.StartDay; count = InsertUpdateDeleteData(sql, new[] { parameterName, parameterBirthDay, parameterAddress, parameterPhoneNumber, parameterEmail, parameterBasicSalary, parameterJobTitleID, parameterStartDay }); } finally { CloseConnection(); } return(count); }
public Boolean SaveData() { Boolean result = false; if (View.IdProfileType == (int)UserTypeStandard.Company) { dtoCompany company = (dtoCompany)View.CurrentProfile; PersonInfo userInfo = View.ProfilePersonalData; result = (Service.SaveCompanyUser(company, userInfo) != null); } else if (View.IdProfileType == (int)UserTypeStandard.Employee) { dtoEmployee employee = (dtoEmployee)View.CurrentProfile; PersonInfo userInfo = View.ProfilePersonalData; Employee savedEmployee = Service.SaveEmployee(employee, userInfo); if (savedEmployee != null && employee.CurrentAgency.Key > 0) { SaveAgencyAffiliation(employee.CurrentAgency.Key, employee.Id); } result = (savedEmployee != null); } else { result = View.SaveProfile(View.CurrentProfile, View.ProfilePersonalData); if (result == true) { Service.UpdateFirstLetter(View.IdProfile); } } return(result); }
public string Update(dtoEmployee Employee) { try { string conStr = Provider.ConnectionString(); SqlConnection con = new SqlConnection(conStr); con.Open(); SqlTransaction sqlTrans = con.BeginTransaction(); string query = @"UPDATE EMPLOYEE SET NAME = N'" + Employee.NAME + "',BIRTHDAY = '" + Employee.BIRTHDAY + "',GENDER = N'" + Employee.GENDER + "',ADDRESS = N'" + Employee.ADDRESS + "' WHERE ID = " + Employee.ID; SqlCommand cmdUpdate = new SqlCommand(query, con); cmdUpdate.CommandType = CommandType.Text; cmdUpdate.Transaction = sqlTrans; int result = cmdUpdate.ExecuteNonQuery(); if (result != 1) { sqlTrans.Rollback(); sqlTrans.Dispose(); con.Close(); return("Lỗi số 1(daoEmployee -> Update): Cập nhật dữ liệu nhân viên lỗi"); } sqlTrans.Commit(); sqlTrans.Dispose(); con.Close(); return("SUCCESS"); } catch (Exception e) { return("Lỗi ngoại lệ: daoEmployee -> Update: " + e.Message); } }
public int SelfUpdateEmployee(dtoEmployee employee) { int count = 0; try { string sql = "UPDATE [dbo].[Employee] SET [EmployeeFullName] = @Name, [EmployeeBirthDay] = @BirthDay, [EmployeeAddress] = @Address, [EmployeePhoneNumber] = @PhoneNumber, [EmployeeEmail] = @Email, [Gender] = @Gender WHERE [EmployeeID] = @EmployeeID"; SqlParameter parameterID = new SqlParameter("@EmployeeID", SqlDbType.Int); parameterID.Value = employee.EmployeeID; SqlParameter parameterName = new SqlParameter("@Name", SqlDbType.NVarChar); parameterName.Value = employee.FullName; SqlParameter parameterBirthDay = new SqlParameter("@BirthDay", SqlDbType.DateTime); parameterBirthDay.Value = employee.BirthDay; SqlParameter parameterAddress = new SqlParameter("@Address", SqlDbType.NVarChar); parameterAddress.Value = employee.Address; SqlParameter parameterPhoneNumber = new SqlParameter("@PhoneNumber", SqlDbType.Char); parameterPhoneNumber.Value = employee.PhoneNumber; SqlParameter parameterEmail = new SqlParameter("@Email", SqlDbType.NVarChar); parameterEmail.Value = employee.Email; SqlParameter parameterGender = new SqlParameter("@Gender", SqlDbType.NVarChar); parameterGender.Value = employee.Gender; count = InsertUpdateDeleteData(sql, new[] { parameterName, parameterBirthDay, parameterAddress, parameterPhoneNumber, parameterEmail, parameterGender }); } finally { CloseConnection(); } return(count); }
public dtoBaseProfile GetCurrentProfileData(Int32 idProfile, Int32 idProfileType, AuthenticationProviderType type, dtoBaseProfile oldProfile) { dtoBaseProfile profile = new dtoBaseProfile(); Person person = CurrentManager.GetPerson(idProfile); if (person != null) { Language language = CurrentManager.GetLanguage(person.LanguageID); switch (idProfileType) { case (int)UserTypeStandard.Company: profile = new dtoCompany(CurrentManager.Get <CompanyUser>(idProfile)); break; case (int)UserTypeStandard.Employee: profile = new dtoEmployee(CurrentManager.Get <Employee>(idProfile)); break; default: profile = oldProfile; break; } profile.IdProfileType = idProfileType; profile.AuthenticationProvider = type; profile.IdLanguage = language.Id; profile.LanguageName = language.Name; } return(profile); }
private dtoEmployee CreateEmployee(ProfileAttributesRow row) { dtoEmployee item = new dtoEmployee(); item.CurrentAgency = row.GetCalculatedCellLongValue(ProfileAttributeType.agencyInternalCode); return(item); }
public int InsertEmployee(dtoEmployee dtoEmployee, string fileName) { dalEmployee employee = new dalEmployee(); int count = employee.InsertEmployee(dtoEmployee, fileName); return(count); }
public List <dtoEmployee> GetEmployees() { dalEmployee dalEmployee = new dalEmployee(); List <dtoEmployee> listEmp = new List <dtoEmployee>(); DataTable employees = dalEmployee.GetEmployees(); for (int i = 0; i < employees.Rows.Count; i++) { dtoEmployee employee = new dtoEmployee(); DataRow row = employees.Rows[i]; employee.EmployeeID = Convert.ToInt32(row[0]); employee.FullName = row[1].ToString(); employee.Potrait = (byte[])row[2]; employee.BirthDay = Convert.ToDateTime(row[3]); employee.Gender = row[4].ToString(); employee.Address = row[5].ToString(); employee.PhoneNumber = row[6].ToString(); employee.Email = row[7].ToString(); employee.BasicSalary = Convert.ToDecimal(row[8]); employee.JobTitleID = Convert.ToInt32(row[9]); employee.StartDay = Convert.ToDateTime(row[10]); listEmp.Add(employee); } return(listEmp); }
public string Insert(ref dtoEmployee Employee) { try { string conStr = DataProvider.ConnectionString(); SqlConnection con = new SqlConnection(conStr); con.Open(); SqlTransaction sqlTrans = con.BeginTransaction(); string query = @"INSERT INTO EMPLOYEE(NAME,BIRTHDAY,GENDER,ADDRESS)VALUES(N'" + Employee.NAME + "','" + Employee.BIRTHDAY + "',N'" + Employee.GENDER + "',N'" + Employee.ADDRESS + "')"; SqlCommand cmdInsert = new SqlCommand(query, con); cmdInsert.CommandType = CommandType.Text; cmdInsert.Transaction = sqlTrans; int result = cmdInsert.ExecuteNonQuery(); if (result == 1) { query = "SELECT IDENT_CURRENT('EMPLOYEE')"; SqlCommand cmdGetID = new SqlCommand(query, con); cmdGetID.CommandType = CommandType.Text; cmdGetID.Transaction = sqlTrans; object id = cmdGetID.ExecuteScalar(); Employee.ID = id.ToString(); if (result > 0) { sqlTrans.Commit(); } else { sqlTrans.Rollback(); sqlTrans.Dispose(); con.Close(); return("Lỗi số 2(daoEmployee -> Insert): Lấy mã nhân viên lỗi"); } } else { sqlTrans.Rollback(); sqlTrans.Dispose(); con.Close(); return("Lỗi số 1(daoEmployee -> Insert): Thêm dữ liệu nhân viên lỗi"); } sqlTrans.Dispose(); con.Close(); return("SUCCESS"); } catch (Exception e) { return("Lỗi ngoại lệ: daoEmployee -> Insert: " + e.Message); } }
private void btnInsert_Click(object sender, EventArgs e) { try { if (txtFullName.Text == "" || txtAddress.Text == "" || txtBasicSalary.Text == "" || txtBirthDay.Text == "" || txtEmail.Text == "" || txtGender.Text == "" || txtJobTitle.Text == "" || txtPass.Text == "" || txtPhoneNumber.Text == "") { throw new Exception("Vui lòng không để trống thông tin!"); } else { dtoEmployee dtoEmployee = new dtoEmployee(); dtoEmployee.FullName = txtFullName.Text; dtoEmployee.Address = txtAddress.Text; dtoEmployee.BasicSalary = Convert.ToDecimal(txtBasicSalary.Text); dtoEmployee.BirthDay = Convert.ToDateTime(txtBirthDay.Text); dtoEmployee.Email = txtEmail.Text; dtoEmployee.Gender = txtGender.Text; dtoEmployee.JobTitleID = Convert.ToInt32(txtJobTitle.Text); dtoEmployee.Password = txtPass.Text; dtoEmployee.PhoneNumber = txtPhoneNumber.Text; dtoEmployee.StartDay = DateTime.Now; int count = employee.InsertEmployee(dtoEmployee, fileName); txtFullName.Text = ""; txtAddress.Text = ""; txtGender.Text = ""; txtJobTitle.Text = ""; txtPass.Text = ""; txtPhoneNumber.Text = ""; txtBirthDay.Text = ""; txtBasicSalary.Text = ""; string mess = "Thông tin nhân viên đã được thêm thành công!" + "\nSố hàng đã được thêm: " + count.ToString(); XtraMessageBox.Show(mess, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Hàm thêm mới nhân viên /// </summary> /// <param name="employee"> Đối tượng nhân viên được thêm mới </param> /// <param name="filename"> là một chuỗi chỉ đường dẫn của ảnh </param> /// <returns> Giá trị trả về là số lượng các dòng bị tác động bởi câu lệnh , nếu 0 là thêm mới thất bại </returns> public int InsertEmployee(dtoEmployee employee, string filename) { int count = 0; try { // Ở câu truy vấn này có sử dụng Bulk Column để mã hóa hình ảnh thành 1 vector và lưu trữ trên SQL string sql = "INSERT [dbo].[Employee] ([EmployeeFullName], [EmployeePotrait], [EmployeeBirthday], [EmployeeAddress], [EmployeePhoneNumber], [EmployeeEmail], [BasicSalary], [JobTilteID], [StartDay], [Password], [Gender]) SELECT @Name, BulkColumn, @Birthday, @Address, @PhoneNumber, @Email, @BasicSalary, @JobtitleID, @StartDay, ENCRYPTBYPASSPHRASE(N'Team up fight on',@Password), @Gender FROM OPENROWSET(BULK N'" + filename + "', Single_Blob) as Picture"; SqlParameter parameterName = new SqlParameter("@Name", SqlDbType.NVarChar); parameterName.Value = employee.FullName; SqlParameter parameterBirthDay = new SqlParameter("@BirthDay", SqlDbType.DateTime); parameterBirthDay.Value = employee.BirthDay; SqlParameter parameterGender = new SqlParameter("@Gender", SqlDbType.NVarChar); parameterGender.Value = employee.Gender; SqlParameter parameterAddress = new SqlParameter("@Address", SqlDbType.NVarChar); parameterAddress.Value = employee.Address; SqlParameter parameterPhoneNumber = new SqlParameter("@PhoneNumber", SqlDbType.NVarChar); parameterPhoneNumber.Value = employee.PhoneNumber; SqlParameter parameterEmail = new SqlParameter("@Email", SqlDbType.NVarChar); parameterEmail.Value = employee.Email; SqlParameter parameterBasicSalary = new SqlParameter("@BasicSalary", SqlDbType.Money); parameterBasicSalary.Value = employee.BasicSalary; SqlParameter parameterJobTitleID = new SqlParameter("@JobTitleID", SqlDbType.Int); parameterJobTitleID.Value = employee.JobTitleID; SqlParameter parameterStartDay = new SqlParameter("@StartDay", SqlDbType.DateTime); parameterStartDay.Value = employee.StartDay; SqlParameter parameterPassword = new SqlParameter("@Password", SqlDbType.NVarChar); parameterPassword.Value = employee.Password; count = InsertUpdateDeleteData(sql, new[] { parameterName, parameterBirthDay, parameterGender, parameterAddress, parameterPhoneNumber, parameterEmail, parameterBasicSalary, parameterJobTitleID, parameterStartDay, parameterPassword }); } finally { CloseConnection(); } return(count); }
public Boolean EditProfileType(Int32 IdNewType) { Boolean result = false; Int32 IdProfile = View.IdProfile; ProfileTypeChanger person = CurrentManager.Get <ProfileTypeChanger>(IdProfile); Int32 oldIdType = person.TypeID; if (IdProfile > 0 && person != null) { if (person.TypeID == (int)UserTypeStandard.Company && IdNewType != (int)UserTypeStandard.Company) { person = Service.EditProfileType(person, IdNewType); } else if (IdNewType == (int)UserTypeStandard.Company) { person = Service.EditProfileType(person, IdNewType); } else if (person.TypeID == (int)UserTypeStandard.Employee && IdNewType != (int)UserTypeStandard.Employee) { person = Service.EditProfileType(person, IdNewType); } else if (IdNewType == (int)UserTypeStandard.Employee) { person = Service.EditProfileType(person, IdNewType); } if (oldIdType != IdNewType) { if (IdNewType == (int)UserTypeStandard.Company) { dtoCompany company = (dtoCompany)View.CurrentProfile; if (oldIdType == (int)UserTypeStandard.Employee || View.DeletePreviousProfileType(IdProfile, oldIdType, IdNewType)) { result = (Service.SaveCompanyUser(company, null) != null); } } else if (IdNewType == (int)UserTypeStandard.Employee) { dtoEmployee employee = (dtoEmployee)View.CurrentProfile; if (oldIdType == (int)UserTypeStandard.Company || View.DeletePreviousProfileType(IdProfile, oldIdType, IdNewType)) { Employee savedEmployee = Service.SaveEmployee(employee, null); if (savedEmployee != null) { long idAgency = employee.CurrentAgency.Key; if (idAgency < 1) { idAgency = Service.GetEmptyAgency(0).Key; } SaveAgencyAffiliation(employee.CurrentAgency.Key, IdProfile); } result = (savedEmployee != null); } } else { result = View.EditProfileType(View.CurrentProfile, oldIdType, IdNewType); if (result == true) { Service.UpdateFirstLetter(IdProfile); } } if (result && oldIdType == (int)UserTypeStandard.Employee) { Service.CloseEmployeeAffiliations(IdProfile); } } } return(result); }
private Boolean EditProfileType(Int32 idProfile, Int32 idNewType, Int32 idOrganization, MacUrlAuthenticationProvider provider, List <UserProfileAttribute> pAttributes, List <dtoMacUrlUserAttribute> attributes) { Boolean result = false; ProfileTypeChanger person = CurrentManager.Get <ProfileTypeChanger>(idProfile); Int32 idOldType = person.TypeID; dtoBaseProfile profile = GetCurrentProfileData(idProfile, idOldType, provider.ProviderType); if (idProfile > 0 && person != null) { Person people = CurrentManager.GetPerson(idProfile); if (people != null) { CurrentManager.Detach(people); } if (person.TypeID == (int)UserTypeStandard.Company && idNewType != (int)UserTypeStandard.Company) { person = ProfileService.EditProfileType(person, idNewType); } else if (idNewType == (int)UserTypeStandard.Company) { person = ProfileService.EditProfileType(person, idNewType); } else if (person.TypeID == (int)UserTypeStandard.Employee && idNewType != (int)UserTypeStandard.Employee) { person = ProfileService.EditProfileType(person, idNewType); } else if (idNewType == (int)UserTypeStandard.Employee) { person = ProfileService.EditProfileType(person, idNewType); } if (idOldType != idNewType && person != null) { if (idNewType == (int)UserTypeStandard.Company) { dtoCompany company = (dtoCompany)Helper.GetProfileData(profile, provider, pAttributes, attributes, idOrganization, idNewType); if (idOldType == (int)UserTypeStandard.Employee || View.DeletePreviousProfileType(idProfile, idOldType, idNewType)) { result = (ProfileService.SaveCompanyUser(company, null) != null); } } else if (idNewType == (int)UserTypeStandard.Employee) { dtoEmployee employee = (dtoEmployee)Helper.GetProfileData(profile, provider, pAttributes, attributes, idOrganization, idNewType); if (idOldType == (int)UserTypeStandard.Company || View.DeletePreviousProfileType(idProfile, idOldType, idNewType)) { Employee savedEmployee = ProfileService.SaveEmployee(employee, null); if (savedEmployee != null) { //long idAgency = employee.CurrentAgency.Key; //if (idAgency < 1) // idAgency = ProfileService.GetEmptyAgency(0).Key; //SaveAgencyAffiliation(employee.CurrentAgency.Key, IdProfile); UpdateAgencyAssocation(idProfile, idOrganization, provider, attributes); } result = (savedEmployee != null); } } else { result = View.EditProfileType(idProfile, Helper.GetProfileData(profile, provider, pAttributes, attributes, idOrganization, idNewType), idOldType, idNewType); } if (result && idOldType == (int)UserTypeStandard.Employee) { ProfileService.CloseEmployeeAffiliations(idProfile); } } } return(result); }
public dtoBaseProfile GetProfileData(MacUrlAuthenticationProvider provider, List <UserProfileAttribute> pAttributes, List <dtoMacUrlUserAttribute> attributes, Int32 idOrganization, Int32 idProfileType) { dtoBaseProfile profile = new dtoBaseProfile(); String pwd = lm.Comol.Core.DomainModel.Helpers.RandomKeyGenerator.GenerateRandomKey(6, 10, true, true, false); Language language = GetUserLanguage(provider.GetAttributeValue(ProfileAttributeType.language, pAttributes, attributes)); switch (idProfileType) { case (int)UserTypeStandard.ExternalUser: profile = new dtoExternal(); break; case (int)UserTypeStandard.Company: profile = new dtoCompany(); break; case (int)UserTypeStandard.Employee: profile = new dtoEmployee(); break; default: profile = new dtoBaseProfile(); break; } profile.Login = provider.GetAttributeValue(ProfileAttributeType.login, pAttributes, attributes); if (String.IsNullOrEmpty(profile.Login)) { profile.Login = provider.GetAttributeValue(ProfileAttributeType.externalId, attributes); } profile.Name = provider.GetAttributeValue(ProfileAttributeType.name, pAttributes, attributes); profile.Surname = provider.GetAttributeValue(ProfileAttributeType.surname, pAttributes, attributes); profile.TaxCode = provider.GetAttributeValue(ProfileAttributeType.taxCode, pAttributes, attributes); if (String.IsNullOrEmpty(profile.TaxCode)) { profile.TaxCode = UrlService.GenerateRandomTaxCode(); } profile.Mail = provider.GetAttributeValue(ProfileAttributeType.mail, pAttributes, attributes); if (String.IsNullOrEmpty(profile.Mail)) { profile.Mail = profile.Login + "@invalid.invalid.it"; } //if (!String.IsNullOrEmpty(profile.Mail)) // profile.Mail = profile.Mail.ToLower(); profile.Password = pwd; profile.ShowMail = false; if (!String.IsNullOrEmpty(profile.Surname)) { profile.FirstLetter = profile.Surname[0].ToString().ToLower(); } profile.IdProfileType = idProfileType; profile.AuthenticationProvider = provider.ProviderType; profile.IdLanguage = language.Id; profile.LanguageName = language.Name; switch (idProfileType) { case (int)UserTypeStandard.Company: dtoCompany dCompany = (dtoCompany)profile; dCompany.Info.Address = provider.GetAttributeValue(ProfileAttributeType.companyAddress, pAttributes, attributes); dCompany.Info.City = provider.GetAttributeValue(ProfileAttributeType.companyCity, pAttributes, attributes); dCompany.Info.Name = provider.GetAttributeValue(ProfileAttributeType.companyName, pAttributes, attributes); dCompany.Info.Region = provider.GetAttributeValue(ProfileAttributeType.companyRegion, pAttributes, attributes); dCompany.Info.TaxCode = provider.GetAttributeValue(ProfileAttributeType.companyTaxCode, pAttributes, attributes); dCompany.Info.ReaNumber = provider.GetAttributeValue(ProfileAttributeType.companyReaNumber, pAttributes, attributes); dCompany.Info.AssociationCategories = provider.GetAttributeValue(ProfileAttributeType.companyAssociations, pAttributes, attributes); return(dCompany); case (int)UserTypeStandard.Employee: dtoEmployee dEmployee = (dtoEmployee)profile; Person anonymous = ProfileService.GetAnonymousUser(); Agency agency = null; if (anonymous == null) { Dictionary <ProfileAttributeType, string> agencyAttributes = GetUserAttributesForAgency(provider, attributes); agency = ProfileService.GetAgency(agencyAttributes); if (agency == null) { agency = ProfileService.GetDefaultAgency(idOrganization); } } else { agency = GetAgencyByAttributes(anonymous.Id, idOrganization, provider, attributes); } if (agency != null) { dEmployee.CurrentAgency = new KeyValuePair <long, string>(agency.Id, agency.Name); } else { dEmployee.CurrentAgency = ProfileService.GetEmptyAgency(idOrganization); } return(dEmployee); case (int)UserTypeStandard.ExternalUser: dtoExternal dExternal = (dtoExternal)profile; dExternal.ExternalUserInfo = provider.GetAttributeValue(ProfileAttributeType.externalUserInfo, pAttributes, attributes); return(dExternal); default: return(profile); } }
private List <Person> CreateProfiles(dtoImportSettings settings, Int32 idDefaultOrganization, ProfileExternalResource selectedItems, List <dtoImportedProfile> createdProfiles, List <dtoBaseProfile> notCreatedProfiles) { List <Person> profiles = new List <Person>(); Language language = CurrentManager.GetDefaultLanguage(); AuthenticationProvider provider = Service.GetAuthenticationProvider(settings.IdProvider); if (provider != null && language != null) { Boolean created = false; Int32 idPerson = 0; Int32 index = 1; foreach (ProfileAttributesRow row in selectedItems.Rows) { dtoBaseProfile baseItem = null; switch (settings.IdProfileType) { case (int)UserTypeStandard.ExternalUser: dtoExternal externalUser = CreateExternal(row); baseItem = externalUser; break; case (int)UserTypeStandard.Company: dtoCompany company = CreateCompanyUser(row); baseItem = company; break; case (int)UserTypeStandard.Employee: dtoEmployee employee = CreateEmployee(row); baseItem = employee; break; default: baseItem = new dtoBaseProfile(); break; } created = false; if (baseItem != null) { GenerateBaseProfile(baseItem, settings, row, provider.ProviderType, GetUserLanguage(row, language)); if (InternalService.isUniqueMail(baseItem.Mail)) { PersonInfo info = GeneratePersonInfo(row, baseItem); idPerson = View.AddUserProfile(baseItem, info, idDefaultOrganization, provider); if (idPerson > 0) { Person person = CurrentManager.GetPerson(idPerson); if (person != null) { created = AddAuthentication(person, baseItem, settings, row, provider); if (created) { Service.SetDefaultProvider(provider.Id, person.Id); } profiles.Add(person); createdProfiles.Add(new dtoImportedProfile() { Profile = baseItem, Info = info }); } } } if (!created) { notCreatedProfiles.Add(baseItem); } View.UpdateProfileCreation(0, index, created, baseItem.DisplayName); } else { View.UpdateProfileCreation(0, index, created, " // "); } index++; } } return(profiles); }