Esempio n. 1
0
        public async Task AddUsers([FromBody] AddUsers addUsers, CancellationToken cancellationToken)
        {
            try
            {
                var inviteUsers = new List <ApplicationUser>();

                foreach (var user in addUsers.Users)
                {
                    var appUser = await _operations.RepositoryManager.GetUserFromLoginAsync(user.Email, cancellationToken);

                    if (appUser != null)
                    {
                        throw new AdminControllerException($"The email address {user.Email} already exists and cannot be added.", null);
                    }
                    if (string.IsNullOrEmpty(user.UserName))
                    {
                        user.UserName = user.Email;
                    }
                    await _operations.RepositoryManager.CreateUserAsync(user, null, cancellationToken);

                    if (user.IsInvited && !user.IsRegistered)
                    {
                        inviteUsers.Add(user);
                    }
                }

                await SendInvites(inviteUsers, cancellationToken);
            }
            catch (Exception ex)
            {
                throw new AdminControllerException($"Error adding users: {ex.Message}", ex);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 添加users
        /// </summary>
        /// <param name="users"></param>
        /// <returns></returns>
        public ResponseModel AddUser(AddUsers users)
        {
            var u = new Users
            {
                F_Account    = users.F_Account,
                F_Password   = users.F_Password,
                F_RealName   = users.F_RealName,
                F_Image      = users.F_Image,
                F_Remark     = users.F_Remark,
                F_CreateTime = DateTime.Now,
            };

            _db.Users.Add(u);
            int i = _db.SaveChanges();

            if (i > 0)
            {
                return new ResponseModel {
                           code = 200, result = "用户添加成功"
                }
            }
            ;
            return(new ResponseModel {
                code = 0, result = "用户添加失败"
            });
        }
Esempio n. 3
0
    protected void btnsave_Click(object sender, EventArgs e)
    {
        bool _isPaidSubscriber = false;

        if (IsPaidSubscriber.Checked)
            _isPaidSubscriber = true;

        bool _isAutoRenewal = false;

        if (IsAutoRenewal.Checked)
            _isAutoRenewal = true;

        AddUsers _addUsers = new AddUsers();
        _addUsers.UserId = txtUserId.Text;
        _addUsers.Password = txtPassword.Text;
        _addUsers.FirstName = txtFirstName.Text;
        _addUsers.LastName = txtLastName.Text;
        _addUsers.PhoneNumber = txtPhoneNumber.Text;
        _addUsers.ZipCode = Int32.Parse(txtZipCode.Text);
        _addUsers.RegistrationDate = DateTime.Parse(txtRegistrationDate.Text);
        _addUsers.SubscriptionStartDate = DateTime.Parse(txtSubscriptionDate.Text);
        _addUsers.SubscriptionEndDate = DateTime.Parse(txtSubscriptionEndDate.Text);
        _addUsers.Address = txtAddress.Text;
        _addUsers.State = txtState.Text;
        _addUsers.Country = txtCountry.Text;
        _addUsers.IsAutoRenewal = _isAutoRenewal;
        _addUsers.IsPaidSubscriber = _isPaidSubscriber;
        _addUsers.AddUser();
        Response.Redirect("userlisting.aspx");
    }
Esempio n. 4
0
 public JsonResult SignUser(string username, string password, string realname)
 {
     try
     {
         var userlst = _usersService.GetUsersByAccount(username.ToLower()).ToList();
         if (userlst.Count() > 0)
         {
             return(Json(new ResponseModel {
                 code = 0, result = "用户名已经存在"
             }));
         }
         var userrealnamelst = _usersService.GetUsersByRealName(realname).ToList();
         if (userrealnamelst.Count() > 0)
         {
             return(Json(new ResponseModel {
                 code = 0, result = "昵称已经存在"
             }));
         }
         AddUsers au = new AddUsers();
         au.F_Account  = username;
         au.F_Password = password;
         au.F_RealName = realname;
         ResponseModel rm = _usersService.AddUser(au);
         return(Json(rm));
     }
     catch (Exception e)
     {
         return(Json(new ResponseModel {
             code = 0, result = $"账号错误"
         }));
     }
 }
        private void addUsersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddUsers adu = new AddUsers();

            adu.MdiParent = this;
            adu.Show();
        }
Esempio n. 6
0
        public void AccountCreateAddUser()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("ds client unit test {unique}");
            acct.Email       = Util.MakeUnique("ds_client_unit_{unique}@gmail.com");
            acct.Password    = "******";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            AddUsers       add      = new AddUsers();
            List <NewUser> userList = new List <NewUser>();

            NewUser nu = new NewUser();

            nu.userName = Util.MakeUnique("ds client unit test member {unique}");
            nu.email    = Util.MakeUnique("ds_client_unit_member_{unique}@gmail.com");
            nu.sendActivationOnInvalidLogin = false.ToString();
            nu.enableConnectForUser         = true.ToString();
            Guid g = Guid.NewGuid();

            nu.password = g.ToString();

            List <UserSetting> userSettings = new List <UserSetting>();

            userSettings.Add(new UserSetting("canSendAPIRequests", "true"));
            userSettings.Add(new UserSetting("canSendEnvelope", "true"));
            userSettings.Add(new UserSetting("AllowSendOnBehalfOf", "true"));
            nu.userSettings = userSettings.ToArray();

            userList.Add(nu);
            add.newUsers = userList.ToArray();

            CreatedUsers added = null;

            try
            {
                added = acct.AddUser(add);
            }
            catch (Exception)
            {
            }

            Assert.IsNotNull(added);
        }
