예제 #1
0
        public List <QI_GROUP_REC> GetQiGroupCollection(bool SortByNameAsc)
        {
            List <QI_GROUP_REC> qiGroupCollection = new List <QI_GROUP_REC>();

            using (SqlConnection dbConn = m_SqlHelpers.GetDbConnection(m_AwareDbConnString))
            {
                string     sqlText = "usp_GetQIGroups";
                SqlCommand sqlCmd  = new SqlCommand(sqlText, dbConn);
                sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
                sqlCmd.Parameters.AddWithValue("@SortAsc", SortByNameAsc);
                SqlDataReader dr = sqlCmd.ExecuteReader();
                while (dr.Read())
                {
                    try
                    {
                        QI_GROUP_REC rec = new QI_GROUP_REC(dr.GetGuid(0), dr.GetString(1), dr.GetBoolean(2));
                        qiGroupCollection.Add(rec);
                    }
                    catch (InvalidCastException ex)
                    {
                    }
                }
                dr.Close();
                dbConn.Close();
            }

            return(qiGroupCollection);
        }
예제 #2
0
 public void UpdateGroup(ref QI_GROUP_REC grpRec)
 {
     using (SqlConnection awareDbConn = m_SqlHelpers.GetDbConnection(m_AwareDbConnString))
     {
         string     sqlText = "usp_UpdateQiGroup";
         SqlCommand sqlCmd  = new SqlCommand(sqlText, awareDbConn);
         sqlCmd.CommandType = System.Data.CommandType.StoredProcedure;
         sqlCmd.Parameters.AddWithValue("@QiGroupName", grpRec.Name);
         sqlCmd.Parameters.AddWithValue("@QiGroupActive", grpRec.Active);
         sqlCmd.Parameters.AddWithValue("@QiGroupId", grpRec.GroupID);
         sqlCmd.ExecuteNonQuery();
         awareDbConn.Close();
     }
 }