Ejemplo n.º 1
0
        // ----------------------------------------------------------------- //
        // this method creates a game object from the fields within a form.  //
        // ----------------------------------------------------------------- //
        public void OnMakeSubmitClick(object sender, EventArgs e)
        {
            string title = (Form1.formgen.GetControl("order.make", "title") as TextBox).Text;
            Game   game  = Form1.context.GetGame(title);

            if (game == null)
            {
                MessageBox.Show("Game not found! " + title);
                return;
            }
            if (game.GetStock() <= 0)
            {
                MessageBox.Show("Game is out of stock! " + title);
                return;
            }

            // decerment stock
            FormPage form = Form1.formgen.GetPage("order.form") as FormPage;

            if (form != null && form.Sanitize("order.make") == true)
            {
                game.SetStock(game.GetStock() - 1);
                Form1.formgen.BuildPage("order.list");
            }
        }
Ejemplo n.º 2
0
        // ----------------------------------------------------------------- //
        // Clicking order on the view page will reroute the user to an order //
        // page and populate the form with the fields from the entity.       //
        // ----------------------------------------------------------------- //
        public void OnViewReturnClick(object sender, EventArgs e)
        {
            Order order = Form1.context.GetSelected("order") as Order;

            if (order == null || order.GetReturnDate() != "")
            {
                return;
            }
            order.SetReturnDate(DateTime.Now.ToString("d/M/yyy"));

            // incerment stock
            string title = (Form1.formgen.GetControl("order.view", "title") as TextBox).Text;
            Game   game  = Form1.context.GetGame(title);

            if (game == null)
            {
                MessageBox.Show("Game not found! " + title);
                return;
            }
            game.SetStock(game.GetStock() + 1);

            string pagename = typename + ".view";

            Form1.formgen.BuildPage(pagename);
            FormPage formpage = Form1.formgen.GetPage(typename + ".form") as FormPage;

            formpage.OnPopulateForm(pagename);
        }
Ejemplo n.º 3
0
        private void OnClickDrop(object sender, EventArgs e)
        {
            Form1.formgen.ClearPage("game.list");
            FormPage formpage = Form1.formgen.GetPage("game.form") as FormPage;

            formpage.OnPopulateForm("game.drop");
            Form1.formgen.BuildPage("game.drop");
        }
Ejemplo n.º 4
0
        private void OnClickMake(object sender, EventArgs e)
        {
            Form1.formgen.ClearPage("order.list");
            FormPage formpage = Form1.formgen.GetPage("order.form") as FormPage;

            formpage.OnPopulateForm("order.make");
            Form1.formgen.BuildPage("order.make");
        }
Ejemplo n.º 5
0
        // ----------------------------------------------------------------- //
        // Clicking addnew on the list page will reroute the user to the     //
        // create page and empty the contents of the form.                   //
        // ----------------------------------------------------------------- //
        public void OnListAddNewClick(object sender, EventArgs e)
        {
            string   pagename = typename + ".make";
            FormPage formpage = Form1.formgen.GetPage(typename + ".form") as FormPage;

            formpage.OnPopulateForm(pagename);
            Form1.formgen.BuildPage(pagename);
        }
Ejemplo n.º 6
0
        private void OnClickEdit(object sender, EventArgs e)
        {
            Form1.formgen.ClearPage("report.list");
            FormPage formpage = Form1.formgen.GetPage("report.form") as FormPage;

            formpage.OnPopulateForm("report.edit");
            Form1.formgen.BuildPage("report.edit");
        }
Ejemplo n.º 7
0
        private void OnClickView(object sender, EventArgs e)
        {
            Form1.formgen.ClearPage("staff.list");
            FormPage formpage = Form1.formgen.GetPage("staff.form") as FormPage;

            formpage.OnPopulateForm("staff.view");
            Form1.formgen.BuildPage("staff.view");
        }
Ejemplo n.º 8
0
        // ----------------------------------------------------------------- //
        // this method creates a game object from the fields within a form.  //
        // ----------------------------------------------------------------- //
        public void OnMakeSubmitClick(object sender, EventArgs e)
        {
            FormPage form = Form1.formgen.GetPage("game.form") as FormPage;

            if (form != null && form.Sanitize("game.make") == true)
            {
                Form1.formgen.BuildPage("game.list");
            }
        }
Ejemplo n.º 9
0
        // ----------------------------------------------------------------- //
        // this method populates a game object from the fields within a form //
        // ----------------------------------------------------------------- //
        public void OnEditSubmitClick(object sender, EventArgs e)
        {
            FormPage form = Form1.formgen.GetPage("order.form") as FormPage;

            if (form != null && form.Sanitize("order.edit") == true)
            {
                Form1.formgen.BuildPage("order.list");
            }
        }
Ejemplo n.º 10
0
        // ----------------------------------------------------------------- //
        // Clicking edit on the view page will reroute the user to the edit  //
        // page and populate the form with the fields from the entity.       //
        // ----------------------------------------------------------------- //
        public void OnViewEditClick(object sender, EventArgs e)
        {
            string pagename = typename + ".edit";

            Form1.formgen.BuildPage(pagename);
            FormPage formpage = Form1.formgen.GetPage(typename + ".form") as FormPage;

            formpage.OnPopulateForm(pagename);
        }
Ejemplo n.º 11
0
        // ----------------------------------------------------------------- //
        // Clicking a record on the list page will reroute the user to the   //
        // view page and populate the contents of the form.                  //
        // ----------------------------------------------------------------- //
        public void OnListRecordClick(object sender, EventArgs e)
        {
            ListView listview = sender as ListView;
            string   pagename = typename + ".view";

            //string itemname = listview.SelectedItems[0].Text;
            //Form1.context.SetSelected(typename, itemname);
            //Entity entity = Form1.context.GetSelected(typename);
            Form1.formgen.BuildPage(pagename);
            FormPage formpage = Form1.formgen.GetPage(typename + ".form") as FormPage;

            formpage.OnPopulateForm(pagename);
        }