Esempio n. 1
0
 public static bool UserAuthorize(string userName, string moduleIDs)
 {
     bool isTrue = true;
     try
     {
         using (TransactionScope scope = new TransactionScope())
         {
             foreach (var moduleId in moduleIDs.Split(','))
             {
                 var roleModule = new UserModule()
                 {
                     UserName = userName,
                     ModuleID = Convert.ToInt32(moduleId)
                 };
                 roleModule = roleModule.PostAdd();
             }
             scope.Complete();
         }
     }
     catch (Exception ex)
     {
         LogHelper.Write(CommonLogger.Web, ex);
         isTrue = false;
     }
     return isTrue;
 }
        /// <summary>
        /// Maps the GP o_ US r_ MODULE.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="rowNumber">The row number.</param>
        /// <returns></returns>
        private object MapGPO_USR_MODULE(IDataReader reader, int rowNumber)
        {
            UserModule _gpo_usr_module = new UserModule();

            _gpo_usr_module.Id                 = Convert.ToString(reader["ID"]);
            _gpo_usr_module.Code               = Convert.ToString(reader["CODE"]);
            _gpo_usr_module.Name               = Convert.ToString(reader["NAME"]);
            _gpo_usr_module.Module_level       = Convert.ToString(reader["MODULE_LEVEL"]);
            _gpo_usr_module.Father_id          = Convert.ToString(reader["FATHER_ID"]);
            _gpo_usr_module.Url                = Convert.ToString(reader["URL"]);
            _gpo_usr_module.Sort               = Convert.ToString(reader["SORT"]);
            _gpo_usr_module.Icon               = Convert.ToString(reader["ICON"]);
            _gpo_usr_module.Link_type          = Convert.ToString(reader["LINK_TYPE"]);
            _gpo_usr_module.Region_id          = Convert.ToString(reader["REGION_ID"]);
            _gpo_usr_module.Enable_flag        = Convert.ToString(reader["ENABLE_FLAG"]);
            _gpo_usr_module.Create_user        = Convert.ToString(reader["CREATE_USER"]);
            _gpo_usr_module.Create_date        = reader["CREATE_DATE"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(reader["CREATE_DATE"]);
            _gpo_usr_module.Create_region      = Convert.ToString(reader["CREATE_REGION"]);
            _gpo_usr_module.Create_org         = Convert.ToString(reader["CREATE_ORG"]);
            _gpo_usr_module.Last_update_user   = Convert.ToString(reader["LAST_UPDATE_USER"]);
            _gpo_usr_module.Last_update_date   = reader["LAST_UPDATE_DATE"] is DBNull ? DateTime.MinValue : Convert.ToDateTime(reader["LAST_UPDATE_DATE"]);
            _gpo_usr_module.Last_update_region = Convert.ToString(reader["LAST_UPDATE_REGION"]);
            _gpo_usr_module.Last_update_org    = Convert.ToString(reader["LAST_UPDATE_ORG"]);
            _gpo_usr_module.Remark             = Convert.ToString(reader["REMARK"]);
            return(_gpo_usr_module);
        }
    private void loadStudent(long studentId)
    {
        UserModule userModule = new UserModule();
        FileModule fileModule = new FileModule();
        Student student = (Student) userModule.getUserByUserId(studentId);

        student_id.Text = student.USER_ID.ToString();
        first_name.Text = student.FIRSTNAME;
        last_name.Text = student.LASTNAME;
        email.Text = student.EMAIL;

        //get profile pic
        string profilePicLocation = fileModule.getProfilePicLocation(studentId);
        if(profilePicLocation.Length > 0)
            profile_pic.ImageUrl = "~/" + profilePicLocation;

        //get courses attended
        IList<Enrollment> courseEnrolled = student.COURSE_ENROLLED;
        foreach (Enrollment enrollment in courseEnrolled)
        {
            Course course = enrollment.COURSE;
            student_writeup.Text += course.COURSE_NAME + "<br />";

        }
    }
Esempio n. 4
0
        /// <summary>
        /// Create a new instance of the game engine. A user
        /// is required to know how to run the engine.
        /// </summary>
        /// <param name="context">The executing context of the engine.</param>
        /// <param name="serviceLocator">The dependency locator.</param>
        protected GameEngine(IContext context, ServiceLocator serviceLocator)
        {
            if (instance != null)
            {
                throw new Exception("Two or more instances of the game engine exist!");
            }

            this.Context        = context;
            this.serviceLocator = serviceLocator;

            LogModule     = new LogModule(this);
            ConfigModule  = new ConfigModule(this);
            UserModule    = new UserModule(this);
            CommandModule = new CommandConsoleModule(this);
            UIModule      = new UIModule(this);
            NetModule     = new NetModule(this);
            InputModule   = new InputModule(this);

            this.Context.EngineTicker.OnInit   += OnTickerInit;
            this.Context.EngineTicker.OnStart  += OnTickerStart;
            this.Context.EngineTicker.OnUpdate += OnTickerUpdate;
            this.Context.EngineTicker.OnEnd    += OnTickerEnd;

            SceneManager.sceneLoaded += SceneManagerSceneLoaded;
            instance = this;
            Core.Context.SetContext(context);
        }
Esempio n. 5
0
 private SqlCommand Get(UserModule userModule, SqlConnection connection, SqlTransaction transaction = default) =>
 connection.CreateProcedureCommand(PROCEDURE, transaction)
 .AddInOutParameter(PARAM_ID, userModule.Id, PARAMTYPE_ID)
 .AddInParameter(PARAM_USERID, userModule.UserId)
 .AddInParameter(PARAM_MODULEID, userModule.ModuleId)
 .AddInParameter(PARAM_ISAPPROVED, userModule.IsApproved)
 .AddSessionIdParameter(_sessionProvider);
Esempio n. 6
0
        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);

            Badge.OnModelCreating(builder);
            User.OnModelCreating(builder);

            // module section
            Module.OnModelCreating(builder);
            Lab.OnModelCreating(builder);
            LabVm.OnModelCreating(builder);
            UserModule.OnModelCreating(builder);
            // user module section
            UserModule.OnModelCreating(builder);
            UserLab.OnModelCreating(builder);
            UserLabVm.OnModelCreating(builder);
            // hypervisor
            Hypervisor.OnModelCreating(builder);
            HypervisorNode.OnModelCreating(builder);
            // configure many to many relationship
            UserUserModule.OnModelCreating(builder);
            ContactEmail.OnModelCreating(builder);
            BridgeInstance.OnModelCreating(builder);
            VmInterfaceTemplate.OnModelCreating(builder);
            VmInterfaceInstance.OnModelCreating(builder);
            BridgeTemplate.OnModelCreating(builder);
            VmTemplate.OnModelCreating(builder);
        }