Esempio n. 7
0
        private void button5_Click(object sender, EventArgs e)
        {
            //CREATE ACCOUNT BUTTON

            //check all fields are not empty
            if (!username.Text.Equals("") && !password.Text.Equals("") && !passwordConfirm.Text.Equals(""))
            {
                if (password.Text == passwordConfirm.Text)
                {
                    //Check if username + passwords match on db
                    //check database for entries
                    string   apiUrl          = "https://craig.im/infosec.php";
                    string   apiMethod       = "addUsers";
                    AddUsers addUser_Request = new AddUsers()
                    {
                        username = username.Text,
                        password = password.Text
                    };

                    // make http post request
                    string response = Http.Post(apiUrl, new NameValueCollection()
                    {
                        { "api_method", apiMethod },
                        { "api_data", JsonConvert.SerializeObject(addUser_Request) }
                    });

                    // decode json string to object
                    API_Response r = JsonConvert.DeserializeObject <API_Response>(response);

                    // check response
                    if (!r.IsError)
                    {
                        //There was no errors when adding the account -> do this:
                        MessageBox.Show("Account added successfully.");
                        //update lits
                        getUserList();
                    }
                    else
                    {
                        MessageBox.Show("ERROR: " + r.ErrorMessage);
                    }
                }
                else
                {
                    MessageBox.Show("Passwords do not match.");
                }
            }

            else if (username.Text.Equals("") || password.Text.Equals(""))
            {
                MessageBox.Show("You cannot leave the fields blank.");
            }
            else
            {
                MessageBox.Show("An error has occured.");
            }
        }
Esempio n. 8
0
 public Form1()
 {
     context = new MyContext();
     InitializeComponent();
     /// <summary>
     /// добавить пользователей если 0
     /// </summary>
     AddUsers.AddUser(context);
 }
Esempio n. 9
0
        private void btnRegistrarUsuario_Click(object sender, EventArgs e)
        {
            var _loginData = new AdminApi();

            Session.Edit = false;

            var registrarUsuario = new AddUsers(_loginData);

            registrarUsuario.Show();
            this.Hide();
        }
        private void btnAddNewUser_Click(object sender, RoutedEventArgs e)
        {
            string [] userNames = new AddUsers().ShowAddUsersDialog();

            foreach (string userName in userNames)
            {
                if (!lvUsers.Items.Contains(userName))
                {
                    lvUsers.Items.Add(userName);
                }
            }
        }
