Ejemplo n.º 1
0
 public void EnterRegistrationForm(RegistrationFormData registrationData)
 {
     _emailField.SendKeys(registrationData.Email);
     _nameField.SendKeys(registrationData.Name);
     _companyField.SendKeys(registrationData.Company);
     _positionDropDownList.Click();
     _positionDropDownList.FindElement(By.XPath("//*[contains(text(), 'Менеджер продукта')]")).Click();
     _phoneField.SendKeys(registrationData.Phone);
     _signUpButton.Click();
 }
        public async Task <IActionResult> Post(RegistrationFormData request)
        {
            if (!csrfVerifier.IsValidCSRFToken(request.CSRF, null, false))
            {
                return(BadRequest("Invalid CSRF"));
            }

            if (!SecurityHelpers.SlowEquals(request.RegistrationCode, configuration.RegistrationCode))
            {
                return(BadRequest("Invalid registration code"));
            }

            if (!request.Email.Contains('@'))
            {
                return(BadRequest("Email is invalid"));
            }

            // Check for conflicting username or email
            if (await database.Users.FirstOrDefaultAsync(u => u.UserName == request.Name) != null ||
                await database.Users.FirstOrDefaultAsync(u => u.Email == request.Email) != null)
            {
                return(BadRequest("There is already an account associated with the given email or name"));
            }

            var password = Passwords.CreateSaltedPasswordHash(request.Password);

            var user = new User()
            {
                Email        = request.Email,
                UserName     = request.Name,
                PasswordHash = password,
                Local        = true
            };

            await database.Users.AddAsync(user);

            Models.User.OnNewUserCreated(user, jobClient);
            await database.SaveChangesAsync();

            logger.LogInformation("New user registered {Name} ({Email})", request.Name, request.Email);

            return(Created($"/users/{user.Id}", user.GetInfo(RecordAccessLevel.Private)));
        }
Ejemplo n.º 3
0
        public IResponse <ApiResponse> FacultyRegistration()
        {
            StringValues RegistrationData = default(string);
            StringValues FileData         = default(string);

            httpContext.Request.Form.TryGetValue("facultObject", out RegistrationData);
            httpContext.Request.Form.TryGetValue("fileDetail", out FileData);
            if (RegistrationData.Count > 0)
            {
                RegistrationFormData facultydetails = JsonConvert.DeserializeObject <RegistrationFormData>(RegistrationData[0]);
                List <Files>         fileDetail     = JsonConvert.DeserializeObject <List <Files> >(FileData);
                if (facultydetails != null)
                {
                    IFormFileCollection files = httpContext.Request.Form.Files;
                    string Result             = this.registrationService.RegisterStaffFaculty(facultydetails, fileDetail, files);
                    BuildResponse(Result);
                }
            }
            return(apiResponse);
        }
Ejemplo n.º 4
0
        public string RegisterStaffFaculty(RegistrationFormData registrationFormData, List <Files> fileDetail, IFormFileCollection FileCollection)
        {
            string          StaffUid        = "";
            string          ImagePath       = this.beanContext.GetContentRootPath();
            string          output          = string.Empty;
            DesignationType designationType = DesignationType.Faculty;

            if (string.IsNullOrEmpty(registrationFormData.Email))
            {
                registrationFormData.Email = null;
            }
            if (!string.IsNullOrEmpty(registrationFormData.StaffMemberUid))
            {
                StaffUid = registrationFormData.StaffMemberUid;
            }
            ServiceResult serviceResult = validateModalService.ValidateModalFieldsService(typeof(RegistrationFormData), registrationFormData);

            if (registrationFormData.ApplicationFor == DesignationType.Faculty.ToString().ToLower())
            {
                designationType = DesignationType.Faculty;
            }
            else if (registrationFormData.ApplicationFor == DesignationType.Driver.ToString().ToLower())
            {
                designationType = DesignationType.Driver;
            }
            else
            {
                designationType = DesignationType.Other;
            }
            if (serviceResult.IsValidModal)
            {
                DbParam[] param = new DbParam[]
                {
                    new DbParam(StaffUid, typeof(System.String), "_StaffMemberUid"),
                    new DbParam(userDetail.schooltenentId, typeof(System.String), "_schooltenentid"),
                    new DbParam(registrationFormData.FirstName, typeof(System.String), "_FirstName"),
                    new DbParam(registrationFormData.LastName, typeof(System.String), "_LastName"),
                    new DbParam(registrationFormData.Gender, typeof(System.Boolean), "_Gender"),
                    new DbParam(registrationFormData.Dob, typeof(System.DateTime), "_Dob"),
                    new DbParam(registrationFormData.MobileNumber, typeof(System.String), "_MobileNumber"),
                    new DbParam(registrationFormData.AlternetNumber, typeof(System.String), "_AlternetNumber"),
                    new DbParam(registrationFormData.Email, typeof(System.String), "_Email"),
                    new DbParam(registrationFormData.Address, typeof(System.String), "_Address"),
                    new DbParam(registrationFormData.State, typeof(System.String), "_State"),
                    new DbParam(registrationFormData.City, typeof(System.String), "_City"),
                    new DbParam(registrationFormData.Pincode, typeof(System.Int64), "_Pincode"),
                    new DbParam(registrationFormData.Subjects, typeof(System.String), "_Subjects"),
                    new DbParam(registrationFormData.Type, typeof(System.String), "_Type"),
                    new DbParam(registrationFormData.SchoolUniversityName, typeof(System.String), "_SchoolUniversityName"),
                    new DbParam(designationType, typeof(System.Int32), "_DesignationId"),
                    new DbParam(registrationFormData.ProofOfDocumentationPath, typeof(System.String), "_ProofOfDocumentationPath"),
                    new DbParam(registrationFormData.DegreeName, typeof(System.String), "_DegreeName"),
                    new DbParam(registrationFormData.Grade, typeof(System.String), "_Grade"),
                    new DbParam(registrationFormData.Position, typeof(System.String), "_Position"),
                    new DbParam(registrationFormData.MarksObtain, typeof(System.Double), "_MarksObtain"),
                    new DbParam(registrationFormData.Title, typeof(System.String), "_Title"),
                    new DbParam(registrationFormData.ExprienceInYear, typeof(System.String), "_ExprienceInYear"),
                    new DbParam(registrationFormData.ExperienceInMonth, typeof(System.String), "_ExperienceInMonth"),
                    new DbParam(registrationFormData.ImageUrl, typeof(System.String), "_ImageUrl"),
                    new DbParam(userDetail.UserId, typeof(System.String), "_AdminId"),
                    new DbParam(registrationFormData.AccessLevelUid, typeof(System.String), "_AccessLevelUid"),
                    new DbParam(registrationFormData.ClassDetailUid, typeof(System.String), "_ClassDetailId")
                };
                output = db.ExecuteNonQuery("sp_RegisterStaffAndFacultyDetails_InsUpd", param, true);
                if (!string.IsNullOrEmpty(output) && output != "fail")
                {
                    if (FileCollection.Count > 0)
                    {
                        string FolderPath = Path.Combine(this.currentSession.FileUploadFolderName,
                                                         ApplicationConstant.Faculty,
                                                         output);
                        List <Files> files = this.fileService.SaveFile(FolderPath, fileDetail, FileCollection, output);
                        if (files != null && files.Count > 0)
                        {
                            DataSet fileDs = this.beanContext.ConvertToDataSet <Files>(files);
                            if (fileDs != null && fileDs.Tables.Count > 0 && fileDs.Tables[0].Rows.Count > 0)
                            {
                                DataTable table = fileDs.Tables[0];
                                table.TableName = "Files";
                                db.InsertUpdateBatchRecord("sp_Files_InsUpd", table);
                                output = "Record inserted successfully.";
                            }
                        }
                        else
                        {
                            ///==========  Log information ====================
                            output = "Record updated successfully.";
                        }
                    }
                    else
                    {
                        output = "Record inserted/updated successfully.";
                    }
                }
            }
            else
            {
                output = JsonConvert.SerializeObject(serviceResult.ErrorResultedList);
            }

            return(output);
        }
