Exemplo n.º 1
0
        public static string GetProductName(string productCode)
        {
            DBManager  DB       = TechSupportDB.GetDBManager();
            SortedList slParams = new SortedList();
            string     strResult;

            string strSelect = "SELECT " + FldName + " FROM " + TblProducts +
                               " WHERE " + FldProductCode + "=@" + FldProductCode;

            slParams.Add(FldProductCode, productCode);

            strResult = (string)DB.GetScalar(strSelect, CommandType.Text, slParams);

            return(strResult);
        }
Exemplo n.º 2
0
        public static string GetTechnicianName(int techID)
        {
            DBManager  DB       = TechSupportDB.GetDBManager();
            SortedList slParams = new SortedList();
            string     strResult;

            string strSelect = "SELECT " + FldName + " FROM " + TblTechnicians +
                               " WHERE " + FldTechID + "=@" + FldTechID;

            slParams.Add(FldTechID, techID);

            strResult = (string)DB.GetScalar(strSelect, CommandType.Text, slParams);

            return(strResult);
        }
Exemplo n.º 3
0
        public static int AddIncident(Incident incident)
        {
            DBManager  DB        = TechSupportDB.GetDBManager();
            SortedList slParams  = new SortedList();
            int        intResult = 0;

            slParams.Add(FldCustomerID, incident.CustomerID);
            slParams.Add(FldProductCode, incident.ProductCode);
            slParams.Add(FldDateOpened, incident.DateOpened);
            slParams.Add(FldTitle, incident.Title);
            slParams.Add(FldDescription, incident.Description);

            intResult = DB.InsertDirect(TblIncidents, CommandType.Text, slParams);

            return(intResult);
        }
Exemplo n.º 4
0
        public static bool ProductRegistered(int customerID, string productCode)
        {
            DBManager  DB       = TechSupportDB.GetDBManager();
            SortedList slParams = new SortedList();
            bool       blnResult;

            string strSelect = "SELECT COUNT(*) FROM " + TblRegistrations +
                               " WHERE " + FldCustomerID + "=@" + FldCustomerID +
                               " AND " + FldProductCode + "=@" + FldProductCode;

            slParams.Add(FldCustomerID, customerID);
            slParams.Add(FldProductCode, productCode);

            blnResult = ((int)DB.GetScalar(strSelect, CommandType.Text, slParams) > 0);

            return(blnResult);
        }
Exemplo n.º 5
0
        public static List <Technician> GetTechnicianList()
        {
            DBManager         DB             = TechSupportDB.GetDBManager();
            List <Technician> technicianList = new List <Technician>();
            SqlDataReader     dr;

            string strSelect = "SELECT " + FldTechID + ", " + FldName +
                               " FROM " + TblTechnicians + " ORDER BY " + FldName;

            dr = DB.SelectDirect(strSelect, CommandType.Text);

            while (dr.Read())
            {
                Technician technician = new Technician();
                technician.TechID = (int)dr[FldTechID];
                technician.Name   = dr[FldName].ToString();
                technicianList.Add(technician);
            }

            dr.Close();

            return(technicianList);
        }
Exemplo n.º 6
0
        public static List <Product> GetProductList()
        {
            DBManager      DB          = TechSupportDB.GetDBManager();
            List <Product> productList = new List <Product>();
            SqlDataReader  dr;

            string strSelect = "SELECT " + FldProductCode + ", " + FldName +
                               " FROM " + TblProducts + " ORDER BY " + FldName;

            dr = DB.SelectDirect(strSelect, CommandType.Text);

            while (dr.Read())
            {
                Product product = new Product();
                product.ProductCode = dr[FldProductCode].ToString();
                product.Name        = dr[FldName].ToString();
                productList.Add(product);
            }

            dr.Close();

            return(productList);
        }
Exemplo n.º 7
0
        public static List <Customer> GetCustomerList()
        {
            DBManager       DB           = TechSupportDB.GetDBManager();
            List <Customer> customerList = new List <Customer>();
            SqlDataReader   dr;

            string strSelect = "SELECT " + FldCustomerID + ", " + FldName +
                               " FROM " + TblCustomers + " ORDER BY " + FldName;

            dr = DB.SelectDirect(strSelect, CommandType.Text);

            while (dr.Read())
            {
                Customer customer = new Customer();
                customer.CustomerID = (int)dr[FldCustomerID];
                customer.Name       = dr[FldName].ToString();
                customerList.Add(customer);
            }

            dr.Close();

            return(customerList);
        }
Exemplo n.º 8
0
        public static List <Incident> GetOpenIncidents()
        {
            DBManager       DB           = TechSupportDB.GetDBManager();
            List <Incident> incidentList = new List <Incident>();
            SqlDataReader   dr;

            string strSelect = "SELECT " + FldCustomerID + ", " + FldProductCode + ", " + FldTechID + ", " +
                               FldDateOpened + ", " + FldTitle +
                               " FROM " + TblIncidents + " WHERE " + FldDateClosed + " IS NULL";

            dr = DB.SelectDirect(strSelect, CommandType.Text);

            while (dr.Read())
            {
                Incident incident = new Incident();
                incident.CustomerID  = (int)dr[FldCustomerID];
                incident.ProductCode = dr[FldProductCode].ToString();

                if (dr[FldTechID].GetType().ToString() == "System.DBNull")
                {
                    incident.TechID = null;
                }
                else
                {
                    incident.TechID = (int)dr[FldTechID];
                }

                incident.DateOpened = (DateTime)dr[FldDateOpened];
                incident.Title      = dr[FldTitle].ToString();
                incidentList.Add(incident);
            }

            dr.Close();

            return(incidentList);
        }