// POST api/<controller> public string Post([FromBody] CreateStudent value) { conn = new SqlConnection("data source=localhost;Initial catalog=College; User Id =personal;Integrated Security=SSPI;Persist Security Info=False;"); var query = "Insert into Student (f_name,l_name,address,birthDate,score,dep_id) values (@f_name,@l_name,@address,@birthDate,@score,@dep_id)"; SqlCommand insertCommand = new SqlCommand(query, conn); insertCommand.Parameters.AddWithValue("@f_name", value.f_name); insertCommand.Parameters.AddWithValue("@l_name", value.l_name); insertCommand.Parameters.AddWithValue("@address", value.address); insertCommand.Parameters.AddWithValue("@birthDate", value.birthDate); insertCommand.Parameters.AddWithValue("@score", value.score); insertCommand.Parameters.AddWithValue("@dep_id", value.dep_id); conn.Open(); int result = insertCommand.ExecuteNonQuery(); if (result > 0) { return("True"); } else { return("False"); } }
// PUT api/<controller>/5 public string Put(int id, [FromBody] CreateStudent value) { _conn = new SqlConnection("Data Source=MSI;Initial Catalog=Nawab;Integrated Security=True"); var query = "update student set f_name= @f_name, m_name= @m_name, l_name= @l_name, address= @address, birthDate= @birthDate, score= @score where id=" + id; SqlCommand insertCommand = new SqlCommand(query, _conn); insertCommand.Parameters.AddWithValue("@f_name", value.f_name); insertCommand.Parameters.AddWithValue("@m_name", value.m_name); insertCommand.Parameters.AddWithValue("@l_name", value.l_name); insertCommand.Parameters.AddWithValue("@address", value.address); insertCommand.Parameters.AddWithValue("@birthDate", value.birthDate); insertCommand.Parameters.AddWithValue("@score", value.score); _conn.Open(); int result = insertCommand.ExecuteNonQuery(); if (result > 0) { return("them thanh cong"); } else { return("them that bai"); } }
private void StaffPageViewPageChanging(object sender, RadPageViewCancelEventArgs e) { if (e.Page == pageEnrollment) { RadPageViewPage createStudentPage = new RadPageViewPage(); createStudentPage.Text = "Create New User"; CreateStudent createStudent = new CreateStudent(); createStudent.Text = "Create New User"; createStudent.Dock = DockStyle.Fill; createStudentPage.Controls.Add(createStudent); enrollmentPage.Pages.Add(createStudentPage); enrollmentPage.SelectedPage = createStudentPage; } else if (e.Page == pageEnlistment) { /* * RadPageViewPage enlistPage = new RadPageViewPage(); * enlistPage.Text = "Student Enlistment"; * * CreateEnlistment createEnlistment = new CreateEnlistment(); * createEnlistment.Text = "Student Enlistment"; * createEnlistment.Dock = DockStyle.Fill; * * enlistPage.Controls.Add(createEnlistment); * * enlistmentPage.Pages.Add(enlistPage); * enlistmentPage.SelectedPage = enlistPage; */ } }
// PUT api/<controller>/5 public string Put(int id, [FromBody] CreateStudent value) { _con = new SqlConnection(@"Data Source=DESKTOP-QRT4B8G\SQLEXPRESS01;Initial Catalog=Nawab;Integrated Security=True"); var query = "update student set f_name=@f_name ,m_name= @m_name,l_name=@l_name,address=@address,brthDate=@brthDate,score=@score where id=" + id; SqlCommand insertCommad = new SqlCommand(query, _con); insertCommad.Parameters.AddWithValue("f_name", value.f_name); insertCommad.Parameters.AddWithValue("m_name", value.m_name); insertCommad.Parameters.AddWithValue("l_name", value.l_name); insertCommad.Parameters.AddWithValue("address", value.address); insertCommad.Parameters.AddWithValue("brthDate", value.brthDate); insertCommad.Parameters.AddWithValue("score", value.score); _con.Open(); int result = insertCommad.ExecuteNonQuery(); if (result > 0) { return("sua thanh cong"); } else { return("sua that bai"); } }
// POST api/<controller> public string Post([FromBody] CreateStudent value) { _conn = new SqlConnection("Data Source=DESKTOP-G0PNN12;Initial Catalog=Nawab;Integrated Security=True"); var query = "insert into Student(f_name,m_name,l_name,address,birthday,score)values(@f_name,@m_name,@l_name,@address,@birthday,@score)"; SqlCommand insertcommand = new SqlCommand(query, _conn); insertcommand.Parameters.AddWithValue("@f_name", value.f_name); insertcommand.Parameters.AddWithValue("@m_name", value.m_name); insertcommand.Parameters.AddWithValue("@l_name", value.l_name); insertcommand.Parameters.AddWithValue("@address", value.address); insertcommand.Parameters.AddWithValue("@birthday", value.birthday); insertcommand.Parameters.AddWithValue("@score", value.score); _conn.Open(); int result = insertcommand.ExecuteNonQuery(); if (result > 0) { return("thêm thành công"); } else { return("thêm thất bại"); } }
// POST api/<controller> public string Post([FromBody] CreateStudent value) { _conn = new SqlConnection("Data Source=.;Initial Catalog=Nawab;Integrated Security=True"); var query = "INSERT INTO Student(f_name,m_name,l_name,address,birthDate, score) values(@f_name,@m_name,@l_name,@address,@birthDate,@score)"; SqlCommand insertCommand = new SqlCommand(query, _conn); insertCommand.Parameters.AddWithValue("@f_name", value.f_name); insertCommand.Parameters.AddWithValue("@m_name", value.m_name); insertCommand.Parameters.AddWithValue("@l_name", value.l_name); insertCommand.Parameters.AddWithValue("@address", value.address); insertCommand.Parameters.AddWithValue("@birthDate", value.birthDate); insertCommand.Parameters.AddWithValue("@score", value.score); _conn.Open(); int result = insertCommand.ExecuteNonQuery(); if (result > 0) { return("Them thanh cong"); } else { return("Them that bai"); } }
public string Post([FromBody] CreateStudent students) { _conn = new SqlConnection("data source=LAPTOP-JP98TU1S\\MSSQLSERVER2019;Initial catalog=practicedb;Integrated Security=True;"); // using Query We need to Write Query // var query = "insert into dbo.StudentTable(student_sysid,student_name,student_age,student_email) values(@StudentSysid,@StudentName,@StudentAge,@StudentEmail)"; //Using Stored Procedure SqlCommand com = new SqlCommand("studentinsertprocedure", _conn); //Using Query //SqlCommand com = new SqlCommand (query, _conn); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@StudentSysid", students.student_sysid); com.Parameters.AddWithValue("@StudentName", students.student_name); com.Parameters.AddWithValue("@StudentAge", students.student_age); com.Parameters.AddWithValue("@StudentEmail", students.student_email); _conn.Open(); // int i = com.ExecuteNonQuery (); // _conn.Close ();S int result = com.ExecuteNonQuery(); if (result > 0) { return("true"); } else { return("false"); } }
public async Task <object> Post(CreateStudent request) { var response = new BaseResponse(); var entity = request.ConvertTo <Student>(); var result = await _studentService.Create(entity); if (request.CreateNewUserLogin) { var userLogin = new CreateUser() { FirstName = entity.FirstName, LastName = entity.LastName, DisplayName = entity.FirstName + " " + entity.LastName, UserName = entity.StudentCode, Password = entity.DateOfBirth.HasValue ? entity.DateOfBirth.Value.ToString("yyyy-MM-dd") : entity.StudentCode, RoleId = RoleEnum.Student.ToDescription() }; await _userService.Post(userLogin); } response.Success = true; response.StatusCode = (int)HttpStatusCode.Created; response.Message = "Create student success"; response.Results = result.ConvertTo <StudentDto>(); return(response); }
// POST api/<controller> public string Post([FromBody] CreateStudent value) { _conn = new SqlConnection("Data Source=MSI\\MSSQL_EXP_2008R2;Initial Catalog=laptrinhAPI;Integrated Security=True"); var query = "insert into Student (f_name, m_name, l_name, address, birthDate, score) values (@f_name, @m_name, @l_name, @address, @birthDate, @score)"; SqlCommand insertCommand = new SqlCommand(query, _conn); insertCommand.Parameters.AddWithValue("@f_name", value.f_name); insertCommand.Parameters.AddWithValue("@m_name", value.m_name); insertCommand.Parameters.AddWithValue("@l_name", value.l_name); insertCommand.Parameters.AddWithValue("@address", value.address); insertCommand.Parameters.AddWithValue("@birthDate", value.birthDate); insertCommand.Parameters.AddWithValue("@score", value.score); _conn.Open(); int result = insertCommand.ExecuteNonQuery(); if (result > 0) { return("Insert thành công"); } else { return("Insert thất bại"); } }
// PUT api/<controller>/5 public String Put(int id, [FromBody] CreateStudent value) { _conn = new SqlConnection(@"Data Source=DESKTOP-9R3VIFH\SQLEXPRESS; Initial Catalog=Nawab;Persist Security Info=True;User ID=sa;Password=123456"); var query = "update student set f_name=@f_name,m_name=@m_name,l_name=l_name,address=@address,birthDate=@birthDate,score=@score where id=" + id; SqlCommand insertCommand = new SqlCommand(query, _conn); insertCommand.Parameters.AddWithValue("@f_name", value.f_name); insertCommand.Parameters.AddWithValue("@m_name", value.m_name); insertCommand.Parameters.AddWithValue("@l_name", value.l_name); insertCommand.Parameters.AddWithValue("@address", value.address); insertCommand.Parameters.AddWithValue("@birthDate", value.birthDate); insertCommand.Parameters.AddWithValue("@score", value.score); _conn.Open(); int result = insertCommand.ExecuteNonQuery(); if (result > 0) { return("update thanh cong"); } else { return("update that bai"); } }
public IActionResult Edit(CreateStudent model, long id) { // If not students found with givin id, redirect to index page var Student = _db.Students.Where((x) => x.Id == id).FirstOrDefault(); if (Student == null) { RedirectToAction("Index", "Students"); } // Prevent duplicate email. Student EmailExists = _db.Students.FirstOrDefault(x => x.Email.ToLower().Trim() == model.Email.ToLower().Trim()); if (EmailExists != null && EmailExists.Email != Student.Email) { ModelState.AddModelError("Email", "البريد الإلكتروني مسجل مسبقًا"); } // When the form validations failed, we return to the form. if (!ModelState.IsValid) { return(View(Student)); } Student.Name = model.Name; Student.Email = model.Email; Student.Age = model.Age; Student.Gender = model.Gender; Student.City = model.City; Student.Enrolled = model.Enrolled; _db.SaveChanges(); return(RedirectToAction("Show", "Students", new { id = id })); }
public IActionResult Create(CreateStudent model) { Student EmailExists = _db.Students.FirstOrDefault(x => x.Email.ToLower().Trim() == model.Email.ToLower().Trim()); if (EmailExists != null) { ModelState.AddModelError("Email", "البريد الإلكتروني مسجل مسبقًا"); } // When the form validations failed, we return to the form. if (!ModelState.IsValid) { return(View()); } var student = new Student { Name = model.Name, City = model.City, Gender = model.Gender, Email = model.Email, Age = model.Age, Enrolled = model.Enrolled, CreatedAt = DateTime.Now, }; _db.Students.Add(student); _db.SaveChanges(); return(RedirectToAction("Show", "Students", new { id = student.Id })); }
// POST api/<controller> public string Post([FromBody] CreateStudent value) { _conn = new SqlConnection(@"Data Source=DESKTOP-92V95VD\SQLEXPRESS;Initial Catalog=Nawab;Integrated Security=True"); var query = "insert into Student (f_name, m_name, l_name, address, birthDate, score) values (@f_name, @m_name, @l_name, @address, @birthDate, @score)"; SqlCommand insertCommand = new SqlCommand(query, _conn); insertCommand.Parameters.AddWithValue("@f_name", value.f_name); insertCommand.Parameters.AddWithValue("@m_name", value.m_name); insertCommand.Parameters.AddWithValue("@l_name", value.l_name); insertCommand.Parameters.AddWithValue("@address", value.address); insertCommand.Parameters.AddWithValue("@birthDate", value.birthDate); insertCommand.Parameters.AddWithValue("@score", value.score); _conn.Open(); int result = insertCommand.ExecuteNonQuery(); if (result > 0) { return("THEM THANH CONG"); } else { return("THEM THAT BAI"); } }
public IActionResult Update(int id, [FromBody] CreateStudent createStudent) { var student = _context.Students.SingleOrDefault(x => x.Id == id); student.Name = createStudent.Name; _context.Update(student); _context.SaveChanges(); return(StatusCode(204)); }
public Student(CreateStudent cmd) { Id = cmd.Id; FullName = cmd.FullName; BirthDate = cmd.BirthDate; FingerprintChecksum = cmd.FingerprintChecksum; FingerprintImage = cmd.FingerprintImage; Image = cmd.Image; }
public RegisteredStudent Create(CreateStudent newRegistry) { using (SchoolDataContext schoolContext = new SchoolDataContext()) { var newStudent = newRegistry.ToEntity(); schoolContext.Students.Add(newStudent); schoolContext.SaveChanges(); return(newStudent.toDTO()); } }
private void btnCreateStudent_Click(object sender, RoutedEventArgs e) { object Result = new CreateStudent( new Entities.Student( Guid.NewGuid().ToString("N"), txtStudentFirstName.Text, txtStudentLastName.Text)).Execute(); Students.Add(Result as Student); }
public async Task <IActionResult> Create([FromBody] CreateStudentDTO dto) { if (null == dto) { return(BadRequest()); } var command = new CreateStudent(dto.Id, dto.FirstName, dto.LastName); await _mediator.Publish(command); return(CreatedAtAction("GetById", new { id = dto.Id }, dto.Id)); }
public async Task CreateAsync(CreateStudent cmd) { cmd.Validate(); if (await _studentsDao.ExistsAsync(cmd.Id)) { throw new ObjectAlreadyExitsException(cmd.Id, typeof(Student)); } await _studentsDao.AddAsync(new Student(cmd)); }
public static EntityStateWrapperContainer Create(CreateStudent.CommandModel commandModel) { var student = new Student { EnrollmentDate = commandModel.EnrollmentDate, FirstMidName = commandModel.FirstMidName, LastName = commandModel.LastName, }; return new EntityStateWrapperContainer().AddEntity(student); }
public static Student ToEntity(this CreateStudent newStudent) { return(new Student() { Name = newStudent.Name , Grade = newStudent.Grade , School = newStudent.School }); }
public void CreateStudentUiTest(string testParams) { // generate test-parameters var parameters = JsonConvert.DeserializeObject <Dictionary <string, object> >(testParams); // execute with parameters var actual = new CreateStudent().WithTestParams(parameters).Execute().Actual; // assert results Assert.IsTrue(actual); }
// Use this for initialization void Start() { epochStart = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc); day = 1800; currentSemester = 0; createStudent = GetComponent<CreateStudent> (); StudentData studentData = GetComponent<StudentData> (); fails = new List<GameObject> (); grads = new List<GameObject> (); }
public async Task ValidateAsync_should_succeed_when_command_valid() { var unitOfWork = NSubstitute.Substitute.For <ISchoolUnitOfWork>(); var sut = new CreateStudentValidator(unitOfWork); var command = new CreateStudent(Guid.NewGuid(), "new", "Student"); var result = await sut.ValidateAsync(command, CancellationToken.None); result.Should().NotBeNull(); result.Success.Should().BeTrue(); result.Errors.Should().BeEmpty(); }
// POST api/values public string Post([FromBody] CreateStudent value) { //CreateStudent cs = new CreateStudent(); if (value.Flag != true) { var query = "INSERT INTO Customer (FirstName, LastName) values (@FirstName, @LastName)"; SqlCommand insertcomm = new SqlCommand(query, _conn); insertcomm.Parameters.AddWithValue("@FirstName", value.FirstName); insertcomm.Parameters.AddWithValue("@LastName", value.LastName); _conn.Open(); int n = insertcomm.ExecuteNonQuery(); if (n > 0) { return("Succesfull"); } else { return("Failed"); } } else { string to = value.To; //"*****@*****.**"; string from = "*****@*****.**"; //From address MailMessage message = new MailMessage(from, to); string mailbody = value.Body; //"Dot Net"; message.Subject = value.Subject; //"Dot Net"; message.Body = mailbody; message.BodyEncoding = Encoding.UTF8; message.IsBodyHtml = true; SmtpClient client = new SmtpClient("smtp.gmail.com", 587); //Gmail smtp System.Net.NetworkCredential basicCredential1 = new System.Net.NetworkCredential("*****@*****.**", "Tombofstone1987$"); client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = basicCredential1; try { client.Send(message); } catch (Exception ex) { throw ex; } return("Email Sent Properly"); } }
public async Task <IActionResult> Post([FromBody] CreateStudent request) { if (ModelState.IsValid) { var student = await this.mediator.Send(request); return(CreatedAtRoute("GetStudent", new { id = student.Id }, student)); } else { return(BadRequest(ModelState)); } }
public CreateStudent.Response Handle(CreateStudent.Request request) { var validationDetails = Validator.ValidateRequest(request); if (validationDetails.HasValidationIssues) return new CreateStudent.Response(validationDetails); var container = StudentFactory.Create(request.CommandModel); validationDetails = _Repository.Save(container); var studentId = default(int?); if (!validationDetails.HasValidationIssues) studentId = container.FindEntity<Student>().ID; return new CreateStudent.Response(validationDetails, studentId); }
private void create_button_Click(object sender, EventArgs e) { Student newStudent = new Student(); CreateStudent studentModal = new CreateStudent(newStudent); studentModal.ShowDialog(); if (studentModal.ok) { StudentsList.Items.Add(studentModal.studentInfo); students.Add(studentModal.studentInfo); } else { MessageBox.Show("Зміни не збережено"); } }
public ActionResult Create(CreateStudent model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateStudentService(); if (service.CreateStudent(model)) { TempData["SaveResult"] = "A student was added."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "A student could not be added."); return(View(model)); }
//Create new student public bool CreateStudent(CreateStudent model) { var entity = new Student() { FirstName = model.StudentFirstName, LastName = model.StudentLastName, GradeLevel = model.StudentGradeLevel }; using (var ctx = new ApplicationDbContext()) { ctx.Students.Add(entity); return(ctx.SaveChanges() > 0); } }
public async Task CreateStudent_InvalidStudent_Fails() { // Arrange var student = new CreateStudent("", "", DateTime.Now); studentRepository.Setup(s => s.Add(It.IsAny <Student>())).ReturnsAsync(1); var handler = new CreateStudentHandler(studentRepository.Object); // Act var result = await handler.Handle(student, CancellationToken.None); // Assert result.Match( Left: error => Assert.Pass(), Right: result => Assert.Fail("Validation should have failed")); }
// PUT api/<controller>/5 public String Put(int id, [FromBody] CreateStudent value) { _con = new SqlConnection("Data Source=.;Initial Catalog=Nawab;Integrated Security=True"); _con.Open(); String query = " UPDATE dbo.Student_ SET f_name =N'" + value.f_name + "', m_name=N'" + value.m_name + "', l_name=N'" + value.l_name + "', address=N'" + value.address + "', birthDate=N'" + value.birthDate + "', score=N'" + value.score + "') where Id = " + value.id + ")"; SqlCommand command = new SqlCommand(query, _con); int result = command.ExecuteNonQuery(); if (result > 0) { return("sua thanh cong"); } else { return("sua that bai"); } }
// POST api/<controller> public String Post([FromBody] CreateStudent value) { _con = new SqlConnection("Data Source=.;Initial Catalog=Nawab;Integrated Security=True"); _con.Open(); String query = " INSERT dbo.Student_(f_name, m_name, l_name, address, birthDate, score)VALUES(N'" + value.f_name + "',N'" + value.m_name + "', N'" + value.l_name + "', N'" + value.address + "', N'" + value.birthDate + "', N'" + value.score + "')"; SqlCommand command = new SqlCommand(query, _con); int result = command.ExecuteNonQuery(); if (result > 0) { return("them thanh cong"); } else { return("them that bai"); } }
public StudentResult getStudentDataWho(string StudentID) { StudentResult returnValue = new StudentResult(); returnValue.StudentData = new CreateStudent(); DataBase Base = new DataBase(); using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString())) { try { Sqlconn.Open(); string sql = "SELECT * FROM StudentDatabase WHERE isDeleted=0 AND StudentID= @ID";////修正SQL式[ StudentID= (@ID) ] → [ ID = @ID ] by Awho SqlCommand cmd = new SqlCommand(sql, Sqlconn); cmd.Parameters.Add("@ID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentID); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { returnValue.Column = Int64.Parse(dr["ID"].ToString()); CreateStudent addValue = new CreateStudent(); StaffDataBase sDB = new StaffDataBase(); List<string> StaffData = sDB.getStaffDataName(dr["WriteName"].ToString()); addValue.fillInName = StaffData[1]; addValue.ID = dr["ID"].ToString(); addValue.assessDate = dr["EvaluationDate"].ToString(); addValue.consultationDate = dr["ConsultDate"].ToString(); addValue.upDate = dr["Updated"].ToString(); addValue.caseStatu = dr["CaseStatu"].ToString(); addValue.Unit = dr["Unit"].ToString(); addValue.studentID = dr["StudentID"].ToString(); addValue.studentName = dr["StudentName"].ToString(); addValue.studentTWID = dr["StudentIdentity"].ToString(); addValue.censusAddressZip = dr["AddressZip1"].ToString(); addValue.censusAddressCity = dr["AddressCity1"].ToString(); addValue.censusAddress = dr["AddressOther1"].ToString(); addValue.addressZip = dr["AddressZip2"].ToString(); addValue.addressCity = dr["AddressCity2"].ToString(); addValue.address = dr["AddressOther2"].ToString(); addValue.studentbirthday = DateTime.Parse(dr["StudentBirthday"].ToString()).ToString("yyyy-MM-dd"); addValue.studentSex = dr["StudentSex"].ToString(); addValue.firstClassDate = DateTime.Parse(dr["ClassDate"].ToString()).ToString("yyyy-MM-dd"); addValue.guaranteeDate = DateTime.Parse(dr["GuaranteeDate"].ToString()).ToString("yyyy-MM-dd"); addValue.endReasonDate = DateTime.Parse(dr["CompletedDate"].ToString()).ToString("yyyy-MM-dd"); addValue.endReasonType = dr["CompletedType"].ToString(); addValue.endReason = dr["CompletedReason"].ToString(); addValue.sendDateSince = DateTime.Parse(dr["ShortEndDateSince"].ToString()).ToString("yyyy-MM-dd"); addValue.sendDateUntil = DateTime.Parse(dr["ShortEndDateUntil"].ToString()).ToString("yyyy-MM-dd"); addValue.nomembershipType = dr["NomembershipType"].ToString(); addValue.nomembershipReason = dr["NomembershipReason"].ToString(); addValue.studentPhoto = dr["StudentAvatar"].ToString(); addValue.wCare = dr["CaregiversDaytime"].ToString(); addValue.wCareName = dr["CaregiversDaytimeText"].ToString(); addValue.bCare = dr["CaregiversNight"].ToString(); addValue.bCareName = dr["CaregiversNightText"].ToString(); addValue.fPRelation1 = dr["ContactRelation1"].ToString(); addValue.fPName1 = dr["ContactName1"].ToString(); addValue.fPTel1 = dr["ContactTel_company1"].ToString(); addValue.fPPhone1 = dr["ContactPhone1"].ToString(); addValue.fPHPhone1 = dr["ContactTel_home1"].ToString(); addValue.fPFax1 = dr["ContactFax1"].ToString(); addValue.fPRelation2 = dr["ContactRelation2"].ToString(); addValue.fPName2 = dr["ContactName2"].ToString(); addValue.fPTel2 = dr["ContactTel_company2"].ToString(); addValue.fPPhone2 = dr["ContactPhone2"].ToString(); addValue.fPHPhone2 = dr["ContactTel_home2"].ToString(); addValue.fPFax2 = dr["ContactFax2"].ToString(); addValue.fPRelation3 = dr["ContactRelation3"].ToString(); addValue.fPName3 = dr["ContactName3"].ToString(); addValue.fPTel3 = dr["ContactTel_company3"].ToString(); addValue.fPPhone3 = dr["ContactPhone3"].ToString(); addValue.fPHPhone3 = dr["ContactTel_home3"].ToString(); addValue.fPFax3 = dr["ContactFax3"].ToString(); addValue.fPRelation4 = dr["ContactRelation4"].ToString(); addValue.fPName4 = dr["ContactName4"].ToString(); addValue.fPTel4 = dr["ContactTel_company4"].ToString(); addValue.fPPhone4 = dr["ContactPhone4"].ToString(); addValue.fPHPhone4 = dr["ContactTel_home4"].ToString(); addValue.fPFax4 = dr["ContactFax4"].ToString(); addValue.email = dr["StudentEmail"].ToString(); addValue.sourceType = dr["ReferralSourceType"].ToString(); addValue.sourceName = dr["ReferralSource"].ToString(); addValue.manualWhether = dr["PhysicalAndMentalDisabilityHandbook"].ToString(); addValue.manualCategory1 = dr["DisabilityCategory1"].ToString(); addValue.manualGrade1 = dr["DisabilityGrade1"].ToString(); addValue.manualCategory2 = dr["DisabilityCategory2"].ToString(); addValue.manualGrade2 = dr["DisabilityGrade2"].ToString(); addValue.manualCategory3 = dr["DisabilityCategory3"].ToString(); addValue.manualGrade3 = dr["DisabilityGrade3"].ToString(); addValue.manualNo = dr["NoDisabilityHandbook"].ToString(); addValue.manualUnit = dr["ApplyDisabilityHandbook"].ToString(); addValue.studentManualImg = dr["DisabilityProve"].ToString(); addValue.notificationWhether = dr["Notify"].ToString(); addValue.notificationUnit = dr["Notify_Unit"].ToString(); addValue.notificationManage = dr["Notify_Member"].ToString(); addValue.notificationTel = dr["Notify_Tel"].ToString(); addValue.notificationDate = DateTime.Parse(dr["Notify_Date"].ToString()).ToString("yyyy-MM-dd"); addValue.notificationCity = dr["Notify_City"].ToString(); addValue.economy = dr["EconomyState"].ToString(); addValue.economyLow = dr["EconomyLow"].ToString(); addValue.fAppellation1 = dr["FamilyAppellation1"].ToString(); addValue.fName1 = dr["FamilyName1"].ToString(); addValue.fBirthday1 = DateTime.Parse(dr["FamilyBirthday1"].ToString()).ToString("yyyy-MM-dd"); addValue.fEDU1 = dr["FamilyEducation1"].ToString(); addValue.fProfession1 = dr["FamilyProfession1"].ToString(); addValue.fLive1 = dr["FamilyLive1"].ToString(); addValue.fHearing1 = dr["FamilyHearing1"].ToString(); addValue.fHealthy1 = dr["FamilyHealth1"].ToString(); addValue.familyText01 = dr["FamilyHealthText1"].ToString(); addValue.fAppellation2 = dr["FamilyAppellation2"].ToString(); addValue.fName2 = dr["FamilyName2"].ToString(); addValue.fBirthday2 = DateTime.Parse(dr["FamilyBirthday2"].ToString()).ToString("yyyy-MM-dd"); addValue.fEDU2 = dr["FamilyEducation2"].ToString(); addValue.fProfession2 = dr["FamilyProfession2"].ToString(); addValue.fLive2 = dr["FamilyLive2"].ToString(); addValue.fHearing2 = dr["FamilyHearing2"].ToString(); addValue.fHealthy2 = dr["FamilyHealth2"].ToString(); addValue.familyText02 = dr["FamilyHealthText2"].ToString(); addValue.fAppellation3 = dr["FamilyAppellation3"].ToString(); addValue.fName3 = dr["FamilyName3"].ToString(); addValue.fBirthday3 = DateTime.Parse(dr["FamilyBirthday3"].ToString()).ToString("yyyy-MM-dd"); addValue.fEDU3 = dr["FamilyEducation3"].ToString(); addValue.fProfession3 = dr["FamilyProfession3"].ToString(); addValue.fLive3 = dr["FamilyLive3"].ToString(); addValue.fHearing3 = dr["FamilyHearing3"].ToString(); addValue.fHealthy3 = dr["FamilyHealth3"].ToString(); addValue.familyText03 = dr["FamilyHealthText3"].ToString(); addValue.fAppellation4 = dr["FamilyAppellation4"].ToString(); addValue.fName4 = dr["FamilyName4"].ToString(); addValue.fBirthday4 = DateTime.Parse(dr["FamilyBirthday4"].ToString()).ToString("yyyy-MM-dd"); addValue.fEDU4 = dr["FamilyEducation4"].ToString(); addValue.fProfession4 = dr["FamilyProfession4"].ToString(); addValue.fLive4 = dr["FamilyLive4"].ToString(); addValue.fHearing4 = dr["FamilyHearing4"].ToString(); addValue.fHealthy4 = dr["FamilyHealth4"].ToString(); addValue.familyText04 = dr["FamilyHealthText4"].ToString(); addValue.fAppellation5 = dr["FamilyAppellation5"].ToString(); addValue.fName5 = dr["FamilyName5"].ToString(); addValue.fBirthday5 = DateTime.Parse(dr["FamilyBirthday5"].ToString()).ToString("yyyy-MM-dd"); addValue.fEDU5 = dr["FamilyEducation5"].ToString(); addValue.fProfession5 = dr["FamilyProfession5"].ToString(); addValue.fLive5 = dr["FamilyLive5"].ToString(); addValue.fHearing5 = dr["FamilyHearing5"].ToString(); addValue.fHealthy5 = dr["FamilyHealth5"].ToString(); addValue.familyText05 = dr["FamilyHealthText5"].ToString(); addValue.fAppellation6 = dr["FamilyAppellation6"].ToString(); addValue.fName6 = dr["FamilyName6"].ToString(); addValue.fBirthday6 = DateTime.Parse(dr["FamilyBirthday6"].ToString()).ToString("yyyy-MM-dd"); addValue.fEDU6 = dr["FamilyEducation6"].ToString(); addValue.fProfession6 = dr["FamilyProfession6"].ToString(); addValue.fLive6 = dr["FamilyLive6"].ToString(); addValue.fHearing6 = dr["FamilyHearing6"].ToString(); addValue.fHealthy6 = dr["FamilyHealth6"].ToString(); addValue.familyText06 = dr["FamilyHealthText6"].ToString(); addValue.fAppellation7 = dr["FamilyAppellation7"].ToString(); addValue.fName7 = dr["FamilyName7"].ToString(); addValue.fBirthday7 = DateTime.Parse(dr["FamilyBirthday7"].ToString()).ToString("yyyy-MM-dd"); addValue.fEDU7 = dr["FamilyEducation7"].ToString(); addValue.fProfession7 = dr["FamilyProfession7"].ToString(); addValue.fLive7 = dr["FamilyLive7"].ToString(); addValue.fHearing7 = dr["FamilyHearing7"].ToString(); addValue.fHealthy7 = dr["FamilyHealth7"].ToString(); addValue.familyText07 = dr["FamilyHealthText7"].ToString(); addValue.fAppellation8 = dr["FamilyAppellation8"].ToString(); addValue.fName8 = dr["FamilyName8"].ToString(); addValue.fBirthday8 = DateTime.Parse(dr["FamilyBirthday8"].ToString()).ToString("yyyy-MM-dd"); addValue.fEDU8 = dr["FamilyEducation8"].ToString(); addValue.fProfession8 = dr["FamilyProfession8"].ToString(); addValue.fLive8 = dr["FamilyLive8"].ToString(); addValue.fHearing8 = dr["FamilyHearing8"].ToString(); addValue.fHealthy8 = dr["FamilyHealth8"].ToString(); addValue.familyText08 = dr["FamilyHealthText8"].ToString(); addValue.lang1 = dr["FamilyLanguage"].ToString(); addValue.lang1t01 = dr["FamilyLanguageText"].ToString(); addValue.lang2 = dr["FamilyConnectLanguage"].ToString(); addValue.lang2t01 = dr["FamilyConnectLanguageText"].ToString(); addValue.familyEcological = dr["FamilyProfile1"].ToString(); addValue.famailySituation = dr["FamilyProfile2"].ToString(); addValue.famailyMedical = dr["FamilyProfile3"].ToString(); addValue.famailyActionSituation = dr["FamilyProfile4"].ToString(); addValue.fswAssess = dr["FamilyProfile5"].ToString(); StaffData = sDB.getStaffDataName(dr["FamilyProfileWriteName"].ToString()); addValue.socialName = StaffData[1]; addValue.socialDate = DateTime.Parse(dr["FamilyProfileWriteDate"].ToString()).ToString("yyyy-MM-dd"); returnValue.StudentData = addValue; StudentHearingInformation addValue2 = new StudentHearingInformation(); addValue2.history = dr["StudentDevelop"].ToString(); addValue2.history02t01 = dr["StudentDevelopText21"].ToString(); addValue2.history02t02 = dr["StudentDevelopText22"].ToString(); addValue2.history03t01 = dr["StudentDevelopText31"].ToString(); addValue2.history06t01 = dr["StudentDevelopText61"].ToString(); addValue2.history06t02 = dr["StudentDevelopText62"].ToString(); addValue2.history08t01 = dr["StudentDevelopText81"].ToString(); addValue2.history10t01 = dr["StudentDevelopText10"].ToString(); addValue2.history11t01 = dr["StudentDevelopText11"].ToString(); addValue2.history12t01 = dr["StudentDevelopText12"].ToString(); addValue2.problems01t01 = dr["HearingProblemAge"].ToString(); addValue2.problems01t02 = dr["HearingProblemMonth"].ToString(); addValue2.hearingQ = dr["HearingProblem"].ToString(); addValue2.hearingQText = dr["HearingProblemText"].ToString(); addValue2.problems02t01 = dr["DiagnoseAge"].ToString(); addValue2.problems02t02 = dr["DiagnoseMonth"].ToString(); addValue2.problems02t03 = dr["DiagnoseAgency"].ToString(); addValue2.problems02t04 = dr["DiagnoseR"].ToString(); addValue2.problems02t05 = dr["DiagnoseL"].ToString(); addValue2.hearingcheck = dr["NewbornHearing"].ToString(); addValue2.hearingYescheck = dr["NewbornHearingInspection"].ToString(); addValue2.hearingYesPlace = dr["NewbornHearingInspectionAgency"].ToString(); addValue2.hearingYesResultR = dr["NewbornHearingInspectionDiagnoseR"].ToString(); addValue2.hearingYesResultL = dr["NewbornHearingInspectionDiagnoseL"].ToString(); addValue2.sleepcheck = dr["AuditoryElectrophysiology1"].ToString(); addValue2.sleepcheckTime1 = DateTime.Parse(dr["AuditoryElectrophysiology_Date1"].ToString()).ToString("yyyy-MM-dd");//dr["AuditoryElectrophysiology_Date1"].ToString(); addValue2.sleepcheckPlace1 = dr["AuditoryElectrophysiology_Agency1"].ToString(); addValue2.sleepcheckCheckItem1 = dr["AuditoryElectrophysiology_Item1"].ToString(); addValue2.sleepcheckResultL1 = dr["AuditoryElectrophysiology_Diagnose1R"].ToString(); addValue2.sleepcheckResultR1 = dr["AuditoryElectrophysiology_Diagnose1L"].ToString(); addValue2.sleepcheckTime2 = DateTime.Parse(dr["AuditoryElectrophysiology_Date2"].ToString()).ToString("yyyy-MM-dd"); addValue2.sleepcheckPlace2 = dr["AuditoryElectrophysiology_Agency2"].ToString(); addValue2.sleepcheckCheckItem2 = dr["AuditoryElectrophysiology_Item2"].ToString(); addValue2.sleepcheckResultL2 = dr["AuditoryElectrophysiology_Diagnose2R"].ToString(); addValue2.sleepcheckResultR2 = dr["AuditoryElectrophysiology_Diagnose2L"].ToString(); addValue2.sleepcheckTime3 = DateTime.Parse(dr["AuditoryElectrophysiology_Date3"].ToString()).ToString("yyyy-MM-dd"); addValue2.sleepcheckPlace3 = dr["AuditoryElectrophysiology_Agency3"].ToString(); addValue2.sleepcheckCheckItem3 = dr["AuditoryElectrophysiology_Item3"].ToString(); addValue2.sleepcheckResultL3 = dr["AuditoryElectrophysiology_Diagnose3R"].ToString(); addValue2.sleepcheckResultR3 = dr["AuditoryElectrophysiology_Diagnose3L"].ToString(); addValue2.sleepcheckTime4 = DateTime.Parse(dr["AuditoryElectrophysiology_Date4"].ToString()).ToString("yyyy-MM-dd"); addValue2.sleepcheckPlace4 = dr["AuditoryElectrophysiology_Agency4"].ToString(); addValue2.sleepcheckCheckItem4 = dr["AuditoryElectrophysiology_Item4"].ToString(); addValue2.sleepcheckResultL4 = dr["AuditoryElectrophysiology_Diagnose4R"].ToString(); addValue2.sleepcheckResultR4 = dr["AuditoryElectrophysiology_Diagnose4L"].ToString(); addValue2.sleepcheckTime5 = DateTime.Parse(dr["AuditoryElectrophysiology_Date5"].ToString()).ToString("yyyy-MM-dd"); addValue2.sleepcheckPlace5 = dr["AuditoryElectrophysiology_Agency5"].ToString(); addValue2.sleepcheckCheckItem5 = dr["AuditoryElectrophysiology_Item5"].ToString(); addValue2.sleepcheckResultL5 = dr["AuditoryElectrophysiology_Diagnose5R"].ToString(); addValue2.sleepcheckResultR5 = dr["AuditoryElectrophysiology_Diagnose5L"].ToString(); addValue2.ctmri = dr["CTorMRI"].ToString(); addValue2.ctmriTime = DateTime.Parse(dr["CTorMRI_Date1"].ToString()).ToString("yyyy-MM-dd"); addValue2.ctmriPlace = dr["CTorMRI_Agency1"].ToString(); addValue2.ctmriResultL = dr["CTorMRI_DiagnoseR"].ToString(); addValue2.ctmriResultR = dr["CTorMRI_DiagnoseL"].ToString(); addValue2.gene = dr["GeneScreening"].ToString(); addValue2.geneTime = DateTime.Parse(dr["GeneScreening_Date"].ToString()).ToString("yyyy-MM-dd"); addValue2.genePlace = dr["GeneScreening_Agency"].ToString(); addValue2.geneResult = dr["GeneScreening_Item"].ToString(); addValue2.familyhistory = dr["FamilyHearingProblemHistory"].ToString(); addValue2.familyhistoryText = dr["FamilyHearingProblemHistoryText"].ToString(); addValue2.changehistory = dr["HearingChangeHistory"].ToString(); addValue2.changehistoryText = dr["HearingChangeHistoryText"].ToString(); addValue2.assistmanage = dr["AidsManagement"].ToString(); addValue2.accessory = dr["AidsManagementTextAge"].ToString(); addValue2.assistmanageR = dr["HearingAids_R"].ToString(); addValue2.brandR = dr["AidsBrand_R"].ToString(); addValue2.modelR = dr["AidsModel_R"].ToString(); addValue2.buyingPlaceR = dr["AidsOptionalLocation_R"].ToString(); addValue2.buyingtimeR = DateTime.Parse(dr["AidsOptionalTime_R"].ToString()).ToString("yyyy-MM-dd"); addValue2.insertHospitalR = dr["EEarHospital_R"].ToString(); addValue2.openHzDateR = DateTime.Parse(dr["EEarOpen_R"].ToString()).ToString("yyyy-MM-dd"); addValue2.assistmanageL = dr["HearingAids_L"].ToString(); addValue2.brandL = dr["AidsBrand_L"].ToString(); addValue2.modelL = dr["AidsModel_L"].ToString(); addValue2.buyingtimeL = DateTime.Parse(dr["AidsOptionalTime_L"].ToString()).ToString("yyyy-MM-dd"); addValue2.buyingPlaceL = dr["AidsOptionalLocation_L"].ToString(); addValue2.insertHospitalL = dr["EEarHospital_L"].ToString(); addValue2.openHzDateL = DateTime.Parse(dr["EEarOpen_L"].ToString()).ToString("yyyy-MM-dd"); addValue2.allassis = dr["AllDayAids"].ToString(); addValue2.allassisNoText = dr["AllDayAidsText"].ToString(); addValue2.assis1 = dr["ActiveReaction"].ToString(); addValue2.assis1NoText = dr["ActiveReactionText"].ToString(); addValue2.assis2 = dr["BasicCare"].ToString(); addValue2.assis2NoText = dr["BasicCareText"].ToString(); addValue2.assisFM = dr["UseFMsystem"].ToString(); addValue2.assisFMBrand = dr["UseFMsystemBrand"].ToString(); addValue2.assessnotes = dr["HearingAssessmentSummary"].ToString(); addValue2.assessnotes1 = dr["EarEndoscopy"].ToString(); addValue2.assessnotes102Text = dr["EarEndoscopyAbnormalText"].ToString(); addValue2.problems11t02 = dr["PureToneText"].ToString(); addValue2.assessnotes2 = dr["Tympanogram"].ToString(); addValue2.problems11t03 = dr["SATorSDT"].ToString(); addValue2.problems11t04 = dr["SpeechRecognition"].ToString(); addValue2.problems11t05 = dr["AidsSystem"].ToString(); addValue2.problems11t06 = dr["HearingInspection"].ToString(); addValue2.problems11t07 = dr["HearingOther"].ToString(); addValue2.inspectorID = dr["Audiologist"].ToString(); addValue2.inspectorDate = DateTime.Parse(dr["SurveyingDate"].ToString()).ToString("yyyy-MM-dd"); returnValue.HearingData = addValue2; StudentTeachingInformation addValue4 = new StudentTeachingInformation(); addValue4.case1 = dr["CaseFamilyCooperative"].ToString(); addValue4.case1t04 = dr["EntrustOthers"].ToString(); addValue4.case1t05 = dr["CooperativeDifficulty"].ToString(); addValue4.case2 = dr["RearingAttitude"].ToString(); addValue4.case21 = dr["RearingAttitude1"].ToString(); addValue4.case21t01 = dr["RearingAttitude1Text"].ToString(); addValue4.case22 = dr["RearingAttitude2"].ToString(); addValue4.case22t01 = dr["RearingAttitude2Text"].ToString(); addValue4.case23 = dr["RearingAttitude3"].ToString(); addValue4.case23t01 = dr["RearingAttitude3Text"].ToString(); addValue4.case24 = dr["RearingAttitude4"].ToString(); addValue4.case24t01 = dr["RearingAttitude4Text"].ToString(); addValue4.case25 = dr["RearingAttitude5"].ToString(); addValue4.case25t01 = dr["RearingAttitude5Text"].ToString(); addValue4.case26 = dr["RearingAttitude6"].ToString(); addValue4.case26t01 = dr["RearingAttitude6Text"].ToString(); addValue4.case3 = dr["Dispositional"].ToString(); addValue4.case31 = dr["Dispositional1"].ToString(); addValue4.case31t01 = dr["Dispositional1Text"].ToString(); addValue4.case32 = dr["Dispositional2"].ToString(); addValue4.case32t01 = dr["Dispositional2Text"].ToString(); addValue4.case33 = dr["Dispositional3"].ToString(); addValue4.case33t01 = dr["Dispositional3Text"].ToString(); addValue4.case34 = dr["Dispositional4"].ToString(); addValue4.case34t01 = dr["Dispositional4Text"].ToString(); addValue4.attend = dr["Attendance"].ToString(); addValue4.attend01t01 = dr["AttendanceText"].ToString(); addValue4.accompany = dr["TeachEscorts"].ToString(); addValue4.accompany01t01 = dr["TeachEscortsText"].ToString(); addValue4.teach = dr["AfterTeach"].ToString(); addValue4.teach01t01 = dr["AfterTeachText"].ToString(); addValue4.caseQ = dr["MajorProblem"].ToString(); addValue4.caseQ01t01 = dr["MajorProblemText"].ToString(); addValue4.OtherRemark1 = dr["RemarkOther"].ToString(); addValue4.case4 = dr["LearningAttitude"].ToString(); addValue4.case5 = dr["Temperament"].ToString(); addValue4.case6 = dr["Activity"].ToString(); addValue4.case7 = dr["Focus"].ToString(); addValue4.case8 = dr["Persistence"].ToString(); addValue4.case9 = dr["CommunicationBehavior"].ToString(); addValue4.case10 = dr["AuditorySkill"].ToString(); addValue4.case11 = dr["Acknowledge"].ToString(); addValue4.case12 = dr["Language"].ToString(); addValue4.case12t01 = dr["LanguageText"].ToString(); addValue4.case13 = dr["Action"].ToString(); addValue4.wear = dr["WearAids"].ToString(); addValue4.mind = dr["SpiritAndCoordinate"].ToString(); addValue4.mind01t01 = dr["SpiritAndCoordinateOther"].ToString(); addValue4.connectwish = dr["Communication"].ToString(); addValue4.studywish = dr["LearningDesire"].ToString(); addValue4.related = dr["AttachmentData"].ToString(); addValue4.related01t01 = dr["AttachmentDataText"].ToString(); addValue4.OtherRemark2 = dr["RemarkOther2"].ToString(); addValue4.case14 = dr["ExistingResources"].ToString(); addValue4.trusteeship = dr["InterventionAgencies"].ToString(); addValue4.case14t01 = dr["HospitalIntervention"].ToString(); addValue4.proceed = dr["RelatedIntervention"].ToString(); addValue4.proceedt01 = dr["RelatedInterventionText"].ToString(); addValue4.preschools = dr["InNurserySchool"].ToString(); addValue4.case15 = dr["HearingRehabilitation"].ToString(); addValue4.Rehabilitation1 = dr["CaseNeed"].ToString(); addValue4.Rehabilitation2 = dr["CaseFamilyEnthusiasm"].ToString(); addValue4.Rehabilitation3 = dr["Rehousing"].ToString(); addValue4.Rehabilitation3Text = dr["RehousingText"].ToString(); addValue4.case16 = dr["CaseFamilyCourseProposal"].ToString(); addValue4.OtherRemark3 = dr["CaseFamilyCourseProposalText"].ToString(); addValue4.case17 = dr["CaseCourseProposal"].ToString(); addValue4.OtherRemark4 = dr["CaseCourseProposalText"].ToString(); addValue4.teacherID = dr["Teacher"].ToString(); addValue4.teacherDate = DateTime.Parse(dr["TeacherDate"].ToString()).ToString("yyyy-MM-dd"); returnValue.TeachData = addValue4; } dr.Close(); List<StudentBodyInformation> addValue3 = new List<StudentBodyInformation>(); sql = "SELECT * FROM StudentHeightWeightRecord WHERE isDeleted=0 AND StudentID=(@ID)"; cmd = new SqlCommand(sql, Sqlconn); cmd.Parameters.Add("@ID", SqlDbType.NVarChar).Value = returnValue.StudentData.studentID; dr = cmd.ExecuteReader(); while (dr.Read()) { StudentBodyInformation addValue3item = new StudentBodyInformation(); addValue3item.RecordID = dr["hwID"].ToString(); addValue3item.RecordDate = DateTime.Parse(dr["hwDate"].ToString()).ToString("yyyy-MM-dd"); addValue3item.studentID = dr["StudentID"].ToString(); addValue3item.RecordHeight = dr["StudentHeight"].ToString(); addValue3item.RecordWeight = dr["StudentWeight"].ToString(); addValue3item.RecordRemark = dr["hwRemark"].ToString(); addValue3.Add(addValue3item); } dr.Close(); returnValue.BodyData = addValue3; Sqlconn.Close(); } catch (Exception e) { returnValue.checkNo = "-1"; returnValue.errorMsg = e.Message; } } return returnValue; }
public string[] setStudentPhotoData(CreateStudent StudentData) { string[] returnValue = new string[2]; returnValue[0] = "0"; returnValue[1] = ""; DataBase Base = new DataBase(); string upPhoto = ""; if (StudentData.studentPhoto != null) { upPhoto += " StudentAvatar=@StudentAvatar, "; } if (StudentData.studentManualImg != null) { upPhoto += " DisabilityProve=@DisabilityProve, "; } if (StudentData.familyEcological != null) { upPhoto += " FamilyProfile1=@FamilyProfile1, "; } SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()); using (Sqlconn) { try { Sqlconn.Open(); StaffDataBase sDB = new StaffDataBase(); List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name); string sql = "UPDATE StudentDatabase SET " + upPhoto + " UpFileBy=@UpFileBy, UpFileDate=(getDate()) " + "WHERE StudentID=@StudentID AND ID=@ID"; SqlCommand cmd = new SqlCommand(sql, Sqlconn); cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = StudentData.ID; cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentID); cmd.Parameters.Add("@StudentAvatar", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentPhoto); cmd.Parameters.Add("@DisabilityProve", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentManualImg); cmd.Parameters.Add("@FamilyProfile1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyEcological); cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]); returnValue[0] = cmd.ExecuteNonQuery().ToString(); returnValue[1] = StudentData.ID.ToString(); Sqlconn.Close(); } catch (Exception e) { returnValue[0] = "-1"; returnValue[1] = e.Message; } } return returnValue; }
// Use this for initialization void Start() { createStudent = GameObject.Find ("GameObject").GetComponent<CreateStudent> (); }
public string[] setStudentBaseData(CreateStudent StudentData) { string[] returnValue = new string[2]; returnValue[0] = "0"; returnValue[1] = ""; DataBase Base = new DataBase(); int CaseStatu = this.CaseStatusFunction(StudentData); string upPhoto = ""; if (StudentData.studentPhoto != null) { upPhoto += " StudentAvatar=@StudentAvatar, "; } if (StudentData.studentManualImg != null) { upPhoto += " DisabilityProve=@DisabilityProve, "; } StudentData1 oldStudentDataBase1=this.getStudentData1(StudentData.ID); StudentHearingInformation oldStudentDataBase5 = this.getStudentHearingInfo(StudentData.ID); #region 離會生&轉通知 if (oldStudentDataBase1.endReasonDate == "1900-01-01" && oldStudentDataBase1.endReasonDate != Chk.CheckStringFunction(StudentData.endReasonDate) && Chk.CheckStringFunction(StudentData.endReasonDate).Length > 0) { /*已結案轉入離會生*/ CreateStudentTracked StudentTracked = new CreateStudentTracked(); StudentTracked.sUnit = StudentData.Unit; StudentTracked.studentID = StudentData.studentID; StudentTracked.StudentIdentity = StudentData.studentTWID; StudentTracked.email = StudentData.email; StudentTracked.addressZip = StudentData.addressZip; StudentTracked.addressCity = StudentData.addressCity; StudentTracked.address = StudentData.address; StudentTracked.Tel = StudentData.fPHPhone2; StudentTracked.manualCategory1 = StudentData.manualCategory1; StudentTracked.manualGrade1 = StudentData.manualGrade1; StudentTracked.manualCategory2 = StudentData.manualCategory2; StudentTracked.manualGrade2 = StudentData.manualGrade2; StudentTracked.manualCategory3 = StudentData.manualCategory3; StudentTracked.manualGrade3 = StudentData.manualGrade3; StudentTracked.assistmanageR = oldStudentDataBase5.assistmanageR; StudentTracked.brandR = oldStudentDataBase5.brandR; StudentTracked.modelR = oldStudentDataBase5.modelR; StudentTracked.buyingtimeR = oldStudentDataBase5.buyingtimeR; StudentTracked.buyingPlaceR = oldStudentDataBase5.buyingPlaceR; StudentTracked.insertHospitalR = oldStudentDataBase5.insertHospitalR; StudentTracked.openHzDateR = oldStudentDataBase5.openHzDateR; StudentTracked.assistmanageL = oldStudentDataBase5.assistmanageL; StudentTracked.brandL = oldStudentDataBase5.brandL; StudentTracked.modelL = oldStudentDataBase5.modelL; StudentTracked.buyingtimeL = oldStudentDataBase5.buyingtimeL; StudentTracked.buyingPlaceL = oldStudentDataBase5.buyingPlaceL; StudentTracked.insertHospitalL = oldStudentDataBase5.insertHospitalL; StudentTracked.openHzDateL = oldStudentDataBase5.openHzDateL; this.createStudentTrackedDataBase(StudentTracked); OtherDataBase oDB = new OtherDataBase(); StaffDataBase sDB = new StaffDataBase(); List<int> item = new List<int>(); //</option><option value="20">主任/教師</option><option value="21">主任/聽力師</option><option value="22">主任/社工</option></select> item.Add(11);//主任 item.Add(20);//主任/教師 item.Add(21);//主任/聽力師 item.Add(22);//主任/社工 item.Add(17);//社工管理長 item.Add(18);//社工 int[] days = { 90, 180, 365 }; List<StaffDataList> SDL = sDB.getAllStaffDataList(item); foreach (StaffDataList atom in SDL) { if (atom.sUnit == StudentData.Unit) { for (int i = 0; i < 3; i++) { CreateRemind Remind = new CreateRemind(); Remind.executionDate = Chk.CheckStringtoDateFunction(StudentData.endReasonDate).AddDays(days[i] - 5).ToShortDateString(); Remind.recipientID = atom.sID; Remind.executionContent = StudentData.studentName + " 離會第 " + days[i].ToString() + " 天追蹤個案近況"; //cmd.Parameters.Add("@Executor", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(RemindSystemData.recipientID); //cmd.Parameters.Add("@RemindContent", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(RemindSystemData.executionContent); //cmd.Parameters.Add("@RemindDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(RemindSystemData.executionDate); //cmd.Parameters.Add("@CompleteDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(RemindSystemData.fulfillmentDate); oDB.CreateRemindSystem(Remind); } } } item.Clear(); item.Add(3);//行政組長 SDL = sDB.getAllStaffDataListRemindlist(item); foreach (StaffDataList atom in SDL) { CreateRemind Remind = new CreateRemind(); Remind.executionDate = Chk.CheckStringtoDateFunction(StudentData.endReasonDate).AddDays(360).ToShortDateString(); Remind.recipientID = atom.sID; Remind.executionContent = StudentData.studentName + " 離會第 365 天"; //cmd.Parameters.Add("@Executor", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(RemindSystemData.recipientID); //cmd.Parameters.Add("@RemindContent", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(RemindSystemData.executionContent); //cmd.Parameters.Add("@RemindDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(RemindSystemData.executionDate); //cmd.Parameters.Add("@CompleteDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(RemindSystemData.fulfillmentDate); oDB.CreateRemindSystem(Remind); } item.Clear(); item.Add(19);//中心行政 SDL = sDB.getAllStaffDataList(item); foreach (StaffDataList atom in SDL) { if (atom.sUnit == StudentData.Unit) { CreateRemind Remind = new CreateRemind(); Remind.executionDate = Chk.CheckStringtoDateFunction(StudentData.endReasonDate).AddDays(25).ToShortDateString(); Remind.recipientID = atom.sID; Remind.executionContent = StudentData.studentName + " 結案30天要完成退保證金:" + Chk.CheckStringtoDateFunction(StudentData.endReasonDate).AddDays(30).ToShortDateString() ; //cmd.Parameters.Add("@Executor", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(RemindSystemData.recipientID); //cmd.Parameters.Add("@RemindContent", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(RemindSystemData.executionContent); //cmd.Parameters.Add("@RemindDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(RemindSystemData.executionDate); //cmd.Parameters.Add("@CompleteDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(RemindSystemData.fulfillmentDate); oDB.CreateRemindSystem(Remind); } } } #endregion #region 轉換成通知系統 //轉通知系統記錄) //評估日期 assessDate if (oldStudentDataBase1.assessDate == "1900-01-01" && oldStudentDataBase1.assessDate != Chk.CheckStringFunction(StudentData.assessDate) && Chk.CheckStringFunction(StudentData.assessDate).Length > 0) { List<int> item = new List<int>(); item.Add(17);//社工管理長 item.Add(18);//社工 item.Add(19);//中心行政 OtherDataBase oDB = new OtherDataBase(); StaffDataBase sDB = new StaffDataBase(); List<StaffDataList> SDL = sDB.getAllStaffDataList(item); foreach (StaffDataList atom in SDL) { if (atom.sUnit == StudentData.Unit) { CreateRemind Remind = new CreateRemind(); Remind.executionDate = Chk.CheckStringtoDateFunction(StudentData.assessDate).AddDays(-5).ToShortDateString(); Remind.recipientID = atom.sID; Remind.executionContent = StudentData.studentName + " 排定評估日期收咨詢費: " + Chk.CheckStringtoDateFunction(StudentData.assessDate).ToShortDateString() + " "; oDB.CreateRemindSystem(Remind); } } } //首次上課 firstClassDate if (oldStudentDataBase1.firstClassDate == "1900-01-01" && oldStudentDataBase1.firstClassDate != Chk.CheckStringFunction(StudentData.firstClassDate) && Chk.CheckStringFunction(StudentData.firstClassDate).Length > 0) { List<int> item = new List<int>(); item.Add(11);//主任 item.Add(20);//主任/教師 item.Add(21);//主任/聽力師 item.Add(22);//主任/社工 item.Add(15);//聽力師管理長 item.Add(16);//聽力師 item.Add(17);//社工管理長 item.Add(18);//社工 OtherDataBase oDB = new OtherDataBase(); StaffDataBase sDB = new StaffDataBase(); List<StaffDataList> SDL = sDB.getAllStaffDataList(item); foreach (StaffDataList atom in SDL) { if (atom.sUnit == StudentData.Unit) { CreateRemind Remind = new CreateRemind(); Remind.executionDate = Chk.CheckStringtoDateFunction(StudentData.firstClassDate).AddDays(25).ToShortDateString(); Remind.recipientID = atom.sID; Remind.executionContent = StudentData.studentName + " 首次上課30天內要完家訪和 ISP,首次上課日期 : " + Chk.CheckStringtoDateFunction(StudentData.firstClassDate).ToShortDateString() + " "; oDB.CreateRemindSystem(Remind); } } } #endregion SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()); using (Sqlconn) { try { Sqlconn.Open(); StaffDataBase sDB = new StaffDataBase(); List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name); string sql = "UPDATE StudentDatabase SET Unit=@Unit,EvaluationDate=@EvaluationDate, ConsultDate=@ConsultDate, Updated=(getdate()), CaseStatu=@CaseStatu, " + "StudentName=@StudentName, StudentIdentity=@StudentIdentity, AddressZip1=@AddressZip1, " + "AddressCity1=@AddressCity1, AddressOther1=@AddressOther1, AddressZip2=@AddressZip2, AddressCity2=@AddressCity2, AddressOther2=@AddressOther2, " + "StudentBirthday=@StudentBirthday, StudentSex=@StudentSex, ClassDate=@ClassDate, GuaranteeDate= @GuaranteeDate, BackGuaranteeDate=@BackGuaranteeDate, CompletedDate=@CompletedDate, " + "CompletedType=@CompletedType, CompletedReason=@CompletedReason, ShortEndDateSince=@ShortEndDateSince, ShortEndDateUntil=@ShortEndDateUntil, " + "NomembershipType=@NomembershipType, NomembershipReason=@NomembershipReason, CaregiversDaytime=@CaregiversDaytime, " + "CaregiversDaytimeText=@CaregiversDaytimeText, CaregiversNight=@CaregiversNight, CaregiversNightText=@CaregiversNightText, ContactRelation1=@ContactRelation1, " + "ContactName1=@ContactName1, ContactTel_company1=@ContactTel_company1, ContactTel_home1=@ContactTel_home1, ContactPhone1=@ContactPhone1, " + "ContactFax1=@ContactFax1, ContactRelation2=@ContactRelation2, ContactName2=@ContactName2, ContactTel_company2=@ContactTel_company2, " + "ContactTel_home2=@ContactTel_home2, ContactPhone2=@ContactPhone2, ContactFax2=@ContactFax2, ContactRelation3=@ContactRelation3, ContactName3=@ContactName3, " + "ContactTel_company3=@ContactTel_company3, ContactTel_home3=@ContactTel_home3, ContactPhone3=@ContactPhone3, ContactFax3=@ContactFax3, " + "ContactRelation4=@ContactRelation4, ContactName4=@ContactName4, ContactTel_company4=@ContactTel_company4, ContactTel_home4=@ContactTel_home4, " + "ContactPhone4=@ContactPhone4, ContactFax4=@ContactFax4, StudentEmail=@StudentEmail, ReferralSourceType=@ReferralSourceType, ReferralSource=@ReferralSource, " + "PhysicalAndMentalDisabilityHandbook=@PhysicalAndMentalDisabilityHandbook, DisabilityCategory1= @DisabilityCategory1, DisabilityGrade1=@DisabilityGrade1, " + "DisabilityCategory2=@DisabilityCategory2, DisabilityGrade2=@DisabilityGrade2, DisabilityCategory3=@DisabilityCategory3, DisabilityGrade3=@DisabilityGrade3, " + "NoDisabilityHandbook=@NoDisabilityHandbook, ApplyDisabilityHandbook=@ApplyDisabilityHandbook, Notify=@Notify, " + "Notify_Unit=@Notify_Unit, Notify_Member=@Notify_Member, Notify_Tel=@Notify_Tel, Notify_Date=@Notify_Date, Notify_City=@Notify_City, EconomyState=@EconomyState, " + "EconomyLow=@EconomyLow ," + upPhoto + " UpFileBy=@UpFileBy, UpFileDate=(getDate()) " + "WHERE StudentID=@StudentID AND ID=@ID"; SqlCommand cmd = new SqlCommand(sql, Sqlconn); cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = StudentData.ID; cmd.Parameters.Add("@Unit", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(StudentData.Unit); cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentID); cmd.Parameters.Add("@EvaluationDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.assessDate); cmd.Parameters.Add("@ConsultDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.consultationDate); cmd.Parameters.Add("@Updated", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.upDate); cmd.Parameters.Add("@CaseStatu", SqlDbType.TinyInt).Value = Chk.CheckIntFunction(CaseStatu); //cmd.Parameters.Add("@WriteName", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(StudentData.fillInName); cmd.Parameters.Add("@StudentName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentName); cmd.Parameters.Add("@StudentIdentity", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentTWID); cmd.Parameters.Add("@AddressZip1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.censusAddressZip); cmd.Parameters.Add("@AddressCity1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.censusAddressCity); cmd.Parameters.Add("@AddressOther1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.censusAddress); cmd.Parameters.Add("@AddressZip2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.addressZip); cmd.Parameters.Add("@AddressCity2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.addressCity); cmd.Parameters.Add("@AddressOther2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.address); cmd.Parameters.Add("@StudentBirthday", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.studentbirthday); cmd.Parameters.Add("@StudentSex", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.studentSex); cmd.Parameters.Add("@ClassDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.firstClassDate); cmd.Parameters.Add("@GuaranteeDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.guaranteeDate); cmd.Parameters.Add("@BackGuaranteeDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.BackGuaranteeDate); cmd.Parameters.Add("@CompletedDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.endReasonDate); cmd.Parameters.Add("@CompletedType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.endReasonType); cmd.Parameters.Add("@CompletedReason", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.endReason); cmd.Parameters.Add("@ShortEndDateSince", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.sendDateSince); cmd.Parameters.Add("@ShortEndDateUntil", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.sendDateUntil); cmd.Parameters.Add("@NomembershipType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.nomembershipType); cmd.Parameters.Add("@NomembershipReason", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.nomembershipReason); cmd.Parameters.Add("@StudentAvatar", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentPhoto); cmd.Parameters.Add("@CaregiversDaytime", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.wCare); cmd.Parameters.Add("@CaregiversDaytimeText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.wCareName); cmd.Parameters.Add("@CaregiversNight", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.bCare); cmd.Parameters.Add("@CaregiversNightText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.bCareName); cmd.Parameters.Add("@ContactRelation1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPRelation1); cmd.Parameters.Add("@ContactName1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPName1); cmd.Parameters.Add("@ContactTel_company1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPTel1); cmd.Parameters.Add("@ContactPhone1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPPhone1); cmd.Parameters.Add("@ContactTel_home1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPHPhone1); cmd.Parameters.Add("@ContactFax1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPFax1); cmd.Parameters.Add("@ContactRelation2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPRelation2); cmd.Parameters.Add("@ContactName2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPName2); cmd.Parameters.Add("@ContactTel_company2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPTel2); cmd.Parameters.Add("@ContactPhone2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPPhone2); cmd.Parameters.Add("@ContactTel_home2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPHPhone2); cmd.Parameters.Add("@ContactFax2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPFax2); cmd.Parameters.Add("@ContactRelation3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPRelation3); cmd.Parameters.Add("@ContactName3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPName3); cmd.Parameters.Add("@ContactTel_company3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPTel3); cmd.Parameters.Add("@ContactPhone3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPPhone3); cmd.Parameters.Add("@ContactTel_home3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPHPhone3); cmd.Parameters.Add("@ContactFax3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPFax3); cmd.Parameters.Add("@ContactRelation4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPRelation4); cmd.Parameters.Add("@ContactName4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPName4); cmd.Parameters.Add("@ContactTel_company4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPTel4); cmd.Parameters.Add("@ContactPhone4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPPhone4); cmd.Parameters.Add("@ContactTel_home4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPHPhone4); cmd.Parameters.Add("@ContactFax4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fPFax4); cmd.Parameters.Add("@StudentEmail", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.email); cmd.Parameters.Add("@ReferralSourceType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.sourceType); cmd.Parameters.Add("@ReferralSource", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.sourceName); cmd.Parameters.Add("@PhysicalAndMentalDisabilityHandbook", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.manualWhether); cmd.Parameters.Add("@DisabilityCategory1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.manualCategory1); cmd.Parameters.Add("@DisabilityGrade1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.manualGrade1); cmd.Parameters.Add("@DisabilityCategory2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.manualCategory2); cmd.Parameters.Add("@DisabilityGrade2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.manualGrade2); cmd.Parameters.Add("@DisabilityCategory3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.manualCategory3); cmd.Parameters.Add("@DisabilityGrade3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.manualGrade3); cmd.Parameters.Add("@NoDisabilityHandbook", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.manualNo); cmd.Parameters.Add("@ApplyDisabilityHandbook", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.manualUnit); cmd.Parameters.Add("@DisabilityProve", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentManualImg); cmd.Parameters.Add("@Notify", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.notificationWhether); cmd.Parameters.Add("@Notify_Unit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.notificationUnit); cmd.Parameters.Add("@Notify_Member", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.notificationManage); cmd.Parameters.Add("@Notify_Tel", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.notificationTel); cmd.Parameters.Add("@Notify_Date", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.notificationDate); cmd.Parameters.Add("@Notify_City", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.notificationCity); cmd.Parameters.Add("@EconomyState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.economy); cmd.Parameters.Add("@EconomyLow", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StudentData.economyLow); cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]); returnValue[0] = cmd.ExecuteNonQuery().ToString(); Sqlconn.Close(); } catch (Exception e) { string error = e.Message; returnValue[0] = "-1"; returnValue[1] = e.Message; } } return returnValue; }
public string[] setStudentBaseData(CreateStudent StudentData) { CaseDataBase SDB = new CaseDataBase(); //if (int.Parse(SDB._StaffhaveRoles[1]) == 1) //{ return SDB.setStudentBaseData(StudentData); //} //else //{ // return new string[2] { _noRole, _errorMsg }; //} }
public string[] createStudentDataBase(CreateStudent SearchStructure) { string[] returnValue = new string[3]; returnValue[0] = "0"; returnValue[1] = "0"; returnValue[2] = "0"; DataBase Base = new DataBase(); SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()); using (Sqlconn) { try { Sqlconn.Open(); int CaseStatu = this.CaseStatusFunction(SearchStructure); StaffDataBase sDB = new StaffDataBase(); List<string> CreateFileName = CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name); string caseUnit = "0"; if (SearchStructure.Unit != null && SearchStructure.Unit != "0") { caseUnit = SearchStructure.Unit; } else { caseUnit = CreateFileName[2]; } /*string[] CreateFileName = new string[4]; CreateFileName = sDB.getStaffDataName2(HttpContext.Current.User.Identity.Name);*/ string sql = "INSERT INTO StudentDatabase(EvaluationDate, ConsultDate, Updated, CaseStatu, WriteName, Unit, StudentID, StudentName, StudentIdentity, " + "AddressZip1, AddressCity1, AddressOther1, AddressZip2, AddressCity2, AddressOther2, StudentBirthday, StudentSex, ClassDate, GuaranteeDate, " + " BackGuaranteeDate, " + "CompletedDate, CompletedType, CompletedReason, ShortEndDateSince, ShortEndDateUntil, NomembershipType, NomembershipReason, StudentAvatar, " + "CaregiversDaytime, CaregiversDaytimeText, CaregiversNight, CaregiversNightText, ContactRelation1, ContactName1, ContactTel_company1, " + "ContactTel_home1, ContactPhone1, ContactFax1, ContactRelation2, ContactName2, ContactTel_company2, ContactTel_home2, ContactPhone2, ContactFax2, " + "ContactRelation3, ContactName3, ContactTel_company3, ContactTel_home3, ContactPhone3, ContactFax3, ContactRelation4, ContactName4, ContactTel_company4, " + "ContactTel_home4, ContactPhone4, ContactFax4, StudentEmail, ReferralSourceType, ReferralSource, PhysicalAndMentalDisabilityHandbook, DisabilityCategory1, " + "DisabilityGrade1, DisabilityCategory2, DisabilityGrade2, DisabilityCategory3, DisabilityGrade3, NoDisabilityHandbook, ApplyDisabilityHandbook, " + "DisabilityProve, Notify, Notify_Unit, Notify_Member, Notify_Tel, Notify_Date, Notify_City, EconomyState, EconomyLow, FamilyAppellation1, FamilyName1, " + "FamilyBirthday1, FamilyEducation1, FamilyProfession1, FamilyLive1, FamilyHearing1, FamilyHealth1, FamilyHealthText1, FamilyAppellation2, FamilyName2, " + "FamilyBirthday2, FamilyEducation2, FamilyProfession2, FamilyLive2, FamilyHearing2, FamilyHealth2, FamilyHealthText2, FamilyAppellation3, FamilyName3, " + "FamilyBirthday3, FamilyEducation3, FamilyProfession3, FamilyLive3, FamilyHearing3, FamilyHealth3, FamilyHealthText3, FamilyAppellation4, FamilyName4, " + "FamilyBirthday4, FamilyEducation4, FamilyProfession4, FamilyLive4, FamilyHearing4, FamilyHealth4, FamilyHealthText4, FamilyAppellation5, FamilyName5, " + "FamilyBirthday5, FamilyEducation5, FamilyProfession5, FamilyLive5, FamilyHearing5, FamilyHealth5, FamilyHealthText5, FamilyAppellation6, FamilyName6, " + "FamilyBirthday6, FamilyEducation6, FamilyProfession6, FamilyLive6, FamilyHearing6, FamilyHealth6, FamilyHealthText6, FamilyAppellation7, FamilyName7, " + "FamilyBirthday7, FamilyEducation7, FamilyProfession7, FamilyLive7, FamilyHearing7, FamilyHealth7, FamilyHealthText7, FamilyAppellation8, FamilyName8, " + "FamilyBirthday8, FamilyEducation8, FamilyProfession8, FamilyLive8, FamilyHearing8, FamilyHealth8, FamilyHealthText8, FamilyLanguage, FamilyLanguageText, " + "FamilyConnectLanguage, FamilyConnectLanguageText, FamilyProfile1, FamilyProfile2, FamilyProfile3, FamilyProfile4, FamilyProfile5, FamilyProfileWriteName, " + "FamilyProfileWriteDate, CreateFileBy, UpFileBy, UpFileDate ) " + "VALUES " + "(@EvaluationDate, @ConsultDate, (getdate()), @CaseStatu, @WriteName, @Unit, @StudentID, @StudentName, @StudentIdentity, @AddressZip1, @AddressCity1, " + "@AddressOther1, @AddressZip2, @AddressCity2, @AddressOther2, @StudentBirthday, @StudentSex, @ClassDate, @GuaranteeDate, "+ " @BackGuaranteeDate, " + "@CompletedDate, @CompletedType, " + "@CompletedReason, @ShortEndDateSince, @ShortEndDateUntil, @NomembershipType, @NomembershipReason, @StudentAvatar, @CaregiversDaytime, " + "@CaregiversDaytimeText, @CaregiversNight, @CaregiversNightText, @ContactRelation1, @ContactName1, @ContactTel_company1, @ContactTel_home1, " + "@ContactPhone1, @ContactFax1, @ContactRelation2, @ContactName2, @ContactTel_company2, @ContactTel_home2, @ContactPhone2, @ContactFax2, " + "@ContactRelation3, @ContactName3, @ContactTel_company3, @ContactTel_home3, @ContactPhone3, @ContactFax3, @ContactRelation4, @ContactName4, " + "@ContactTel_company4, @ContactTel_home4, @ContactPhone4, @ContactFax4, @StudentEmail, @ReferralSourceType, @ReferralSource, " + "@PhysicalAndMentalDisabilityHandbook, @DisabilityCategory1, @DisabilityGrade1, @DisabilityCategory2, @DisabilityGrade2, @DisabilityCategory3, " + "@DisabilityGrade3, @NoDisabilityHandbook, @ApplyDisabilityHandbook, @DisabilityProve, @Notify, @Notify_Unit, @Notify_Member, @Notify_Tel, " + "@Notify_Date, @Notify_City, @EconomyState, @EconomyLow, @FamilyAppellation1, @FamilyName1, @FamilyBirthday1, @FamilyEducation1, @FamilyProfession1, " + "@FamilyLive1, @FamilyHearing1, @FamilyHealth1, @FamilyHealthText1, @FamilyAppellation2, @FamilyName2, @FamilyBirthday2, @FamilyEducation2, " + "@FamilyProfession2, @FamilyLive2, @FamilyHearing2, @FamilyHealth2, @FamilyHealthText2, @FamilyAppellation3, @FamilyName3, @FamilyBirthday3, " + "@FamilyEducation3, @FamilyProfession3, @FamilyLive3, @FamilyHearing3, @FamilyHealth3, @FamilyHealthText3, @FamilyAppellation4, @FamilyName4, " + "@FamilyBirthday4, @FamilyEducation4, @FamilyProfession4, @FamilyLive4, @FamilyHearing4, @FamilyHealth4, @FamilyHealthText4, @FamilyAppellation5, " + "@FamilyName5, @FamilyBirthday5, @FamilyEducation5, @FamilyProfession5, @FamilyLive5, @FamilyHearing5, @FamilyHealth5, @FamilyHealthText5, " + "@FamilyAppellation6, @FamilyName6, @FamilyBirthday6, @FamilyEducation6, @FamilyProfession6, @FamilyLive6, @FamilyHearing6, @FamilyHealth6, " + "@FamilyHealthText6, @FamilyAppellation7, @FamilyName7, @FamilyBirthday7, @FamilyEducation7, @FamilyProfession7, @FamilyLive7, @FamilyHearing7, " + "@FamilyHealth7, @FamilyHealthText7, @FamilyAppellation8, @FamilyName8, @FamilyBirthday8, @FamilyEducation8, @FamilyProfession8, @FamilyLive8, " + "@FamilyHearing8, @FamilyHealth8, @FamilyHealthText8, @FamilyLanguage, @FamilyLanguageText, @FamilyConnectLanguage, @FamilyConnectLanguageText, " + "@FamilyProfile1, @FamilyProfile2, @FamilyProfile3, @FamilyProfile4, @FamilyProfile5, @FamilyProfileWriteName, @FamilyProfileWriteDate ,@CreateFileBy, @UpFileBy, (getDate()))"; SqlCommand cmd = new SqlCommand(sql, Sqlconn); cmd.Parameters.Add("@EvaluationDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.assessDate); cmd.Parameters.Add("@ConsultDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.consultationDate); cmd.Parameters.Add("@Updated", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.upDate); cmd.Parameters.Add("@CaseStatu", SqlDbType.TinyInt).Value = Chk.CheckIntFunction(CaseStatu); cmd.Parameters.Add("@WriteName", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]); cmd.Parameters.Add("@Unit", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(caseUnit); cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.studentID); cmd.Parameters.Add("@StudentName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.studentName); cmd.Parameters.Add("@StudentIdentity", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.studentTWID); cmd.Parameters.Add("@AddressZip1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.censusAddressZip); cmd.Parameters.Add("@AddressCity1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.censusAddressCity); cmd.Parameters.Add("@AddressOther1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.censusAddress); cmd.Parameters.Add("@AddressZip2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.addressZip); cmd.Parameters.Add("@AddressCity2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.addressCity); cmd.Parameters.Add("@AddressOther2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.address); cmd.Parameters.Add("@StudentBirthday", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.studentbirthday); cmd.Parameters.Add("@StudentSex", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.studentSex); cmd.Parameters.Add("@ClassDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.firstClassDate); cmd.Parameters.Add("@GuaranteeDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.guaranteeDate); cmd.Parameters.Add("@BackGuaranteeDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.BackGuaranteeDate); cmd.Parameters.Add("@CompletedDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.endReasonDate); cmd.Parameters.Add("@CompletedType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.endReasonType); cmd.Parameters.Add("@CompletedReason", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.endReason); cmd.Parameters.Add("@ShortEndDateSince", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.sendDateSince); cmd.Parameters.Add("@ShortEndDateUntil", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.sendDateUntil); cmd.Parameters.Add("@NomembershipType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.nomembershipType); cmd.Parameters.Add("@NomembershipReason", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.nomembershipReason); cmd.Parameters.Add("@StudentAvatar", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.studentPhoto); cmd.Parameters.Add("@CaregiversDaytime", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.wCare); cmd.Parameters.Add("@CaregiversDaytimeText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.wCareName); cmd.Parameters.Add("@CaregiversNight", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.bCare); cmd.Parameters.Add("@CaregiversNightText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.bCareName); cmd.Parameters.Add("@ContactRelation1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPRelation1); cmd.Parameters.Add("@ContactName1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPName1); cmd.Parameters.Add("@ContactTel_company1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPTel1); cmd.Parameters.Add("@ContactPhone1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPPhone1); cmd.Parameters.Add("@ContactTel_home1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPHPhone1); cmd.Parameters.Add("@ContactFax1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPFax1); cmd.Parameters.Add("@ContactRelation2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPRelation2); cmd.Parameters.Add("@ContactName2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPName2); cmd.Parameters.Add("@ContactTel_company2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPTel2); cmd.Parameters.Add("@ContactPhone2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPPhone2); cmd.Parameters.Add("@ContactTel_home2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPHPhone2); cmd.Parameters.Add("@ContactFax2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPFax2); cmd.Parameters.Add("@ContactRelation3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPRelation3); cmd.Parameters.Add("@ContactName3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPName3); cmd.Parameters.Add("@ContactTel_company3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPTel3); cmd.Parameters.Add("@ContactPhone3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPPhone3); cmd.Parameters.Add("@ContactTel_home3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPHPhone3); cmd.Parameters.Add("@ContactFax3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPFax3); cmd.Parameters.Add("@ContactRelation4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPRelation4); cmd.Parameters.Add("@ContactName4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPName4); cmd.Parameters.Add("@ContactTel_company4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPTel4); cmd.Parameters.Add("@ContactPhone4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPPhone4); cmd.Parameters.Add("@ContactTel_home4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPHPhone4); cmd.Parameters.Add("@ContactFax4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fPFax4); cmd.Parameters.Add("@StudentEmail", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.email); cmd.Parameters.Add("@ReferralSourceType", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.sourceType); cmd.Parameters.Add("@ReferralSource", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.sourceName); cmd.Parameters.Add("@PhysicalAndMentalDisabilityHandbook", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.manualWhether); cmd.Parameters.Add("@DisabilityCategory1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.manualCategory1); cmd.Parameters.Add("@DisabilityGrade1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.manualGrade1); cmd.Parameters.Add("@DisabilityCategory2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.manualCategory2); cmd.Parameters.Add("@DisabilityGrade2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.manualGrade2); cmd.Parameters.Add("@DisabilityCategory3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.manualCategory3); cmd.Parameters.Add("@DisabilityGrade3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.manualGrade3); cmd.Parameters.Add("@NoDisabilityHandbook", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.manualNo); cmd.Parameters.Add("@ApplyDisabilityHandbook", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.manualUnit); cmd.Parameters.Add("@DisabilityProve", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.studentManualImg); cmd.Parameters.Add("@Notify", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.notificationWhether); cmd.Parameters.Add("@Notify_Unit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.notificationUnit); cmd.Parameters.Add("@Notify_Member", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.notificationManage); cmd.Parameters.Add("@Notify_Tel", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.notificationTel); cmd.Parameters.Add("@Notify_Date", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.notificationDate); cmd.Parameters.Add("@Notify_City", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.notificationCity); cmd.Parameters.Add("@EconomyState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.economy); cmd.Parameters.Add("@EconomyLow", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.economyLow); cmd.Parameters.Add("@FamilyAppellation1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fAppellation1); cmd.Parameters.Add("@FamilyName1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fName1); cmd.Parameters.Add("@FamilyBirthday1", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.fBirthday1); cmd.Parameters.Add("@FamilyEducation1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fEDU1); cmd.Parameters.Add("@FamilyProfession1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fProfession1); cmd.Parameters.Add("@FamilyLive1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fLive1); cmd.Parameters.Add("@FamilyHearing1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHearing1); cmd.Parameters.Add("@FamilyHealth1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHealthy1); cmd.Parameters.Add("@FamilyHealthText1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyText01); cmd.Parameters.Add("@FamilyAppellation2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fAppellation2); cmd.Parameters.Add("@FamilyName2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fName2); cmd.Parameters.Add("@FamilyBirthday2", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.fBirthday2); cmd.Parameters.Add("@FamilyEducation2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fEDU2); cmd.Parameters.Add("@FamilyProfession2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fProfession2); cmd.Parameters.Add("@FamilyLive2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fLive2); cmd.Parameters.Add("@FamilyHearing2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHearing2); cmd.Parameters.Add("@FamilyHealth2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHealthy2); cmd.Parameters.Add("@FamilyHealthText2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyText02); cmd.Parameters.Add("@FamilyAppellation3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fAppellation3); cmd.Parameters.Add("@FamilyName3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fName3); cmd.Parameters.Add("@FamilyBirthday3", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.fBirthday3); cmd.Parameters.Add("@FamilyEducation3", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fEDU3); cmd.Parameters.Add("@FamilyProfession3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fProfession3); cmd.Parameters.Add("@FamilyLive3", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fLive3); cmd.Parameters.Add("@FamilyHearing3", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHearing3); cmd.Parameters.Add("@FamilyHealth3", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHealthy3); cmd.Parameters.Add("@FamilyHealthText3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyText03); cmd.Parameters.Add("@FamilyAppellation4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fAppellation4); cmd.Parameters.Add("@FamilyName4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fName4); cmd.Parameters.Add("@FamilyBirthday4", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.fBirthday4); cmd.Parameters.Add("@FamilyEducation4", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fEDU4); cmd.Parameters.Add("@FamilyProfession4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fProfession4); cmd.Parameters.Add("@FamilyLive4", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fLive4); cmd.Parameters.Add("@FamilyHearing4", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHearing4); cmd.Parameters.Add("@FamilyHealth4", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHealthy4); cmd.Parameters.Add("@FamilyHealthText4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyText04); cmd.Parameters.Add("@FamilyAppellation5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fAppellation5); cmd.Parameters.Add("@FamilyName5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fName5); cmd.Parameters.Add("@FamilyBirthday5", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.fBirthday5); cmd.Parameters.Add("@FamilyEducation5", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fEDU5); cmd.Parameters.Add("@FamilyProfession5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fProfession5); cmd.Parameters.Add("@FamilyLive5", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fLive5); cmd.Parameters.Add("@FamilyHearing5", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHearing5); cmd.Parameters.Add("@FamilyHealth5", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHealthy5); cmd.Parameters.Add("@FamilyHealthText5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyText05); cmd.Parameters.Add("@FamilyAppellation6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fAppellation6); cmd.Parameters.Add("@FamilyName6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fName6); cmd.Parameters.Add("@FamilyBirthday6", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.fBirthday6); cmd.Parameters.Add("@FamilyEducation6", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fEDU6); cmd.Parameters.Add("@FamilyProfession6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fProfession6); cmd.Parameters.Add("@FamilyLive6", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fLive6); cmd.Parameters.Add("@FamilyHearing6", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHearing6); cmd.Parameters.Add("@FamilyHealth6", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHealthy6); cmd.Parameters.Add("@FamilyHealthText6", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyText06); cmd.Parameters.Add("@FamilyAppellation7", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fAppellation7); cmd.Parameters.Add("@FamilyName7", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fName7); cmd.Parameters.Add("@FamilyBirthday7", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.fBirthday7); cmd.Parameters.Add("@FamilyEducation7", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fEDU7); cmd.Parameters.Add("@FamilyProfession7", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fProfession7); cmd.Parameters.Add("@FamilyLive7", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fLive7); cmd.Parameters.Add("@FamilyHearing7", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHearing7); cmd.Parameters.Add("@FamilyHealth7", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHealthy7); cmd.Parameters.Add("@FamilyHealthText7", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyText07); cmd.Parameters.Add("@FamilyAppellation8", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fAppellation8); cmd.Parameters.Add("@FamilyName8", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fName8); cmd.Parameters.Add("@FamilyBirthday8", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.fBirthday8); cmd.Parameters.Add("@FamilyEducation8", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fEDU8); cmd.Parameters.Add("@FamilyProfession8", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fProfession8); cmd.Parameters.Add("@FamilyLive8", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fLive8); cmd.Parameters.Add("@FamilyHearing8", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHearing8); cmd.Parameters.Add("@FamilyHealth8", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.fHealthy8); cmd.Parameters.Add("@FamilyHealthText8", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyText08); cmd.Parameters.Add("@FamilyLanguage", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.lang1); cmd.Parameters.Add("@FamilyLanguageText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.lang1t01); cmd.Parameters.Add("@FamilyConnectLanguage", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.lang2); cmd.Parameters.Add("@FamilyConnectLanguageText", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.lang2t01); cmd.Parameters.Add("@FamilyProfile1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.familyEcological); cmd.Parameters.Add("@FamilyProfile2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.famailySituation); cmd.Parameters.Add("@FamilyProfile3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.famailyMedical); cmd.Parameters.Add("@FamilyProfile4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.famailyActionSituation); cmd.Parameters.Add("@FamilyProfile5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.fswAssess); cmd.Parameters.Add("@FamilyProfileWriteName", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(SearchStructure.socialID); cmd.Parameters.Add("@FamilyProfileWriteDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.socialDate); 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] == "1") { string FieldName = "StudentDB_" + caseUnit; Int64 Column = 0; sql = "select IDENT_CURRENT('StudentDatabase') AS TID "+ "UPDATE AutomaticNumberTable SET " + FieldName + "=" + FieldName + "+1 WHERE ID=1 "; cmd = new SqlCommand(sql, Sqlconn); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Column = Int64.Parse(dr["TID"].ToString()); } dr.Close(); /*string stuIDName =""; sql = "SELECT Count(*) AS QCOUNT FROM StudentDatabase WHERE Unit=(@Unit) "; cmd = new SqlCommand(sql, Sqlconn); cmd.Parameters.Add("@Unit", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(caseUnit); string stuNumber = cmd.ExecuteScalar().ToString();*/ string stuNumber = this.getUnitAutoNumber(FieldName); string stuIDName = caseUnit + stuNumber.PadLeft(4, '0') + "0"; sql = "UPDATE StudentDatabase SET StudentID=(@StudentID) WHERE ID=(@TID) "; cmd = new SqlCommand(sql, Sqlconn); cmd.Parameters.Add("@TID", SqlDbType.BigInt).Value = Column; cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(stuIDName); returnValue[0] = cmd.ExecuteNonQuery().ToString(); returnValue[1] = Column.ToString(); returnValue[2] = stuIDName; } Sqlconn.Close(); } catch (Exception e) { returnValue[0] = "-1"; returnValue[1] = e.Message.ToString(); } } return returnValue; }
private int CaseStatusFunction(CreateStudent StructureData) { int returnValue = 1; if (StructureData.consultationDate != null) { returnValue = 1; } if (StructureData.firstClassDate != null) { returnValue = 2; } //if (StructureData.guaranteeDate != null) //{ // returnValue = 2; //} if (StructureData.sendDateSince != null && StructureData.sendDateUntil != null) { returnValue = 3; } if (StructureData.endReasonDate != null) { returnValue = 4; } return returnValue; }
// Use this for initialization void Start() { studentGen = GameObject.Find("GameObject"); createStudent = studentGen.GetComponent<CreateStudent>(); }