Esempio n. 7
0
    protected void loadUCList()
    {
        UserModule userModule = new UserModule();
        uc_list.DataSource = userModule.getUsersByRole("UNITCOORDINATOR", 0, 9999); //Get it up first before we optimize this

        uc_list.DataBind();
    }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Dependency injection.
            NinjectModule userModule    = new UserModule();
            NinjectModule serviceModule = new ServiceModule("DefaultConnection");

            var kernel = new StandardKernel(userModule, serviceModule);

            // Because of Ninject CLR throws this exeption.
            // Exception Details:
            // System.InvalidOperationException:
            // Validation type names in unobtrusive client validation rules must be unique. The following validation
            // type was seen more than once: regex.
            // So I add this code.
            kernel.Unbind <ModelValidatorProvider>();
            DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));

            // Initialize AutoMapper.
            //IMapper mapper = BLLAutoMapper.GetMapper;
        }
Esempio n. 9
0
 /// <summary>
 /// 处理好友状态变化
 /// </summary>
 /// <param name="pollData"></param>
 /// <returns></returns>
 public QQNotifyEvent ProcessBuddyStatusChange(JObject pollData)
 {
     try
     {
         var uin   = pollData["uin"].ToObject <long>();
         var buddy = Context.Store.GetBuddyByUin(uin);
         if (buddy == null)
         {
             buddy = new QQBuddy()
             {
                 Uin = uin
             };
             Context.Store.AddBuddy(buddy);
             UserModule userModule = Context.GetModule <UserModule>(QQModuleType.USER);
             userModule.GetUserInfo(buddy, null);
         }
         var status     = pollData["status"].ToString();
         var clientType = pollData["client_type"].ToObject <int>();
         buddy.Status     = QQStatus.ValueOfRaw(status);
         buddy.ClientType = QQClientType.ValueOfRaw(clientType);
         return(new QQNotifyEvent(QQNotifyEventType.BUDDY_STATUS_CHANGE, buddy));
     }
     catch (Exception ex)
     {
         return(new QQNotifyEvent(QQNotifyEventType.NET_ERROR, ex));
     }
 }
Esempio n. 10
0
        void IInitializableModule.Initialize()
        {
            StreamModule streammodule = context.GetModule <StreamModule>();

            notificationwindow = context.GetModule <NotificationModule>();
            usermodule         = context.GetModule <UserModule>();
            imagemodule        = context.GetModule <ImageCacheModule>();

            streammodule.NewFollower += information => notificationwindow.ShowNotification(
                new MessageBuilder().Text("New Follower").BuildMessage(),
                new MessageBuilder()
                .User(usermodule.GetExistingUser(information.Service, information.Username), u => imagemodule.AddImage(u.Avatar))
                .Text(" started to follow.")
                .BuildMessage()
                );

            streammodule.NewSubscriber += information => notificationwindow.ShowNotification(
                new MessageBuilder().Text("New Subscriber").BuildMessage(),
                new MessageBuilder()
                .User(usermodule.GetExistingUser(information.Service, information.Username), u => imagemodule.AddImage(u.Avatar))
                .Text(" subscribed with ")
                .Text(information.PlanName, StreamColors.Option, FontWeight.Bold)
                .Text(" to this channel.")
                .BuildMessage()
                );

            streammodule.Hosted += information => notificationwindow.ShowNotification(
                new MessageBuilder().Text("New Host").BuildMessage(),
                information.Viewers > 0 ?
                new MessageBuilder().User(usermodule.GetExistingUser(information.Service, information.Channel), u => imagemodule.AddImage(u.Avatar)).Text(" is hosting this channel to ").Text(information.Viewers.ToString(), StreamColors.Option, FontWeight.Bold).Text(" viewers.").BuildMessage() :
                new MessageBuilder().User(usermodule.GetExistingUser(information.Service, information.Channel), u => imagemodule.AddImage(u.Avatar)).Text(" is hosting this channel.").BuildMessage()
                );

            streammodule.Raid += OnRaid;
        }
Esempio n. 11
0
        public HttpResponseMessage getCurrentUserDetails()
        {
            var prinicpal = (ClaimsPrincipal)Thread.CurrentPrincipal;
            var userId    = prinicpal.Claims.Where(c => c.Type == "UserId").Select(c => c.Value).SingleOrDefault().ToString();

            return(Request.CreateResponse(HttpStatusCode.OK, UserModule.GetUserDetailById(userId)));
        }
Esempio n. 12
0
        public async Task <IActionResult> AppLogin(LoginViewModel model)
        {
            ParentModule module = new ParentModule(_context);

            if (ModelState.IsValid)
            {
                // This doesn't count login failures towards account lockout
                // To enable password failures to trigger account lockout, set lockoutOnFailure: true
                var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure : false);

                if (result.Succeeded)
                {
                    _logger.LogInformation(1, "User logged in.");

                    UserModule module1 = new UserModule(_context, _userManager, _signInManager);
                    Users      user    = new Users {
                        Email = model.Email
                    };
                    string userid = module1.GetUserInfo(user).Id;     //select userID
                    if (userid.Length == 0)
                    {
                        return(NotFound());
                    }
                    List <Parent> item = module.GetParentInfo2(userid);

                    var resultToken = GetToken(model);

                    return(CreatedAtAction("Get", new { Successed = true, statusCode = 200, tokenResult = resultToken, item }));
                    //return Json(item);
                }
            }

            // If we got this far, something failed, redisplay form
            return(BadRequest());
        }
Esempio n. 13
0
        public JsonResult Remove(string id)
        {
            var module = new UserModule(CurrentUser);
            var data   = module.Remove(id);

            return(Json(new { code = 0, msg = "Ok", data = data }));
        }
Esempio n. 14
0
 public void SetUp()
 {
     userService = MockRepository.GenerateStub <IUserService> ();
     bus         = MockRepository.GenerateStub <EasyNetQ.IBus> ();
     dateService = MockRepository.GenerateStub <IDateService> ();
     userModule  = new UserModule(userService, bus, dateService);
 }
