示例#1
0
        public GetInsureeModel Get(string chfid)
        {
            GetInsureeModel response = new GetInsureeModel();

            using (var imisContext = new ImisDB())
            {
                response = (from I in imisContext.TblInsuree
                            join P in imisContext.TblPhotos on I.Chfid equals P.Chfid
                            join G in imisContext.TblGender on I.Gender equals G.Code
                            where I.Chfid == chfid &&
                            I.ValidityTo == null &&
                            P.ValidityTo == null
                            select new GetInsureeModel()
                {
                    CHFID = I.Chfid,
                    DOB = I.Dob,
                    Gender = G.Gender,
                    InsureeName = I.LastName + " " + I.OtherNames,
                    PhotoPath = P.PhotoFolder + P.PhotoFileName
                }).FirstOrDefault();
            }

            return(response);
        }
示例#2
0
        public GetInsureeModel Get(string chfid)
        {
            GetInsureeModel response = new GetInsureeModel();

            try
            {
                using (var imisContext = new ImisDB())
                {
                    response = (from I in imisContext.TblInsuree
                                join P in imisContext.TblPhotos on I.Chfid equals P.Chfid
                                join G in imisContext.TblGender on I.Gender equals G.Code
                                where I.Chfid == chfid &&
                                I.ValidityTo == null &&
                                P.ValidityTo == null
                                select new GetInsureeModel()
                    {
                        CHFID = I.Chfid,
                        DOB = I.Dob.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture),
                        Gender = G.Gender,
                        InsureeName = I.LastName + " " + I.OtherNames,
                        PhotoPath = P.PhotoFolder + P.PhotoFileName
                    })
                               .FirstOrDefault();
                }

                return(response);
            }
            catch (SqlException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw e;
            }
        }