Beispiel #1
0
        public string teacherSync_project(string person_id, int type_person)
        {
            ResponseProjectList r = new ResponseProjectList();
            ProjectOwner        p = new ProjectOwner();

            if (type_person == 0)
            {
                r.code = 11;
                r.msg  = "Parameter Wrong";
            }
            else
            {
                string        constr = WebConfigurationManager.ConnectionStrings["Dbconnection"].ConnectionString;
                SqlConnection con    = new SqlConnection(constr);
                con.Open();

                string sqlRequest = "SELECT * FROM Relation WHERE PersID = '" + person_id + "' AND Status_ID = '1' OR Status_ID = '2'";

                SqlCommand    qrRequest = new SqlCommand(sqlRequest, con);
                SqlDataReader reader    = qrRequest.ExecuteReader();
                r.projectlist = new List <ProjectOwner>();
                while (reader.Read())
                {
                    p = new ProjectOwner();

                    p.project = getNameProject(reader["ProjID"].ToString());
                    r.projectlist.Add(p);
                }
                reader.Close();
                con.Close();
            }
            return(JsonConvert.SerializeObject(r));
        }
        public string teacherSync_project(string person_id, int type_person)
        {
            ResponseProjectList r = new ResponseProjectList();
            ProjectOwner p = new ProjectOwner();
            if (type_person == 0)
            {
                r.code = 11;
                r.msg = "Parameter Wrong";
            }
            else
            {
                string constr = WebConfigurationManager.ConnectionStrings["Dbconnection"].ConnectionString;
                SqlConnection con = new SqlConnection(constr);
                con.Open();

                string sqlRequest = "SELECT * FROM Relation WHERE PersID = '" + person_id + "' AND Status_ID = '1' OR Status_ID = '2'";

                SqlCommand qrRequest = new SqlCommand(sqlRequest, con);
                SqlDataReader reader = qrRequest.ExecuteReader();
                r.projectlist = new List<ProjectOwner>();
                while (reader.Read())
                {
                    p = new ProjectOwner();

                    p.project = getNameProject(reader["ProjID"].ToString());
                    r.projectlist.Add(p);
                }
                reader.Close();
                con.Close();
            }
            return JsonConvert.SerializeObject(r);
        }