Esempio n. 15
0
 private void InitUserModule(UserSystem userSystem)
 {
     foreach (var module in userSystem.System.Modules)
     {
         var userModules = userSystem.UserModules.Where(um => um.Module.ModuleID == module.ModuleID &&
                                                        um.UserSystem.UserSystemID == userSystem.UserSystemID);
         if (userModules.Count() == 0)
         {
             UserModule um = new UserModule()
             {
                 UserModuleID = Guid.NewGuid(),
                 UserSystem   = userSystem,
                 Module       = module,
                 IsActive     = userSystem.User.UserName == "Admin"
             };
             userSystem.IsActive = userSystem.User.UserName == "Admin";
             SetParentUserModuleIsActiveFalse(um);
             UserModuleRepository.Add(um);
             UserModuleRepository.SaveChanges();
         }
         var userModule = userSystem.UserModules.Single(um => um.Module.ModuleID == module.ModuleID &&
                                                        um.UserSystem.UserSystemID == userSystem.UserSystemID);
         InitUserFunctions(userModule);
     }
 }
Esempio n. 16
0
        public async Task <JsonResult> CreateUser(RegisterViewModel model)
        {
            UserModule module = new UserModule(_context, _userManager, _signInManager);
            var        result = await module.CreateUser(model);

            return(Json(result));
        }
Esempio n. 17
0
        public ActionResult UserModuleCreate(FormCollection collection, UserModule userModule)
        {
            if (Request.Cookies["Username"] != null)
            {
                var Name        = collection["Name"];
                var Ord         = collection["Order"];
                var description = collection["Description"];
                var Active      = collection["Active"];

                userModule.Name        = Name;
                userModule.Order       = Convert.ToInt32(Ord);
                userModule.Description = description;
                userModule.Active      = (collection["Active"] == "false") ? false : true;

                db.UserModules.Add(userModule);
                db.SaveChanges();



                return(RedirectToAction("UserModuleIndex"));
            }
            else
            {
                return(Redirect("/Admins/admins"));
            }
        }
Esempio n. 18
0
        public JsonResult GetUserList()
        {
            UserModule module    = new UserModule(_context, _userManager, _signInManager);
            var        returnVal = module.GetList();

            return(Json(returnVal));
        }
Esempio n. 19
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            NinjectModule clientModule        = new ClientModule();
            NinjectModule usertModule         = new UserModule();
            NinjectModule categoryModule      = new CategoryModule();
            NinjectModule priceCategoryModule = new PriceCategoryModule();
            NinjectModule roomModule          = new RoomModule();
            NinjectModule reservationModule   = new ReservationModule();
            NinjectModule dependencyModule    = new DependencyModule("HotelModel");

            var kernel = new StandardKernel(dependencyModule, usertModule, clientModule,
                                            categoryModule, priceCategoryModule, roomModule, reservationModule);

            DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
            ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory(kernel));

            //var kernel = new StandardKernel(clientModule, usertModule, categoryModule,
            //    priceCategoryModule, roomModule, reservationModule, dependencyModule);
            //kernel.Bind<DefaultFilterProviders>().ToSelf().WithConstructorArgument(GlobalConfiguration.Configuration.Services.GetFilterProviders());
            //kernel.Bind<DefaultModelValidatorProviders>().ToConstant(new DefaultModelValidatorProviders(GlobalConfiguration.Configuration.Services.GetModelValidatorProviders()));
            //GlobalConfiguration.Configuration.DependencyResolver = new Ninject.Web.WebApi.NinjectDependencyResolver(kernel);
        }
Esempio n. 20
0
        public async Task <IHttpActionResult> PostUserModule(UserModule userModule)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.UserModules.Add(userModule);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (UserModuleExists(userModule.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = userModule.Id }, userModule));
        }
Esempio n. 21
0
        public async Task <IHttpActionResult> PutUserModule(string id, UserModule userModule)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userModule.Id)
            {
                return(BadRequest());
            }

            db.Entry(userModule).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserModuleExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IActionResult> Create([FromBody] CreateUserRequest User)
        {
            var userModule = new UserModule(context, mapper);
            var response   = await userModule.Add(User);

            return(Ok(response));
        }
