Exemple #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string     MethodeName = MethodBase.GetCurrentMethod().ToString();
            TypSerwera TypSer      = TypSerwera.SqlServer;

            if (TypSer == TypSerwera.MySqlServer)
            {
                DAOfunctions daof = new DAOfunctions("localhost", "rfid", "root", "");
                daof.LoadDataBaseTableToGrid(TabelaGridView);
            }
            else
            {
                DAOMsSql.LoadTableToDataGrid(/*conn, */ TabelaGridView, globals.TableName);
            }
        }
Exemple #2
0
        public MainForm()
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(Handler);

            InitializeComponent();
            DAOMsSql.UtworzPulePolaczen();
            //wątek do czytania z anten
            Thread thread = new Thread(Serwer_asynchroniczny.StartListening);

            globals.serwerAsyn          = thread;
            globals.serwerAsyn.Priority = ThreadPriority.AboveNormal;
            globals.serwerAsyn.Start();
            //           CheckOnClick = true;
        }
Exemple #3
0
        private void zmieńStatusToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            string MethodeName = MethodBase.GetCurrentMethod().ToString();
            int    status;

            try
            {
                MainFormlog.Debug("Wchodzę do :" + MethodeName);
                DataGridViewRow row;
                if (TabelaGridView.Rows.Count == 1)
                {
                    row = TabelaGridView.Rows[0];
                    if (row.Cells[0].Value == null)
                    {
                        MessageBox.Show("Wiersz jest pusty - nie można zmienić statusu");
                        MainFormlog.Debug("Wychodzę po komunikacie z :" + MethodeName);
                    }
                }
                int SelectedRow = TabelaGridView.CurrentCell.RowIndex;
                row = TabelaGridView.Rows[SelectedRow];
                int    record_number = int.Parse(row.Cells[0].Value.ToString());
                string WEPC          = row.Cells[1].Value.ToString();
                string status_val    = row.Cells[2].Value.ToString();
                int    stat          = Utils.ConvertSoldUnsoldToInt(status_val);

                if (stat == globals.sold)
                {
                    status = globals.unsold;
                }
                else
                {
                    status = globals.sold;
                }

                DAOMsSql.ChangeStatus(WEPC, status, globals.TableName);
                this.RefreshGridView();
                MainFormlog.Debug("Wychodzę z :" + MethodeName);
            }
            catch (Exception ec)
            {
                String km = Utils.DisplayExceptionMessage(ec, MethodeName, ClassName, "Wyjątek w metodzie zmiany statusu");
                MainFormlog.Debug(km);
                throw ec;
            }
        }
Exemple #4
0
        public void RefreshGridView()
        {
            string MethodeName = MethodBase.GetCurrentMethod().ToString();

            try
            {
                MainFormlog.Debug("Wchodzę do :" + MethodeName);
                TabelaGridView.Rows.Clear();
                DAOMsSql.LoadTableToDataGrid(TabelaGridView, globals.TableName);
                TabelaGridView.Refresh();
                TabelaGridView.Update();
                MainFormlog.Debug("Wychodzę z :" + MethodeName);
            }
            catch (Exception e3)
            {
                String km = Utils.DisplayExceptionMessage(e3, MethodeName, ClassName, "Wyjątek w metodzie RefreshGrid");
                MainFormlog.Debug(km);
                throw e3;
            }
        }
Exemple #5
0
        private void WyczyscMenuItem_Click_1(object sender, EventArgs e)
        {
            string MethodeName = MethodBase.GetCurrentMethod().ToString();

            try
            {
                MainFormlog.Debug("Wchodzę do :" + MethodeName);
                DAOMsSql.CzyscTabele(globals.TableName);
                TabelaGridView.Rows.Clear();
                MainFormlog.Debug("Wychodzę z :" + MethodeName);
            }
            catch (Exception ew)
            {
                //                MessageBox.Show(e1.Message);
                String km = Utils.DisplayExceptionMessage(ew, MethodeName, ClassName, "Wyjątek w metodzie wyczyść bazę");
                MainFormlog.Debug(km);
                throw ew;
            }
            MessageBox.Show("Baza została wyczyszczona");
            MainFormlog.Debug("Wychodzę z :" + MethodeName);
        }
Exemple #6
0
        private void UsunRekord()
        {
            string MethodeName = MethodBase.GetCurrentMethod().ToString();

            try
            {
                MainFormlog.Debug("Wchodzę do :" + MethodeName);
                int             SelectedRow = TabelaGridView.CurrentCell.RowIndex;
                DataGridViewRow row         = TabelaGridView.Rows[SelectedRow];
                string          EPC         = row.Cells[1].Value.ToString();
                DAOMsSql.DeleteRow(globals.TableName, EPC);
                TabelaGridView.Rows.RemoveAt(SelectedRow);
                MainFormlog.Debug("Wychodzę z :" + MethodeName);
            }
            catch (Exception e)
            {
                String km = Utils.DisplayExceptionMessage(e, MethodeName, ClassName, "Wyjątek w metodzie usuń rekord");
                MainFormlog.Debug(km);
                throw e;
            }
        }