Exemplo n.º 1
0
        public bool CanEditApplication(string university, Application application, OfferState offerState,
                                       out string reason)
        {
            reason = null;

            if (application == null)
            {
                reason = "Application was not Found.";
                return(false);
            }

            if (application.University != university)
            {
                reason = "Permission Denied.";
                return(false);
            }

            if (application.OfferState != OfferState.Conditional && application.OfferState != OfferState.Pending)
            {
                reason = "Offerstate can not be modified.";
                return(false);
            }

            if (application.OfferState == OfferState.Conditional && offerState != OfferState.Unconditional)
            {
                reason = "Conditional Offer State can only be set to Unconditional.";
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public Offer(Product NewProduct, User <string> User)
        {
            productsList = new List <Product>();
            ProductsList.Add(NewProduct);

            Random rnd = new Random();

            offerNumber = rnd.Next();
            state       = OfferState.New;
            this.user   = User;
        }
Exemplo n.º 3
0
        async void addOffer_Clicked(object sender, EventArgs e)
        {
            string     title       = titleEntry.Text;
            string     description = descriptionEntry.Text;
            int        categoryId  = Convert.ToInt32(((Category)CategoryBinder.SelectedItem).CategoryID);
            int        quantity    = Convert.ToInt32(quantityEntry.Text);
            string     price       = priceEntry.Text;
            OfferState state       = (OfferState)StateBinder.SelectedItem;


            var offerItem = new Models.BindingModels.OfferBindingModel
            {
                Title            = title,
                Description      = description,
                CategoryID       = categoryId,
                InStockOriginaly = quantity,
                Price            = price,
                UserID           = Session.user.UserID,
                OfferState       = state
            };

            if (string.IsNullOrEmpty(titleEntry.Text) || string.IsNullOrEmpty(descriptionEntry.Text))
            {
                await DisplayAlert("Enter data", "Enter valid data", "Ok");
            }
            else
            {
                try
                {
                    OfferItem response = await AddOfferViewModel.AddOfferAsync(offerItem);

                    if (response != null)
                    {
                        output.Text = "Oferta dodana pomyślnie!";
                    }
                    else
                    {
                    }
                }
                catch (AggregateException err)
                {
                    foreach (var errInner in err.InnerExceptions)
                    {
                        Debug.WriteLine(errInner); //this will call ToString() on the inner execption and get you message, stacktrace and you could perhaps drill down further into the inner exception of it if necessary
                    }
                    ;
                }
            }
        }
Exemplo n.º 4
0
 public OfferItem(int offerID, string title, string description, DateTime creationDate, bool isActive, string stocking, double inStockOriginaly, double inStockNow, double price, int userID, int categoryID, List <OfferItemPicture> offerItemPictures, string login, OfferState offerState)
 {
     OfferID          = offerID;
     Title            = title;
     Description      = description;
     CreationDate     = creationDate;
     IsActive         = isActive;
     Stocking         = stocking;
     InStockOriginaly = inStockOriginaly;
     InStockNow       = inStockNow;
     Price            = price;
     UserID           = userID;
     Login            = login;
     CategoryID       = categoryID;
     OfferPictures    = offerItemPictures;
     OfferState       = offerState;
 }
Exemplo n.º 5
0
        public void ApplyFiters(string name, OfferState state, double priceBegin, double priceEnd)
        {
            List <OfferItem> filteredList = allItems;

            Offers = new ObservableCollection <OfferItem>(filteredList);
            if (name != "")
            {
                filteredList = filteredList.Where(w => w.Title.ToLower().Contains(name.ToLower())).ToList();
            }
            if (state != 0)
            {
                filteredList = filteredList.Where(w => w.OfferState == state).ToList();
            }
            if (priceBegin > 0 || priceEnd < 10000)
            {
                filteredList = filteredList.Where(w => w.Price <priceEnd && w.Price> priceBegin).ToList();
            }
            Offers = new ObservableCollection <OfferItem>(filteredList);
        }
Exemplo n.º 6
0
 public bool RequireBiddingOffer(String OfferID, OfferState OfferState)
 {
     if (OfferState != OfferState.None && OfferState != OfferState.All)
     {
         Fc_Offer   info    = db.Offer.Where(x => x.OfferID.Equals(OfferID)).FirstOrDefault();
         Fc_Install install = db.Install.Where(x => x.InstallID.Equals(info.InstallID)).FirstOrDefault();
         install.InsProjectState = InsProjectState.NoInstalled;
         info.OfferState         = OfferState;
         db.Offer.Attach(info);
         db.Entry <Fc_Offer>(info).State = System.Data.Entity.EntityState.Modified;
         db.Install.Attach(install);
         db.Entry <Fc_Install>(install).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     else
     {
         throw new ArgumentException("投标状态不能为空!");
     }
 }
Exemplo n.º 7
0
        private async void applyFilters(object sender, EventArgs e)
        {
            string name = "";

            if (productName.Text != null)
            {
                name = productName.Text;
            }

            double     min   = minValue.Value;
            double     max   = maxValue.Value;
            OfferState state = 0;

            if (StateBinder.SelectedItem != null)
            {
                state = (OfferState)StateBinder.SelectedItem;
            }


            page.FilterList(name, state, min, max);
            await PopupNavigation.Instance.PopAsync(true);
        }
Exemplo n.º 8
0
        public Application SetApplicationsStatus(string university, int applicationId, OfferState offerState,
                                                 string comment = "")
        {
            var application = _applicationService.GetApplication(applicationId);

            if (!_applicationService.CanEditApplication(university, application, offerState, out var reason))
            {
                throw new SoapException(reason, SoapException.ClientFaultCode, Context.Request.Url.AbsoluteUri);
            }

            application.OfferState = offerState;
            application.Comment    = comment;
            _applicationService.EditApplication(application);

            //break cycling reference
            application.Applicant = null;

            return(application);
        }
Exemplo n.º 9
0
 public void FilterList(string productName = "", OfferState state = 0, double beginPrice = Double.MinValue, double EndPrice = Double.MaxValue)
 {
     model.ApplyFiters(productName, state, beginPrice, EndPrice);
 }