예제 #1
0
        public static DayCarePL.ChildFamilyProperties LoadChildFamilyById(Guid Id, Guid CurrentSchoolyearId)
        {
            clConnection.DoConnection();
            DayCareDataContext db = new DayCareDataContext();

            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clChildFamily, "LoadChildFamilyById", "Execute LoadChildFamilyById Method", DayCarePL.Common.GUID_DEFAULT);
            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clChildFamily, "LoadChildFamilyById", "Debug LoadChildFamilyById Method", DayCarePL.Common.GUID_DEFAULT);
                DayCarePL.ChildFamilyProperties objChildFamilyId = null;
                SortedList sl = new SortedList();
                sl.Add("@Id", Id);
                sl.Add("@CurrentSchoolyearId", CurrentSchoolyearId);
                objChildFamilyId           = new DayCarePL.ChildFamilyProperties();
                objChildFamilyId.lstFamily = new List <DayCarePL.FamilyDataProperties>();
                DayCarePL.FamilyDataProperties objFamilyData;
                var data = db.spGetChildFamilyById(Id, CurrentSchoolyearId);

                foreach (var d in data)
                {
                    if (objChildFamilyId.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                    {
                        objChildFamilyId.Id                   = d.ChildFamilyId;
                        objChildFamilyId.SchoolId             = d.SchoolId;
                        objChildFamilyId.FamilyTitle          = d.FamilyTitle;
                        objChildFamilyId.UserName             = d.UserName;
                        objChildFamilyId.Password             = d.Password;
                        objChildFamilyId.Code                 = d.Code;
                        objChildFamilyId.Address1             = d.Address1;
                        objChildFamilyId.Address2             = d.Address2;
                        objChildFamilyId.City                 = d.City;
                        objChildFamilyId.StateId              = d.StateId;
                        objChildFamilyId.Zip                  = d.Zip;
                        objChildFamilyId.HomePhone            = d.HomePhone;
                        objChildFamilyId.Comments             = d.Comments;
                        objChildFamilyId.Active               = d.Active;
                        objChildFamilyId.MsgDisplayed         = d.MsgDisplayed;
                        objChildFamilyId.MsgStartDate         = d.MsgStartDate;
                        objChildFamilyId.MsgEndDate           = d.MsgEndDate;
                        objChildFamilyId.MsgActive            = d.MsgActive;
                        objChildFamilyId.CreatedById          = d.ChildFamilyCreatedById;
                        objChildFamilyId.CreatedDateTime      = d.ChildFamilyCreateDateTime;
                        objChildFamilyId.LastModifiedById     = d.ChildFamilyLastModifiedById;
                        objChildFamilyId.LastModifiedDatetime = d.ChildFamilyLastModifiedDateTime;
                    }
                    objFamilyData                      = new DayCarePL.FamilyDataProperties();
                    objFamilyData.Id                   = d.FamilyDataId;
                    objFamilyData.RelationShipId       = d.RelationShipId;
                    objFamilyData.FirstName            = d.FamilyFirstName;
                    objFamilyData.LastName             = d.FamilyLastName;
                    objFamilyData.Email                = d.Email;
                    objFamilyData.Phone1Type           = d.FamilyPhone1Type;
                    objFamilyData.Phone1               = d.FamilyPhone1;
                    objFamilyData.Phone2Type           = d.FamilyPhone2Type;
                    objFamilyData.Phone2               = d.FamilyPhone2;
                    objFamilyData.Photo                = d.Photo;
                    objFamilyData.GuardianIndex        = d.Guardian;
                    objFamilyData.CreatedById          = d.FamilyCreatedById;
                    objFamilyData.CreatedDateTime      = d.FamilyCreateDateTime;
                    objFamilyData.LastModifiedById     = d.FamilyLastModifiedById;
                    objFamilyData.LastModifiedDatetime = d.FamilyLastModifiedDateTime;
                    objChildFamilyId.lstFamily.Add(objFamilyData);
                }
                return(objChildFamilyId);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clChildFamily, "LoadChildFamilyById", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }