Пример #1
0
 private void updateModifyPaymentGrid(Team_Member selectedMember)
 {
     if ((selectedTeamMember.amount_due).Equals("0.00") || (selectedTeamMember.amount_due).Substring(0, 1) == "-")
     {
         PayAmountDue.Visibility = Visibility.Collapsed;
         PayOtherAmount.Visibility = Visibility.Collapsed;
         FeeDoesntApply.Visibility = Visibility.Collapsed;
     }
     else
     {
         PayAmountDue.Visibility = Visibility.Visible;
         PayOtherAmount.Visibility = Visibility.Visible;
         FeeDoesntApply.Visibility = Visibility.Visible;
     }
     if ((selectedTeamMember.is_applicable == false))
     {
         PayAmountDue.Visibility = Visibility.Collapsed;
         PayOtherAmount.Visibility = Visibility.Collapsed;
         ChangeAmountDue.Visibility = Visibility.Collapsed;
         FeeDoesntApply.Content = "Fee Does Apply";
         FeeDoesntApply.Visibility = Visibility.Visible;
     }
     else
     {
         PayAmountDue.Visibility = Visibility.Visible;
         PayOtherAmount.Visibility = Visibility.Visible;
         ChangeAmountDue.Visibility = Visibility.Visible;
         FeeDoesntApply.Content = "Fee Doesn't Apply";
         FeeDoesntApply.Visibility = Visibility.Visible;
     }
 }
Пример #2
0
 public PaymentItemDetails()
 {
     this.InitializeComponent();
     APILibrary = new Library_APICall();
     rteamfee = new TeamFeeItems();
     selectedTeamMember = new Team_Member();
     rteammember_collection = new ObservableCollection<Team_Member>();
     selectedTeamMemberPosInList = 0;
 }
