Esempio n. 1
0
        public async Task <IHttpActionResult> GetFORM(int id)
        {
            FORM fORM = await db.FORM.FindAsync(id);

            if (fORM == null)
            {
                return(NotFound());
            }

            return(Ok(fORM));
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> PostForm(FORM form)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.FORM.Add(form);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = form.FormID }, form));
        }
Esempio n. 3
0
        public async Task <IHttpActionResult> DeleteFORM(int id)
        {
            FORM fORM = await db.FORM.FindAsync(id);

            if (fORM == null)
            {
                return(NotFound());
            }

            db.FORM.Remove(fORM);
            await db.SaveChangesAsync();

            return(Ok(fORM));
        }
Esempio n. 4
0
        private void ADD_EDIT_RECIPE(object sender, EventArgs e) //Both the "Add Recipe" button and the "Edit Recipe" button call this.
        {
            EVENTS.LOG_MESSAGE(1, "ENTER");

            //Check if form is open.
            FormCollection COLLECTION = Application.OpenForms; //Get a collection of all the open forms.

            foreach (Form FORM in COLLECTION)                  //Go through each open form...
            {
                if (FORM.Name == "FORM_ADD_RECIPE")            //If the evaluated form has the same name as the form we're about to open...
                {
                    FORM.BringToFront();                       //Bring the form to the front.
                    EVENTS.LOG_MESSAGE(2, "Form already open.");
                    EVENTS.LOG_MESSAGE(1, "EXIT_FAIL");
                    return; //Exit.
                }
            }

            //Get the listings of checksheet types from the SQL DB, this will be used to populate a list box on the new form.
            DataTable CHECKSHEET_DATA = DB.GET_TABLE(Properties.DB.Default.CHECKSHEET_TABLE, Properties.DB.Default.CHECKSHEET_TABLE_COLUMN_SCHEMA); //Get the checksheet data listing to pass over to the form.

            //Determine if the edit button is what called this method. If it is, we have to get the currently selected recipe.
            if ((Button)sender == BTN_EDIT_RECIPE)                                                   //Cast the sender into a button type and check if it is BTN_EDIT. If it is...
            {
                RECIPE_DATA CURRENT_RECORD = new RECIPE_DATA();                                      //Create a blank RECIPE_DATA object.
                bool        SUCCESS        = GET_CURRENTLY_SELECTED_RECIPE_DATA(out CURRENT_RECORD); //Populate the object and store if it was a success. Function will return true on success.
                if (SUCCESS)
                {
                    var ADD_FORM = new FORM_ADD_RECIPE(CHECKSHEET_DATA, CURRENT_RECORD); //Create a new form with optional CURRENT_RECORD attached.
                                                                                         //FORM_ADD_RECIPE recognizes optional record attachment as a request to edit rather than add.
                    ADD_FORM.Show();                                                     //Show the form.
                    ADD_FORM.DATA_READY += new EventHandler(PROCESS_ADD_RECIPE_DATA);    //Add handler for when the form has its data all set.
                }
                else //If getting data was unsuccessful...
                {
                    EVENTS.LOG_MESSAGE(1, "EXIT_FAIL");
                    return;
                }
            }
            else
            {
                var ADD_FORM = new FORM_ADD_RECIPE(CHECKSHEET_DATA);              //Create a blank form.
                ADD_FORM.Show();                                                  //Show the form.
                ADD_FORM.DATA_READY += new EventHandler(PROCESS_ADD_RECIPE_DATA); //Add handler for when the form has its data all set.
            }
            EVENTS.LOG_MESSAGE(1, "EXIT_SUCCESS");
        }
Esempio n. 5
0
        private void MENU_ITEM_TOOL_STRIP_Click(object sender, EventArgs e)
        {
            bool           FORM_EXISTS = false;
            FormCollection OPEN_FORMS  = Application.OpenForms;

            foreach (Form FORM in OPEN_FORMS)
            {
                if (FORM.Name == "FORM_LOGS")
                {
                    FORM.BringToFront();
                    FORM_EXISTS = true;
                    break;
                }
            }
            if (!FORM_EXISTS)
            {
                FORM_LOGS LOG_FORM = new FORM_LOGS();
                LOG_FORM.Show();
            }
        }