Ejemplo n.º 1
0
 public void searchSites()
 {
     ListofCautationSitesFromDb = db.db_GetCautationSiteList(StaticMaster.convertDateToString(_startDate), StaticMaster.convertDateToString(_endDate), StaticMaster.convertStringToSiteStatus(_selectedStatus), _siteHeight == null ? "ALL" : _siteHeight, _siteWidth == null ? "ALL" : _siteWidth, _siteAmount == null ? "ALL" : _siteAmount, _siteName == null ? "ALL" : _siteName, _siteAddress == null ? "ALL" : _siteAddress);
     ListofCautationSites       = new ObservableCollection <SiteCautationModel>(_listofSelectedCautationSites);
     foreach (SiteCautationModel cautationSite in _listofCautationSitesFromDb)
     {
         if (!_listofCautationSites.Contains(cautationSite, new InlineComparer <SiteCautationModel>((i1, i2) => i1.SiteSeqNum == i2.SiteSeqNum, i => i.SiteSeqNum.GetHashCode())))
         {
             ListofCautationSites.Add(cautationSite);
         }
     }
 }
 public void searchOrders()
 {
     TotalAmount  = 0;
     ListOfOrders = new ObservableCollection <OrderModel>(db.db_GetOrderList(clientModel.ClientSeqNum, 0, 0, StaticMaster.convertDateToString(_startDate), StaticMaster.convertDateToString(_endDate), "ALL"));
     for (int i = 0; i < _listOfOrders.Count; i++)
     {
         TotalAmount += (_listOfOrders.ToArray())[i].OrderTotalAmount;
     }
     if (_startDate != null && _endDate != null)
     {
         DateRange = "From : " + StaticMaster.convertDisplayDateToString(_startDate) + "\nTo : " + StaticMaster.convertDisplayDateToString(_endDate);
         FontSize  = 15;
     }
 }
        public TodayTomorrowSiteViewModel(string action)
        {
            db = Database.getInstance();

            switch (action)
            {
            case "ENDD":
            {
                ActionLable = "Today End Sites";
                SiteList    = new ObservableCollection <OrderModel>(db.db_GetTodayEndOrderList(StaticMaster.convertDateToString(DateTime.Today), "RUNN"));
                break;
            }

            case "STRT":
            {
                ActionLable = "Tomorrow Start Sites";
                SiteList    = new ObservableCollection <OrderModel>(db.db_GetTomorrowStartOrderList(StaticMaster.convertDateToString(DateTime.Today.AddDays(1)), "PREE"));
                break;
            }

            default:
            {
                break;
            }
            }
        }