Esempio n. 23
0
    protected void Login(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(3000);
        UserModule userModule = new UserModule();
        string userid = input_userid.Text;
        string password = input_password.Text;

        try
        {
            UserAccount authenticatedUser = userModule.login(userid, password);

            SessionIDManager sessionIdManager = new SessionIDManager();
            string newId = sessionIdManager.CreateSessionID(Context);

            string oldUserId = "";
            string oldUsername = "";
            string oldUserRole = "";

            if(Session["userid"] != null) oldUserId = Session["userid"].ToString();
            if(Session["username"] != null) oldUsername = Session["username"].ToString();
            if(Session["userRole"] != null) oldUserRole = Session["userRole"].ToString();

            Session["userid"] = userid;
            Session["username"] = authenticatedUser.USERNAME;
            Session["userRole"] = authenticatedUser.ROLE;
            //Session["Sessionid"] = Session.SessionID; //Unnecessary

            if (Session["previous_url"] != null &&
                userid.Equals(oldUserId)) //impt! potential security vulnerability
            {
                string previous_url = Session["previous_url"].ToString();
                Session["previous_url"] = ""; //Clear session variable just in case
                Response.Redirect(previous_url);
            }

            string redirectURL = UserRoleDispatcher.getPageByUserRole(authenticatedUser.ROLE);
            if (redirectURL.Length <= 0)
            {
                throw new Exception("No role configured for " + authenticatedUser.ROLE + " yet, please contact administrator.");
            }

            Response.Redirect(redirectURL);

        }
        catch (LoginException lex)
        {
            login_message.Controls.Add(new LiteralControl(
                "<div class='alert alert-danger col-sm-10 col-sm-offset-1'>"
                    + lex.Message
                    + "</div>"));
        }
        catch (Exception ex)
        {
            login_message.Controls.Add(new LiteralControl(
                "<div class='alert alert-danger col-sm-10 col-sm-offset-1'>"
                    + ex.Message
                    + "</div>"));
        }
    }
        public ActionResult DeleteConfirmed(string id)
        {
            UserModule userModule = db.UserModules.Find(id);

            db.UserModules.Remove(userModule);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 25
0
        public async Task <Boolean> GetUserValidationAsync(string email, string password)
        {
            UserModule module = new UserModule(_context, _userManager, _signInManager);

            var result = await module.GetUserValidationAsync(email, password);

            return(result);
        }
Esempio n. 26
0
        // Get: /User/GetData?{orgId=&roleId=&page=1&rows=20}
        public JObject GetData(string queryOrgId, string queryRoleId, int page, int rows)
        {
            var module = new UserModule(CurrentUser);
            var count  = 0;
            var items  = module.Page(queryOrgId, queryRoleId, page, rows, out count);
            var json   = TableUserDataModel.Model.GetJson(items, count, TableUserHeaderModel.Header);

            return(json);
        }
Esempio n. 27
0
 public static UpdateUserData.UserModule GetValidUserModule(UserModule userModule)
 {
     return(new UpdateUserData.UserModule()
     {
         Id = userModule.ModuleId,
         Permission = userModule.Permission,
         GranterId = userModule.GranterId
     });
 }
Esempio n. 28
0
 public static ModuleInfoPacket FromUserModule(UserModule mod)
 {
     return(new ModuleInfoPacket()
     {
         Name = mod.Name,
         Prefix = mod.Prefix,
         Commands = mod.RegisteredCommands
     });
 }
Esempio n. 29
0
        public IActionResult fetchOrgList()
        {
            UserModule user    = new UserModule();
            string     Admin   = user.getAdminCode();
            bool       isAdmin = UserId.Equals(Admin);
            Dictionary <string, object> res = mm.fetchOrgList(isAdmin);

            return(Json(res));
        }
Esempio n. 30
0
        private void SetupComponents(object sender, RoutedEventArgs e)
        {
            Closing += (o, args) => {
                Application.Current.Shutdown();
            };

            //Setup the command line interface
            Cmd = Cmd ?? CommandLine.GetInstance();

            //Taskbar notification icon
            TaskbarIconManager.AddItem("Show", () => {
                ShowInTaskbar = true;
                Visibility    = Visibility.Visible;
                Activate();
                WindowState = WindowState.Maximized;
            });
            TaskbarIconManager.AddItem("Exit", () => {
                Application.Current.Shutdown(0);
            });
            TaskbarIconManager.CommitItems();
            TaskbarIconManager.SetVisible(true);

            LoadedModules.SelectionChanged += LoadedModulesOnSelectionChanged;

            // Invokes commands recieved from TCP connections
            RemoteManager.CommandRecieved += (command, tcpClient) => {
                Task.Factory.StartNew(() => {
                    UserModule mod = null;
                    Command cm     = null;

                    if (UserModule.FindResponsibleUserModule(command, out mod, out cm, tcpClient))
                    {
                        Dispatcher.Invoke(() => {
                            Status = $"{(tcpClient != null ? (tcpClient.Client.RemoteEndPoint + " > ") : "")} [{mod.Name}:{mod.Prefix}] > {cm.LocalCommand}";
                            mod.GiveRegexCommand(cm);
                        });
                    }
                });
            };

            RemoteManager.ClientConnected += client => {
                Dispatcher.Invoke(() => {
                    Status = $"({client.Client.RemoteEndPoint}) has connected!";
                });
            };
            RemoteManager.ClientDisconnected += client => {
                Dispatcher.Invoke(() => {
                    Status = $"({client.Client.RemoteEndPoint}) has disconnected.";
                });
            };

            Command.Responded += (response, com, client) => {
                Dispatcher.Invoke(() => {
                    Status = $"{((com != null && com != Command.Empty) ? $"[{com?.UserModuleName}] > " : "")}{response}";
                });
            };
        }
Esempio n. 31
0
 public Modules()
 {
     SaveModule       = new SaveModule(this, "UserData.json");
     DataModule       = new DataModule(this);
     PunishmentModule = new PunishmentModule(this);
     TokenModule      = new TokenModule(this);
     UserModule       = new UserModule(this);
     XPModule         = new XPModule(this);
 }
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            UserModule userModule = await db.UserModules.FindAsync(id);

            db.UserModules.Remove(userModule);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 33
0
 public ActionResult Edit([Bind(Include = "Id,MacAddress,DateIssued")] UserModule userModule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userModule).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userModule));
 }
