Ejemplo n.º 1
0
        public List <InquiryModel> findInquries(string value)
        {
            DbConnection.Open();
            MySqlCommand command = DbConnection.CreateCommand();

            command.CommandText = "select * from inquiry where noticeid=@value";
            command.Parameters.AddWithValue("@value", value);
            MySqlDataReader     reader  = command.ExecuteReader();
            List <InquiryModel> inqList = new List <InquiryModel>();

            while (reader.Read())
            {
                InquiryModel inq = new InquiryModel();
                inq.Question = reader.GetString("question");
                try
                {
                    inq.Answer = reader.GetString("answer");
                }
                catch
                {
                    inq.Answer = "";
                }
                inqList.Add(inq);
            }
            DbConnection.Close();
            return(inqList);
        }
Ejemplo n.º 2
0
        public List <InquiryModel> FindAllInquiries(String tenderID)
        {
            DbConnection.Open();
            MySqlCommand command = DbConnection.CreateCommand();

            command.CommandText = "SELECT * FROM inquiry where noticeid =@value";
            command.Parameters.AddWithValue("@value", tenderID);
            MySqlDataReader     reader  = command.ExecuteReader();
            List <InquiryModel> inqList = new List <InquiryModel>();

            while (reader.Read())
            {
                InquiryModel inq = new InquiryModel();
                try { reader.GetString("answer"); }
                catch
                {
                    inq.InquiryId = reader.GetInt32("inquiryId");
                    inq.Question  = reader.GetString("question");
                    inq.User      = reader.GetString("user");
                    inqList.Add(inq);
                }
            }
            DbConnection.Close();
            return(inqList);
        }
Ejemplo n.º 3
0
        public void createInquiry(InquiryModel inq)
        {
            DbConnection.Open();
            MySqlCommand command = DbConnection.CreateCommand();

            command.CommandText = "INSERT INTO inquiry (noticeid,user,question) values(@noticeid,@user,@question)";
            command.Parameters.AddWithValue("@user", inq.User);
            command.Parameters.AddWithValue("@noticeid", inq.NoticeId);
            command.Parameters.AddWithValue("@question", inq.Question);
            command.ExecuteNonQuery();
            DbConnection.Close();
        }
Ejemplo n.º 4
0
 public void createInquiry(InquiryModel inq)
 {
     DbConnection.Open();
     MySqlCommand command = DbConnection.CreateCommand();
     command.CommandText = "INSERT INTO inquiry (noticeid,user,question) values(@noticeid,@user,@question)";
     command.Parameters.AddWithValue("@user",inq.User);
     command.Parameters.AddWithValue("@noticeid", inq.NoticeId);
     command.Parameters.AddWithValue("@question", inq.Question);
     command.ExecuteNonQuery();
     DbConnection.Close();
 }
Ejemplo n.º 5
0
 public List<InquiryModel> findInquries(string value)
 {
     DbConnection.Open();
     MySqlCommand command = DbConnection.CreateCommand();
     command.CommandText = "select * from inquiry where noticeid=@value";
     command.Parameters.AddWithValue("@value", value);
     MySqlDataReader reader = command.ExecuteReader();
     List<InquiryModel> inqList = new List<InquiryModel>();
     while (reader.Read())
     {
         InquiryModel inq = new InquiryModel();
         inq.Question = reader.GetString("question");
         try
         {
             inq.Answer = reader.GetString("answer");
         }
         catch
         {
             inq.Answer = "";
         }
         inqList.Add(inq);
     }
     DbConnection.Close();
     return inqList;
 }
Ejemplo n.º 6
0
 public List<InquiryModel> FindAllInquiries(String tenderID)
 {
     DbConnection.Open();
     MySqlCommand command = DbConnection.CreateCommand();
     command.CommandText = "SELECT * FROM inquiry where noticeid =@value";
     command.Parameters.AddWithValue("@value", tenderID);
     MySqlDataReader reader = command.ExecuteReader();
     List<InquiryModel> inqList = new List<InquiryModel>();
     while (reader.Read())
     {
         InquiryModel inq = new InquiryModel();
         try { reader.GetString("answer"); }
         catch
         {
             inq.InquiryId = reader.GetInt32("inquiryId");
             inq.Question = reader.GetString("question");
             inq.User = reader.GetString("user");
             inqList.Add(inq);
         }
     }
     DbConnection.Close();
     return inqList;
 }