public decimal Save(int rol, decimal document, string name, string password) { CultureInfo ci = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci; int id = int.Parse(Session[sessionName].ToString()); UserBO userBO = new UserBO(); User currentUser = userBO.Get(id); Entity.User user = new Entity.User(); user.Document = document; user.Name = name; user.Password = password; user.RolId = rol; user.CompanyId = currentUser.CompanyId; userBO.Save(user); return user.Document; }
public bool Save(string nit, string name, decimal document, string username, string password) { Entity.Company company = new Entity.Company(); CompanyBO companyBo = new CompanyBO(); int id = int.Parse(Session[sessionName].ToString()); UserBO userBO = new UserBO(); User user = userBO.Get(id); var parentCompany = companyBo.Get(user.CompanyId); company.Id = nit; company.Name = name; company.CreationDate = DateTime.Now; company.LevelId = parentCompany.LevelId + 1; company.ParentId = parentCompany.Id; company.CreationUser = id; company.ManagerId = document; companyBo.Save(company); var manager = userBO.Get(document); if (manager == null) { manager = new User(); } manager.CompanyId = nit; manager.Document = document; manager.Name = username; manager.RolId = 1; manager.Password = password; userBO.Save(manager); return true; }