Example #1
0
        /*Precondition: Needs an order to be loaded
         Postcondition: Creates a .docx file containing the a small mailing label and opens it */
        private void btnSmallMailingLabel_Click(object sender, EventArgs e)
        {
            bool haveStorageLocation = checkForStorageLocation();

            if (haveStorageLocation)
            {
                if (currOrder != null)
                {
                    bool bigLabel = false;
                    MailingLabelCreator labelCreator = new MailingLabelCreator(this, currCustomer, bigLabel);

                    string documentName = currOrder.orderID.ToString() + ".docx";

                    string filePath = fileManager.getStorageFilePath() + @"\Mailing Labels\" + documentName;
                    bool successfulFileCreation = labelCreator.createMailingLabel(filePath);

                    if(successfulFileCreation)
                        System.Diagnostics.Process.Start(filePath);
                }
            }
        }
Example #2
0
        /*Precondition:
         Postcondition: Creates a .docx file with a small mailing label and opens it automatically */
        private void btnSmallMailingLabel_Click(object sender, EventArgs e)
        {
            bool haveStorageLocation = checkForStorageLocation();

            //Check that storage location is set
            if (haveStorageLocation)
            {
                //Check that the customer is set because it's required for the mailing label
                if (currentCustomer != null)
                {
                    //Get the current order
                    Order currOrder = createOrder();

                    //Correct the current orders ID
                    currOrder.orderID = dbManager.getNextOrderID();

                    //Setup and create the .docx file that contains the mailing label
                    bool bigLabel = false;
                    MailingLabelCreator labelCreator = new MailingLabelCreator(null, currentCustomer, bigLabel);

                    string documentName = currOrder.orderID.ToString() + ".docx";

                    string filePath = fileManager.getStorageFilePath() + @"\Mailing Labels\" + documentName;
                    bool successfulFileCreation = labelCreator.createMailingLabel(filePath);

                    //Open the file containing the mailing label
                    if (successfulFileCreation)
                        System.Diagnostics.Process.Start(filePath);
                }
            }
        }