private void NewInwardEntry()
 {
     if (InwardDetails.Count > 0 && InwardSummary.InwardNo == 0)
     {
         MessageBoxResult result = System.Windows.MessageBox.Show("Are you sure you want to create New Inward?", "Warning Message", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning, MessageBoxResult.No);
         if (result == MessageBoxResult.No || result == MessageBoxResult.Cancel)
         {
             return;
         }
     }
     InwardDetails.Clear();
     InwardSummary.Clear();
     Add();
 }
 private void Delete()
 {
     if (InwardDetails == null || InwardDetails.Count == 0 || InwardDetail.InwardDetailId == -1)
     {
         System.Windows.MessageBox.Show("No record selected!");
     }
     else
     {
         MessageBoxResult result = System.Windows.MessageBox.Show("Would you like to delete selected record ?", "Warning Message", MessageBoxButton.YesNoCancel);
         if (result == MessageBoxResult.Yes)
         {
             Product = null;
             InwardDetails.Remove(InwardDetail);
             Reset();
             if (InwardDetails.Count == 0)
             {
                 Add();
             }
             //OrderSummary.RefreshBillTotals();
         }
     }
 }
        private void Submit()
        {
            /**bool retValue;
             * retValue = IsValidOrder();
             * if (!retValue)
             * {
             *
             *  return false;
             *
             * }
             **/
            if (InwardDetail != null)
            {
                if (InwardDetail.InwardDetailId == -1)
                {
                    var inwDet = InwardDetails.Where(p => p.BarCodeId == InwardDetail.BarCodeId).FirstOrDefault();
                    if (inwDet != null)
                    {
                        inwDet.Quantity = inwDet.Quantity + InwardDetail.Quantity;
                        //ord.Total = ord.Quantity * ord.Price;
                    }
                    else
                    {
                        InwardDetail.InwardDetailId = InwardDetails.Count + 1;

                        InwardDetails.Add(InwardDetail);
                    }
                }
                //Order.Total = Order.Quantity * Order.Price;
            }

            NotifyPropertyChanged("InwardDetail");
            NotifyPropertyChanged("InwardDetails");
            Add();
            //OrderSummary.RefreshBillTotals();
        }