private void btnCadUser_Click(object sender, EventArgs e) { Graph g = new Graph(); UserContextModel ctx = new UserContextModel(); SingletonStarDog dog = SingletonStarDog.getDbInstance(); //ctx.userID = txtAlunoID.Text; //ctx.ComunidadeMoodle = txtAlunoComunidade.Text; HardwareModel device = new HardwareModel(); //device.Device_ID = txtDeviceID.Text; //ctx.DeviceList.Add(device); OntoStudent obj = new OntoStudent(ctx, device); dog.GetDBConnection().Begin(); obj.insertStudent(ref g); dog.GetDBConnection().SaveGraph(g); // obj.insertHasDevice(ref g); dog.GetDBConnection().SaveGraph(g); obj.insertComunidadeMoodle(ref g); dog.GetDBConnection().SaveGraph(g); dog.GetDBConnection().Commit(); Ontology.Ontology.ListAllDevices(txtComunidades.Text); Ontology.Ontology onto2 = new Ontology.Ontology(); onto2.ListAllUserDevice(); }
public GlobalProfileModel GetGlobalProfileById(int ID, UserContextModel objUser) { try { var data = _globalProfileRepository.GetGlobalProfileById(ID, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public List <Entity> GetEntityById(Entity model, UserContextModel objUser) { try { var data = _entityRepository.GetEntityById(model, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public List <UserDefinedField> GetAllUserDefinedField(UserContextModel objUser) { try { var data = _userDefinedFieldRepository.GetAllUserDefinedField(objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public UserDefinedField GetUserDefinedFieldById(int ID, UserContextModel objUser) { try { var data = _userDefinedFieldRepository.GetUserDefinedFieldById(ID, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public List <SecuritySettings> GetSecuritySettings(SecuritySettings model, UserContextModel objUser) { try { var data = _securitysettingsRepository.GetSecuritySettings(model, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public List <GlobalProfileModel> GetAllGlobalProfile(UserContextModel objUser) { try { var data = _globalProfileRepository.GetAllGlobalProfile(objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public List <GroupCompany> GetGroupCompany(GroupCompany model, UserContextModel objUser) { try { var data = _groupCompanyRepository.GetGroupCompany(model, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public ActionResult Index() { UserContextModel objUser = new UserContextModel(); this.LoadIsAdmin(); if (SettingsManager.Instance.Branding == "SINDHI") { var countries = objVendor.GetVendorsSPMO(); int pageindex = 0; var filter = countries.OrderBy(p => p.UserRequestID).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = countries; Session["pageindex"] = 0; return(View("Index", filter)); } else { var countries = objVendor.GetVendors(); VendorTypeContextModel objVendorType = new VendorTypeContextModel(); List <SelectListItem> lst = (from tbl in objVendorType.GetVendorTypes() select new SelectListItem { Value = tbl.VendorTypeId.ToString(), Text = tbl.VendorType }).ToList(); lst.Insert(0, new SelectListItem() { Value = "0", Text = SettingsManager.Instance.Branding == "SINDHI" ? "---Business Type---" : "----व्यवसायाचा प्रकार ----" }); ViewBag.VendorTypeId = lst; lst = (from tbl in objUser.GetAgentDetails() select new SelectListItem { Value = tbl.UserId.ToString(), Text = tbl.FirstName + " " + tbl.LName }).ToList(); lst.Insert(0, new SelectListItem() { Value = "0", Text = SettingsManager.Instance.Branding == "SINDHI" ? "---Select Panchayat---" : "----माहिती देणारा ----" }); ViewBag.AgentId = lst; int pageindex = 0; var filter = countries.OrderBy(p => p.VendorId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = countries; Session["pageindex"] = 0; return(View("Index", filter)); } }
public async Task <bool> IsBlogAlreadyLikedByUser(string blogId, UserContextModel user) { bool isLiked = false; var existFilter = Builders <BlogModel> .Filter.And( Builders <BlogModel> .Filter.ElemMatch(x => x.Like, l => l.UserName == user.UserName), Builders <BlogModel> .Filter.Eq(x => x.Id, blogId) ); var check = (await _collection.FindAsync(existFilter)).ToList(); if (check != null && check.Count() > 0) { isLiked = true; } return(isLiked); }
public ActionResult Login(string email, string password) { bool emailAndPasswordAreEmpty = string.IsNullOrWhiteSpace(email) && string.IsNullOrWhiteSpace(password); UserContextModel userContextModel = UsersRepository.ValidatePasswordIsCorrect(email, password); if (userContextModel == null) { ViewBag.ErrorMessages = UsersRepository.ErrorList; return(View("Index")); } else { UserContextHelper.SetUserSession(userContextModel); return(RedirectToAction("Index", "SportEvent")); } }
public async Task UpdateAccountAsync(UserContextModel userContext, JsonPatchDocument <UpdateAgencyRequestModel> jsonPatch, CancellationToken ct) { Agency agency = await _agencyRepository.GetAll().Where(x => x.Id == userContext.AgencyId).Include (x => x.Employees).FirstOrDefaultAsync(); UpdateAgencyRequestModel jsonPatchDTO = _mapper.Map <UpdateAgencyRequestModel>(agency); jsonPatch.ApplyTo(jsonPatchDTO); _mapper.Map(jsonPatchDTO, agency); _agencyRepository.Update(agency); await _unitOfWork.SaveChangesAsync(); //return jsonPatchDTO; }
public ActionResult RegisterVendor() { UserContextModel objUser = new UserContextModel(); var countries = objVendor.GetVendors(); VendorTypeContextModel objVendorType = new VendorTypeContextModel(); List <SelectListItem> lst = (from tbl in objVendorType.GetVendorTypes() select new SelectListItem { Value = tbl.VendorTypeId.ToString(), Text = tbl.VendorType }).ToList(); lst.Insert(0, new SelectListItem() { Value = "0", Text = SettingsManager.Instance.Branding == "SINDHI" ? "---Business Type---" : "----व्यवसायाचा प्रकार ----" }); ViewBag.VendorTypeId = lst; ViewBag.VendorTypes = Newtonsoft.Json.JsonConvert.SerializeObject(lst); if (SettingsManager.Instance.Branding != "SINDHI") { lst = (from tbl in objUser.GetAgentDetails() select new SelectListItem { Value = tbl.UserId.ToString(), Text = tbl.FirstName + " " + tbl.LName }).ToList(); } else { lst = (from tbl in objUser.GetPanchayatList() select new SelectListItem { Value = tbl.UserId.ToString(), Text = tbl.FirstName + " " + tbl.LName + " " + tbl.City + " " + tbl.Address + " " + tbl.State + " " + tbl.PanchayatCode }).ToList(); } lst.Insert(0, new SelectListItem() { Value = "0", Text = SettingsManager.Instance.Branding == "SINDHI" ? "---Select Panchayat---" : "----माहिती देणारा ----" }); ViewBag.AgentId = lst; string ViewName = SettingsManager.Instance.Branding == "SINDHI" ? "RegisterVendorSPMO" : "RegisterVendor"; return(View(ViewName)); }
public HttpResponseMessage GetAllGlobalProfile() { try { //Log.Info("GlobalProfileController:GetAllGlobalProfile", "Get All GlobalProfileModel START", string.Empty); UserContextModel objUser = new UserContextModel(); objUser.UserID = 1; objUser.CompanyCode = "devDB"; var data = _globalProfileService.GetAllGlobalProfile(objUser); //Log.Info("GlobalProfileController:GetAllGlobalProfile", "Get All GlobalProfileModel END", string.Empty); return(this.Request.CreateResponse(HttpStatusCode.OK, data)); } catch (Exception ex) { var helper = new AppPresentationException(ex); return(helper.GetResponse(this)); } }
public HttpResponseMessage UpdateUserDefinedField(List <UserDefinedField> model) { try { // Log.Info("UserDefineController:UpdateUserDefinedField", "Update UserDefinedField START", string.Empty); UserContextModel objUser = new UserContextModel(); objUser.UserID = 1; objUser.CompanyCode = "devDB"; var data = _userDefinedFieldService.UpdateUserDefinedField(model, objUser); //Log.Info("UserDefineController:UpdateUserDefinedField", "Update UserDefinedField END", string.Empty); return(this.Request.CreateResponse(HttpStatusCode.OK, data)); } catch (Exception ex) { var helper = new AppPresentationException(ex); return(helper.GetResponse(this)); } }
public HttpResponseMessage UpdateInstitute(Institute model) { try { Log.Info("QualificationController:UpdateInstitute", "Update Institute START", string.Empty); UserContextModel objUser = new UserContextModel(); objUser.UserID = 1; objUser.CompanyCode = "devDB"; var data = _qualificationService.UpdateInstitute(model, objUser); Log.Info("QualificationController:UpdateInstitute", "Update Institute END", string.Empty); return(this.Request.CreateResponse(HttpStatusCode.OK, data)); } catch (Exception ex) { var helper = new AppPresentationException(ex); return(helper.GetResponse(this)); } }
public HttpResponseMessage GetCourseTypeById(int Id) { try { Log.Info("QualificationController:GetCourseTypeById", "Get CourseType By Id START", string.Empty); UserContextModel objUser = new UserContextModel(); objUser.UserID = 1; objUser.CompanyCode = "devDB"; var data = _qualificationService.GetCourseTypeByID(Id, objUser); Log.Info("QualificationController:GetCourseTypeById", "Get CourseType By Id END", string.Empty); return(this.Request.CreateResponse(HttpStatusCode.OK, data)); } catch (Exception ex) { var helper = new AppPresentationException(ex); return(helper.GetResponse(this)); } }
public HttpResponseMessage GetEntityById(Entity model) { try { Log.Info("EntityController:GetEntityById", "Get Entities By Id Start", string.Empty); model.TransType = "FETCHBYENTITYID"; UserContextModel objUser = new UserContextModel(); objUser.UserID = 1; objUser.CompanyCode = "devDB"; var data = _entityService.GetEntityById(model, objUser); Log.Info("EntityController:GetEntityById", "Get Entities By Id End", string.Empty); return(this.Request.CreateResponse(HttpStatusCode.OK, data)); } catch (Exception ex) { var helper = new AppPresentationException(ex); return(helper.GetResponse(this)); } }
public ApplicationResponse UpdateCourseType(CourseType model, UserContextModel objUser) { try { var validationResponse = _modelValidation.Validate(CourseTypeValidation.ValidateAll_key, model, "Course type model can not be empty."); if (validationResponse.Messages != null && validationResponse.Messages.Count != 0) { throw new ValidationException(validationResponse); } model.CreatedBy = objUser.UserID; var data = _qualificationRepository.UpdateCourseType(model, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public ApplicationResponse AddUpdateSecuritySettings(SecuritySettings model, UserContextModel objUser) { try { var validationResponse = _modelValidation.Validate(SecuritySettingValidation.ValidateAll_key, model, "Security settings model can not be empty."); if (validationResponse.Messages != null && validationResponse.Messages.Count != 0) { throw new ValidationException(validationResponse); } model.CreatedBy = objUser.UserID; var data = _securitysettingsRepository.AddUpdateSecuritySettings(model, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
public HttpResponseMessage AddUpdateSecuritySettings(SecuritySettings model) { try { Log.Info("SecuritySettingsController:AddUpdateSecuritySettings", "Add Security Settings Start", string.Empty); model.TransType = "SAVE"; UserContextModel objUser = new UserContextModel(); objUser.UserID = 1; objUser.CompanyCode = "devDB"; var data = _securitySettingService.AddUpdateSecuritySettings(model, objUser); Log.Info("SecuritySettingsController:AddUpdateSecuritySettings", "Add Security Settings End", string.Empty); return(this.Request.CreateResponse(HttpStatusCode.OK, data)); } catch (Exception ex) { var helper = new AppPresentationException(ex); return(helper.GetResponse(this)); } }
public HttpResponseMessage GetGroupCompany() { try { Log.Info("GroupCompanyController:GetGroupCompany", "Get Group Company Start", string.Empty); GroupCompany model = new GroupCompany(); model.TransType = "FETCH"; UserContextModel objUser = new UserContextModel(); objUser.UserID = 1; objUser.CompanyCode = "devDB"; var data = _groupCompanyService.GetGroupCompany(model, objUser); Log.Info("GroupCompanyController:GetGroupCompany", "Get Group Company END", string.Empty); return(this.Request.CreateResponse(HttpStatusCode.OK, data)); } catch (Exception ex) { var helper = new AppPresentationException(ex); return(helper.GetResponse(this)); } }
public static void LoadIsAdmin(this ControllerBase target) { try { target.ViewBag.IsAdmin = false; var user = new UserContextModel(); var users = user.Select_STP_GetUserDetails(); target.ViewBag.Gender = "M"; target.ViewBag.TotalUsers = users.Where(p => p.UserType.ToUpper() == "USER").Count(); var dt = DateTime.Now.Date.AddDays(-15); target.ViewBag.MarriedBrideCount = users.Where(p => p.Gender.ToUpper() == "F" && p.UserType.ToUpper() == "USER" && p.ismarried == 1).Count(); target.ViewBag.MarriedGroomCount = users.Where(p => p.Gender.ToUpper() == "M" && p.UserType.ToUpper() == "USER" && p.ismarried == 1).Count(); target.ViewBag.BridesCount = users.Where(p => p.Gender.ToUpper() == "F" && p.UserType.ToUpper() == "USER").Count(); target.ViewBag.BridesCount = target.ViewBag.BridesCount - target.ViewBag.MarriedBrideCount; target.ViewBag.GroomCount = users.Where(p => p.Gender.ToUpper() == "F" && p.UserType.ToUpper() == "USER").Count(); target.ViewBag.GroomCount = target.ViewBag.GroomCount - target.ViewBag.MarriedGroomCount; //target.ViewBag.NewRegisterd = users.Where(p => dt <= p.DateofReg.Value.Date).Count(); target.ViewBag.UserId = SessionManager.GetInstance.ActiveUser.UserId; target.ViewBag.UserName = ""; if (SessionManager.GetInstance.ActiveUser != null) { bool IsAdmin = SessionManager.GetInstance.ActiveUser.UserType.Equals("User") == true ? false : true; target.ViewBag.IsAdmin = IsAdmin; target.ViewBag.UserName = SessionManager.GetInstance.ActiveUser.FirstName + " " + SessionManager.GetInstance.ActiveUser.LName; if (IsAdmin == false) { target.ViewBag.Gender = SessionManager.GetInstance.ActiveUser.Gender; } target.ViewBag.VisitorCount = user.GetVisitors().Count(); } target.ViewBag.Title = SettingsManager.Instance.Branding; } catch (Exception) { } }
public void FireObjects() { #region Seleciona todos os usuários do sistema String strSPARQL = @"SELECT ?Student ?DevID { ?Student rdf:type :Student. ?Student :hasDevice ?Dev. ?Dev :DeviceID ?DevID}"; var dog = SingletonStarDog.getDbInstance(); dog.GetDBConnection().Reasoning = StardogReasoningMode.SL; var resultsNoReasoning = dog.GetDBConnection().Query(strSPARQL) as SparqlResultSet; if (resultsNoReasoning != null) { var lista = resultsNoReasoning.ToList(); var toReturn = new List<string>(); StringBuilder strBuilder = new StringBuilder(); List<UserContextModel> userList = new List<UserContextModel>(); foreach (SparqlResult rlt in lista) { UserContextModel user = new UserContextModel(); user.Matricula = rlt[0].ToString().Substring(rlt[0].ToString().IndexOf("#") + 1); HardwareModel model = new HardwareModel(); model.Device_ID = rlt[1].ToString().Substring(rlt[1].ToString().IndexOf("#") + 1); user.DeviceList = new List<HardwareModel>(); user.DeviceList.Add(model); userList.Add(user); } #endregion foreach (UserContextModel user in userList) { //selecionar o objeto e enviar push String strSparqlobj = @" SELECT ?Title ?Link WHERE {:" + user.Matricula; strSparqlobj += @" :hasObjectChosenToStudent ?obj. ?obj :LO_Link ?Link. ?obj :LO_Title ?Title.}"; dog.GetDBConnection().Reasoning = StardogReasoningMode.SL; var resultsNoReasoningOBJ = dog.GetDBConnection().Query(strSparqlobj) as SparqlResultSet; if (resultsNoReasoningOBJ != null) { var listaOBJ = resultsNoReasoningOBJ.ToList(); foreach (SparqlResult rlt in listaOBJ) { //RemoveURLFromOntoloryResults( string obj = rlt[0].ToString().Substring(rlt[0].ToString().IndexOf("#") + 1); //string link = rlt[1].ToString().Substring(rlt[1].ToString().IndexOf("#") + 1); #region EnviaMsg var msg = String.Format("O objeto : {0} está disponível para download.", obj); SendPushMessages(user.DeviceList[0].Device_ID, msg); #endregion } } } } }
public async Task <IList <BlogModel> > GetBlogsLikedByUser(UserContextModel user) { var filter = Builders <BlogModel> .Filter.Where(x => x.Like.Any(u => u.UserId == user.UserId)); return(await _collection.Find <BlogModel>(filter).ToListAsync()); }
//Dificulty dificuldade; public OntoStudent(UserContextModel _student, HardwareModel _device) { student = _student; device = _device; }
public AccountController() { objUser = new UserContextModel(); }
public AccountController(UserContextModel context) { db = context; }
public void GetObjectbyContext(string contextFile) { RootObject deserializedProduct = null; try { deserializedProduct = JsonConvert.DeserializeObject<RootObject>(contextFile); } catch (IOException) { } #region Armazena o Contexto var g = new Graph(); var ctx = new UserContextModel(); var dog = SingletonStarDog.getDbInstance(); if (deserializedProduct != null && deserializedProduct.Profile != null) { ctx.StudentIdiom = deserializedProduct.Profile.Language; ctx.StudentPreference = deserializedProduct.Profile.PreferenceMedia; ctx.Matricula = deserializedProduct.Profile.Matricula; } var device = new HardwareModel(); if (deserializedProduct != null && deserializedProduct.Device.DeviceIMEI != null) { device.Device_ID = deserializedProduct.Device.DeviceIMEI.ToString(); } if (deserializedProduct != null) device.device_os_version = deserializedProduct.Device.SystemVersion; device.model_name = "Dev" + device.Device_ID; dog.GetDBConnection().Reasoning = VDS.RDF.Storage.StardogReasoningMode.SL; var Student = new OntoStudent(ctx, device); dog.GetDBConnection().Begin(); Student.insertStudent(ref g); dog.GetDBConnection().SaveGraph(g); Student.insertPreference(ref g, ctx.StudentPreference); dog.GetDBConnection().SaveGraph(g); device.MediaPreference = ctx.StudentPreference; Student.insertLearningStyle(ref g); dog.GetDBConnection().SaveGraph(g); Student.insertDeviceID(ref g); dog.GetDBConnection().SaveGraph(g); var dev = new OntoDevice(device); dev.InsertDevice(ref g); dog.GetDBConnection().SaveGraph(g); dev.insertDeviceMediaPreference(ref g); dog.GetDBConnection().SaveGraph(g); dev.InsertDeviceToken(ref g); dog.GetDBConnection().SaveGraph(g); dog.GetDBConnection().Commit(); #endregion #region LOCALIZAR OBJ String strSparql = @"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX onto: <http://www.owl-ontologies.com/OntoAdapt2.owl#> SELECT ?obj ?p WHERE {:" + ctx.Matricula; strSparql += " onto:hasObjectChosenToStudent ?obj. " + "?obj :LO_Link ?p.}"; dog.GetDBConnection().Reasoning = StardogReasoningMode.SL; var resultsNoReasoning = dog.GetDBConnection().Query(strSparql) as SparqlResultSet; if (resultsNoReasoning != null) { List<SparqlResult> lista = resultsNoReasoning.ToList(); var toReturn = new List<string>(); var strBuilder = new StringBuilder(); foreach (SparqlResult rlt in lista) { //RemoveURLFromOntoloryResults( strBuilder.Append(rlt[1].ToString()); } #endregion #region EnviaMsg SendPushMessages(device.Device_ID, "Você tem um Objeto de Aprendizagem para fazer Donwload"); #endregion } }
/// <summary> /// Insere no banco RDF o ID e o número do dispositivo /// </summary> /// <param name="UserID">ID do usuário utilizado para fazer o login do sistema</param> /// <param name="deviceToken">numero do dispositivo móvel</param> public void InsertUserDeviceTokenInDatabase(string Matricula, string deviceToken, string DeviceName) { Graph g = new Graph(); UserContextModel user = new UserContextModel(); //Pega a instancia do banco de dados RDF SingletonStarDog dog = SingletonStarDog.getDbInstance(); user.Matricula = Matricula; HardwareModel device = new HardwareModel(); device.model_name = DeviceName; //Nome do dispositivo device.Device_ID = deviceToken; //ID do dispositivo para enviar notificações OntoStudent obj = new OntoStudent(user, device); dog.GetDBConnection().Begin(); obj.insertStudent(ref g); dog.GetDBConnection().SaveGraph(g); OntoDevice OntoDev = new OntoDevice(device); OntoDev.InsertDevice(ref g); dog.GetDBConnection().SaveGraph(g); //obj.insertHasDevice(ref g); dog.GetDBConnection().SaveGraph(g); dog.GetDBConnection().Commit(); }
public UserContextModel GetUserContext(IEnumerable <ApplicationUserRole> applicationUserRoles) { UserContextModel contextOptions = new UserContextModel(); foreach (var applicationUserRole in applicationUserRoles) { CompanyModel company = null; DivisionModel division = null; DepartmentEditModel department = null; if (applicationUserRole.Company == null) { // if company is null => access to all companies divisions and departments foreach (var domainCompany in _companyService.GetAllCompanies()) { company = new CompanyModel() { CompanyName = domainCompany.CompanyName, CompanyId = domainCompany.CompanyID }; if (contextOptions.Companies.All(c => c.CompanyId != company.CompanyId)) { contextOptions.Companies.Add(company); } else { company = contextOptions.Companies.Find(c => c.CompanyId == company.CompanyId); } foreach (var domainDivision in _divisonService.GetDivisionsByCompanyID(domainCompany.CompanyID)) { division = new DivisionModel() { DivisionName = domainDivision.DivisionName, DivisionId = domainDivision.DivisionID }; if (company.Divisions.All(d => d.DivisionId != division.DivisionId)) { company.Divisions.Add(division); } else { division = company.Divisions.Find(d => d.DivisionId == division.DivisionId); } division.Departments.AddRange( _departmentService.GetAllDeptByDivID(domainDivision.DivisionID) .Select( c => new DepartmentEditModel() { DepartmentName = c.DepartmentName, DepartmentId = c.DepartmentID })); } } continue; } company = new CompanyModel() { CompanyName = applicationUserRole.Company.CompanyName, CompanyId = applicationUserRole.CompanyId ?? Guid.Empty }; if (contextOptions.Companies.All(c => c.CompanyId != company.CompanyId)) { contextOptions.Companies.Add(company); } else { company = contextOptions.Companies.Find(c => c.CompanyId == company.CompanyId); } if (applicationUserRole.Division == null) { // if division is null => access to all divisions and departments foreach ( var domainDivision in _divisonService.GetDivisionsByCompanyID(applicationUserRole.Company.CompanyID)) { division = new DivisionModel() { DivisionName = domainDivision.DivisionName, DivisionId = domainDivision.DivisionID }; if (company.Divisions.All(d => d.DivisionId != division.DivisionId)) { company.Divisions.Add(division); } else { division = company.Divisions.Find(d => d.DivisionId == division.DivisionId); } division.Departments.AddRange( _departmentService.GetAllDeptByDivID(domainDivision.DivisionID) .Select( c => new DepartmentEditModel() { DepartmentName = c.DepartmentName, DepartmentId = c.DepartmentID })); } continue; } division = new DivisionModel() { DivisionName = applicationUserRole.Division.DivisionName, DivisionId = applicationUserRole.DivisionId ?? Guid.Empty }; if (company.Divisions.All(d => d.DivisionId != division.DivisionId)) { company.Divisions.Add(division); } else { division = company.Divisions.Find(d => d.DivisionId == division.DivisionId); } if (applicationUserRole.Department == null) { division.Departments.AddRange( applicationUserRole.Division.Departments.Select( c => new DepartmentEditModel() { DepartmentName = c.DepartmentName, DepartmentId = c.DepartmentID })); continue; } department = new DepartmentEditModel() { DepartmentName = applicationUserRole.Department.DepartmentName, DepartmentId = applicationUserRole.DepartmentId ?? Guid.Empty }; division.Departments.Add(department); } return(contextOptions); }
public ApplicationResponse UpdateUserDefinedField(List <UserDefinedField> model, UserContextModel objUser) { try { var validationRespons = _modelValidation.Validate(UserDefineValidation.ValidateAll_key, model, "Section Name can not be blank."); foreach (ValidationResponse obj in validationRespons) { if (obj.Messages != null && obj.Messages.Count != 0) { throw new ValidationException(obj); } } model.ForEach(x => x.CreatedBy = objUser.UserID); var data = _userDefinedFieldRepository.UpdateUserDefinedField(model, objUser.CompanyCode); return(data); } catch (Exception ex) { var helper = new BusinessException(ex); throw helper.GetException(); } }
//sets the static context of authentication model in constructor public HomeController(UserContextModel context) { AuthenticationModel.UserContext = context; }
public void insertUser() { HardwareModel device = new HardwareModel(); device.Device_ID = "b297de0164546e4a5b5d0c7d876b14dc15cca8f849c96da9a50472a35384b533"; device.model_name = "iPhone_4S"; device.Brand_Name = "Apple"; device.Device_type = "smartphone"; UserContextModel user = new UserContextModel(); user.Matricula = "0895837"; dog.Begin(); Graph g = null; OntoStudent student = new OntoStudent(user, device); student.insertStudent(ref g); dog.SaveGraph(g); //student.insertLearningStyle(ref g, "LearningStyle_Active"); dog.SaveGraph(g); //student.insertLearningStyle(ref g, "LearningStyle_Intuitive"); dog.SaveGraph(g); dog.Commit(); }
public static void SetUserSession(UserContextModel user) { System.Web.HttpContext.Current.Session["CurrentUser"] = user; }
/// <summary> /// /// </summary> /// <param name="grafo"></param> /// <param name="user"></param> public void InsertDeviceOwner(ref Graph grafo, UserContextModel user) { grafo.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#")); INode sujeito = grafo.CreateUriNode("onto:" + user.Matricula); INode rdfType = grafo.CreateUriNode("onto:hasDevice"); INode objeto = grafo.CreateUriNode("onto:" + Device.model_name); Triple triple = new Triple(sujeito, rdfType, objeto); grafo.Assert(triple); }
//dependency injection, sets usercontext public AdministrationController(UserContextModel context) { AuthenticationModel.UserContext = context; }