Ejemplo n.º 1
0
        public IResponse <ApiResponse> QuickRegisterStudent()
        {
            StringValues SubmitedStringifyData = default(string);
            StringValues FileData = default(string);

            httpContext.Request.Form.TryGetValue("quickRegistrationObject", out SubmitedStringifyData);
            httpContext.Request.Form.TryGetValue("fileDetail", out FileData);
            if (SubmitedStringifyData.Count > 0)
            {
                QuickRegistrationModal quickRegistrationModal = JsonConvert.DeserializeObject <QuickRegistrationModal>(SubmitedStringifyData[0]);
                List <Files>           fileDetail             = JsonConvert.DeserializeObject <List <Files> >(FileData);
                if (quickRegistrationModal != null)
                {
                    IFormFileCollection files = httpContext.Request.Form.Files;
                    string Result             = this.registrationService.QuickStudentRegistrationService(quickRegistrationModal, fileDetail, files);
                    BuildResponse(Result, HttpStatusCode.OK);
                }
            }
            return(apiResponse);
        }
Ejemplo n.º 2
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);
        }