Ejemplo n.º 5
0
        public string QuickStudentRegistrationService(QuickRegistrationModal quickRegistrationModal, List <Files> fileDetail, IFormFileCollection files)
        {
            string Result = default(string);

            if (quickRegistrationModal.Type == "student")
            {
                StudentRegistrationModel registrationFormData = new StudentRegistrationModel();
                if (!string.IsNullOrEmpty(quickRegistrationModal.ClassDetailUid))
                {
                    registrationFormData.ClassDetailUid = quickRegistrationModal.ClassDetailUid;
                }
                else
                {
                    Result = " Class or section";
                }
                if (!string.IsNullOrEmpty(quickRegistrationModal.Class))
                {
                    registrationFormData.Class = quickRegistrationModal.Class;
                }
                else
                {
                    Result = " Class or section";
                }
                if (!string.IsNullOrEmpty(quickRegistrationModal.Fatherfirstname))
                {
                    registrationFormData.FatherFirstName = quickRegistrationModal.Fatherfirstname;
                }
                else
                {
                    Result = " Father name";
                }
                registrationFormData.FatherLastName = quickRegistrationModal.Fatherlastname;
                if (!string.IsNullOrEmpty(quickRegistrationModal.Motherfirstname))
                {
                    registrationFormData.MotherFirstName = quickRegistrationModal.Motherfirstname;
                }
                else
                {
                    Result = " Mother name";
                }
                registrationFormData.MotherLastName = quickRegistrationModal.Motherlastname;
                if (!string.IsNullOrEmpty(quickRegistrationModal.MobileNumber))
                {
                    registrationFormData.FatherMobileno = quickRegistrationModal.MobileNumber;
                }
                else
                {
                    Result = " Father Mobile no.#";
                }
                if (!string.IsNullOrEmpty(quickRegistrationModal.Class))
                {
                    registrationFormData.FirstName = quickRegistrationModal.Studentfirstname;
                }
                else
                {
                    Result = " Student name";
                }
                registrationFormData.LastName = quickRegistrationModal.Studentlastname;
                if (string.IsNullOrEmpty(Result))
                {
                    Result = SubmitStudentForm(registrationFormData, fileDetail, files, "sp_RegisterStudent");
                }
                else
                {
                    Result = "Invalid" + Result;
                }
            }
            else
            {
                RegistrationFormData registrationFormData = new RegistrationFormData();
                if (!string.IsNullOrEmpty(quickRegistrationModal.FirstName))
                {
                    registrationFormData.FirstName = quickRegistrationModal.FirstName;
                }
                else
                {
                    Result = " First name";
                }
                registrationFormData.LastName = quickRegistrationModal.LastName;
                if (!string.IsNullOrEmpty(quickRegistrationModal.MobileNumber))
                {
                    registrationFormData.MobileNumber = quickRegistrationModal.MobileNumber;
                }
                else
                {
                    Result = " Mobile no.#";
                }
                if (quickRegistrationModal.Type == "faculty")
                {
                    registrationFormData.Designation = "Faculty";
                }
                else
                {
                    registrationFormData.Designation = "Other";
                }
                if (string.IsNullOrEmpty(Result))
                {
                    Result = RegisterStaffFaculty(registrationFormData, fileDetail, files);
                }
                else
                {
                    Result = "Invalid" + Result;
                }
            }
            return(Result);
        }