public string[] setStudentDataBase4(StudentData4 StudentData)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "";
        string upPhoto = "";
        if (StudentData.familyEcological != null)
        {
            upPhoto += " FamilyProfile1=@FamilyProfile1, ";
        }
        DataBase Base = new DataBase();
        SqlConnection Sqlconn = new SqlConnection(Base.GetConnString());
        using (Sqlconn)
        {
            try
            {
                Sqlconn.Open();
                //Unit=@Unit,
                string sql = "UPDATE StudentDatabase SET FamilyProfile2=@FamilyProfile2, FamilyProfile3=@FamilyProfile3, " +
                    "FamilyProfile4=@FamilyProfile4, FamilyProfile5=@FamilyProfile5, FamilyProfileWriteName=@FamilyProfileWriteName, " +upPhoto+
                    "FamilyProfileWriteDate=@FamilyProfileWriteDate " +
                    "WHERE StudentID=@StudentID AND ID=@ID";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.studentID);
                cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = StudentData.ID;
                cmd.Parameters.Add("@FamilyProfile1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.familyEcological);
                cmd.Parameters.Add("@FamilyProfile2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.famailySituation);
                cmd.Parameters.Add("@FamilyProfile3", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.famailyMedical);
                cmd.Parameters.Add("@FamilyProfile4", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.famailyActionSituation);
                cmd.Parameters.Add("@FamilyProfile5", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StudentData.fswAssess);
                cmd.Parameters.Add("@FamilyProfileWriteName", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(StudentData.socialID);
                cmd.Parameters.Add("@FamilyProfileWriteDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StudentData.socialDate);

                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }
        }
        return returnValue;
    }
示例#2
0
 public string[] setStudentDataBase4(StudentData4 StudentData)
 {
     CaseDataBase SDB = new CaseDataBase();
     //if (int.Parse(SDB._StaffhaveRoles[1]) == 1)
     //{
         return SDB.setStudentDataBase4(StudentData);
     //}
     //else
     //{
     //    return new string[2] { _noRole, _errorMsg };
     //}
 }
    public StudentData4 getStudentData4(string ID)
    {
        StudentData4 returnValue = new StudentData4();
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                Sqlconn.Open();
                string sql = "SELECT * FROM StudentDatabase WHERE isDeleted=0 AND ID=(@ID)";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = Chk.CheckStringtoInt64Function(ID);
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    StaffDataBase sDB = new StaffDataBase();

                    returnValue.ID = dr["ID"].ToString();
                    returnValue.studentID = dr["StudentID"].ToString();
                    returnValue.familyEcological = dr["FamilyProfile1"].ToString();
                    returnValue.famailySituation = dr["FamilyProfile2"].ToString();
                    returnValue.famailyMedical = dr["FamilyProfile3"].ToString();
                    returnValue.famailyActionSituation = dr["FamilyProfile4"].ToString();
                    returnValue.fswAssess = dr["FamilyProfile5"].ToString();

                    List<string>  StaffData = sDB.getStaffDataName(dr["FamilyProfileWriteName"].ToString());
                    returnValue.socialName = StaffData[1];
                    returnValue.socialDate = DateTime.Parse(dr["FamilyProfileWriteDate"].ToString()).ToString("yyyy-MM-dd");

                }
                dr.Close();
                Sqlconn.Close();

            }
            catch (Exception e)
            {
                returnValue.checkNo = "-1";
                returnValue.errorMsg = e.Message.ToString();
            }
        }
        return returnValue;
    }
示例#4
0
    public StudentData4 getStudentDataBase4(string ID)
    {
        CaseDataBase SDB = new CaseDataBase();
        StudentData4 returnValue = new StudentData4();
        if (int.Parse(SDB._StaffhaveRoles[3]) == 1)
        {

            returnValue = SDB.getStudentData4(ID);
        }
        else
        {
            returnValue.checkNo = _noRole;
            returnValue.errorMsg = _errorMsg;
        }
        return returnValue;
    }