コード例 #1
0
        public string get_committee(string project_id, int type_person)
        {
            ComitteeList c   = new ComitteeList();
            Committee    stg = new Committee();

            c.commitee = new List <Committee>();
            string pers_id = "";

            try
            {
                string        constr = WebConfigurationManager.ConnectionStrings["Dbconnection"].ConnectionString;
                SqlConnection con    = new SqlConnection(constr);
                con.Open();

                string sqlproject = "SELECT PersID FROM Relation WHERE Status_ID = '3' AND ProjID='" + project_id + "'";

                SqlCommand    qrproject = new SqlCommand(sqlproject, con);
                SqlDataReader reader    = qrproject.ExecuteReader();

                if (reader.Read())
                {
                    pers_id = reader["PersID"].ToString();
                }
                reader.Close();
                con.Close();
            }
            catch
            {
                c.code = 1;
                c.msg  = "Error";
                return(JsonConvert.SerializeObject(c));
            }

            try
            {
                string        constr = WebConfigurationManager.ConnectionStrings["Dbconnection"].ConnectionString;
                SqlConnection con    = new SqlConnection(constr);
                con.Open();

                string sqlproject = "SELECT Title, Fname, Lname FROM person WHERE PersID='" + pers_id + "'";

                SqlCommand    qrproject = new SqlCommand(sqlproject, con);
                SqlDataReader reader    = qrproject.ExecuteReader();

                while (reader.Read())
                {
                    stg = new Committee();
                    stg.title_person = reader["Title"].ToString();
                    stg.firstName    = reader["Fname"].ToString();
                    stg.lastName     = reader["Lname"].ToString();
                    c.commitee.Add(stg);
                }
                reader.Close();
                con.Close();

                c.code = 0;
                c.msg  = "OK";

                return(JsonConvert.SerializeObject(c));
            }
            catch
            {
                c.code = 1;
                c.msg  = "Error";
                return(JsonConvert.SerializeObject(c));
            }
        }
コード例 #2
0
        public string get_committee(string project_id, int type_person)
        {
            ComitteeList c = new ComitteeList();
            Committee stg = new Committee();
            c.commitee = new List<Committee>();
            string pers_id = "";
            try
            {
                string constr = WebConfigurationManager.ConnectionStrings["Dbconnection"].ConnectionString;
                SqlConnection con = new SqlConnection(constr);
                con.Open();

                string sqlproject = "SELECT PersID FROM Relation WHERE Status_ID = '3' AND ProjID='" + project_id + "'";

                SqlCommand qrproject = new SqlCommand(sqlproject, con);
                SqlDataReader reader = qrproject.ExecuteReader();

                if (reader.Read())
                {
                    pers_id = reader["PersID"].ToString();
                }
                reader.Close();
                con.Close();

            }
            catch
            {
                c.code = 1;
                c.msg = "Error";
                return JsonConvert.SerializeObject(c);
            }

            try
            {
                string constr = WebConfigurationManager.ConnectionStrings["Dbconnection"].ConnectionString;
                SqlConnection con = new SqlConnection(constr);
                con.Open();

                string sqlproject = "SELECT Title, Fname, Lname FROM person WHERE PersID='" + pers_id + "'";

                SqlCommand qrproject = new SqlCommand(sqlproject, con);
                SqlDataReader reader = qrproject.ExecuteReader();

                while (reader.Read())
                {
                    stg = new Committee();
                    stg.title_person = reader["Title"].ToString();
                    stg.firstName = reader["Fname"].ToString();
                    stg.lastName = reader["Lname"].ToString();
                    c.commitee.Add(stg);
                }
                reader.Close();
                con.Close();

                c.code = 0;
                c.msg = "OK";

                return JsonConvert.SerializeObject(c);
            }
            catch
            {
                c.code = 1;
                c.msg = "Error";
                return JsonConvert.SerializeObject(c);
            }
        }