Beispiel #1
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,ContractDetailId,SupportTypeId,ObjectsId,Amount,SpDefenition,ObjNumber,CustomersId,MonthDept")] PaymentsList paymentsList)
        {
            if (id != paymentsList.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paymentsList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentsListExists(paymentsList.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(paymentsList));
        }
Beispiel #2
0
        private void AddPayment(object param)
        {
            decimal amount;
            bool    isAmountValid = decimal.TryParse(this.PaymentAmount, out amount);

            if (!isAmountValid || !IsValid(this as DependencyObject))
            {
                AmountError = "Niepoprawna kwota";
                return;
            }

            var mpdg = new MultiPaymentDataGrid()
            {
                PaymentId               = null,
                Apartment               = SelectedApartmentNumber,
                Building                = SelectedBuildingName,
                ChargeGroup             = SelectedGroupName,
                Owner                   = _selectedOwner,
                PaymentAddDate          = DateTime.Now,
                PaymentAmount           = amount,
                PaymentRegistrationDate = PaymentRegistrationDate,
            };

            PaymentsList.Add(mpdg);
        }
        /// <summary>
        /// Binds the payments list.
        /// </summary>
        /// <param name="shippingRow">The shipping row.</param>
        private void BindPaymentsList(ShippingMethodDto.ShippingMethodRow shippingRow)
        {
            List <PaymentMethodDto.PaymentMethodRow> leftPayments  = new List <PaymentMethodDto.PaymentMethodRow>();
            List <PaymentMethodDto.PaymentMethodRow> rightPayments = new List <PaymentMethodDto.PaymentMethodRow>();

            PaymentMethodDto dto = PaymentManager.GetPaymentMethods(shippingRow != null ? shippingRow.LanguageId : LanguageCode, true);

            bool allToLeft = false;             // if true, then add all payments to the left list

            if (shippingRow != null)
            {
                ShippingMethodDto.ShippingPaymentRestrictionRow[] restrictedPaymentRows = shippingRow.GetShippingPaymentRestrictionRows();
                if (restrictedPaymentRows != null && restrictedPaymentRows.Length > 0)
                {
                    foreach (PaymentMethodDto.PaymentMethodRow paymentMethodRow in dto.PaymentMethod)
                    {
                        bool found = false;
                        foreach (ShippingMethodDto.ShippingPaymentRestrictionRow restrictedPaymentRow in restrictedPaymentRows)
                        {
                            if (paymentMethodRow.PaymentMethodId == restrictedPaymentRow.PaymentMethodId)
                            {
                                found = true;
                                break;
                            }
                        }

                        if (found)
                        {
                            rightPayments.Add(paymentMethodRow);
                        }
                        else
                        {
                            leftPayments.Add(paymentMethodRow);
                        }
                    }

                    PaymentsList.LeftDataSource  = leftPayments;
                    PaymentsList.RightDataSource = rightPayments;
                }
                else
                {
                    // add all payments to the left list
                    allToLeft = true;
                }
            }
            else
            {
                allToLeft = true;
            }

            if (allToLeft)
            {
                // add all payments to the left list
                PaymentsList.LeftDataSource = dto.PaymentMethod;
            }

            PaymentsList.DataBind();
        }
    // --------------------------------------------------------------------------------
    // AccountToPayments
    // --------------------------------------------------------------------------------

    // Set payments list
    public static Coroutine SetPaymentsList(string accountId, PaymentsList list, GameDB.ActionOnResult <PaymentsList> func)
    {
        return(GameDB.instance.StartCoroutine(GameDB.Set <PaymentsList>(
                                                  "AccountToPayments",
                                                  accountId,
                                                  list,
                                                  func
                                                  )));
    }
        protected override PaymentViewsList getRandomObject()
        {
            var payments = new PaymentsList(null, null);

            SetRandom.Values(payments);
            var l = new PaymentViewsList(payments);

            return(l);
        }
Beispiel #6
0
        public async Task <IActionResult> Create([Bind("Id,ContractDetailId,SupportTypeId,ObjectsId,Amount,SpDefenition,ObjNumber,CustomersId,MonthDept")] PaymentsList paymentsList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(paymentsList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(paymentsList));
        }
Beispiel #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MiddleName != null ? MiddleName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Id;
         hashCode = (hashCode * 397) ^ (Address != null ? Address.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MobilePhone != null ? MobilePhone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PaymentsList != null ? PaymentsList.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)CustomerType;
         return(hashCode);
     }
 }
        public async Task Init()
        {
            if (PaymentsList.Count > 0)
            {
                PaymentsList.Clear();
                Total = 0;
            }

            var clients = await _userService.GetAll <List <User> >(new UserSearchRequest { Username = APIService.Username });

            var client = clients[0];

            var payments = await _paymentService.GetAll <List <Payment> >(new PaymentSearchRequest { UserID = client.UserID });

            foreach (var payment in payments)
            {
                PaymentsList.Add(payment);
                Total += payment.Amount;
            }
        }
Beispiel #9
0
        private void AcceptDialog(object obj)
        {
            if (SelectedHouse == null)
            {
                AddError(nameof(SelectedHouse), "Field cannot be empty");
            }
            if (string.IsNullOrEmpty(HeatMeter))
            {
                AddError(nameof(HeatMeter), "Field cannot be empty");
            }
            if (string.IsNullOrEmpty(Cost))
            {
                AddError(nameof(Cost), "Field cannot be empty");
            }

            if (!HasErrors)
            {
                var payment = new Payment
                {
                    Date      = DateTime.Now,
                    Cost      = Convert.ToInt32(Cost),
                    HeatMeter = Convert.ToInt32(HeatMeter)
                };

                var user  = context.Users.FirstOrDefault(u => u.Id == UserId);
                var house = context.Houses.FirstOrDefault(u => u.Id == SelectedHouse.Id);

                house.HeatMeter = Convert.ToInt32(HeatMeter);

                payment.User  = user;
                payment.House = house;
                PaymentsList.Add(payment);
                context.SaveChanges();
                SelectedHouse = null;
                IsDialogOpen  = false;
            }
        }
Beispiel #10
0
        public async Task Init()
        {
            if (PaymentsList.Count > 0)
            {
                PaymentsList.Clear();
                Total = 0.00f;
            }
            search_request.Username = APIService.Username;
            var candidates = await _candidateService.GetAll <List <Candidate> >(search_request);

            var candidate = candidates[0];

            search_request2.CandidateId = candidate.Id;
            var payments = await _paymentService.GetAll <List <Payment> >(search_request2);

            foreach (var payment in payments)
            {
                var category = await categoryService.GetById <Category>(payment.CategoryId);

                payment.Category = category.Name;
                PaymentsList.Add(payment);
                Total += payment.Amount;
            }
        }
Beispiel #11
0
 private void DeletePayment(object param)
 {
     PaymentsList.Remove(SelectedPayment);
 }
Beispiel #12
0
 internal void ScrollToFirst(Object item)
 {
     PaymentsList.ScrollTo(item, ScrollToPosition.MakeVisible, false);
 }