Esempio n. 11
0
        public async Task <JsonResult> AddUser(AddUsers users, IFormCollection collection)
        {
            if (string.IsNullOrEmpty(users.F_Account))
            {
                return(Json(new ResponseModel {
                    code = 0, result = "请输入账号!"
                }));
            }
            if (string.IsNullOrEmpty(users.F_Password))
            {
                return(Json(new ResponseModel {
                    code = 0, result = "请输入密码"
                }));
            }
            var files = collection.Files;

            if (files.Count > 0)
            {
                var    webRootPath     = _host.WebRootPath;
                string relativeDirPath = "/UserPic";
                string absolutePath    = webRootPath + relativeDirPath;

                string[] fileTypes = new string[] { ".gif", ".jpg", ".jpeg", ".png", ".bmp" };
                string   extension = Path.GetExtension(files[0].FileName);
                if (fileTypes.Contains(extension.ToLower()))
                {
                    if (!Directory.Exists(absolutePath))
                    {
                        Directory.CreateDirectory(absolutePath);
                    }
                    string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + extension;
                    var    filePath = absolutePath + "/" + fileName;
                    using (var stream = new FileStream(filePath, FileMode.Create))
                    {
                        await files[0].CopyToAsync(stream);
                    }
                    users.F_Image = "/UserPic/" + fileName;
                    return(Json(_usersService.AddUser(users)));
                }
                return(Json(new ResponseModel {
                    code = 0, result = "图片格式有误"
                }));
            }
            return(Json(new ResponseModel {
                code = 0, result = "请上传图片文件"
            }));
        }
Esempio n. 12
0
        private static int RunAddUsersAndReturnExitCode(AddUsers opts)
        {
            CreateAuthConnection(opts.VssAccountUrl);
            var csvRows = File.ReadAllLines(opts.Csv);

            foreach (var row in csvRows)
            {
                string[] bits       = row.Split(',');
                License  VssLicense = ConvertStringToLicence(bits[1].ToLower());
                AddUserToAccount(opts.VssAccountName, bits[0], VssLicense);
                if (!string.IsNullOrEmpty(opts.Project))
                {
                    AddUserToSecurityGroup(opts.Project, opts.Group, bits[0]);
                }
            }
            return(0);
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
            using var context = new WorkShop.Data.WorkShopContext();

            context.Database.EnsureCreated();

            var armors = new AddArmors();

            armors.CreateArmors(context);

            var weapons = new AddWeapons();

            weapons.CreateWeapons(context);

            var users = new AddUsers();

            users.CreateUsers(context);
        }
Esempio n. 14
0
        private void dgvPrueba_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 5)
            {
                int rowIndex = dgvPrueba.CurrentCell.RowIndex;
                Session.Edit = true;

                var      userAdminApi = dgvPrueba.CurrentRow.DataBoundItem;
                AdminApi adminApi     = (AdminApi)userAdminApi;

                var _loginData = adminApi;

                this.Hide();

                var registrarUsuario = new AddUsers(_loginData);
                registrarUsuario.Show();
            }
            else if (e.ColumnIndex == 6)
            {
                //Actualizar
                string token = Session.Token;

                var      userAdminApi = dgvPrueba.CurrentRow.DataBoundItem;
                AdminApi adminApi     = (AdminApi)userAdminApi;

                dynamic user = new System.Dynamic.ExpandoObject();
                user.id = adminApi.id;

                var userUpdateStatusById = VirtualFairIntegration.UserUpdateStatusById(token, user);

                if (userUpdateStatusById.statusCode == 200)
                {
                    string text  = userUpdateStatusById.message;
                    string title = "Información";
                    MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    LoadGrid();
                }
            }
        }
Esempio n. 15
0
        public void EnvelopeCreateAddMemberWithDocumentTest()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("ds client unit test {unique}");
            acct.Email       = Util.MakeUnique("ds_client_unit_{unique}@gmail.com");
            acct.Password    = "******";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            AddUsers       add      = new AddUsers();
            List <NewUser> userList = new List <NewUser>();

            NewUser nu = new NewUser();

            nu.userName = Util.MakeUnique("ds client unit test member {unique}");
            nu.email    = Util.MakeUnique("ds_client_unit_member_{unique}@gmail.com");
            nu.sendActivationOnInvalidLogin = false.ToString();
            nu.enableConnectForUser         = true.ToString();
            Guid g = Guid.NewGuid();

            nu.password = g.ToString();

            List <UserSetting> userSettings = new List <UserSetting>();

            userSettings.Add(new UserSetting("canSendAPIRequests", "true"));
            userSettings.Add(new UserSetting("canSendEnvelope", "true"));
            userSettings.Add(new UserSetting("AllowSendOnBehalfOf", "true"));
            nu.userSettings = userSettings.ToArray();

            userList.Add(nu);
            add.newUsers = userList.ToArray();

            CreatedUsers added = null;

            try
            {
                added = acct.AddUser(add);
            }
            catch (Exception)
            {
            }

            Account member = new Account();

            member.ApiPassword = added.NewUsers[0].ApiPassword;
            member.AccountId   = added.NewUsers[0].UserId;
            member.Email       = added.NewUsers[0].Email;
            //member.BaseUrl = added.NewUsers[0].Uri;
            bool log = member.Login();

            Assert.IsNotNull(added);
            Envelope target = new Envelope();

            target.Login = member;
            FileInfo fi   = new FileInfo("./Test Contract.pdf");
            string   path = fi.FullName;

            actual = false;

            try
            {
                actual = target.Create(path);
            }
            catch (ArgumentNullException)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(target.SenderViewUrl));
        }
