Пример #1
0
        public static List <DayCarePL.ChildFamilyProperties> LoadChildFamily(Guid SchoolId, Guid SchoolYearId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamily", "Execute LoadChildFamily Method", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            DayCareDataContext db = new DayCareDataContext();

            DayCarePL.ChildFamilyProperties        objChildFamily;
            List <DayCarePL.ChildFamilyProperties> lstChildFamily = new List <DayCarePL.ChildFamilyProperties>();

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamily", "Debug LoadChildFamily Method", DayCarePL.Common.GUID_DEFAULT);

                var data = db.spGetChildFamilyForLEdgerOfFammily(SchoolId, SchoolYearId);
                foreach (var d in data)
                {
                    objChildFamily             = new DayCarePL.ChildFamilyProperties();
                    objChildFamily.Id          = d.Id;
                    objChildFamily.Email       = d.Email;
                    objChildFamily.FamilyTitle = d.FamilyTitle;
                    objChildFamily.HomePhone   = d.HomePhone;
                    if (d.ChildName.Length > 0)
                    {
                        objChildFamily.ChildName = "[ " + d.ChildName.Substring(0, d.ChildName.LastIndexOf(", ")) + " ]";
                    }
                    objChildFamily.Debit  = d.Debit;
                    objChildFamily.Credit = d.Credit;

                    try
                    {
                        objChildFamily.OpBal = d.OpBal.HasValue ? d.OpBal.Value : 0;
                    }
                    catch
                    {
                        objChildFamily.OpBal = 0;
                    }
                    objChildFamily.Balance = d.Balance + objChildFamily.OpBal;// d.Debit - d.Credit;
                    try
                    {
                        objChildFamily.Active = d.Active == null ? false : d.Active.Value;
                    }
                    catch
                    {
                        objChildFamily.Active = false;
                    }

                    lstChildFamily.Add(objChildFamily);
                }
                return(lstChildFamily);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clLedgerOfFamily, "LoadChildFamily", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }