Exemple #1
0
 private void autoFillRo(RO ro)
 {
     this.Text    = "RO#" + ro.getId().ToString();
     tbRONum.Text = ro.getId().ToString();
     tbRONum.Text = ro.getId().ToString();
     autoFillBike(ro.bike);
     autoFillCustomer(ro.customer);
     autoFillParts(ro.parts);
     autoFillServices(ro.services);
     dataGridViewTotalPrice.Rows[0].Cells[5].Value = ro.deposit;
     nudTires.Value         = ro.tires;
     dateTimePickerIn.Value = ro.dateIn;
     if (ro.dateOut > DateTime.Now.AddYears(-10))
     {
         dateTimePickerOut.Value   = ro.dateOut;
         dateTimePickerOut.Enabled = true;
         cbOut.Checked             = true;
     }
     tbDescOfWork.Text   = ro.descriptionOfWork;
     nudHourlyRate.Value = ro.hourlyRate;
     cbSaveParts.Checked = ro.saveOldParts;
     tbGOG.Text          = ro.gasOilGreas.ToString();
     lbTakenBy.Text      = "Taken by " + ro.takenBy;
     lbTakenBy.Location  = new Point(groupBoxCustomer.Right - lbTakenBy.Width, lbTakenBy.Location.Y);
     calculateTotalPrice();
 }
Exemple #2
0
        private void writeTopArea(System.Drawing.Printing.PrintPageEventArgs e)
        {
            Font         fontNum    = new Font("Times New Roman", 14, FontStyle.Bold);
            String       text       = "R.O. #" + currentRo.getId();
            SizeF        sizeOfText = e.Graphics.MeasureString(text, fontNum);
            StringFormat format     = new StringFormat();

            format.FormatFlags = StringFormatFlags.FitBlackBox;

            format.Alignment = StringAlignment.Far;
            e.Graphics.DrawString(text, fontNum, Brushes.Black, topArea, format);
            format.Alignment = StringAlignment.Near;
            fontNum          = new Font("Times New Roman", 14);
            text             = "Taken By \n" + currentRo.takenBy;
            e.Graphics.DrawString(text, fontNum, Brushes.Black, topArea, format);

            format.Alignment = StringAlignment.Center;
            fontNum          = new Font("Times New Roman", 16, FontStyle.Bold);
            text             = "Revolution Motorsports";
            e.Graphics.DrawString(text, fontNum, Brushes.Black, topArea, format);
            text = "10778 Myers Way S\nSeattle, WA 98168\n(206)327 - 9891";

            RectangleF writeArea = new RectangleF(topArea.X, topArea.Y + fontNum.Height, topArea.Width, topArea.Height - fontNum.Height);

            fontNum = new Font("Times New Roman", 14);
            e.Graphics.DrawString(text, fontNum, Brushes.Black, writeArea, format);
        }
Exemple #3
0
        private void printRo(PrinterSettings settings, RO ro)
        {
            PrintDocument printDoc;

            printDoc = new RoPrint(ro);
            printDoc.PrinterSettings = settings;
            printDoc.DocumentName    = "RO #" + ro.getId();
            printDoc.Print();
            if (cbSignPage.Checked)
            {
                printDoc = new SigningDocumentPrint(ro);
                printDoc.PrinterSettings = settings;
                printDoc.DocumentName    = "Sign RO #" + ro.getId();
                printDoc.Print();
            }
        }
Exemple #4
0
        public static void addRO(RO ro)
        {
            if (rosIndexed.ContainsKey(ro.getId()))
            {
                rosIndexed[ro.getId()] = ro;
            }
            else
            {
                rosIndexed.Add(ro.getId(), ro);
                if (ro.getId() > currentRoID)
                {
                    currentRoID = ro.getId();
                }
            }

            ro.improtROData();
            if (writeMode)
            {
                ro.writeToFile();
            }
        }
Exemple #5
0
 private void addRoToDgv(RO ro)
 {
     object[] data = new object[7];
     data[0] = ro.getId();
     data[1] = ro.customer.name;
     data[2] = ro.bike.getMakeModel();
     data[3] = ro.dateIn.ToShortDateString();
     if (!ro.isCLosed())
     {
         data[4] = "n/a";
     }
     else
     {
         data[4] = ro.dateOut.ToShortDateString();
     }
     data[5] = ro.getSubTotal();
     data[6] = ro.getTotal();
     dgvRo.Rows.Add(data);
 }
Exemple #6
0
        //====================GENERATe
        private bool generateRo()
        {
            if (ro == null)
            {
                ro = new RO();
            }
            int desiredID = -1;

            try
            {
                desiredID = Convert.ToInt32(tbRONum.Text);
                if (desiredID != ro.getId())
                {
                    if (DataManager.getRoById(desiredID) != null)
                    {
                        DialogResult res = MessageBox.Show("RO #" + desiredID.ToString() + " already exists. Do you want to overwrite RO?", "Warrning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                        if (res == DialogResult.OK)
                        {
                            ro.changeID(desiredID);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        ro.changeID(desiredID);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Ro id isnt a integer value!" + e.Message, "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            ro.customer = getCustomer();
            ro.bike     = getBike();
            ro.dateIn   = dateTimePickerIn.Value;
            try
            {
                ro.deposit = Convert.ToDouble(tbDeposit.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Deposit isnt a numerical value!", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (cbOut.Checked)
            {
                ro.dateOut = dateTimePickerOut.Value.Date;
            }
            else
            {
                ro.dateOut = DateTime.MinValue;
            }
            ro.gasOilGreas       = Convert.ToDouble(tbGOG.Text);
            ro.descriptionOfWork = tbDescOfWork.Text;
            ro.hourlyRate        = nudHourlyRate.Value;
            ro.parts             = getParts();
            ro.services          = getServices();
            ro.saveOldParts      = cbSaveParts.Checked;
            ro.takenBy           = Core.logedIn.getName();
            ro.tires             = nudTires.Value;
            ro.deposit           = getDepositFromDgv();
            DataManager.addRO(ro);
            return(true);
        }