Пример #1
0
        public static int CostLookupPages()
        {
            int output   = 0;
            int totPages = AllDocs.TotalPages();

            switch (totPages)
            {
            case 0:
                output = Cost.PageCost["Zero"] * Cost.Hourly();
                break;

            case int n when(n > 0 && n <= 5):
                output = Cost.PageCost["1To5"] * Cost.Hourly();

                break;

            case int n when(n > 5 && n <= 10):
                output = Cost.PageCost["6To10"] * Cost.Hourly();

                break;

            case int n when(n > 10 && n <= 20):
                output = Cost.PageCost["11To20"] * Cost.Hourly();

                break;

            case int n when(n > 20 && n <= 30):
                output = Cost.PageCost["21To30"] * Cost.Hourly();

                break;

            case int n when(n > 30 && n <= 40):
                output = Cost.PageCost["31To40"] * Cost.Hourly();

                break;

            case int n when(n > 40 && n <= 50):
                output = Cost.PageCost["41To50"] * Cost.Hourly();

                break;
            }
            return(output);
        }
Пример #2
0
        public static int CostLookupFields()
        {
            int output    = 0;
            int totFields = AllDocs.TotalFields();
            int totPages  = AllDocs.TotalPages();
            Dictionary <string, int> lookupDict;
            string lookupKey;


            switch (totPages) //set which lookup table to use, based on total pages
            {
            case int n when(n >= 0 && n <= 5):
                lookupDict = Cost.FieldCost1To5;

                break;

            case int n when(n > 5 && n <= 10):
                lookupDict = Cost.FieldCost6To10;

                break;

            case int n when(n > 10 && n <= 20):
                lookupDict = Cost.FieldCost11To20;

                break;

            case int n when(n > 20 && n <= 30):
                lookupDict = Cost.FieldCost21To30;

                break;

            case int n when(n > 30 && n <= 40):
                lookupDict = Cost.FieldCost31To40;

                break;

            case int n when(n > 40 && n <= 50):
                lookupDict = Cost.FieldCost41To50;

                break;

            default:
                lookupDict = Cost.FieldCost1To5;     //not used, but needed "default" to mold scope
                break;
            }

            switch (totFields)
            {
            case 0:
                lookupKey = "Zero";
                break;

            case int n when(n > 0 && n < 10):
                lookupKey = "1To10";

                break;

            case int n when(n >= 10 && n <= 20):
                lookupKey = "10To20";

                break;

            case int n when(n > 20 && n <= 40):
                lookupKey = "21To40";

                break;

            case int n when(n > 40 && n <= 50):
                lookupKey = "41To50";

                break;

            default:
                lookupKey = "Zero";     // not used, but needed "default" to mold scope
                break;
            }

            output = (lookupDict[lookupKey] * Cost.Hourly());

            return(output);
        }
Пример #3
0
        private void UpdateTotalsValues()
        {
            int total    = 0;
            int subTotal = 0;

            if (AllDocs.TotalPages() > 50 || AllDocs.TotalFields() > 50)
            {
                //numTotalPagesCost.Text = numTotalFieldsCost.Text =
                numGrandTotal.Text         = "This needs a custom quote.";
                numRushUpchargeAmount.Text = numWordUpchargePercent.Text = numWordUpchargeAmount.Text = "";
                return;
            }
            else
            {
                //numTotalPagesCost.Text = AllDocs.CostLookupPages().ToString();
                //numTotalFieldsCost.Text = AllDocs.CostLookupFields().ToString();
                total += AllDocs.CostLookupPages() + AllDocs.CostLookupFields();
            }

            if (AllDocs.NeedRush())
            {
                numRushUpchargeAmount.Text = (total * ((float)Cost.Rush / 100)).ToString();
                subTotal += (int)(total * (float)Cost.Rush / 100);
            }


            float tempTotal = AllDocs.CostLookupPages() + AllDocs.CostLookupFields();

            if (AllDocs.WordCount() != 0)
            {
                if (AllDocs.PDFCount() == 0)
                { // All word docs
                    numWordUpchargePercent.Text = Cost.DocTypeUpcharge["AllWord"].ToString();
                    numWordUpchargeAmount.Text  = (tempTotal * Cost.DocTypeUpcharge["AllWord"] / 100).ToString();
                    subTotal += (int)(tempTotal * Cost.DocTypeUpcharge["AllWord"] / 100);
                }
                else
                { //Mixed word and PDF
                    numWordUpchargePercent.Text = Cost.DocTypeUpcharge["MixedWord"].ToString();
                    numWordUpchargeAmount.Text  = (tempTotal * Cost.DocTypeUpcharge["MixedWord"] / 100).ToString();
                    subTotal += (int)(tempTotal * Cost.DocTypeUpcharge["MixedWord"] / 100);
                }
            }
            else
            { //All PDF
                numWordUpchargePercent.Text = Cost.DocTypeUpcharge["AllPDF"].ToString();
                numWordUpchargeAmount.Text  = (tempTotal * Cost.DocTypeUpcharge["AllPDF"] / 100).ToString();
                subTotal += (int)(tempTotal * Cost.DocTypeUpcharge["AllPDF"] / 100);
            }



            if (AllDocs.TotalFields() > 50 || AllDocs.TotalPages() > 50)
            {
                numGrandTotal.Text = "This needs a custom quote.";
            }
            else
            {
                numGrandTotal.Text = "$" + (total + subTotal).ToString();
            }

            numGrandTotal.IsReadOnly = true;
        }