Esempio n. 34
0
 /// <summary>
 /// creates a new <see cref="TwitchUserChat"/>
 /// </summary>
 /// <param name="channel">channel access</param>
 /// <param name="usermodule">access to usermodule</param>
 /// <param name="imagecache">access to image cache</param>
 public TwitchUserChat(ChatChannel channel, UserModule usermodule, ImageCacheModule imagecache)
 {
     this.channel             = channel;
     this.usermodule          = usermodule;
     this.imagecache          = imagecache;
     channel.UserJoined      += OnUserJoined;
     channel.UserLeft        += OnUserLeft;
     channel.MessageReceived += OnMessageReceived;
     channel.Subscription    += s => Subscription?.Invoke(s);
 }
    private void loadStudent(long studentId)
    {
        UserModule userModule = new UserModule();
        FileModule fileModule = new FileModule();
        Student student = (Student) userModule.getUserByUserId(studentId);

        student_id.Text = student.USER_ID.ToString();
        first_name.Text = student.FIRSTNAME;
        last_name.Text = student.LASTNAME;
        email.Text = student.EMAIL;
        student_writeup.Text = student.WRITE_UP;

        //get profile pic
        string profilePicLocation = fileModule.getProfilePicLocation(studentId);
        if (profilePicLocation.Length > 0)
            profile_pic.ImageUrl = "~/" + profilePicLocation;
    }
    private void loadDetails(long studentId)
    {
        UserModule userModule = new UserModule();
        Student student = (Student)userModule.getUserByUserId(studentId);

        //student.Text = partner.USERNAME;
        student_id.Text = student.USER_ID.ToString();
        first_name.Text = student.FIRSTNAME;
        last_name.Text = student.LASTNAME;
        email.Text = student.EMAIL;
        phone.Text = student.PHONE;
        address1.Text = student.ADDRESS1;
        address2.Text = student.ADDRESS2;
        city_town.Text = student.CITY_TOWN;
        state.Text = student.STATE;
        zipcode.Text = student.ZIP_CODE;
        country.Text = student.COUNTRY;
        writeup.Text = student.WRITE_UP;
    }
Esempio n. 37
0
 public bool checkEncryptedPassword(string rawPassword, string hash)
 {
     UserModule userModule = new UserModule();
     return userModule.checkEncryptedPassword(rawPassword, hash);
 }
Esempio n. 38
0
 public string encodePassword(string rawPassword)
 {
     UserModule userModule = new UserModule();
     return userModule.encodePassword(rawPassword);
 }