Ejemplo n.º 4
0
 public void searchSites()
 {
     ListofSites = db.db_GetSiteList(StaticMaster.convertDateToString(_startDate), StaticMaster.convertDateToString(_endDate), StaticMaster.convertStringToSiteStatus(_selectedStatus), _siteHeight == null?"ALL":_siteHeight, _siteWidth == null?"ALL":_siteWidth, _siteAmount == null?"ALL":_siteAmount, _siteName == null?"ALL":_siteName, _siteAddress == null?"ALL":_siteAddress);
 }
 public void searchOrders()
 {
     ListOfOrders = new ObservableCollection <OrderModel>(db.db_GetOrderList(_selectedClient.ClientSeqNum, _selectedSite.SiteSeqNum, Double.Parse(_amount), StaticMaster.convertDateToString(_startDate), StaticMaster.convertDateToString(_endDate), StaticMaster.convertStringToOrderStatus(_selectedStatus)));
 }
        private bool validate()
        {
            String ErrorMsg = null;

            if (_selectedSite == null || CustomValidation.validateString(_selectedSite.SiteName))
            {
                StatusString    = "Please Select Site";
                ForegroundColor = System.Windows.Media.Brushes.Red;
                this.parent.SiteFilter.Focus();
                return(false);
            }

            if (_selectedClient == null || CustomValidation.validateString(_selectedClient.ClientName))
            {
                StatusString    = "Please Select Client";
                ForegroundColor = System.Windows.Media.Brushes.Red;
                this.parent.ClientFilter.Focus();
                return(false);
            }

            if (_startDate == null)
            {
                StatusString    = "Please Select Order Start Date";
                ForegroundColor = System.Windows.Media.Brushes.Red;
                this.parent.StartDate.Focus();
                return(false);
            }

            if (_endDate == null)
            {
                StatusString    = "Please Select Order End Date";
                ForegroundColor = System.Windows.Media.Brushes.Red;
                this.parent.EndDate.Focus();
                return(false);
            }

            if (_startDate > _endDate)
            {
                StatusString    = "End Date can not be greater than Start Date";
                ForegroundColor = System.Windows.Media.Brushes.Red;
                this.parent.EndDate.Focus();
                return(false);
            }

            switch (action)
            {
            case "ADD":
            {
                if (_startDate < StaticMaster.convertStringToDate(StaticMaster.convertDateToString(DateTime.Today)))
                {
                    StatusString    = "Start Date Can not be Less than Current Date";
                    ForegroundColor = System.Windows.Media.Brushes.Red;
                    this.parent.StartDate.Focus();
                    return(false);
                }
                ErrorMsg = db.db_CheckBookingDates(StaticMaster.convertDateToString(_startDate), StaticMaster.convertDateToString(_endDate), _selectedSite.SiteSeqNum, 0);
                if (ErrorMsg != null)
                {
                    StatusString    = ErrorMsg;
                    ForegroundColor = System.Windows.Media.Brushes.Red;
                    this.parent.StartDate.Focus();
                    return(false);
                }
                if (_endDate < StaticMaster.convertStringToDate(StaticMaster.convertDateToString(DateTime.Today)))
                {
                    StatusString    = "End Date Can not be Less than Current Date";
                    ForegroundColor = System.Windows.Media.Brushes.Red;
                    this.parent.EndDate.Focus();
                    return(false);
                }
                break;
            }

            case "MDFY":
            {
                if (orderModel.OrderStatus.Equals(Status.PREE))
                {
                    if (_startDate < StaticMaster.convertStringToDate(StaticMaster.convertDateToString(DateTime.Today)))
                    {
                        StatusString    = "Start Date Can not be Less than Current Date";
                        ForegroundColor = System.Windows.Media.Brushes.Red;
                        this.parent.StartDate.Focus();
                        return(false);
                    }
                }
                ErrorMsg = db.db_CheckBookingDates(StaticMaster.convertDateToString(_startDate), StaticMaster.convertDateToString(_endDate), _selectedSite.SiteSeqNum, orderModel.OrderSeqNum);
                if (ErrorMsg != null)
                {
                    StatusString    = ErrorMsg;
                    ForegroundColor = System.Windows.Media.Brushes.Red;
                    this.parent.StartDate.Focus();
                    return(false);
                }
                if (_endDate < StaticMaster.convertStringToDate(StaticMaster.convertDateToString(DateTime.Today)))
                {
                    StatusString    = "End Date Can not be Less than Current Date";
                    ForegroundColor = System.Windows.Media.Brushes.Red;
                    this.parent.EndDate.Focus();
                    return(false);
                }
                break;
            }
            }

            if (CustomValidation.validateString(_charges) || CustomValidation.validationDouble(_charges))
            {
                StatusString    = "Please Enter Charges";
                ForegroundColor = System.Windows.Media.Brushes.Red;
                this.parent.Charges.Focus();
                return(false);
            }
            if (CustomValidation.validateString(_printing) || CustomValidation.validationDouble(_printing))
            {
                StatusString    = "Please Enter Printing Amount";
                ForegroundColor = System.Windows.Media.Brushes.Red;
                this.parent.Printing.Focus();
                return(false);
            }
            if (CustomValidation.validateString(_mounting) || CustomValidation.validationDouble(_mounting))
            {
                StatusString    = "Please Enter Mounting Amount";
                ForegroundColor = System.Windows.Media.Brushes.Red;
                this.parent.Mounting.Focus();
                return(false);
            }

            return(true);
        }
        public void Save()
        {
            if (validate())
            {
                orderStatus = getOrderStatus(StartDate, EndDate);
                switch (action)
                {
                case "ADD":
                {
                    string output = db.db_PlaceOrder(SelectedSite.SiteSeqNum, SelectedClient.ClientSeqNum, Double.Parse(Charges), Double.Parse(Printing), Double.Parse(Mounting), StaticMaster.convertDateToString(StartDate), StaticMaster.convertDateToString(EndDate), StaticMaster.convertStringToOrderStatus(orderStatus));
                    if (output.Equals(Status.SUCC))
                    {
                        StatusString    = "Order Placed Successfully";
                        ForegroundColor = System.Windows.Media.Brushes.Green;
                    }
                    else if (output.Equals(Status.ERR))
                    {
                        StatusString    = "Failed to Place Order";
                        ForegroundColor = System.Windows.Media.Brushes.Red;
                    }
                    else
                    {
                        StatusString    = output;
                        ForegroundColor = System.Windows.Media.Brushes.Red;
                    }
                    StatusStringFlag = Visibility.Visible;
                    break;
                }

                case "MDFY":
                {
                    string output = db.db_MdfyOrder(orderModel.OrderSeqNum, Double.Parse(Charges), Double.Parse(Printing), Double.Parse(Mounting), StaticMaster.convertDateToString(StartDate), StaticMaster.convertDateToString(EndDate), StaticMaster.convertStringToOrderStatus(orderStatus));
                    if (output.Equals(Status.SUCC))
                    {
                        StatusString    = "Order Modified Successfully";
                        ForegroundColor = System.Windows.Media.Brushes.Green;
                    }
                    else if (output.Equals(Status.ERR))
                    {
                        StatusString    = "Failed to Modify Order";
                        ForegroundColor = System.Windows.Media.Brushes.Red;
                    }
                    else
                    {
                        StatusString    = output;
                        ForegroundColor = System.Windows.Media.Brushes.Red;
                    }
                    StatusStringFlag = Visibility.Visible;
                    break;
                }

                case "CNCL":
                {
                    var messageBoxResult = CustomMessageBox.Show("Confirmation", "Do you want to Cancel Order " + orderModel.OrderSeqNum + " ?", MessageBoxButton.YesNo);
                    if (messageBoxResult == MessageBoxResult.Yes)
                    {
                        string output = db.db_CnclOrder(orderModel.OrderSeqNum);
                        if (output.Equals(Status.SUCC))
                        {
                            StatusString    = "Order Cancelled Successfully";
                            ForegroundColor = System.Windows.Media.Brushes.Green;
                        }
                        else if (output.Equals(Status.ERR))
                        {
                            StatusString    = "Failed to Cancel Order";
                            ForegroundColor = System.Windows.Media.Brushes.Red;
                        }
                        else
                        {
                            StatusString    = output;
                            ForegroundColor = System.Windows.Media.Brushes.Red;
                        }
                        StatusStringFlag = Visibility.Visible;
                    }
                    break;
                }

                default:
                {
                    StatusString     = "Invalid Operation";
                    ForegroundColor  = System.Windows.Media.Brushes.Red;
                    StatusStringFlag = Visibility.Visible;
                    break;
                }
                }
            }
        }
Ejemplo n.º 8
0
 public void searchClients()
 {
     ListofClients = db.db_GetClientList(StaticMaster.convertStringToClientStatus(_fselectedStatus), _fclientName == null?"ALL":_fclientName);
 }