Example #1
0
        static void AddOrderDetails(Order temp_o)
        {
            string wannadd;

            do
            {
                OrderDetail od = new OrderDetail();
                od.OrderNoRef    = temp_o.OrderNo;
                od.ProductDetail = fillProductDetails();

                if (od.ProductDetail.IsActive)
                {
                    Console.Write("Product Unit Price is {0} (Enter to skip) : ", od.ProductDetail.UnitPrice);
                    string price   = Console.ReadLine();
                    double OD_unit = 0;

                    if (price.Equals(""))
                    {
                        OD_unit = od.ProductDetail.UnitPrice;
                    }
                    else if (price.Equals("-1"))
                    {
                        Program.start();
                    }
                    else
                    {
                        OD_unit = Convert.ToDouble(price);
                    }

                    string qt;
                    int    OD_quantity = 1;
                    do
                    {
                        Console.Write("Enter Quantity (Enter to skip) (default 1) : ");
                        qt = Console.ReadLine();
                        if (qt.Equals("") || qt.Equals("-1"))
                        {
                            break;
                        }
                        else
                        {
                        }
                    } while (Validation.IsQuantity(qt));
                    if (!qt.Equals(""))
                    {
                        OD_quantity = Convert.ToInt32(qt);
                    }

                    if (qt.Equals("-1"))
                    {
                        Program.start();
                    }

                    string dis;
                    double OD_discount = 0;
                    bool   flag        = true;
                    do
                    {
                        Console.Write("Enter Discount (Enter to skip) : ");
                        dis = Console.ReadLine();
                        if (dis.Equals(""))
                        {
                            OD_discount = 0;
                            flag        = false;
                        }
                        else if (dis.Equals("-1"))
                        {
                            Program.start();
                        }
                        else
                        {
                            if (Validation.IsNumber(dis))
                            {
                                flag        = false;
                                OD_discount = Convert.ToInt32(dis);
                            }
                        }
                    } while (flag);

                    DateTime OD_create = DateTime.Now;
                    DateTime OD_modifi = DateTime.Now;


                    od.UnitPrice      = OD_unit;
                    od.Quantity       = OD_quantity;
                    od.Amount         = OD_unit * OD_quantity;
                    od.DiscountAmount = OD_discount;
                    od.GrandTotal     = od.Amount - OD_discount;
                    od.CreatedDate    = OD_create;
                    od.ModifiedDate   = OD_modifi;

                    AllOrder.Add(temp_o);
                    AllOrderDetails.Add(od);
                }
                else
                {
                    Console.WriteLine("Product not avilable");
                }
                Console.Write("\nAdd Product? (Yes/No) : ");
                wannadd = Console.ReadLine().ToLower();
            } while (wannadd != "no");
        }
Example #2
0
 public static void showLastCustomer(OrderDetail od)
 {
     Console.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3}\t\t{4}\t\t{5}\t\t{6}\t\t{7}", od.ProductDetail.ProductNo, od.ProductDetail.ProductName, od.UnitPrice, od.Quantity, od.Amount, od.DiscountAmount, od.GrandTotal, od.CreatedDate);
 }