Esempio n. 39
0
 public IList<UserAccount> insertUserAccount(int numUsers)
 {
     UserModule userModule = new UserModule();
     return userModule.insertUserAccount(numUsers);
 }
Esempio n. 40
0
 public void login(string userid, string password)
 {
     UserModule userModule = new UserModule();
     userModule.login(userid, password);
 }
    protected void loadPartnerList()
    {
        UserModule userModule = new UserModule();
        company_list.DataSource = userModule.getUsersByRole("PARTNER", 0, 9999); //Get it up first before we optimize this

        company_list.DataBind();
    }
    protected void loadStudentList()
    {
        UserModule userModule = new UserModule();
        student_list.DataSource = userModule.getUsersByRole("STUDENT", 0, 9999); //Get it up first before we optimize this

        student_list.DataBind();
    }
    private void updateDetails(long studentId)
    {
        UserModule userModule = new UserModule();
        Student student = (Student)userModule.getUserByUserId(studentId);

        student.FIRSTNAME = first_name.Text;
        student.LASTNAME = last_name.Text;
        student.EMAIL = email.Text;
        student.PHONE = phone.Text;

        student.ADDRESS1 = address1.Text;
        student.ADDRESS2 = address2.Text;
        student.CITY_TOWN = city_town.Text;
        student.STATE = state.Text;
        student.ZIP_CODE = zipcode.Text;
        student.COUNTRY = country.Text;

        student.WRITE_UP = writeup.Text;

        userModule.updateUser(student);
    }
 private void updatePassword(long UCId, string old_password, string new_password)
 {
     UserModule userModule = new UserModule();
     userModule.setPassword(UCId, old_password, new_password);
 }
    private void updateDetails(long UCId)
    {
        UserModule userModule = new UserModule();
        UnitCoordinator uc = (UnitCoordinator)userModule.getUserByUserId(UCId);

        uc.FIRSTNAME = first_name.Text;
        uc.LASTNAME = last_name.Text;
        uc.EMAIL = email.Text;
        uc.PHONE = phone.Text;

        uc.ADDRESS1 = address1.Text;
        uc.ADDRESS2 = address2.Text;
        uc.CITY_TOWN = city_town.Text;
        uc.STATE = state.Text;
        uc.ZIP_CODE = zipcode.Text;
        uc.COUNTRY = country.Text;

        userModule.updateUser(uc);
    }
    private void loadDetails(long UCId)
    {
        UserModule userModule = new UserModule();
        UnitCoordinator uc = (UnitCoordinator)userModule.getUserByUserId(UCId);

        //student.Text = partner.USERNAME;
        first_name.Text = uc.FIRSTNAME;
        last_name.Text = uc.LASTNAME;
        email.Text = uc.EMAIL;
        phone.Text = uc.PHONE;
        address1.Text = uc.ADDRESS1;
        address2.Text = uc.ADDRESS2;
        city_town.Text = uc.CITY_TOWN;
        state.Text = uc.STATE;
        zipcode.Text = uc.ZIP_CODE;
        country.Text = uc.COUNTRY;
    }
    private void loadDetails(long partnerId)
    {
        UserModule userModule = new UserModule();
        Partner partner = (Partner)userModule.getUserByUserId(partnerId);

        company_name.Text = partner.USERNAME;
        email.Text = partner.EMAIL;
        phone.Text = partner.PHONE;
        fax.Text = partner.FAX;
        address1.Text = partner.ADDRESS1;
        address2.Text = partner.ADDRESS2;
        city_town.Text = partner.CITY_TOWN;
        state.Text = partner.STATE;
        zipcode.Text = partner.ZIP_CODE;
        country.Text = partner.COUNTRY;
    }
    private void updateDetails(long partnerId)
    {
        UserModule userModule = new UserModule();
        Partner partner = (Partner)userModule.getUserByUserId(partnerId);

        partner.USERNAME = company_name.Text;
        partner.EMAIL = email.Text;
        partner.PHONE = phone.Text;
        partner.FAX = fax.Text;
        partner.ADDRESS1 = address1.Text;
        partner.ADDRESS2 = address2.Text;
        partner.CITY_TOWN = city_town.Text;
        partner.STATE = state.Text;
        partner.ZIP_CODE = zipcode.Text;
        partner.COUNTRY = country.Text;

        userModule.updateUser(partner);

        //Change username
        Session["username"] = partner.USERNAME;
    }