Example #1
0
        public userInfoPassing(string name)
        {
            ServeitDBEntities sdbe = new ServeitDBEntities();
            MainPage          mp   = new MainPage();
            DineIn            din  = new DineIn();
            NewReceipt        nr   = new NewReceipt();
            EditReceipt       er   = new EditReceipt();
            var x = from o in sdbe.UserLists where o.Name == name select o;

            foreach (var y in x)
            {
                mp.idlabel.Text     = y.User_id.ToString();
                mp.namelabel.Text   = y.Name;
                mp.accesslabel.Text = y.Access;

                din.idlabel.Text     = y.User_id.ToString();
                din.namelabel.Text   = y.Name;
                din.accesslabel.Text = y.Access;

                nr.idlabel.Text     = y.User_id.ToString();
                nr.namelabel.Text   = y.Name;
                nr.accesslabel.Text = y.Access;

                er.idlabel.Text     = y.User_id.ToString();
                er.namelabel.Text   = y.Name;
                er.accesslabel.Text = y.Access;
            }
        }
Example #2
0
        /*private void MainPage_FormClosing(object sender, FormClosingEventArgs e)
         * {
         *  DialogResult dr = MessageBox.Show("Do you want to close the program?", "Exit", MessageBoxButtons.YesNo);
         *  if (dr == DialogResult.Yes)
         *  {
         *      Application.Exit();
         *  }
         *  else if (dr == DialogResult.No)
         *  {
         *      e.Cancel = true;
         *  }
         * }*/

        private void edit_Click(object sender, EventArgs e)
        {
            try
            {
                EditReceipt er = new EditReceipt(name, id, access);
                // hide main form
                this.Hide();

                // show other form
                er.ShowDialog();

                // close application
                this.Close();
            }
            catch (NullReferenceException a)
            {
                Console.WriteLine("Exception caught: {0}", a);
            }
        }