public void AddInvitee(Domain.Invitee inv)
        {
            Entites.sp_AddPhysician
            (
                inv.FirstName,
                inv.LastName,
                inv.PrimaryWorkplace,
                inv.Address,
                inv.City,
                inv.ProvinceID,
                inv.PostalCode,
                inv.Phone,
                inv.Fax,
                inv.OptInEmail,
                inv.Comments,
                inv.RegistrationCode,
                inv.IsAdminApproved ? 1 : 0,
                inv.PhysicianType == Enums.PhysicianType.PCP ? 1 : 2,
                inv.YourFirstName,
                inv.YourLastName,
                inv.YourEmail,

                inv.BITerritoryID,
                inv.LillyID
            );
        }
        public List <Domain.Invitee> GetAllInviteesByProvincePending(int provinceID, bool?isPCP)
        {
            List <Domain.Invitee> retLst = new List <Domain.Invitee>();

            foreach (var item in Entites.sp_GetAllInviteesPending(provinceID, isPCP.HasValue ? (isPCP.Value ? 1 : 2) : 0))
            {
                Domain.Invitee newInvitee = new Domain.Invitee();

                newInvitee.PhysicianID      = item.ID;
                newInvitee.Speciality       = item.Specialty;
                newInvitee.OneKeyID         = item.OneKeyID;
                newInvitee.RegistrationCode = item.RegCode;
                newInvitee.FirstName        = item.FirstName;
                newInvitee.LastName         = item.LastName;
                newInvitee.PrimaryWorkplace = item.PrimaryWorkplace;
                newInvitee.Address          = item.Address;
                newInvitee.City             = item.City;
                newInvitee.ProvinceID       = item.ProvinceID.HasValue ? item.ProvinceID.Value : 0;
                newInvitee.Invited          = item.Invited.HasValue ? item.Invited.Value : false;
                newInvitee.Status           = item.RegistrationStatusID;
                newInvitee.PostalCode       = item.PostalCode;
                newInvitee.Phone            = item.Phone;
                newInvitee.Fax        = item.Fax;
                newInvitee.OptInEmail = item.OptInEmail;

                newInvitee.YourFirstName = item.AdderFirstName;
                newInvitee.YourLastName  = item.AdderLastName;
                newInvitee.YourEmail     = item.AdderEmail;


                newInvitee.Province = new Domain.Province()
                {
                    ID = item.ProvinceID, Name = item.Province
                };

                newInvitee.ReStatus = new RegistrationStatus()
                {
                    ID = item.RegistrationStatusID, Name = item.Status
                };
                newInvitee.FSA = item.FSA;

                newInvitee.InvitationSentDate       = item.InvitationSentDate;
                newInvitee.InvitationSentDateFrench = item.InvitationSentDateFrench;

                newInvitee.PhysicianType = item.TypeID.Value == 1 ? VistaDM.Domain.Enums.PhysicianType.PCP : VistaDM.Domain.Enums.PhysicianType.CS;

                retLst.Add(newInvitee);
            }

            return(retLst);
        }
        public List <Domain.Invitee> GetAllInvitees(bool?isPCP)
        {
            List <Domain.Invitee> retLst = new List <Domain.Invitee>();

            foreach (var item in Entites.sp_GetAllInvitees(null, isPCP.HasValue ? (isPCP.Value ? 1 : 2) : 0))
            {
                Domain.Invitee newInvitee = new Domain.Invitee();

                newInvitee.PhysicianID      = item.ID;
                newInvitee.Speciality       = item.Specialty;
                newInvitee.OneKeyID         = item.OneKeyID;
                newInvitee.RegistrationCode = item.RegCode;
                newInvitee.FirstName        = item.FirstName;
                newInvitee.LastName         = item.LastName;
                newInvitee.PrimaryWorkplace = item.PrimaryWorkplace;
                newInvitee.Address          = item.Address;
                newInvitee.City             = item.City;
                newInvitee.ProvinceID       = item.ProvinceID.HasValue ? item.ProvinceID.Value : 0;
                newInvitee.Invited          = item.Invited.HasValue ? item.Invited.Value : false;
                newInvitee.Status           = item.RegistrationStatusID;
                newInvitee.PostalCode       = item.PostalCode;
                newInvitee.Phone            = item.Phone;
                newInvitee.Fax           = item.Fax;
                newInvitee.OptInEmail    = item.OptInEmail;
                newInvitee.BITerritoryID = item.BITerritoryID.HasValue ?  item.BITerritoryID.Value : new int?();
                newInvitee.LillyID       = string.IsNullOrEmpty(item.LillyID) ? string.Empty : item.LillyID;

                newInvitee.Province = new Domain.Province()
                {
                    ID = item.ProvinceID, Name = item.Province
                };
                newInvitee.PhysicianType = item.TypeID == 1 ? Enums.PhysicianType.PCP : Enums.PhysicianType.CS;
                newInvitee.ReStatus      = new RegistrationStatus()
                {
                    ID = item.RegistrationStatusID, Name = item.Status
                };
                newInvitee.FSA = item.FSA;

                newInvitee.InvitationSentDate       = item.InvitationSentDate;
                newInvitee.InvitationSentDateFrench = item.InvitationSentDateFrench;

                retLst.Add(newInvitee);
            }

            return(retLst);
        }
        public Domain.Invitee GetDetail(int physicianID)
        {
            Domain.Invitee retVal = new Domain.Invitee();

            var item = Entites.sp_GetInviteeDetail(physicianID).SingleOrDefault();

            if (item != null)
            {
                retVal.PhysicianID      = item.ID;
                retVal.Speciality       = item.Specialty;
                retVal.OneKeyID         = item.OneKeyID;
                retVal.RegistrationCode = item.RegCode;
                retVal.FirstName        = item.FirstName;
                retVal.LastName         = item.LastName;
                retVal.PrimaryWorkplace = item.PrimaryWorkplace;
                retVal.Address          = item.Address;
                retVal.City             = item.City;
                retVal.ProvinceID       = item.ProvinceID.HasValue ? item.ProvinceID.Value : 0;
                retVal.Invited          = item.Invited.HasValue ? item.Invited.Value : false;
                retVal.Status           = item.RegistrationStatusID;
                retVal.PostalCode       = item.PostalCode;
                retVal.Phone            = item.Phone;
                retVal.Fax        = item.Fax;
                retVal.OptInEmail = item.OptInEmail;
                retVal.Comments   = item.Comments;

                retVal.YourFirstName = item.AdderFirstName;
                retVal.YourLastName  = item.AdderLastName;
                retVal.YourEmail     = item.AdderEmail;

                retVal.BITerritoryID = item.BITerritoryID.HasValue ? item.BITerritoryID.Value : new int?();
                retVal.LillyID       = string.IsNullOrEmpty(item.LillyID) ? string.Empty : item.LillyID;
                retVal.UserName      = item.UserName;

                retVal.Province = new Domain.Province()
                {
                    ID = item.ProvinceID, Name = item.Province
                };
                retVal.PhysicianType = item.TypeID.Value == 1 ? VistaDM.Domain.Enums.PhysicianType.PCP : VistaDM.Domain.Enums.PhysicianType.CS;
                retVal.ReStatus      = new RegistrationStatus()
                {
                    ID = item.RegistrationStatusID, Name = item.Status
                };
            }
            return(retVal);
        }
        public List <Domain.Invitee> GetInviteeData(List <int> idLst)
        {
            List <Domain.Invitee> retLst = new List <Domain.Invitee>();

            foreach (var item in Entites.sp_GetAllInvitees(null, null))
            {
                if (idLst.Contains(item.ID))
                {
                    Domain.Invitee newInvitee = new Domain.Invitee();

                    newInvitee.PhysicianID      = item.ID;
                    newInvitee.Speciality       = item.Specialty;
                    newInvitee.OneKeyID         = item.OneKeyID;
                    newInvitee.RegistrationCode = item.RegCode;
                    newInvitee.FirstName        = item.FirstName;
                    newInvitee.LastName         = item.LastName;
                    newInvitee.PrimaryWorkplace = item.PrimaryWorkplace;
                    newInvitee.Address          = item.Address;
                    newInvitee.City             = item.City;
                    newInvitee.ProvinceID       = item.ProvinceID.HasValue ? item.ProvinceID.Value : 0;
                    newInvitee.Invited          = item.Invited.HasValue ? item.Invited.Value : false;
                    newInvitee.Status           = item.RegistrationStatusID;
                    newInvitee.PostalCode       = item.PostalCode;
                    newInvitee.Phone            = item.Phone;
                    newInvitee.Fax        = item.Fax;
                    newInvitee.OptInEmail = item.OptInEmail;

                    newInvitee.Province = new Domain.Province()
                    {
                        ID = item.ProvinceID, Name = item.Province
                    };
                    newInvitee.PhysicianType = item.TypeID == 1 ? Enums.PhysicianType.PCP : Enums.PhysicianType.CS;
                    newInvitee.ReStatus      = new RegistrationStatus()
                    {
                        ID = item.RegistrationStatusID, Name = item.Status
                    };
                    newInvitee.FSA = item.FSA;

                    retLst.Add(newInvitee);
                }
            }

            return(retLst);
        }
        public void UpdateInvitee(Domain.Invitee inv)
        {
            Entites.sp_UpdatePhysician
            (

                inv.PhysicianID,
                inv.FirstName,
                inv.LastName,
                inv.PrimaryWorkplace,
                inv.Address,
                inv.City,
                inv.ProvinceID,
                inv.PostalCode,
                inv.Phone,
                inv.Fax,
                inv.OptInEmail,
                inv.Comments,
                inv.BITerritoryID,
                inv.LillyID
            );
        }