public IActionResult Create(CreateStudentView createStudentView)
        {
            Student student = new Student();

            if (ModelState.IsValid)
            {
                student = new Student()
                {
                    FullName    = createStudentView.FullName,
                    DateOfBirth = createStudentView.DateOfBirth,
                    Gender      = createStudentView.Gender,
                    Email       = createStudentView.Email,
                    ClassId     = createStudentView.ClassId
                };


                if (studentRepository.CreateStudent(student) > 0)
                {
                    return(View("Views/StudentsClass/Students.cshtml", studentsClassRepository.GetWatchStudentView(student.ClassId)));
                }
                else
                {
                    ModelState.AddModelError("", "some thing wrong");
                }
            }
            return(View(student));
        }
        public ActionResult Create(CreateStudentView FormData)
        {
            try {
                //if(String.IsNullOrEmpty(FormData.FirstName))
                //{
                //    ViewData["FirstNameError"] = " First name must be not null";
                //    return View();
                //}

                if (!ModelState.IsValid)
                {
                    return(View());
                }
                StudentService studentService = new StudentService();

                List <Student> studentList = studentService.GetStudents();

                Student student = Mapper.Map <Student>(FormData);

                student.Uuid      = Guid.NewGuid();
                student.LastLogin = null;
                student.CreatedAt = DateTime.Now;
                student.UpdatedAt = DateTime.Now;

                studentService.AddStudent(student);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
                return(View());
            }
        }
Пример #3
0
        public ActionResult Create(CreateStudentView FormData)
        {
            try {
                if (!ModelState.IsValid)
                {
                    return(View(FormData));
                }
                StudentService studentService = new StudentService();

                List <Student> studentList = studentService.GetStudents();

                Student student = Mapper.Map <Student>(FormData);

                student.Uuid      = Guid.NewGuid();
                student.LastLogin = null;
                student.CreatedAt = DateTime.Now;
                student.UpdatedAt = DateTime.Now;

                studentService.AddStudent(student);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
                return(View());
            }
        }
Пример #4
0
        private bool EmailAlreadyExists(CreateStudentView model)
        {
            int students = context.Students.Where(x => x.Email == model.Email).Count();

            if (students != 0)
            {
                return(false);
            }
            return(true);
        }
        public static void Create()
        {
            // Show the user prompts to create a student
            Student student = CreateStudentView.Show();

            // Save student to database and store the updated student object
            student = Student.Create(student);

            // Attach a cohort instance to the student.Cohort property
            student.Cohort = Cohort.Get(student.CohortId);

            // Display student
            Console.WriteLine(student.ToString());
        }
Пример #6
0
        public async Task <RegistrationStatus> RegisterStudent(CreateStudentView model)
        {
            RegistrationStatus status = model.Verify();

            try
            {
                if (status.Result)
                {
                    var user = new ApplicationUser()
                    {
                        UserName = model.UserName
                    };
                    user.Student = new Student(model);
                    user.Role    = ApplicationConstants.STUDENT;
                    string passowrd = Membership.GeneratePassword(10, 0);  // will be password
                    var    result   = await UserManager.CreateAsync(user, passowrd);

                    status = new RegistrationStatus(model, result.Succeeded, StudentRegResults.OK, result.Errors);
                    if (result.Succeeded)
                    {
                        var student = UserManager.FindByName(user.UserName);
                        UserManager.AddToRole(student.Id, ApplicationConstants.STUDENT);
                        Mailer.Mailer mail = new Mailer.Mailer();
                        mail.SetGeter(user.Student.Email);
                        string emailText = "You was ordet to the course ****** , by *******. <br /> ";
                        emailText += "User name: " + user.UserName + " <br /> ";
                        emailText += "Password: "******"Order to Course", emailText);
                        mail.Send();
                    }
                }
            }
            catch (Exception ex)
            {
                status = new RegistrationStatus(model, false, StudentRegResults.Exception, new List <string>()
                {
                    ex.Message
                });
            }

            return(status);
        }
 public IActionResult Create(CreateStudentView createStudentView)
 {
     if (ModelState.IsValid)
     {
         Student student = new Student()
         {
             ClassRoomId = createStudentView.ClassRoomId,
             FullName    = createStudentView.FullName,
             DoB         = createStudentView.DoB,
             Email       = createStudentView.Email,
             Gender      = createStudentView.Gender
         };
         if (studentRepository.CreateStudent(student) > 0)
         {
             var ModelForWatchStudentsByClassIdView = classRoomRepository.GetStudentViewById(student.ClassRoomId);
             return(View("Views/ClassRoom/WatchStudentsByClassId.cshtml", ModelForWatchStudentsByClassIdView));
         }
     }
     return(View(createStudentView));
 }