Esempio n. 16
0
        public void InitializeBase(IWebDriver objDriver)
        {
            //LoginPage = new MdnHomePage(driver);
            //LoginPage1 = new MdnLoginPage1(driver);
            //HomePage = new MdnHomePage(driver);
            //CommonPage = new MdnCommonPage(driver);

            #region initialize old
            driver                = objDriver;
            CheckOutobj           = new CheckOut(driver);
            takeScreenhsot        = new ScreenShot(driver);
            approvalrequest       = new Approvalrequestobject(driver);
            instructors           = new Instructor(driver);
            approvalrequest       = new Approvalrequestobject(driver);
            DomainConsoleobj      = new DomainConsole(driver);
            ManageGradebookobj    = new ManageGradebook();
            Instructorsobj        = new Instructorspof();
            MyResponsibilitiesobj = new My_Responsibilities(driver);
            manageuserobj         = new ManageUsers(driver);
            objTrainingHome       = new TrainingHomes(driver);
            objCurriculum         = new CreateCurriculum(driver);
            classroomcourse       = new ClassroomCourse(driver);
            ContentSearchobj      = new ContentSearch(driver);
            objCreate             = new Create(driver);
            detailspage           = new Details(driver);


            TrainingHomeobj         = new TrainingHomes(driver);
            AdminstrationConsoleobj = new AdminstrationConsole(driver);
            Testsobj             = new Tests(driver);
            Detailsobj           = new Details(driver);
            EditSummaryobj       = new EditSummary(driver);
            Scorm1_2obj          = new Scorm1_2(driver);
            EditQuestionobj      = new EditQuestion(driver);
            EditQuestionGroupobj = new EditQuestionGroup(driver);

            AddUsrObj = new AddUsers(driver);

            generalcourseobj           = new GeneralCourse(driver);
            myteachingscheduleobj      = new MyTeachingSchedule();
            professionaldevelopmentobj = new ProfessionalDevelopments(driver);
            documentobj                = new Document(driver);
            CreateNewAccountobj        = new CreateNewAccount(driver);
            ManageUsersobj             = new ManageUsers(driver);
            Createobj                  = new Create(driver);
            summaryobj                 = new Summary(driver);
            reauiredtrainingconsoleobj = new RequiredTrainingConsoles(driver);
            requiredtrainingobj        = new RequiredTraining(driver);
            Trainingobj                = new Training(driver);
            Loginobj      = new Login(driver);
            Contentobj    = new Content(driver);
            Creditsobj    = new Credits(driver);
            AddContentobj = new AddContent(driver);
            Summaryobj    = new Summary(driver);
            ScheduleAndManageSectionobj = new ScheduleAndManageSection(driver);
            SearchResultsobj            = new SearchResults(driver);
            CourseSectionobj            = new CreateNewCourseSectionAndEventPage(driver);
            Transcriptsobj              = new Transcripts(driver);
            Productsobj                 = new Products(driver);
            BrowseTrainingCatalogobj    = new BrowseTrainingCatalog(driver);
            ShoppingCartsobj            = new ShoppingCarts(driver);
            ProfessionalDevelopmentsobj = new ProfessionalDevelopments(driver);
            Createnewproficencyscaleobj = new Createnewproficencyscale(driver);
            Createnewcompetencyobj      = new Createnewcompetency(driver);
            CreateNewSucessProfileobj   = new CreateNewSucessProfile(driver);
            SucessProfileobj            = new SucessProfile(driver);
            Searchobj             = new Search(driver);
            TrainingActivitiesobj = new TrainingActivities(driver);
            ProfessionalDevelopments_learnerobj = new ProfessionalDevelopments_learner(driver);
            Organizationobj             = new Organization(driver);
            DevelopmentPlansobj         = new DevelopmentPlans(driver);
            AddDevelopmentActivitiesobj = new AddDevelopmentActivities(driver);
            MyAccountobj            = new MyAccount(driver);
            UsersUtilobj            = new UsersUtil(driver);
            MyCalendersobj          = new MyCalenders(driver);
            MyReportsobj            = new MyReports(driver);
            Config_Reportsobj       = new Config_Reports(driver);
            ConfigurationConsoleobj = new ConfigurationConsole(driver);
            ApprovalPathobj         = new ApprovalPath(driver);
            MyMessageobj            = new MyMessages(driver);
            MessageUtilobj          = new MessageUtil(driver);
            MyRequestsobj           = new MyRequests(driver);
            Blogsobj = new Blogs(driver);
            CollabarationSpacesobj = new CollabarationSpaces(driver);
            Faqsobj                     = new Faqs(driver);
            HomePageFeedobj             = new HomePageFeed(driver);
            ProductTypesobj             = new ProductTypes(driver);
            Surveysobj                  = new Surveys(driver);
            SurveyScalesobj             = new SurveyScales(driver);
            AuditingConsolesobj         = new AuditingConsoles(driver);
            Categoryobj                 = new Category(driver);
            Trainingsobj                = new Trainings(driver);
            VirtualMeetingsobj          = new VirtualMeetings(driver);
            CreditTypeobj               = new CreditType(driver);
            AssignedUserobj             = new AssignedUser(driver);
            AddUsersobj                 = new AddUsers(driver);
            CustomFieldobj              = new CustomField(driver);
            CreateNewCustomFieldobj     = new CreateNewCustomField(driver);
            EditFieldobj                = new EditField(driver);
            EducationLevelobj           = new EducationLevel(driver);
            EditOrganizationobj         = new EditOrganization(driver);
            SelectManagerobj            = new SelectManager(driver);
            Roleobj                     = new Role(driver);
            SelectTrainingPOCobj        = new SelectTrainingPOC(driver);
            Complexobj                  = new Complex(driver);
            AccountCodesobj             = new AccountCodes(driver);
            AccountCodeTypesobj         = new AccountCodeTypes(driver);
            DiscountCodesobj            = new DiscountCodes(driver);
            ManageTaxRatesobj           = new ManageTaxRates(driver);
            TaxItemCategoriesobj        = new TaxItemCategories(driver);
            Certificatesobj             = new Certificates(driver);
            CourseProvidersobj          = new CourseProviders(driver);
            ExternalLearningsobj        = new ExternalLearnings(driver);
            ExternalLearningConsolesobj = new ExternalLearningConsoles(driver);
            ExternalLearningtypesobj    = new ExternalLearningtypes(driver);
            RequiredTrainingConsolesobj = new RequiredTrainingConsoles(driver);
            SelectProfileobj            = new SelectProfile(driver);
            TrainingProfilesobj         = new TrainingProfiles(driver);
            EditTrainingProfileobj      = new EditTrainingProfile(driver);
            MergeUsersobj               = new MergeUsers(driver);
            UserGroupobj                = new UserGroup(driver);
            SelectCertificateobj        = new SelectCertificate(driver);
            ManageProficencyScaleobj    = new ManageProficencyScale(driver);
            ArchivedProficencyScaleobj  = new ArchivedProficencyScale(driver);
            MappedContentobj            = new MappedContent(driver);
            MappedCompetencyobj         = new MappedCompetency(driver);
            ManageSuccessProfileobj     = new ManageSuccessProfile(driver);
            FAQ_lobj                    = new FAQ_l(driver);
            Announcements_lobj          = new Announcements_l(driver);
            JobTitlesobj                = new JobTitles(driver);
            ManageJobTitleobj           = new ManageJobTitle(driver);
            ManagePricingScheduleobj    = new ManagePricingSchedule(driver);
            ExternalLearningSearchobj   = new ExternalLearningSearch(driver);
            urlobj              = new url(driver);
            skinobj             = new skin(driver);
            MyOwnLearningobj    = new MyOwnLearningUtils(driver);
            CurrentTrainingsobj = new CurrentTrainings(driver);
            scormobj            = new Scorm12(driver);
            aicccourse          = new AICC(driver);
            ojtcourse           = new OJT(driver);
            TrainingCatalogobj  = new TrainingCatalogUtil(driver);
            accesskeys          = new AccessKeys(driver);
            #endregion
        }