public int Update(XRayReport xRayReport)
        {
            UpdateCommand.Parameters["@ID"].Value                                  = xRayReport.ID;
            UpdateCommand.Parameters["@PatientID"].Value                           = xRayReport.PatientID;
            UpdateCommand.Parameters["@PatientName"].Value                         = xRayReport.PatientName;
            UpdateCommand.Parameters["@DOB"].Value                                 = xRayReport.DOB;
            UpdateCommand.Parameters["@Sex"].Value                                 = xRayReport.Sex;
            UpdateCommand.Parameters["@ImagePath"].Value                           = xRayReport.ImagePath;
            UpdateCommand.Parameters["@XRayReportDate"].Value                      = xRayReport.XRayReportDate;
            UpdateCommand.Parameters["@SkeletonAndSoftTissue"].Value               = xRayReport.SkeletonAndSoftTissue;
            UpdateCommand.Parameters["@CardiacShadow"].Value                       = xRayReport.CardiacShadow;
            UpdateCommand.Parameters["@HilarandLymphaticGlands"].Value             = xRayReport.HilarandLymphaticGlands;
            UpdateCommand.Parameters["@HemidiaphragmsAndCostophrenicAngles"].Value = xRayReport.HemidiaphragmsAndCostophrenicAngles;
            UpdateCommand.Parameters["@LungFields"].Value                          = xRayReport.LungFields;
            UpdateCommand.Parameters["@EvidenceofTB"].Value                        = xRayReport.EvidenceofTB;
            UpdateCommand.Parameters["@Evidenceofold"].Value                       = xRayReport.Evidenceofold;
            UpdateCommand.Parameters["@EvidenceSuspicious"].Value                  = xRayReport.EvidenceSuspicious;
            UpdateCommand.Parameters["@ConsultantRadiologist"].Value               = xRayReport.ConsultantRadiologist;
            UpdateCommand.Parameters["@Remark"].Value                              = xRayReport.Remark;
            UpdateCommand.Parameters["@Status"].Value                              = xRayReport.Status;

            int returnValue = -1;

            try
            {
                UpdateCommand.Connection.Open();
                returnValue = UpdateCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                Logger.Write(ex);
            }
            finally
            {
                UpdateCommand.Connection.Close();
            }
            return(returnValue);
        }
        private XRayReport DataTableToEntity(DataTable dt)
        {
            XRayReport xRayReport = new XRayReport();

            if (Null.IsNotNull(dt) == true && dt.Rows.Count > 0)
            {
                if (Null.IsNotNull(dt.Rows[0]))
                {
                    DataRow dr = dt.Rows[0];
                    if (Null.IsNotNull(dr["ID"]))
                    {
                        xRayReport.ID = Convert.ToInt32(dr["ID"]);
                    }
                    else
                    {
                        xRayReport.ID = 0;
                    }
                    if (Null.IsNotNull(dr["PatientID"]))
                    {
                        xRayReport.PatientID = Convert.ToInt32(dr["PatientID"]);
                    }
                    else
                    {
                        xRayReport.PatientID = 0;
                    }
                    if (Null.IsNotNull(dr["PatientName"]))
                    {
                        xRayReport.PatientName = Convert.ToString(dr["PatientName"]);
                    }
                    else
                    {
                        xRayReport.PatientName = string.Empty;
                    }
                    if (Null.IsNotNull(dr["DOB"]))
                    {
                        xRayReport.DOB = Convert.ToDateTime(dr["DOB"]);
                    }
                    else
                    {
                        xRayReport.DOB = DateTime.Now;
                    }
                    if (Null.IsNotNull(dr["Sex"]))
                    {
                        xRayReport.Sex = Convert.ToString(dr["Sex"]);
                    }
                    else
                    {
                        xRayReport.Sex = string.Empty;
                    }
                    if (Null.IsNotNull(dr["ImagePath"]))
                    {
                        xRayReport.ImagePath = Convert.ToString(dr["ImagePath"]);
                    }
                    else
                    {
                        xRayReport.ImagePath = string.Empty;
                    }
                    if (Null.IsNotNull(dr["XRayReportDate"]))
                    {
                        xRayReport.XRayReportDate = Convert.ToDateTime(dr["XRayReportDate"]);
                    }
                    else
                    {
                        xRayReport.XRayReportDate = DateTime.Now;
                    }
                    if (Null.IsNotNull(dr["SkeletonAndSoftTissue"]))
                    {
                        xRayReport.SkeletonAndSoftTissue = Convert.ToString(dr["SkeletonAndSoftTissue"]);
                    }
                    else
                    {
                        xRayReport.SkeletonAndSoftTissue = string.Empty;
                    }
                    if (Null.IsNotNull(dr["CardiacShadow"]))
                    {
                        xRayReport.CardiacShadow = Convert.ToString(dr["CardiacShadow"]);
                    }
                    else
                    {
                        xRayReport.CardiacShadow = string.Empty;
                    }
                    if (Null.IsNotNull(dr["HilarandLymphaticGlands"]))
                    {
                        xRayReport.HilarandLymphaticGlands = Convert.ToString(dr["HilarandLymphaticGlands"]);
                    }
                    else
                    {
                        xRayReport.HilarandLymphaticGlands = string.Empty;
                    }
                    if (Null.IsNotNull(dr["HemidiaphragmsAndCostophrenicAngles"]))
                    {
                        xRayReport.HemidiaphragmsAndCostophrenicAngles = Convert.ToString(dr["HemidiaphragmsAndCostophrenicAngles"]);
                    }
                    else
                    {
                        xRayReport.HemidiaphragmsAndCostophrenicAngles = string.Empty;
                    }
                    if (Null.IsNotNull(dr["LungFields"]))
                    {
                        xRayReport.LungFields = Convert.ToString(dr["LungFields"]);
                    }
                    else
                    {
                        xRayReport.LungFields = string.Empty;
                    }
                    if (Null.IsNotNull(dr["EvidenceofTB"]))
                    {
                        xRayReport.EvidenceofTB = Convert.ToString(dr["EvidenceofTB"]);
                    }
                    else
                    {
                        xRayReport.EvidenceofTB = string.Empty;
                    }
                    if (Null.IsNotNull(dr["Evidenceofold"]))
                    {
                        xRayReport.Evidenceofold = Convert.ToString(dr["Evidenceofold"]);
                    }
                    else
                    {
                        xRayReport.Evidenceofold = string.Empty;
                    }
                    if (Null.IsNotNull(dr["EvidenceSuspicious"]))
                    {
                        xRayReport.EvidenceSuspicious = Convert.ToString(dr["EvidenceSuspicious"]);
                    }
                    else
                    {
                        xRayReport.EvidenceSuspicious = string.Empty;
                    }
                    if (Null.IsNotNull(dr["ConsultantRadiologist"]))
                    {
                        xRayReport.ConsultantRadiologist = Convert.ToString(dr["ConsultantRadiologist"]);
                    }
                    else
                    {
                        xRayReport.ConsultantRadiologist = string.Empty;
                    }
                    if (Null.IsNotNull(dr["Remark"]))
                    {
                        xRayReport.Remark = Convert.ToString(dr["Remark"]);
                    }
                    else
                    {
                        xRayReport.Remark = string.Empty;
                    }
                    if (Null.IsNotNull(dr["Status"]))
                    {
                        xRayReport.Status = Convert.ToString(dr["Status"]);
                    }
                    else
                    {
                        xRayReport.Status = string.Empty;
                    }
                }
            }
            return(xRayReport);
        }