Пример #3
0
        public static async Task<RootPaymentCollection> createPaymentCollection(RootObjectTeamFeeAPI rteamFee, RootObjectMemberPaymentAPI rteamMemberPayment)
        {
            Library_APICall APILibrary = new Library_APICall();
            RootPaymentCollection rpayment = new RootPaymentCollection();
            methodLibrary mlb = new methodLibrary();
            List<CollectionUsersTeamMembers> ctrmList = new List<CollectionUsersTeamMembers>();
            Dictionary<long, int> teamfeeId_ListPos = new Dictionary<long, int>();  // Keeps track of position of each team id in the team_fees list.
            /*Extracting the list of members for the current team from FileUserClass.txt*/
            Dictionary<long, int> memberid_ListPos = new Dictionary<long, int>();  //Keeps track of the position in list based on the member id. Will be useful later.            
            string fileuserclass = await mlb.readSerializedUserClass();
            RootObjectUsers ruser = Users.usersDataDeserializer(fileuserclass);
            for (int i = 0; i < ruser.teams.Count; i++)
            {
                if (ruser.teams[i].id == (long)ApplicationData.Current.LocalSettings.Values["currentTeamID"])
                {
                    for (int j = 0; j < ruser.teams[i].members.Count; j++)
                    {
                        CollectionUsersTeamMembers ctm = new CollectionUsersTeamMembers();
                        ctm = ruser.teams[i].members[j];
                        ctrmList.Add(ctm);                                                                  // Keep in mind that all this stuff is being done for just one team. A single team will have all unique member_ids
                        if (ctrmList.Count > 0)
                        {
                            memberid_ListPos.Add(ruser.teams[i].members[j].member_id, ctrmList.Count - 1);
                        }
                    }
                }
            }
            /****************************/

            /*Working on the TeamFee */
            rpayment.team_fees = new List<TeamFeeItems>();
            Dictionary<string, int> rteamfee_ht = new Dictionary<string, int>();    // Adding the data items to a hashtable so that I can compare and add stuff to the right place
            for (int i = 0; i < rteamFee.collection.items[0].data.Count; i++)
            {
                rteamfee_ht.Add(rteamFee.collection.items[0].data[i].name, i);
            }

            // Run through array of items and add it to and object of type TeamFeeItems
            for (int i = 0; i < rteamFee.collection.items.Count; i++)
            {
                TeamFeeItems rtfitems = new TeamFeeItems();
                rtfitems.team_fee_id = rteamFee.collection.items[i].data[(int)rteamfee_ht["id"]].value == null ? 0 : (long)rteamFee.collection.items[i].data[(int)rteamfee_ht["id"]].value;
                if (!teamfeeId_ListPos.ContainsKey(rtfitems.team_fee_id))
                {
                    teamfeeId_ListPos.Add(rtfitems.team_fee_id, i);
                }
                rtfitems.team_fee_description = (string)rteamFee.collection.items[i].data[(int)rteamfee_ht["description"]].value;
                rtfitems.team_fee_amount = (string)rteamFee.collection.items[i].data[(int)rteamfee_ht["amount"]].value;
                rtfitems.team_fee_notes = (string)rteamFee.collection.items[i].data[(int)rteamfee_ht["notes"]].value;
                rtfitems.team_fee_balance = (string)rteamFee.collection.items[i].data[(int)rteamfee_ht["balance"]].value;
                rtfitems.team_member = new List<Team_Member>();
                rpayment.team_fees.Add(rtfitems);
            }


            /*************************/
            /*Working on member payments now*/
            //Run through memberPayments and for each matching team_fee_id, add the data to rpayment.team_fees[i].team_member

            Dictionary<string, int> rteamMemberPayment_ht = new Dictionary<string, int>();
            for (int i = 0; i < rteamMemberPayment.collection.items[0].data.Count; i++)
            {
                rteamMemberPayment_ht.Add(rteamMemberPayment.collection.items[0].data[i].name, i);
            }

            for (int i = 0; i < rteamMemberPayment.collection.items.Count; i++)
            {
                // read the team_fee_id
                long member_team_fee_id = (long)rteamMemberPayment.collection.items[i].data[(int)rteamMemberPayment_ht["team_fee_id"]].value;
                // check if it matches an existing team_fee_id in teamfeeId_ListPos
                if (teamfeeId_ListPos.ContainsKey(member_team_fee_id))
                {
                    TeamFeeItems rtfitems = new TeamFeeItems();
                    rtfitems = rpayment.team_fees[(int)teamfeeId_ListPos[member_team_fee_id]];
                    Team_Member rteammember = new Team_Member();
                    rteammember.tickmark = new TeamMemberTickMarkVisibility();
                    rteammember.team_fee_id = member_team_fee_id;
                    rteammember.team_id = (long)rteamMemberPayment.collection.items[i].data[(int)rteamMemberPayment_ht["team_id"]].value;
                    rteammember.amount_paid = (string)rteamMemberPayment.collection.items[i].data[(int)rteamMemberPayment_ht["amount_paid"]].value;
                    rteammember.amount_due = (string)rteamMemberPayment.collection.items[i].data[(int)rteamMemberPayment_ht["amount_due"]].value;
                    rteammember.is_applicable = rteamMemberPayment.collection.items[i].data[(int)rteamMemberPayment_ht["is_applicable"]].value == null ? false : (bool)rteamMemberPayment.collection.items[i].data[(int)rteamMemberPayment_ht["is_applicable"]].value;
                    rteammember.member_id = (long)rteamMemberPayment.collection.items[i].data[(int)rteamMemberPayment_ht["member_id"]].value;
                    rteammember.tickmark.is_applicable = rteammember.is_applicable;
                    rteammember.tickmark.amount_due = rteammember.amount_due;
                    //Check if memberid_ListPos contains this team_fee_member_id. If it does, fetch member info from there
                    long team_fee_member_id = (long)rteamMemberPayment.collection.items[i].data[(int)rteamMemberPayment_ht["member_id"]].value;
                    if (memberid_ListPos.ContainsKey(team_fee_member_id))
                    {
                        int pos = (int)memberid_ListPos[team_fee_member_id];
                        rteammember.member_name = ctrmList[pos].first_name + (String.IsNullOrEmpty(ctrmList[pos].last_name) ? "" : " " + ctrmList[pos].last_name);
                        rteammember.member_photo = ctrmList[pos].member_photo;
                        rteammember.member_photo = ctrmList[pos].member_photo_notscaled;
                        rteammember.email_address = ctrmList[pos].email_address;
                        rteammember.is_non_player = ctrmList[pos].is_non_player;
                    }
                    rpayment.team_fees[(int)teamfeeId_ListPos[member_team_fee_id]].team_member.Add(rteammember);  // Adding rteammember under the right TeamFeeItems
                }
            }
            return rpayment;
        }
Пример #4
0
 private void PaymentItemMembersListView_ItemClick(object sender, ItemClickEventArgs e)
 {
     ModifyPaymentGrid_Title.Text = "";
     selectedTeamMember = (Team_Member)e.ClickedItem;
     updateModifyPaymentGrid(selectedTeamMember);
     PayAmountDue.Content = "Paid Amount : $" + selectedTeamMember.amount_due;
     for (int i = 0; i < rteamfee.team_member.Count; i++)
     {
         if (rteamfee.team_member[i].member_id == selectedTeamMember.member_id)
         {
             selectedTeamMemberPosInList = i;
             break;
         }
     }
     ListViewMemberOptionsGrid.Visibility = Visibility.Visible;
 }