Exemplo n.º 1
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()
        {
            SqlCommand _LDBComm = new SqlCommand();

            Program.PartWeights.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_Weights_SP]";
                _Adap = new SqlDataAdapter(_LDBComm);
                _Adap.Fill(_DS);
                var allRows = _DS.Tables[0].Rows;
                LoadLists.LoadWeightsList(allRows);
                _LDBConn.Close();
            }
            catch (Exception ex)
            {
                string extext = ex.Message;
            }
            DetachFile();
        }
Exemplo n.º 2
0
        //=======================================================================================================
        //This method called when the user wants to narrow the current part 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 weight
        //  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_Weights_SP]";
                _LDBComm.Parameters.AddWithValue("@strDept", strDept);
                _Adap = new SqlDataAdapter(_LDBComm);
                _Adap.Fill(_DS);
                var allRows = _DS.Tables[0].Rows;
                LoadLists.LoadWeightsList(allRows);
                _LDBConn.Close();
                DetachFile();
            }
            catch (Exception ex)
            {
                string extext = ex.Message;
            }
        }
        //=======================================================================================================
        //This method is called when the user wants to view the currently archived list in the module 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.ADAMMods.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_Modules_SP]";
                _Adap = new SqlDataAdapter(_LDBComm);
                _Adap.Fill(_DS);
                var allRows = _DS.Tables[0].Rows;
                LoadLists.LoadADAMList(allRows);
                await System.Threading.Tasks.Task.Delay(100);

                _LDBConn.Close();
                DetachFile();
            }
            catch (Exception ex)
            {
                string errorText = ex.Message;
            }
        }
Exemplo n.º 4
0
        //=======================================================================================================
        //This method is called when the user wants to view the currently archived list in the weight 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 static void ViewArchive()
        {
            SqlCommand _LDBComm = new SqlCommand();

            Program.PartWeights.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_Weights_SP]";
                _Adap = new SqlDataAdapter(_LDBComm);
                _Adap.Fill(_DS);
                var allRows = _DS.Tables[0].Rows;
                LoadLists.LoadWeightsList(allRows);
                _LDBConn.Close();
                DetachFile();
                _frmView.RefreshDGV();
                _frmView.pnlDefault.Visible     = false;
                _frmView.pnlUpdate.Visible      = false;
                _frmView.pnlArchiveView.Visible = true;
                _frmView.btnViewArchive.Visible = false;
            }
            catch (Exception ex)
            {
                string errorText = ex.Message;
            }
        }