Пример #8
0
    public string[] createStudentVisitData(CreateStudentView StudentData)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "0";
        DataBase Base = new DataBase();
        SqlConnection Sqlconn = new SqlConnection(Base.GetConnString());
        using (Sqlconn)
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "INSERT INTO CaseVisitRecord(Unit, StudentID, VisitType, Purpose, VisitStaff, VisitDateTime, VisitTimeSince, VisitTimeUntil, VisitUnit, " +
                    "VisitUnitTel, VisitUnitZip, VisitUnitCity, VisitUnitOther, Participants, ContentRecord, CaseRecord, Remark, VisitPeople, VisitPlace, FamilyProfile1, " +
                    "FamilyProfile2, TreatmentUnit, TreatmentDate, TreatmentType1, TreatmentType2, TreatmentUnit1, Frequency1, FrequencyTime1, TreatmentType3, TreatmentUnit2, " +
                    "Frequency2, FrequencyTime2, NurserySchool, AttendedDate1, AttendedDate2, AttendedType, FamilyType, FamilyTypeText, PrimaryCaregiver, PrimaryCaregiverText, " +
                    "PrimaryCareTime, HomeOwnership, HomeEnvironment, HomeEnvironmentText, HomeType, HomeTypeText, TransportType, LeisurePlace, LeisurePlaceText, Remark2, " +
                    "HomeSpace1, HomeSpace2, Furniture, Electric, DangerPlace, Hydro, GarbagePlace, KitchenHealth, VentilateRoom, AdequateLight, SpaceSpaciou, SoundGood, " +
                    "Remark3, EconomicResource, PolicyDecision, Teaching, CareResources, EmotionalSupport, Problem, ResourceUse, ResourceUseText, Interactions, InteractionsText, " +
                    "Assistance, AssistanceText, ProblemSolve, Remark4, MedicalResources, InterventionResources, EconomicResources, fCareresources, fEmotionalSupport, " +
                    "EducationalResources, ReligiousResources, CulturalResources, fOther, fAssistance, fAssistanceText, Workaround, Remark5, FamilyEconomicResources, " +
                    "FamilyMedicalResources, FamilyInterventionResources, FamilyReligiousResources, FamilySources, FamilyEmotionalSupport, VisitSituation, FamilySuperiority, " +
                    "FamilyLimit, CaseSuperiority, CaseLimit, PrimaryCareSuperiority, PrimaryCareLimit, HouseholdDemand, SocialAssessment, TrafficRoute, Remark6, VisitPhoto1, " +
                    "VisitPhotoText1, VisitPhoto2, VisitPhotoText2, VisitPhoto3, VisitPhotoText3, VisitPhoto4, VisitPhotoText4, VisitPhoto5, VisitPhotoText5, VisitPhoto6, VisitPhotoText6, VisitPhoto7, VisitPhotoText7, VisitPhoto8, VisitPhotoText8, TeachingEnvironment, FamilySupport, FamilyInteraction, TeachingDemonstration, Interviews, TeachingAnalysis, CreateFileBy, UpFileBy, UpFileDate ) " +
                    "VALUES (@Unit, @StudentID, @VisitType, @Purpose, @VisitStaff, @VisitDateTime, @VisitTimeSince, @VisitTimeUntil, @VisitUnit, @VisitUnitTel, " +
                    "@VisitUnitZip, @VisitUnitCity, @VisitUnitOther, @Participants, @ContentRecord, @CaseRecord, @Remark, @VisitPeople, @VisitPlace, @FamilyProfile1, " +
                    "@FamilyProfile2, @TreatmentUnit, @TreatmentDate, @TreatmentType1, @TreatmentType2, @TreatmentUnit1, @Frequency1, @FrequencyTime1, @TreatmentType3, " +
                    "@TreatmentUnit2, @Frequency2, @FrequencyTime2, @NurserySchool, @AttendedDate1, @AttendedDate2, @AttendedType, @FamilyType, @FamilyTypeText, " +
                    "@PrimaryCaregiver, @PrimaryCaregiverText, @PrimaryCareTime, @HomeOwnership, @HomeEnvironment, @HomeEnvironmentText, @HomeType, @HomeTypeText, " +
                    "@TransportType, @LeisurePlace, @LeisurePlaceText, @Remark2, @HomeSpace1, @HomeSpace2, @Furniture, @Electric, @DangerPlace, @Hydro, @GarbagePlace, " +
                    "@KitchenHealth, @VentilateRoom, @AdequateLight, @SpaceSpaciou, @SoundGood, @Remark3, @EconomicResource, @PolicyDecision, @Teaching, @CareResources, " +
                    "@EmotionalSupport, @Problem, @ResourceUse, @ResourceUseText, @Interactions, @InteractionsText, @Assistance, @AssistanceText, @ProblemSolve, @Remark4, " +
                    "@MedicalResources, @InterventionResources, @EconomicResources, @fCareresources, @fEmotionalSupport, @EducationalResources, @ReligiousResources, " +
                    "@CulturalResources, @fOther, @fAssistance, @fAssistanceText, @Workaround, @Remark5, @FamilyEconomicResources, @FamilyMedicalResources, " +
                    "@FamilyInterventionResources, @FamilyReligiousResources, @FamilySources, @FamilyEmotionalSupport, @VisitSituation, @FamilySuperiority, " +
                    "@FamilyLimit, @CaseSuperiority, @CaseLimit, @PrimaryCareSuperiority, @PrimaryCareLimit, @HouseholdDemand, @SocialAssessment, @TrafficRoute, " +
                    "@Remark6, @VisitPhoto1, @VisitPhotoText1, @VisitPhoto2, @VisitPhotoText2, @VisitPhoto3, @VisitPhotoText3, @VisitPhoto4, @VisitPhotoText4, @VisitPhoto5, " +
                    "@VisitPhotoText5, @VisitPhoto6, @VisitPhotoText6, @VisitPhoto7, @VisitPhotoText7, @VisitPhoto8, @VisitPhotoText8, @TeachingEnvironment, @FamilySupport, " +
                    "@FamilyInteraction, @TeachingDemonstration, @Interviews, @TeachingAnalysis, @CreateFileBy, @UpFileBy, (getDate()) )";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@Unit", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[2].ToString());
                cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentID);
                cmd.Parameters.Add("@VisitType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.visitType);
                cmd.Parameters.Add("@Purpose", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.target);
                cmd.Parameters.Add("@VisitStaff", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(StudentData.viewSocialWork);
                cmd.Parameters.Add("@VisitDateTime", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.viewDate);
                cmd.Parameters.Add("@VisitTimeSince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewTime1);
                cmd.Parameters.Add("@VisitTimeUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewTime2);
                cmd.Parameters.Add("@VisitUnit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewUnit);
                cmd.Parameters.Add("@VisitUnitTel", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewTel);
                cmd.Parameters.Add("@VisitUnitZip", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.addressZip);
                cmd.Parameters.Add("@VisitUnitCity", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.addressCity);
                cmd.Parameters.Add("@VisitUnitOther", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.address);
                cmd.Parameters.Add("@Participants", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPeople1);
                cmd.Parameters.Add("@ContentRecord", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewContent1);
                cmd.Parameters.Add("@CaseRecord", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewContent2);
                cmd.Parameters.Add("@Remark", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewRemark1);
                cmd.Parameters.Add("@VisitPeople", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.viewPeople2);
                cmd.Parameters.Add("@VisitPlace", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPlace);
                cmd.Parameters.Add("@FamilyProfile1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.pedigree);
                cmd.Parameters.Add("@FamilyProfile2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.ecological);
                cmd.Parameters.Add("@TreatmentUnit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.cureUnit);
                cmd.Parameters.Add("@TreatmentDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.cureDate);
                cmd.Parameters.Add("@TreatmentType1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureType);
                cmd.Parameters.Add("@TreatmentType2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureType1);
                cmd.Parameters.Add("@TreatmentUnit1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.cureUnit1);
                cmd.Parameters.Add("@Frequency1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureNumber1);
                cmd.Parameters.Add("@FrequencyTime1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureNumberTime1);
                cmd.Parameters.Add("@TreatmentType3", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureType2);
                cmd.Parameters.Add("@TreatmentUnit2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.cureUnit2);
                cmd.Parameters.Add("@Frequency2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureNumber2);
                cmd.Parameters.Add("@FrequencyTime2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureNumberTime2);
                cmd.Parameters.Add("@NurserySchool", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.preSchool);
                cmd.Parameters.Add("@AttendedDate1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studyDate1);
                cmd.Parameters.Add("@AttendedDate2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studyDate2);
                cmd.Parameters.Add("@AttendedType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.studyType);
                cmd.Parameters.Add("@FamilyType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.familyType);
                cmd.Parameters.Add("@FamilyTypeText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyTypeText);
                cmd.Parameters.Add("@PrimaryCaregiver", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.careProple);
                cmd.Parameters.Add("@PrimaryCaregiverText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.carePropleText);
                cmd.Parameters.Add("@PrimaryCareTime", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.careTime);
                cmd.Parameters.Add("@HomeOwnership", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.homeOwnership);
                cmd.Parameters.Add("@HomeEnvironment", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.homeAround);
                cmd.Parameters.Add("@HomeEnvironmentText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.homeAroundText);
                cmd.Parameters.Add("@HomeType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.homeType);
                cmd.Parameters.Add("@HomeTypeText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.homeTypeText);
                cmd.Parameters.Add("@TransportType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.transportType);
                cmd.Parameters.Add("@LeisurePlace", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.leisureType);
                cmd.Parameters.Add("@LeisurePlaceText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.leisureTypeText);
                cmd.Parameters.Add("@Remark2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation2);
                cmd.Parameters.Add("@HomeSpace1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.homeSpace1);
                cmd.Parameters.Add("@HomeSpace2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.homeSpace2);
                cmd.Parameters.Add("@Furniture", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.furniture);
                cmd.Parameters.Add("@Electric", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.electric);
                cmd.Parameters.Add("@DangerPlace", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.place);
                cmd.Parameters.Add("@Hydro", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.hydro);
                cmd.Parameters.Add("@GarbagePlace", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.dining1);
                cmd.Parameters.Add("@KitchenHealth", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.dining2);
                cmd.Parameters.Add("@VentilateRoom", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.indoor1);
                cmd.Parameters.Add("@AdequateLight", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.indoor2);
                cmd.Parameters.Add("@SpaceSpaciou", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.indoor3);
                cmd.Parameters.Add("@SoundGood", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.indoor4);
                cmd.Parameters.Add("@Remark3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation3);
                cmd.Parameters.Add("@EconomicResource", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal1);
                cmd.Parameters.Add("@PolicyDecision", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal2);
                cmd.Parameters.Add("@Teaching", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal3);
                cmd.Parameters.Add("@CareResources", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal4);
                cmd.Parameters.Add("@EmotionalSupport", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal5);
                cmd.Parameters.Add("@Problem", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal6);
                cmd.Parameters.Add("@ResourceUse", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal7);
                cmd.Parameters.Add("@ResourceUseText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.informal7Text);
                cmd.Parameters.Add("@Interactions", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal8);
                cmd.Parameters.Add("@InteractionsText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.informal8Text);
                cmd.Parameters.Add("@Assistance", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal9);
                cmd.Parameters.Add("@AssistanceText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.informal9Text);
                cmd.Parameters.Add("@ProblemSolve", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal10);
                cmd.Parameters.Add("@Remark4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation4);
                cmd.Parameters.Add("@MedicalResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText1);
                cmd.Parameters.Add("@InterventionResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText2);
                cmd.Parameters.Add("@EconomicResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText3);
                cmd.Parameters.Add("@fCareresources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText4);
                cmd.Parameters.Add("@fEmotionalSupport", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText5);
                cmd.Parameters.Add("@EducationalResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText6);
                cmd.Parameters.Add("@ReligiousResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText7);
                cmd.Parameters.Add("@CulturalResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText8);
                cmd.Parameters.Add("@fOther", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText9);
                cmd.Parameters.Add("@fAssistance", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.formal1);
                cmd.Parameters.Add("@fAssistanceText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formal2);
                cmd.Parameters.Add("@Workaround", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.formal3);
                cmd.Parameters.Add("@Remark5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation5);
                cmd.Parameters.Add("@FamilyEconomicResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction1);
                cmd.Parameters.Add("@FamilyMedicalResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction2);
                cmd.Parameters.Add("@FamilyInterventionResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction3);
                cmd.Parameters.Add("@FamilyReligiousResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction4);
                cmd.Parameters.Add("@FamilySources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction5);
                cmd.Parameters.Add("@FamilyEmotionalSupport", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction6);
                cmd.Parameters.Add("@VisitSituation", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewSituation);
                cmd.Parameters.Add("@FamilySuperiority", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyStrengths);
                cmd.Parameters.Add("@FamilyLimit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyLimit);
                cmd.Parameters.Add("@CaseSuperiority", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.caseStrengths);
                cmd.Parameters.Add("@CaseLimit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.caseLimit);
                cmd.Parameters.Add("@PrimaryCareSuperiority", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.primaryCaseStrengths);
                cmd.Parameters.Add("@PrimaryCareLimit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.primaryCaseLimit);
                cmd.Parameters.Add("@HouseholdDemand", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyDemand);
                cmd.Parameters.Add("@SocialAssessment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.assessment);
                cmd.Parameters.Add("@TrafficRoute", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.trafficRoute);
                cmd.Parameters.Add("@Remark6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation6);
                cmd.Parameters.Add("@VisitPhoto1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto1);
                cmd.Parameters.Add("@VisitPhotoText1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText1);
                cmd.Parameters.Add("@VisitPhoto2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto2);
                cmd.Parameters.Add("@VisitPhotoText2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText2);
                cmd.Parameters.Add("@VisitPhoto3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto3);
                cmd.Parameters.Add("@VisitPhotoText3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText3);
                cmd.Parameters.Add("@VisitPhoto4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto4);
                cmd.Parameters.Add("@VisitPhotoText4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText4);
                cmd.Parameters.Add("@VisitPhoto5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto5);
                cmd.Parameters.Add("@VisitPhotoText5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText5);
                cmd.Parameters.Add("@VisitPhoto6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto6);
                cmd.Parameters.Add("@VisitPhotoText6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText6);
                cmd.Parameters.Add("@VisitPhoto7", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto7);
                cmd.Parameters.Add("@VisitPhotoText7", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText7);
                cmd.Parameters.Add("@VisitPhoto8", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto8);
                cmd.Parameters.Add("@VisitPhotoText8", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText8);
                cmd.Parameters.Add("@TeachingEnvironment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.teachingSpace);
                cmd.Parameters.Add("@FamilySupport", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familySupport);
                cmd.Parameters.Add("@FamilyInteraction", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyInteraction);
                cmd.Parameters.Add("@TeachingDemonstration", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.teachingDemonstration);
                cmd.Parameters.Add("@Interviews", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewConclusion);
                cmd.Parameters.Add("@TeachingAnalysis", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.teachingAnalysis);

                cmd.Parameters.Add("@Personnel", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue[0] = cmd.ExecuteNonQuery().ToString();

                if (returnValue[0] != "0")
                {
                    sql = "select IDENT_CURRENT('CaseVisitRecord') AS cID";
                    cmd = new SqlCommand(sql, Sqlconn);
                    SqlDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        returnValue[1] = dr["cID"].ToString();
                    }
                    dr.Close();
                }
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }
        }
        return returnValue;
    }
Пример #9
0
    public string[] setStudentVisitData(CreateStudentView StudentData)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "0";
        string PicUpdatestring = "";

        if (StudentData.pedigree != null) {
            PicUpdatestring +=" FamilyProfile1=@FamilyProfile1, ";
        }
        if (StudentData.ecological != null) {
            PicUpdatestring += " FamilyProfile2=@FamilyProfile2, ";
        }
        if (StudentData.trafficRoute != null)
        {
            PicUpdatestring += "TrafficRoute=@TrafficRoute, ";
        }
        if (StudentData.viewPhoto1 != null) {
             PicUpdatestring += "VisitPhoto1=@VisitPhoto1, ";
        }
        if (StudentData.viewPhoto2 != null) {
            PicUpdatestring += "VisitPhoto2=@VisitPhoto2, ";
        }
        if (StudentData.viewPhoto3 != null) {
           PicUpdatestring += "VisitPhoto3=@VisitPhoto3, ";
        }
        if (StudentData.viewPhoto4 != null) {
           PicUpdatestring += "VisitPhoto4=@VisitPhoto4, ";
        }
        if (StudentData.viewPhoto5 != null) {
           PicUpdatestring += "VisitPhoto5=@VisitPhoto5, ";
        }
        if (StudentData.viewPhoto6 != null) {
            PicUpdatestring += "VisitPhoto6=@VisitPhoto6, ";
        }
        if (StudentData.viewPhoto7 != null) {
           PicUpdatestring += "VisitPhoto7=@VisitPhoto7, ";
        }
        if (StudentData.viewPhoto8 != null)
        {
            PicUpdatestring += "VisitPhoto8=@VisitPhoto8, ";
        }
        DataBase Base = new DataBase();
        SqlConnection Sqlconn = new SqlConnection(Base.GetConnString());
        using (Sqlconn)
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "UPDATE CaseVisitRecord SET Purpose=@Purpose, VisitStaff=@VisitStaff, VisitDateTime=@VisitDateTime, VisitTimeSince=@VisitTimeSince, " +
                    "VisitTimeUntil=@VisitTimeUntil, VisitUnit=@VisitUnit, VisitUnitTel=@VisitUnitTel, VisitUnitZip=@VisitUnitZip, VisitUnitCity=@VisitUnitCity, " +
                    "VisitUnitOther=@VisitUnitOther, Participants=@Participants, ContentRecord=@ContentRecord, CaseRecord=@CaseRecord, Remark=@Remark, " +
                    "VisitPeople=@VisitPeople, VisitPlace=@VisitPlace, TreatmentUnit=@TreatmentUnit, " +
                    "TreatmentDate=@TreatmentDate, TreatmentType1=@TreatmentType1, TreatmentType2=@TreatmentType2, TreatmentUnit1=@TreatmentUnit1, Frequency1=@Frequency1, " +
                    "FrequencyTime1=@FrequencyTime1, TreatmentType3=@TreatmentType3, TreatmentUnit2=@TreatmentUnit2, Frequency2=@Frequency2, FrequencyTime2=@FrequencyTime2, " +
                    "NurserySchool=@NurserySchool, AttendedDate1=@AttendedDate1, AttendedDate2=@AttendedDate2, AttendedType=@AttendedType, FamilyType=@FamilyType, " +
                    "FamilyTypeText=@FamilyTypeText, PrimaryCaregiver=@PrimaryCaregiver, PrimaryCaregiverText=@PrimaryCaregiverText, PrimaryCareTime=@PrimaryCareTime, " +
                    "HomeOwnership=@HomeOwnership, HomeEnvironment=@HomeEnvironment, HomeEnvironmentText=@HomeEnvironmentText, HomeType=@HomeType, HomeTypeText=@HomeTypeText, " +
                    "TransportType=@TransportType, LeisurePlace=@LeisurePlace, LeisurePlaceText=@LeisurePlaceText, Remark2=@Remark2, HomeSpace1=@HomeSpace1, " +
                    "HomeSpace2=@HomeSpace2, Furniture=@Furniture, Electric=@Electric, DangerPlace=@DangerPlace, Hydro=@Hydro, GarbagePlace=@GarbagePlace, " +
                    "KitchenHealth=@KitchenHealth, VentilateRoom=@VentilateRoom, AdequateLight=@AdequateLight, SpaceSpaciou=@SpaceSpaciou, SoundGood=@SoundGood, " +
                    "Remark3=@Remark3, EconomicResource=@EconomicResource, PolicyDecision=@PolicyDecision, Teaching=@Teaching, CareResources=@CareResources, " +
                    "EmotionalSupport=@EmotionalSupport, Problem=@Problem, ResourceUse=@ResourceUse, ResourceUseText=@ResourceUseText, Interactions=@Interactions, " +
                    "InteractionsText=@InteractionsText, Assistance=@Assistance, AssistanceText=@AssistanceText, ProblemSolve=@ProblemSolve, Remark4=@Remark4, " +
                    "MedicalResources=@MedicalResources, InterventionResources=@InterventionResources, EconomicResources=@EconomicResources, fCareresources=@fCareresources, " +
                    "fEmotionalSupport=@fEmotionalSupport, EducationalResources=@EducationalResources, ReligiousResources=@ReligiousResources, " +
                    "CulturalResources=@CulturalResources, fOther=@fOther, fAssistance=@fAssistance, fAssistanceText=@fAssistanceText, Workaround=@Workaround, " +
                    "Remark5=@Remark5, FamilyEconomicResources=@FamilyEconomicResources, FamilyMedicalResources=@FamilyMedicalResources, " +
                    "FamilyInterventionResources=@FamilyInterventionResources, FamilyReligiousResources=@FamilyReligiousResources, FamilySources=@FamilySources, " +
                    "FamilyEmotionalSupport=@FamilyEmotionalSupport, VisitSituation=@VisitSituation, FamilySuperiority=@FamilySuperiority, FamilyLimit=@FamilyLimit, " +
                    "CaseSuperiority=@CaseSuperiority, CaseLimit=@CaseLimit, PrimaryCareSuperiority=@PrimaryCareSuperiority, PrimaryCareLimit=@PrimaryCareLimit, " +
                    "HouseholdDemand=@HouseholdDemand, SocialAssessment=@SocialAssessment, Remark6=@Remark6, " +
                    "VisitPhotoText1=@VisitPhotoText1, VisitPhotoText2=@VisitPhotoText2, VisitPhotoText3=@VisitPhotoText3, VisitPhotoText4=@VisitPhotoText4, " +
                    "VisitPhotoText5=@VisitPhotoText5, VisitPhotoText6=@VisitPhotoText6, VisitPhotoText7=@VisitPhotoText7, VisitPhotoText8=@VisitPhotoText8, " +
                    "TeachingEnvironment=@TeachingEnvironment, FamilySupport=@FamilySupport, FamilyInteraction=@FamilyInteraction, TeachingDemonstration=@TeachingDemonstration, " +
                    "Interviews=@Interviews, TeachingAnalysis=@TeachingAnalysis, "+ PicUpdatestring +" UpFileBy=@UpFileBy, UpFileDate=(getDate()) " +
                    "WHERE ID=@ID";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = Chk.CheckStringtoInt64Function(StudentData.ID);
                cmd.Parameters.Add("@VisitType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.visitType);
                cmd.Parameters.Add("@Purpose", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.target);
                cmd.Parameters.Add("@VisitStaff", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(StudentData.viewSocialWork);
                cmd.Parameters.Add("@VisitDateTime", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.viewDate);
                cmd.Parameters.Add("@VisitTimeSince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewTime1);
                cmd.Parameters.Add("@VisitTimeUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewTime2);
                cmd.Parameters.Add("@VisitUnit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewUnit);
                cmd.Parameters.Add("@VisitUnitTel", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewTel);
                cmd.Parameters.Add("@VisitUnitZip", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.addressZip);
                cmd.Parameters.Add("@VisitUnitCity", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.addressCity);
                cmd.Parameters.Add("@VisitUnitOther", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.address);
                cmd.Parameters.Add("@Participants", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPeople1);
                cmd.Parameters.Add("@ContentRecord", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewContent1);
                cmd.Parameters.Add("@CaseRecord", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewContent2);
                cmd.Parameters.Add("@Remark", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewRemark1);
                cmd.Parameters.Add("@VisitPeople", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.viewPeople2);
                cmd.Parameters.Add("@VisitPlace", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPlace);
                cmd.Parameters.Add("@FamilyProfile1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.pedigree);
                cmd.Parameters.Add("@FamilyProfile2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.ecological);
                cmd.Parameters.Add("@TreatmentUnit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.cureUnit);
                cmd.Parameters.Add("@TreatmentDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.cureDate);
                cmd.Parameters.Add("@TreatmentType1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureType);
                cmd.Parameters.Add("@TreatmentType2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureType1);
                cmd.Parameters.Add("@TreatmentUnit1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.cureUnit1);
                cmd.Parameters.Add("@Frequency1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureNumber1);
                cmd.Parameters.Add("@FrequencyTime1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureNumberTime1);
                cmd.Parameters.Add("@TreatmentType3", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureType2);
                cmd.Parameters.Add("@TreatmentUnit2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.cureUnit2);
                cmd.Parameters.Add("@Frequency2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureNumber2);
                cmd.Parameters.Add("@FrequencyTime2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.cureNumberTime2);
                cmd.Parameters.Add("@NurserySchool", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.preSchool);
                cmd.Parameters.Add("@AttendedDate1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studyDate1);
                cmd.Parameters.Add("@AttendedDate2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studyDate2);
                cmd.Parameters.Add("@AttendedType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.studyType);
                cmd.Parameters.Add("@FamilyType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.familyType);
                cmd.Parameters.Add("@FamilyTypeText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyTypeText);
                cmd.Parameters.Add("@PrimaryCaregiver", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.careProple);
                cmd.Parameters.Add("@PrimaryCaregiverText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.carePropleText);
                cmd.Parameters.Add("@PrimaryCareTime", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.careTime);
                cmd.Parameters.Add("@HomeOwnership", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.homeOwnership);
                cmd.Parameters.Add("@HomeEnvironment", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.homeAround);
                cmd.Parameters.Add("@HomeEnvironmentText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.homeAroundText);
                cmd.Parameters.Add("@HomeType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.homeType);
                cmd.Parameters.Add("@HomeTypeText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.homeTypeText);
                cmd.Parameters.Add("@TransportType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.transportType);
                cmd.Parameters.Add("@LeisurePlace", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.leisureType);
                cmd.Parameters.Add("@LeisurePlaceText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.leisureTypeText);
                cmd.Parameters.Add("@Remark2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation2);
                cmd.Parameters.Add("@HomeSpace1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.homeSpace1);
                cmd.Parameters.Add("@HomeSpace2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.homeSpace2);
                cmd.Parameters.Add("@Furniture", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.furniture);
                cmd.Parameters.Add("@Electric", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.electric);
                cmd.Parameters.Add("@DangerPlace", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.place);
                cmd.Parameters.Add("@Hydro", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.hydro);
                cmd.Parameters.Add("@GarbagePlace", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.dining1);
                cmd.Parameters.Add("@KitchenHealth", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.dining2);
                cmd.Parameters.Add("@VentilateRoom", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.indoor1);
                cmd.Parameters.Add("@AdequateLight", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.indoor2);
                cmd.Parameters.Add("@SpaceSpaciou", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.indoor3);
                cmd.Parameters.Add("@SoundGood", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.indoor4);
                cmd.Parameters.Add("@Remark3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation3);
                cmd.Parameters.Add("@EconomicResource", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal1);
                cmd.Parameters.Add("@PolicyDecision", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal2);
                cmd.Parameters.Add("@Teaching", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal3);
                cmd.Parameters.Add("@CareResources", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal4);
                cmd.Parameters.Add("@EmotionalSupport", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal5);
                cmd.Parameters.Add("@Problem", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal6);
                cmd.Parameters.Add("@ResourceUse", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal7);
                cmd.Parameters.Add("@ResourceUseText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.informal7Text);
                cmd.Parameters.Add("@Interactions", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal8);
                cmd.Parameters.Add("@InteractionsText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.informal8Text);
                cmd.Parameters.Add("@Assistance", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal9);
                cmd.Parameters.Add("@AssistanceText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.informal9Text);
                cmd.Parameters.Add("@ProblemSolve", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.informal10);
                cmd.Parameters.Add("@Remark4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation4);
                cmd.Parameters.Add("@MedicalResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText1);
                cmd.Parameters.Add("@InterventionResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText2);
                cmd.Parameters.Add("@EconomicResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText3);
                cmd.Parameters.Add("@fCareresources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText4);
                cmd.Parameters.Add("@fEmotionalSupport", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText5);
                cmd.Parameters.Add("@EducationalResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText6);
                cmd.Parameters.Add("@ReligiousResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText7);
                cmd.Parameters.Add("@CulturalResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText8);
                cmd.Parameters.Add("@fOther", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formalText9);
                cmd.Parameters.Add("@fAssistance", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.formal1);
                cmd.Parameters.Add("@fAssistanceText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.formal2);
                cmd.Parameters.Add("@Workaround", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.formal3);
                cmd.Parameters.Add("@Remark5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation5);
                cmd.Parameters.Add("@FamilyEconomicResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction1);
                cmd.Parameters.Add("@FamilyMedicalResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction2);
                cmd.Parameters.Add("@FamilyInterventionResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction3);
                cmd.Parameters.Add("@FamilyReligiousResources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction4);
                cmd.Parameters.Add("@FamilySources", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction5);
                cmd.Parameters.Add("@FamilyEmotionalSupport", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyFunction6);
                cmd.Parameters.Add("@VisitSituation", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewSituation);
                cmd.Parameters.Add("@FamilySuperiority", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyStrengths);
                cmd.Parameters.Add("@FamilyLimit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyLimit);
                cmd.Parameters.Add("@CaseSuperiority", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.caseStrengths);
                cmd.Parameters.Add("@CaseLimit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.caseLimit);
                cmd.Parameters.Add("@PrimaryCareSuperiority", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.primaryCaseStrengths);
                cmd.Parameters.Add("@PrimaryCareLimit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.primaryCaseLimit);
                cmd.Parameters.Add("@HouseholdDemand", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyDemand);
                cmd.Parameters.Add("@SocialAssessment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.assessment);
                cmd.Parameters.Add("@TrafficRoute", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.trafficRoute);
                cmd.Parameters.Add("@Remark6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.explanation6);
                cmd.Parameters.Add("@VisitPhoto1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto1);
                cmd.Parameters.Add("@VisitPhotoText1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText1);
                cmd.Parameters.Add("@VisitPhoto2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto2);
                cmd.Parameters.Add("@VisitPhotoText2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText2);
                cmd.Parameters.Add("@VisitPhoto3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto3);
                cmd.Parameters.Add("@VisitPhotoText3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText3);
                cmd.Parameters.Add("@VisitPhoto4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto4);
                cmd.Parameters.Add("@VisitPhotoText4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText4);
                cmd.Parameters.Add("@VisitPhoto5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto5);
                cmd.Parameters.Add("@VisitPhotoText5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText5);
                cmd.Parameters.Add("@VisitPhoto6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto6);
                cmd.Parameters.Add("@VisitPhotoText6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText6);
                cmd.Parameters.Add("@VisitPhoto7", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto7);
                cmd.Parameters.Add("@VisitPhotoText7", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText7);
                cmd.Parameters.Add("@VisitPhoto8", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhoto8);
                cmd.Parameters.Add("@VisitPhotoText8", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewPhotoText8);
                cmd.Parameters.Add("@TeachingEnvironment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.teachingSpace);
                cmd.Parameters.Add("@FamilySupport", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familySupport);
                cmd.Parameters.Add("@FamilyInteraction", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyInteraction);
                cmd.Parameters.Add("@TeachingDemonstration", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.teachingDemonstration);
                cmd.Parameters.Add("@Interviews", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.viewConclusion);
                cmd.Parameters.Add("@TeachingAnalysis", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.teachingAnalysis);
                cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }
        }
        return returnValue;
    }
Пример #10
0
    public CreateStudentView getStudentVisitData(string ID)
    {
        CreateStudentView returnValue = new CreateStudentView();
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                Sqlconn.Open();
                string sql = "SELECT StudentDatabase.StudentName, CaseVisitRecord.* , StaffDatabase.StaffName " +
                 "FROM CaseVisitRecord INNER JOIN StudentDatabase ON CaseVisitRecord.StudentID=StudentDatabase.StudentID " +
                 "INNER JOIN StaffDatabase ON CaseVisitRecord.CreateFileBy=StaffDatabase.StaffID " +
                 "WHERE CaseVisitRecord.isDeleted=0 AND CaseVisitRecord.ID=@ID";

                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = Chk.CheckStringtoInt64Function(ID);
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    returnValue.ID = dr["ID"].ToString();
                    returnValue.caseUnit = dr["Unit"].ToString();
                    returnValue.studentID = dr["StudentID"].ToString();
                    returnValue.studentName = dr["StudentName"].ToString();
                    returnValue.visitType = dr["VisitType"].ToString();
                    returnValue.target = dr["Purpose"].ToString();
                    returnValue.viewSocialWork = dr["StaffName"].ToString();
                    returnValue.viewDate = DateTime.Parse(dr["VisitDateTime"].ToString()).ToString("yyyy-MM-dd");
                    returnValue.viewTime1 = dr["VisitTimeSince"].ToString();
                    returnValue.viewTime2 = dr["VisitTimeUntil"].ToString();
                    returnValue.viewUnit = dr["VisitUnit"].ToString();
                    returnValue.viewTel = dr["VisitUnitTel"].ToString();
                    returnValue.addressZip = dr["VisitUnitZip"].ToString();
                    returnValue.addressCity = dr["VisitUnitCity"].ToString();
                    returnValue.address = dr["VisitUnitOther"].ToString();
                    returnValue.viewPeople1 = dr["Participants"].ToString();
                    returnValue.viewContent1 = dr["ContentRecord"].ToString();
                    returnValue.viewContent2 = dr["CaseRecord"].ToString();
                    returnValue.viewRemark1 = dr["Remark"].ToString();
                    returnValue.viewPeople2 = dr["VisitPeople"].ToString();
                    returnValue.viewPlace = dr["VisitPlace"].ToString();
                    returnValue.pedigree = dr["FamilyProfile1"].ToString();
                    returnValue.ecological = dr["FamilyProfile2"].ToString();
                    returnValue.cureUnit = dr["TreatmentUnit"].ToString();
                    returnValue.cureDate = DateTime.Parse(dr["TreatmentDate"].ToString()).ToString("yyyy-MM-dd");
                    returnValue.cureType = dr["TreatmentType1"].ToString();
                    returnValue.cureType1 = dr["TreatmentType2"].ToString();
                    returnValue.cureUnit1 = dr["TreatmentUnit1"].ToString();
                    returnValue.cureNumber1 = dr["Frequency1"].ToString();
                    returnValue.cureNumberTime1 = dr["FrequencyTime1"].ToString();
                    returnValue.cureType2 = dr["TreatmentType3"].ToString();
                    returnValue.cureUnit2 = dr["TreatmentUnit2"].ToString();
                    returnValue.cureNumber2 = dr["Frequency2"].ToString();
                    returnValue.cureNumberTime2 = dr["FrequencyTime2"].ToString();
                    returnValue.preSchool = dr["NurserySchool"].ToString();
                    returnValue.studyDate1 = dr["AttendedDate1"].ToString();
                    returnValue.studyDate2 = dr["AttendedDate2"].ToString();
                    returnValue.studyType = dr["AttendedType"].ToString();
                    returnValue.familyType = dr["FamilyType"].ToString();
                    returnValue.familyTypeText = dr["FamilyTypeText"].ToString();
                    returnValue.careProple = dr["PrimaryCaregiver"].ToString();
                    returnValue.carePropleText = dr["PrimaryCaregiverText"].ToString();
                    returnValue.careTime = dr["PrimaryCareTime"].ToString();
                    returnValue.homeOwnership = dr["HomeOwnership"].ToString();
                    returnValue.homeAround = dr["HomeEnvironment"].ToString();
                    returnValue.homeAroundText = dr["HomeEnvironmentText"].ToString();
                    returnValue.homeType = dr["HomeType"].ToString();
                    returnValue.homeTypeText = dr["HomeTypeText"].ToString();
                    returnValue.transportType = dr["TransportType"].ToString();
                    returnValue.leisureType = dr["LeisurePlace"].ToString();
                    returnValue.leisureTypeText = dr["LeisurePlaceText"].ToString();
                    returnValue.explanation2 = dr["Remark2"].ToString();
                    returnValue.homeSpace1 = dr["HomeSpace1"].ToString();
                    returnValue.homeSpace2 = dr["HomeSpace2"].ToString();
                    returnValue.furniture = dr["Furniture"].ToString();
                    returnValue.electric = dr["Electric"].ToString();
                    returnValue.place = dr["DangerPlace"].ToString();
                    returnValue.hydro = dr["Hydro"].ToString();
                    returnValue.dining1 = dr["GarbagePlace"].ToString();
                    returnValue.dining2 = dr["KitchenHealth"].ToString();
                    returnValue.indoor1 = dr["VentilateRoom"].ToString();
                    returnValue.indoor2 = dr["AdequateLight"].ToString();
                    returnValue.indoor3 = dr["SpaceSpaciou"].ToString();
                    returnValue.indoor4 = dr["SoundGood"].ToString();
                    returnValue.explanation3 = dr["Remark3"].ToString();
                    returnValue.informal1 = dr["EconomicResource"].ToString();
                    returnValue.informal2 = dr["PolicyDecision"].ToString();
                    returnValue.informal3 = dr["Teaching"].ToString();
                    returnValue.informal4 = dr["CareResources"].ToString();
                    returnValue.informal5 = dr["EmotionalSupport"].ToString();
                    returnValue.informal6 = dr["Problem"].ToString();
                    returnValue.informal7 = dr["ResourceUse"].ToString();
                    returnValue.informal7Text = dr["ResourceUseText"].ToString();
                    returnValue.informal8 = dr["Interactions"].ToString();
                    returnValue.informal8Text = dr["InteractionsText"].ToString();
                    returnValue.informal9 = dr["Assistance"].ToString();
                    returnValue.informal9Text = dr["AssistanceText"].ToString();
                    returnValue.informal10 = dr["ProblemSolve"].ToString();
                    returnValue.explanation4 = dr["Remark4"].ToString();
                    returnValue.formalText1 = dr["MedicalResources"].ToString();
                    returnValue.formalText2 = dr["InterventionResources"].ToString();
                    returnValue.formalText3 = dr["EconomicResources"].ToString();
                    returnValue.formalText4 = dr["fCareresources"].ToString();
                    returnValue.formalText5 = dr["fEmotionalSupport"].ToString();
                    returnValue.formalText6 = dr["EducationalResources"].ToString();
                    returnValue.formalText7 = dr["ReligiousResources"].ToString();
                    returnValue.formalText8 = dr["CulturalResources"].ToString();
                    returnValue.formalText9 = dr["fOther"].ToString();
                    returnValue.formal1 = dr["fAssistance"].ToString();
                    returnValue.formal2 = dr["fAssistanceText"].ToString();
                    returnValue.formal3 = dr["Workaround"].ToString();
                    returnValue.explanation5 = dr["Remark5"].ToString();
                    returnValue.familyFunction1 = dr["FamilyEconomicResources"].ToString();
                    returnValue.familyFunction2 = dr["FamilyMedicalResources"].ToString();
                    returnValue.familyFunction3 = dr["FamilyInterventionResources"].ToString();
                    returnValue.familyFunction4 = dr["FamilyReligiousResources"].ToString();
                    returnValue.familyFunction5 = dr["FamilySources"].ToString();
                    returnValue.familyFunction6 = dr["FamilyEmotionalSupport"].ToString();
                    returnValue.viewSituation = dr["VisitSituation"].ToString();
                    returnValue.familyStrengths = dr["FamilySuperiority"].ToString();
                    returnValue.familyLimit = dr["FamilyLimit"].ToString();
                    returnValue.caseStrengths = dr["CaseSuperiority"].ToString();
                    returnValue.caseLimit = dr["CaseLimit"].ToString();
                    returnValue.primaryCaseStrengths = dr["PrimaryCareSuperiority"].ToString();
                    returnValue.primaryCaseLimit = dr["PrimaryCareLimit"].ToString();
                    returnValue.familyDemand = dr["HouseholdDemand"].ToString();
                    returnValue.assessment = dr["SocialAssessment"].ToString();
                    returnValue.trafficRoute = dr["TrafficRoute"].ToString();
                    returnValue.explanation6 = dr["Remark6"].ToString();
                    returnValue.viewPhoto1 = dr["VisitPhoto1"].ToString();
                    returnValue.viewPhotoText1 = dr["VisitPhotoText1"].ToString();
                    returnValue.viewPhoto2 = dr["VisitPhoto2"].ToString();
                    returnValue.viewPhotoText2 = dr["VisitPhotoText2"].ToString();
                    returnValue.viewPhoto3 = dr["VisitPhoto3"].ToString();
                    returnValue.viewPhotoText3 = dr["VisitPhotoText3"].ToString();
                    returnValue.viewPhoto4 = dr["VisitPhoto4"].ToString();
                    returnValue.viewPhotoText4 = dr["VisitPhotoText4"].ToString();
                    returnValue.viewPhoto5 = dr["VisitPhoto5"].ToString();
                    returnValue.viewPhotoText5 = dr["VisitPhotoText5"].ToString();
                    returnValue.viewPhoto6 = dr["VisitPhoto6"].ToString();
                    returnValue.viewPhotoText6 = dr["VisitPhotoText6"].ToString();
                    returnValue.viewPhoto7 = dr["VisitPhoto7"].ToString();
                    returnValue.viewPhotoText7 = dr["VisitPhotoText7"].ToString();
                    returnValue.viewPhoto8 = dr["VisitPhoto8"].ToString();
                    returnValue.viewPhotoText8 = dr["VisitPhotoText8"].ToString();
                    returnValue.teachingSpace = dr["TeachingEnvironment"].ToString();
                    returnValue.familySupport = dr["FamilySupport"].ToString();
                    returnValue.familyInteraction = dr["FamilyInteraction"].ToString();
                    returnValue.teachingDemonstration = dr["TeachingDemonstration"].ToString();
                    returnValue.viewConclusion = dr["Interviews"].ToString();
                    returnValue.teachingAnalysis = dr["TeachingAnalysis"].ToString();

                }
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue.ID = "-1";
            }
        }
        return returnValue;
    }
Пример #11
0
 public string[] setStudentVisitDataBase(CreateStudentView StudentTracked)
 {
     CaseDataBase SDB = new CaseDataBase();
     if (int.Parse(SDB._StaffhaveRoles[1]) == 1)
     {
         return SDB.setStudentVisitData(StudentTracked);
     }
     else
     {
         return new string[2] { _noRole, _errorMsg };
     }
 }
Пример #12
0
 public CreateStudentView getStudentVisitDataBase(string ID)
 {
     CaseDataBase SDB = new CaseDataBase();
     CreateStudentView returnValue = new CreateStudentView();
     if (int.Parse(SDB._StaffhaveRoles[3]) == 1)
     {
         returnValue=SDB.getStudentVisitData(ID);
     }
     else
     {
         returnValue.checkNo = _noRole;
         returnValue.errorMsg = _errorMsg;
     }
     StaffDataBase sDB = new StaffDataBase();
     List<string> UserFile = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
     if (returnValue.caseUnit != UserFile[2] && int.Parse(SDB._StaffhaveRoles[4]) == 0 && UserFile[1].Length > 0)
     {
         returnValue.checkNo = _getcheckNo;
         returnValue.errorMsg = _errorMsg;
     }
     return returnValue;
 }