public void TesCan_GetAll()
        {
            var repo = new FacilityHardwareInventoryRespository();
            var facilityHardwareList = repo.GetAll();

            Assert.IsNotNull(facilityHardwareList);
        }
        public List<FacilityHardwareInventoryModel> GetAllFacilityHardware()
        {
            var hardwareList = new List<FacilityHardwareInventoryModel>();
            var repo = new FacilityHardwareInventoryRespository();
            var facData = new FacilityData();
            var dataList = repo.GetAll();
            foreach ( var item in dataList )
            {
                var hardware = new FacilityHardwareInventoryModel();

                hardware.FacilityHardwareInventoryId = GetDataValue(item.faclty_hw_invtry_id);
                hardware.FacilityId = GetDataValue(item.faclty_id);
                hardware.Facility = facData.GetFacility(item.faclty_id).HealthCareFacility;
                hardware.ItemDescription = GetDataValue(item.itm_descn);
                hardware.MacAddress = GetDataValue(item.mac_addr);
                hardware.ApplicationVersion = GetDataValue(item.aplctn_vrsn);
                hardware.HardwareStatus = GetDataValue(item.hw_stat);
                hardware.CreateDate = GetDataValue(item.rec_creat_dt);
                hardware.CreatedBy = GetDataValue(item.rec_creat_user_id_cd);
                hardware.UpdateDate = GetDataValue(item.rec_updt_dt);
                hardware.UpdatedBy = GetDataValue(item.rec_updt_user_id_cd);

                hardwareList.Add(hardware);

            }

            return hardwareList;
        }
        public int CreateFacilityHardwareInventory(FacilityHardwareInventoryModel model)
        {
            var repo = new FacilityHardwareInventoryRespository();
            var dataModel = new HealthInformationProgram.Data.Tables.faclty_hw_invtry();

            try
            {

                dataModel.faclty_id = Convert.ToDecimal(model.FacilityId);
                dataModel.aplctn_vrsn = model.ApplicationVersion;
                dataModel.hw_stat = model.HardwareStatus;
                dataModel.itm_descn = model.ItemDescription;
                dataModel.mac_addr = model.MacAddress;
                dataModel.rec_creat_dt = DateTime.Now;
                dataModel.rec_creat_user_id_cd = model.CreatedBy;
                dataModel.rec_updt_dt = DateTime.Now;
                dataModel.rec_updt_user_id_cd = model.UpdatedBy;

              var result=  repo.CreateFacilityHardware(dataModel);

              return result;
            }
            catch ( Exception ex )
            {
                throw ex;
            }
        }
        public decimal? SaveOfficeVisit(OfficeVisitModel officeVisitModel)
        {
            OfficeVisitData officeVisitData = new OfficeVisitData();
            decimal? ov_idAfterSave = officeVisitModel.OfficeVisitId;

            FacilityHardwareInventoryRespository FacilityHardwareInventoryRespository =
                new FacilityHardwareInventoryRespository();

            List<faclty_hw_invtry> allFacilityHardwareInventoryRecords = FacilityHardwareInventoryRespository.GetAll();
            faclty_hw_invtry facilityHardwareInventory = (from webAdminFacilityHardwareInventoryIds in allFacilityHardwareInventoryRecords
                                                          where webAdminFacilityHardwareInventoryIds.itm_descn == "Website- Hip Admin"
                                                          select webAdminFacilityHardwareInventoryIds).FirstOrDefault();
            if (facilityHardwareInventory != null)
            {
                if (officeVisitModel.OfficeVisitId > 0)
                {
                    officeVisitModel.FacilityHardwareId = (decimal)facilityHardwareInventory.faclty_hw_invtry_id;
                    officeVisitData.UpdateVisit(officeVisitModel);
                }
                else
                {
                    ov_idAfterSave = officeVisitData.CreateVisit(officeVisitModel);
                }
            }

            return ov_idAfterSave;
        }
        public FacilityHardwareInventoryModel GetFacilityHardware(string id)
        {
            var hardware = new FacilityHardwareInventoryModel();
            var repo = new FacilityHardwareInventoryRespository();
            var dataItem = repo.GetFacilityHardware(Convert.ToDecimal(id));
            var facData = new FacilityData();

            hardware.FacilityHardwareInventoryId = GetDataValue(dataItem.faclty_hw_invtry_id);
            hardware.FacilityId = GetDataValue(dataItem.faclty_id);
            hardware.Facility = facData.GetFacility(dataItem.faclty_id).HealthCareFacility; hardware.ItemDescription = GetDataValue(dataItem.itm_descn);
            hardware.MacAddress = GetDataValue(dataItem.mac_addr);
            hardware.ApplicationVersion = GetDataValue(dataItem.aplctn_vrsn);
            hardware.HardwareStatus = GetDataValue(dataItem.hw_stat);
            hardware.CreateDate = GetDataValue(dataItem.rec_creat_dt);
            hardware.CreatedBy = GetDataValue(dataItem.rec_creat_user_id_cd);
            hardware.UpdateDate = GetDataValue(dataItem.rec_updt_dt);
            hardware.UpdatedBy = GetDataValue(dataItem.rec_updt_user_id_cd);

            return hardware;
        }