public async Task <IActionResult> Post([FromBody] SuperAdminViewModel model) { try { var user = new User { FullName = model.FullName, Email = model.Email, PhoneNumber = model.PhoneNumber }; ILogger <UsersController> logger = new LoggerFactory().CreateLogger <UsersController>(); OkObjectResult userResponse = (OkObjectResult)await new UsersController(Config, logger, DataContext).Post(user); var superAdmin = new SuperAdmin { CoursesId = model.CoursesId, Deleted = model.Deleted, GroupsId = model.GroupsId, TeachersId = model.TeachersId, UserId = Convert.ToString(user.Id), }; await UnitOfWork.Repository <SuperAdmin>().InsertAsync(superAdmin); return(new OkObjectResult(superAdmin.Id)); } catch (Exception ex) { return(new BadRequestResult()); } }
// GET: SuperAdmin public ActionResult GetPagViewBySuperAdmin() { SuperAdmin GetPagViewBySuperAdmin = new SuperAdmin(); GetPagViewBySuperAdmin.PAGwiseViewForSuperAdmin = GetPagViewBySuperAdmin.GetPagViewBySuperAdmin(); return(View(GetPagViewBySuperAdmin)); }
public InquiryTests(CustomWebApplicationFactory <Admin.Startup> factory) { _client = factory.CreateClient(); var domain1 = new Domain { Name = "domain0", Organization = _org1 }; var domain2 = new Domain { Name = "domain1", Organization = _org2 }; var user0 = new SuperAdmin { AccountName = "user0", Password = Utils.HashPassword("user0") }; // スーパー管理者 var user1 = new UserAdmin { AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = domain1 }; // ユーザー管理者1 var user2 = new UserAdmin { AccountName = "user2", Password = Utils.HashPassword("user2"), Domain = domain2 }; // ユーザー管理者2 using var scope = factory.Services.GetService <IServiceScopeFactory>().CreateScope(); var context = scope.ServiceProvider.GetService <MainDbContext>(); Utils.RemoveAllEntities(context); context.Add(_org1); context.Add(_org2); context.Add(domain1); context.Add(domain2); context.Add(user0); context.Add(user1); context.Add(user2); context.SaveChanges(); }
public static void AddSuperAdmin() { string config = File.ReadAllText(@"D:\Projects\Official\HRA\Sprints\Common\config.xml"); string connectionString = System.Configuration.ConfigurationSettings.AppSettings["InstitutionDbConnection"].ToString(); string password = System.Configuration.ConfigurationSettings.AppSettings["InstitutionPassword"].ToString(); config = config.Replace("[DBCONNECTION]", connectionString); config = config.Replace("[PWD]", password); string dbscript = File.ReadAllText(@"C:\Users\mkumar\Desktop\Script2008.sql"); string conn1 = "Server=.\\SQLEXPRESS;Database=RiskappCommon;User Id=sa;Password=mk#12345;"; //We cannot run/use Simple.Data when support for legacy framework is allowed. dynamic commonDbContext = Simple.Data.Database.OpenConnection(conn1); SuperAdmin admin = new SuperAdmin() { FirstName = "Super", LastName = "Admin", UserName = "******", Password = "******", ForceResetPassword = true, DatabaseSchema = dbscript, ConfigurationTemplate = config }; }
public IHttpActionResult GetSuperAdmin(string id) { SuperAdmin sp = suprepo.GetInfo(id); if (sp == null) { return(StatusCode(HttpStatusCode.NoContent)); } sp.HyperLinks.Add(new HyperLink() { HRef = "http://localhost:44347/api/superadmins/" + sp.superadminid, HttpMethod = "GET", Relation = "Self" }); sp.HyperLinks.Add(new HyperLink() { HRef = "http://localhost:44347/api/superadmins/" + sp.id, HttpMethod = "GET", Relation = "Get Super By Id" }); sp.HyperLinks.Add(new HyperLink() { HRef = "http://localhost:44347/api/superadmins/" + sp.id, HttpMethod = "PUT", Relation = "Edit Super Admin" }); return(Ok(sp)); }
public IHttpActionResult PutSuperAdmin([FromBody] SuperAdmin sp, [FromUri] string id) { //SuperAdmin S = suprepo.GetInfo(id); //int sid = S.id; //sp.id = sid; //sp.superadminid = id; suprepo.ManualUpdate(sp, id); sp.HyperLinks.Add(new HyperLink() { HRef = "http://localhost:44347/api/superadmins/" + sp.superadminid, HttpMethod = "GET", Relation = "Get SUperadmin Info" }); sp.HyperLinks.Add(new HyperLink() { HRef = "http://localhost:44347/api/superadmins/" + sp.id, HttpMethod = "GET", Relation = "Get Super By Id" }); sp.HyperLinks.Add(new HyperLink() { HRef = "http://localhost:44347/api/superadmins/" + sp.id, HttpMethod = "PUT", Relation = "Self" }); return(Ok(sp)); }
public ActionResult ScreenShotViewBySuperAdminByAllDetails(int Id) { SuperAdmin SearchByNameForSuperAdmin = new SuperAdmin(); SearchByNameForSuperAdmin = SearchByNameForSuperAdmin.getLeaveInfo(Id); return(View("ScreenShotViewBySuperAdminByAllDetails", SearchByNameForSuperAdmin)); }
public UpdateMineTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory) { _client = factory.CreateClient(); using var scope = factory.Services.GetService <IServiceScopeFactory>().CreateScope(); var context = scope.ServiceProvider.GetService <MainDbContext>(); var org1 = Utils.CreateOrganization(code: 1, name: "org1"); var org2 = Utils.CreateOrganization(code: 2, name: "org2"); var domain1 = new Domain { Id = Guid.Parse("93b25287-7516-4051-9c8e-d114fad099ab"), Name = "domain1", Organization = org1 }; var user0 = new SuperAdmin { AccountName = "user0", Name = "", Password = Utils.HashPassword("user0") }; // スーパー管理者 var user1 = new UserAdmin { AccountName = "user1", Name = "", Password = Utils.HashPassword("user1"), Domain = domain1 }; // ユーザー管理者 Utils.RemoveAllEntities(context); context.Add(org1); context.Add(org2); context.Add(domain1); context.Add(user0); context.Add(user1); context.SaveChanges(); }
// View to list all TypeOfLeaves when he click on Data in Table public ActionResult GetPagViewBySuperAdminByPAGNameByTOL(string PAGName, string TOL) { SuperAdmin GetPagViewBySuperAdminByPAGNamByTOLobj = new SuperAdmin(); GetPagViewBySuperAdminByPAGNamByTOLobj.PAGWiseViewForSuperAdminByPAGNameByTOLList = GetPagViewBySuperAdminByPAGNamByTOLobj.PAGWiseViewForSuperAdminBYPAGNameByTOL(PAGName, TOL); return(View(GetPagViewBySuperAdminByPAGNamByTOLobj)); }
public InquiryTests(CustomWebApplicationFactory <JinCreek.Server.Admin.Startup> factory) { _client = factory.CreateClient(); _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>(); _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); _context.Add(_clientOs1 = new ClientOs { Id = Guid.NewGuid(), Name = "Windows 10" }); _context.Add(_clientApp1 = new ClientApp { Id = Guid.NewGuid(), ClientOs = _clientOs1, Version = "1903" }); _context.Add(_organizationClientApp1 = new OrganizationClientApp { Id = Guid.NewGuid(), Organization = _org1, ClientApp = _clientApp1 }); _context.Add(_org1 = Utils.CreateOrganization(code: 1, name: "org1")); _context.Add(_domain1 = new Domain { Id = Guid.NewGuid(), Name = "domain1", Organization = _org1 }); _context.Add(_deviceGroup1 = new DeviceGroup { Id = Guid.NewGuid(), Domain = _domain1, Name = "deviceGroup1" }); _context.Add(_userGroup1 = new UserGroup { Id = Guid.NewGuid(), Domain = _domain1, Name = "userGroup1" }); _context.Add(_lte1 = new LteModule { Id = Guid.NewGuid(), Name = "lte1" }); _context.Add(_device1 = new Device { Id = Guid.NewGuid(), Name = "deviceName1", Domain = _domain1, ManagedNumber = "0001", SerialNumber = "0001", ProductName = "Test1", UseTpm = true, StartDate = DateTime.Parse("2020-02-01"), EndDate = DateTime.Parse("2021-03-01"), LteModule = _lte1, DeviceGroupDevices = new HashSet <DeviceGroupDevice> { new DeviceGroupDevice { DeviceGroup = _deviceGroup1 } }, WindowsSignInListCacheDays = 1, OrganizationClientApp = _organizationClientApp1, }); _context.Add(_user0 = new SuperAdmin { AccountName = "user0", Password = Utils.HashPassword("user0") }); // スーパー管理者; _context.Add(_user1 = new UserAdmin { AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1 }); // ユーザー管理者1 _context.SaveChanges(); }
public ShellViewModel(SuperAdmin sa) { this.WindowHeight = 700; this.WindowWidth = 1200; EventAggregator = new EventAggregator(); EventAggregator.Subscribe(this); EventAggregator.PublishOnUIThread(new NavigatePage(new SuperAdminMainViewModel(sa))); }
public ActionResult GetPagViewBySuperAdminByPAGName(string PAGName) { Session["PAGName"] = PAGName; SuperAdmin GetPagViewBySuperAdminByPAGNamobj = new SuperAdmin(); GetPagViewBySuperAdminByPAGNamobj.PAGWiseViewForSuperAdminByPAGNameList = GetPagViewBySuperAdminByPAGNamobj.PAGWiseViewForSuperAdminBYPAGName(PAGName); return(View(GetPagViewBySuperAdminByPAGNamobj)); }
public ActionResult GetPagViewBySuperAdminByPAGNameDetails(string PAGName) { string dummp = Request.HttpMethod; SuperAdmin GetPagViewBySuperAdminByPAGNamobj = new SuperAdmin(); GetPagViewBySuperAdminByPAGNamobj.PAGWiseViewForSuperAdminByPAGNameList = GetPagViewBySuperAdminByPAGNamobj.PAGWiseViewForSuperAdminBYPAGNameDetailed(PAGName); return(View(GetPagViewBySuperAdminByPAGNamobj)); }
protected void Page_Load(object sender, EventArgs e) { SuperAdmin superAdmin = new SuperAdmin(); //Response.Redirect(superAdmin.validarSession(Session["user_id"].ToString(), Session["clave"].ToString(), Convert.ToInt32(Session["rol_id"]))); Label_Usuario.Text = Session["nombre"].ToString(); L_Sede.Text = Session["sede"].ToString(); }
public ActionResult SearchByNameForSuperAdmin(SuperAdmin superAdmin) { // Session["superAdmin"] = superAdmin; string Name = superAdmin.searchTextBox; SuperAdmin SearchByNameForSuperAdmin = new SuperAdmin(); SearchByNameForSuperAdmin.SearchByNameForSuperAdminList = SearchByNameForSuperAdmin.SearchByNameForSuperAdminDetails(Name); return(View(SearchByNameForSuperAdmin)); }
public static LoginResponse Login(LoginRequest request) { request.mobile_number = Common.GetStandardMobileNumber(request.mobile_number); LoginResponse response = new LoginResponse(); SuperAdmin superuser = null; string hashPassword = TokenGenerator.GetHashedPassword(request.password, 49); try { using (SuperUserDao dao = new SuperUserDao()) { superuser = dao.FindByMobileNumber(request.mobile_number); if (superuser == null) { MakeNouserResponse(response); return(response); } if (hashPassword == superuser.Password) { response.code = 1; response.has_resource = 0; //admin. = request.app_id; superuser.AppToken = request.push_token; superuser.AppID = request.app_id; superuser.LastLogin = DateTime.Now; string authToken = TokenGenerator.GenerateToken(superuser.FullName, superuser.Password, request.mobile_number); superuser.AccToken = authToken; dao.Update(superuser); response.code = 0; SuperUserLoginDto dto = new SuperUserLoginDto(); SuperUserHelper.CopyFromEntity(dto, superuser); SuperUserLoginDetailsDto dtoDetails = new SuperUserLoginDetailsDto(); SuperUserHelper.CopyFromEntity(dtoDetails, superuser); response.user_login = dto; response.super_user_details = dtoDetails; response.has_resource = 1; response.code = 0; response.message = MessagesSource.GetMessage("login.ok"); return(response); } else { response.code = 1; response.has_resource = 0; response.message = MessagesSource.GetMessage("login.fail"); } } } catch (Exception ex) { response.MakeExceptionResponse(ex); } return(response); }
// GET: SuperAdmins /* public ActionResult Index() * { * return View(db.Admin.ToList()); * } * * // GET: SuperAdmins/Details/5 * public ActionResult Details(int? id) * { * if (id == null) * { * return new HttpStatusCodeResult(HttpStatusCode.BadRequest); * } * SuperAdmin superAdmin = db.Admin.Find(id); * if (superAdmin == null) * { * return HttpNotFound(); * } * return View(superAdmin); * } * * // GET: SuperAdmins/Create * public ActionResult Create() * { * return View(); * } * * // POST: SuperAdmins/Create * // To protect from overposting attacks, please enable the specific properties you want to bind to, for * // more details see https://go.microsoft.com/fwlink/?LinkId=317598. * [HttpPost] * [ValidateAntiForgeryToken] * public ActionResult Create([Bind(Include = "SID,FirstName,MiddleName,LastName,Phone,Email,Password,Status")] SuperAdmin superAdmin) * { * if (ModelState.IsValid) * { * db.Admin.Add(superAdmin); * db.SaveChanges(); * return RedirectToAction("Index"); * } * * return View(superAdmin); * } * * // GET: SuperAdmins/Delete/5 * public ActionResult Delete(int? id) * { * if (id == null) * { * return new HttpStatusCodeResult(HttpStatusCode.BadRequest); * } * SuperAdmin superAdmin = db.Admin.Find(id); * if (superAdmin == null) * { * return HttpNotFound(); * } * return View(superAdmin); * } * * // POST: SuperAdmins/Delete/5 * [HttpPost, ActionName("Delete")] * [ValidateAntiForgeryToken] * public ActionResult DeleteConfirmed(int id) * { * SuperAdmin superAdmin = db.Admin.Find(id); * db.Admin.Remove(superAdmin); * db.SaveChanges(); * return RedirectToAction("Index"); * }*/ // GET: SuperAdmins/Edit/5 public ActionResult Edit() { SuperAdmin superAdmin = db.Admin.Find(1); if (superAdmin == null) { return(HttpNotFound()); } return(View(superAdmin)); }
public ActionResult Edit([Bind(Include = "SID,FirstName,MiddleName,LastName,Phone,Email,Password,Status")] SuperAdmin superAdmin) { if (ModelState.IsValid) { db.Entry(superAdmin).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("DashSuper", "Home")); } return(View(superAdmin)); }
public static bool CheckSuperUser(string mobilenumber) { SuperAdmin superuser = SuperUserServices.GetAuthUserbyMobileNumber(mobilenumber); if (superuser == null) { return(false); } return(true); }
public IHttpActionResult GetSuperAdmin(int id) { SuperAdmin sp = suprepo.GetByID(id); if (sp == null) { return(StatusCode(HttpStatusCode.NoContent)); } return(Ok(sp)); }
public ActionResult PAGWiseViewForSuperAdminByProjNameByTOL(string PAGName, string ProjName, string TOL) { Session["PAGName"] = PAGName; Session["ProjName"] = ProjName; Session["TOL"] = TOL; SuperAdmin PAGWiseViewForSuperAdminByProjNameByTOLobj = new SuperAdmin(); PAGWiseViewForSuperAdminByProjNameByTOLobj.PAGWiseViewForSuperAdminByProjNameByTOLList = PAGWiseViewForSuperAdminByProjNameByTOLobj.PAGWiseViewForSuperAdminByProjNameByTOL(ProjName, TOL); return(View(PAGWiseViewForSuperAdminByProjNameByTOLobj)); }
public ActionResult SearchByNMByLocByTOLForSuperAdmin(SuperAdmin superAdmin) { string PAGName = Session["PAGName"].ToString(); string ProjName = Session["ProjName"].ToString(); string dummyVariable = superAdmin.ByNameByLocByTOL; SuperAdmin SearchByNameForSuperAdmin = new SuperAdmin(); SearchByNameForSuperAdmin.SearchByNameForSuperAdminList = SearchByNameForSuperAdmin.SearchByNMByLocByTOLForSuperAdmin(dummyVariable, PAGName, ProjName); return(View(SearchByNameForSuperAdmin)); }
public static bool CheckSuperUser(int userId, string authToken, ResponseDto response) { SuperAdmin superuser = SuperUserServices.GetAuthUser(userId, authToken, response); if (superuser == null || superuser.AccToken != authToken) { return(false); } return(true); }
public DeleteTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory) { _client = factory.CreateClient(); _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>(); Utils.RemoveAllEntities(_context); _context.Add(_org1 = Utils.CreateOrganization(code: 1, name: "org1")); _context.Add(_domain1 = new Domain { Id = Guid.NewGuid(), Name = "domain01", Organization = _org1 }); _context.Add(_user1 = new SuperAdmin { Name = "", AccountName = "user0", Password = Utils.HashPassword("user0") }); // スーパー管理者 _context.Add(_user2 = new UserAdmin { Name = "", AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1 }); // ユーザー管理者 _context.Add(_simGroup1 = new SimGroup() { Id = Guid.NewGuid(), Name = "simGroup1", Organization = _org1, Apn = "apn", AuthenticationServerIp = "AuthenticationServerIp", IsolatedNw1IpPool = "IsolatedNw1IpPool", IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns", IsolatedNw1IpRange = "IsolatedNw1IpRange", IsolatedNw1PrimaryDns = "IsolatedNw1PrimaryDns", NasIp = "NasIp", PrimaryDns = "PrimaryDns", SecondaryDns = "SecondaryDns", UserNameSuffix = "" }); _context.Add(_sim = new Sim() { SimGroup = _simGroup1, Msisdn = "1001", Imsi = "1001", IccId = "1001", UserName = "******", Password = "******" }); _context.Add(_device1 = new Device() { Domain = _domain1, Name = "device01", UseTpm = true, ManagedNumber = "001", WindowsSignInListCacheDays = 1, ProductName = "", SerialNumber = "" }); _context.SaveChanges(); }
public SuperAdmin GetAuthSuperUser(SuperUserDao superuserDao, int userId, string authCode, bool withDetails = false) { SuperAdmin superuser = null; superuser = superuserDao.FindById(userId); if (superuser != null && superuser.AccToken == authCode) { return(superuser); } return(null); }
public ActionResult RefineResult(SuperAdmin superAdmin) { SuperAdmin PAGWiseViewForSuperAdminByProjNameRefinedByDate = new SuperAdmin(); string sDstring = superAdmin.StartDateBySuperAdmin.ToString("yyyy-MM-dd"); string eDstring = superAdmin.EndDateBySuperAdmin.ToString("yyyy-MM-dd"); Session["sDforExportToExcel"] = sDstring; Session["eDforExportToExcel"] = eDstring; PAGWiseViewForSuperAdminByProjNameRefinedByDate.PAGWiseViewForSuperAdminByProjNameList = PAGWiseViewForSuperAdminByProjNameRefinedByDate.PAGWiseViewForSuperAdminByProjNameRefinedByDate(superAdmin, sDstring, eDstring); return(View(PAGWiseViewForSuperAdminByProjNameRefinedByDate)); }
public ActionResult PAGWiseViewForSuperAdminByProjName(string PAGName, string ProjName) { Session["PAGName"] = PAGName; Session["ProjName"] = ProjName; SuperAdmin PAGWiseViewForSuperAdminByProjNameobj = new SuperAdmin(); PAGWiseViewForSuperAdminByProjNameobj.PAGWiseViewForSuperAdminByProjNameList = PAGWiseViewForSuperAdminByProjNameobj.PAGWiseViewForSuperAdminByProjName(PAGName, ProjName); // SuperAdmin PAGWiseViewForSuperAdminByProjNameobj = new SuperAdmin(); var list = PAGWiseViewForSuperAdminByProjNameobj.getSelectMonth(); PAGWiseViewForSuperAdminByProjNameobj.selectMonthIM = PAGWiseViewForSuperAdminByProjNameobj.GetSelectListItem(list); return(View(PAGWiseViewForSuperAdminByProjNameobj)); }
public RegisterMineTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory) { _client = factory.CreateClient(); _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>(); Utils.RemoveAllEntities(_context); _context.Add(_org1 = Utils.CreateOrganization(code: 1, name: "org1")); _context.Add(_org2 = Utils.CreateOrganization(code: 2, name: "org2")); _context.Add(_domain1 = new Domain { Id = Guid.NewGuid(), Name = "domain01", Organization = _org1 }); _context.Add(_user1 = new SuperAdmin { AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0") }); // スーパー管理者 _context.Add(_user2 = new UserAdmin { AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1 }); // ユーザー管理者 _context.Add(_simGroup1 = new SimGroup() { Id = Guid.NewGuid(), Name = "simGroup1", Organization = _org1, Apn = "apn", AuthenticationServerIp = "AuthenticationServerIp", IsolatedNw1IpPool = "IsolatedNw1IpPool", IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns", IsolatedNw1IpRange = "IsolatedNw1IpRange", IsolatedNw1PrimaryDns = "IsolatedNw1PrimaryDns", NasIp = "NasIp", PrimaryDns = "PrimaryDns", SecondaryDns = "SecondaryDns", UserNameSuffix = "UserNameSuffix", }); _context.Add(_simGroup2 = new SimGroup() { Id = Guid.NewGuid(), Name = "simGroup2", Organization = _org2, Apn = "apn", AuthenticationServerIp = "AuthenticationServerIp", IsolatedNw1IpPool = "IsolatedNw1IpPool", IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns", IsolatedNw1IpRange = "IsolatedNw1IpRange", IsolatedNw1PrimaryDns = "IsolatedNw1PrimaryDns", NasIp = "NasIp", PrimaryDns = "PrimaryDns", SecondaryDns = "SecondaryDns", UserNameSuffix = "UserNameSuffix", }); _context.SaveChanges(); }
public InstituteManagementRepository(IMSDbContext iMSDbContext, UserManager <ApplicationUser> userManager, IOptions <SuperAdmin> superAdmin, IEmailService emailService, IOptions <EmailConfiguration> emailConfiguration, ITeachingStaffManagementRepository teachingStaffManagementRepository, IRolePermissionSeed rolePermissionSeed, IDisciplinaryStatusManagementRepository disciplinaryStatusManagementRepository) { _iMSDbContext = iMSDbContext; _userManager = userManager; _superAdmin = superAdmin.Value; _emailService = emailService; _emailConfiguration = emailConfiguration.Value; _teachingStaffManagementRepository = teachingStaffManagementRepository; _rolePermissionSeed = rolePermissionSeed; _disciplinaryStatusManagementRepository = disciplinaryStatusManagementRepository; }
public static superadmin convert(SuperAdmin s) { if (s == null) { return(null); } superadmin ret = new superadmin() { id = s.id, }; return(ret); }