Beispiel #1
0
 //OPEN SAVED ORDER
 private void btnOpen_Click(object sender, EventArgs e)
 {
     if (nextForm == null)                          //WILL CHECK IF USER CLICK FIRST TIME ON THE NEXT BUTTON
     {
         frmProductInfo fpi = new frmProductInfo(); //IF YES, WILL CREATE OBJECT OF PRODUCT INFORMATION FORM TO DISPLAY DATA FROM SAVED FILE
         frmSelectForm  fsl = new frmSelectForm();  // WILL CREATE OBJECT OF SELECT FORM, IF USER CLICK BACK BUTTON OF PRODUCT INFO FORM, AND IF SELECT FORM IS NOT LOADED, WILL OPEN FIRST TIME
         fsl.Show();                                //LOAD SELECT FORM
         fsl.Hide();                                //HIND SELECT FORM
         fpi.ProdPrevForm = fsl;                    //SET PREVIOUS FORM OF PRODUCT INFO FORM = SELECT FORM
         fsl.previousForm = this;                   //SET PREVIOUS FORM OF SELECT FORM = START UP FORM
         fsl.nextForm     = fpi;                    // SET NEXT FORM OF SELECT FORM = PRODUCT INFORMATION FORM
         fpi.OpenSave();                            //FUNCTION CALL FROM PRODUCT INFORMATION FORM TO DISPLAY PRODUCT INFORMATION OF SAVED FILE
         fpi.Show();                                // PRODUCT INFORMATION FORM WILL SHOW PRODUCT INFORMATION OF SAVED FILE
     }
     else //IF FORMS ARE ALREADY OPEN IN MEMORY
     {
         try
         {
             frmSelectForm fslnew = this.nextForm as frmSelectForm; // WILL OPEN SELECT FORM AS NEXT FORM WHICH IS ALREADY IN MEMORY
             if (fslnew.nextForm == null)                           //BUT IF SELECT FORM IS NOT IN MEMORY - MEANS USER DID NOT TRY TO BACK AND FORTH
             {
                 frmProductInfo fpinew2 = new frmProductInfo();     //
                 fpinew2.ProdPrevForm = fslnew;                     // SET PREVIOUS FORM OF PRODUCT INFO FORM = SELECT FORM
                 fslnew.nextForm      = fpinew2;                    // SET NEXT FORM OF SELECT FORM = PRODUCT INFORMATION FORM
                 fpinew2.OpenSave();                                //FUNCTION CALL FROM PRODUCT INFORMATION FORM TO DISPLAY PRODUCT INFORMATION OF SAVED FILE
                 fpinew2.Show();                                    //PRODUCT INFORMATION FORM WILL SHOW PRODUCT INFORMATION OF SAVED FILE
             }
             else
             {
                 frmProductInfo fpinew = fslnew.nextForm as frmProductInfo; // WILL OPEN PRODUCT INFORMATION FORM AS NEXT FORM WHICH IS ALREADY IN MEMORY
                 fpinew.OpenSave();                                         //FUNCTION CALL FROM PRODUCT INFORMATION FORM TO DISPLAY PRODUCT INFORMATION OF SAVED FILE
                 fpinew.Show();                                             //PRODUCT INFORMATION FORM WILL SHOW PRODUCT INFORMATION OF SAVED FILE
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex); //GIVES ERROR IF PROBLEM ARISE
         }
     }
     this.Hide(); // HIDE START UP FORM
 }
 //NEXT BUTTON - PRODUCT INFORATION PAGE DISPLAY WITH SELECTED RECORD ON GRID
 private void btnNext_Click(object sender, EventArgs e)
 {
     if (nextForm == null)                          //IF USER CLICKS FRIST TIME ON NEXT BUTTON -
     {
         frmProductInfo fpi = new frmProductInfo(); //IF YES, CREATE NEW INSTANCE OF FORM PRODUCT INFO
         fpi.ProdPrevForm = this;                   //SET PREVIOUS FORM_PRODUCT INFO = SELECT FORM
         this.nextForm    = fpi;                    //SET NEXT FOEM_SELECT FORM = PRODUCT INFO FORM
         fpi.Show();                                //PRODUCT INFO FORM SHOW
     }
     else
     {
         this.nextForm.Show(); //IF PRODUCT FORM ALREADY OPEN IN MEMORY, PRODUCT FORM WILL SHOW
         try
         {
             frmProductInfo fpi = this.nextForm as frmProductInfo; //SET NEXT FOEM_SELECT FORM = PRODUCT INFO FORM
             fpi.refreshData();                                    //FUNCTION CALL TO REFRESH FORM TO LOAD CURRENT SELECTED DATA ON PRODUCT INFO PAGE
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
         }
     }
     this.Hide();
 }