コード例 #1
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            GridColumn col = new GridColumn("Date", 70);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Patient", 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Category", 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Total Cost", 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Balance", 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Due Now", 80);
            gridMain.ListGridColumns.Add(col);
            List <long>     listPayPlanNums = _listValidPayPlans.Select(x => x.PayPlanNum).ToList();
            List <PaySplit> listPaySplits   = PaySplits.GetForPayPlans(listPayPlanNums);
            List <Patient>  listPats        = Patients.GetLimForPats(_listValidPayPlans.Select(x => x.PatNum).ToList());

            for (int i = 0; i < _listValidPayPlans.Count; i++)
            {
                //no db calls are made in this loop because we have all the necessary information already.
                PayPlan planCur = _listValidPayPlans[i];
                Patient patCur  = listPats.Where(x => x.PatNum == planCur.PatNum).FirstOrDefault();
                GridRow row     = new GridRow();
                row.Cells.Add(planCur.PayPlanDate.ToShortDateString());       //date
                row.Cells.Add(patCur.LName + ", " + patCur.FName);            //patient
                if (planCur.PlanCategory == 0)
                {
                    row.Cells.Add(Lan.g(this, "None"));
                }
                else
                {
                    row.Cells.Add(Defs.GetDef(DefCat.PayPlanCategories, planCur.PlanCategory).ItemName);
                }
                row.Cells.Add(PayPlans.GetTotalCost(planCur.PayPlanNum, _listPayPlanCharges).ToString("F"));               //total cost
                row.Cells.Add(PayPlans.GetBalance(planCur.PayPlanNum, _listPayPlanCharges, listPaySplits).ToString("F"));  //balance
                row.Cells.Add(PayPlans.GetDueNow(planCur.PayPlanNum, _listPayPlanCharges, listPaySplits).ToString("F"));   //due now
                row.Tag = planCur.PayPlanNum;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }