コード例 #1
0
        //=======================================================================================================
        //This method called when the user wants to narrow the current printer list down to a specific department.
        //  Its parameter is what is currently entered into the text box on frmView. If the user does not
        //  enter any kind of string in the text box it assumes the user wants to view all records in the printer
        //  table. If a department is not found in the table, a prompt will appear and tell the user that was
        //  was an invaild department entered.
        //=======================================================================================================
        public static void NarrowToDept(string strDept)
        {
            SqlCommand _LDBComm = new SqlCommand();

            try
            {
                SqlConnection  _LDBConn = new SqlConnection();
                DataSet        _DS      = new DataSet();
                SqlDataAdapter _Adap    = new SqlDataAdapter();
                _DS.Clear();
                _Adap.Dispose();
                _LDBConn = new SqlConnection
                {
                    ConnectionString = LDBConn
                };
                _LDBComm.Connection  = _LDBConn;
                _LDBComm.CommandType = CommandType.StoredProcedure;
                _LDBComm.CommandText = "[dbo].[Get_All_Dept_QAD_Printers_SP]";
                _LDBComm.Parameters.AddWithValue("@strDept", strDept);
                _Adap = new SqlDataAdapter(_LDBComm);
                _Adap.Fill(_DS);
                var allRows = _DS.Tables[0].Rows;
                LoadLists.LoadQADList(allRows);
                _LDBConn.Close();
                DetachFile();
            }
            catch (Exception ex)
            {
                string extext = ex.Message;
            }
        }
コード例 #2
0
        //=======================================================================================================
        //This method is called when the user wants to view the currently archived list in the printer table. I
        //  decided to implement the archvie incase the user accidently selected the wrong entry when they went
        //  to delete the entry. You can only permanently delete a record from the archive view
        //=======================================================================================================
        public async static void ViewArchive()
        {
            SqlCommand _LDBComm = new SqlCommand();

            Program.QADPrinters.Clear();
            try
            {
                SqlConnection  _LDBConn = new SqlConnection();
                DataSet        _DS      = new DataSet();
                SqlDataAdapter _Adap    = new SqlDataAdapter();
                _DS.Clear();
                _Adap.Dispose();
                _LDBConn = new SqlConnection
                {
                    ConnectionString = LDBConn
                };
                _LDBComm.Connection  = _LDBConn;
                _LDBComm.CommandType = CommandType.StoredProcedure;
                _LDBComm.CommandText = "[dbo].[Get_Archive_Printers_SP]";
                _Adap = new SqlDataAdapter(_LDBComm);
                _Adap.Fill(_DS);
                var allRows = _DS.Tables[0].Rows;
                LoadLists.LoadQADList(allRows);
                await System.Threading.Tasks.Task.Delay(100);

                _LDBConn.Close();
                DetachFile();
            }
            catch (Exception ex)
            {
                string errorText = ex.Message;
            }
        }
コード例 #3
0
        //=======================================================================================================
        //This method is called when the list needs to be refreshed. It is also the same method I call when the
        //  user clicks the "View" button on frmMain
        //=======================================================================================================
        public static void ViewCurrent()
        {
            SplashScreen _splash  = new SplashScreen();
            SqlCommand   _LDBComm = new SqlCommand();

            Program.QADPrinters.Clear();
            try
            {
                SqlConnection  _LDBConn = new SqlConnection();
                DataSet        _DS      = new DataSet();
                SqlDataAdapter _Adap    = new SqlDataAdapter();
                _DS.Clear();
                _Adap.Dispose();
                _LDBConn = new SqlConnection
                {
                    ConnectionString = LDBConn
                };
                _LDBComm.Connection  = _LDBConn;
                _LDBComm.CommandType = CommandType.StoredProcedure;
                _LDBComm.CommandText = "[dbo].[Get_All_Printers_SP]";
                _Adap = new SqlDataAdapter(_LDBComm);
                _Adap.Fill(_DS);
                var allRows = _DS.Tables[0].Rows;
                _LDBConn.Close();
                LoadLists.LoadQADList(allRows);
            }
            catch (Exception ex)
            {
                string extext = ex.Message;
            }
            DetachFile();
        }