Example #1
0
        /// <summary>
        ///inserting new record in databse
        /// </summary>
        public void Save()
        {
            try
            {
                string Q_SaveAreaMasterDetail = "insert into areamaster(AreaName, ShortAreaName) values({0}','{1}')";

                Logger.Debug("AreaMasterModel", "Save", "Assigning values to query.");
                string cmdText = string.Format(Q_SaveAreaMasterDetail, ParameterFormater.FormatParameter(this.AreaName), ParameterFormater.FormatParameter(this.ShortAreaName));

                Logger.Debug("AreaMasterModel", "Save", "Formatting the special character");
                Database db = new Database();
                Logger.Debug("AreaMasterModel", "Save", "Database object created.");

                Logger.Debug("AreaMasterModel", "Save", "Before inserting value in database");
                db.Insert(cmdText);
                Logger.Debug("AreaMasterModel", "Save", "After value inserted in database");
            }
            catch (Exception ex)
            {
                Logger.Error("AreaMasterModel", "Save", "Error occured while saving area master detail", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("AreaMasterModel", "Save", "Killing sleep connection.");
                Database.KillConnections();
            }
        }
Example #2
0
        /// <summary>
        /// Updating existing record in database
        /// </summary>
        public void Update()
        {
            try
            {
                string Q_UpdateAreaMasterDetail = "Update areamaster set AreaName = '{0}', ShortAreaName = '{1}' where Id = {2}";

                Logger.Debug("AreaMasterModel", "Update", "Assigning values to query.");
                string cmdText = string.Format(Q_UpdateAreaMasterDetail, ParameterFormater.FormatParameter(this.AreaName), ParameterFormater.FormatParameter(this.ShortAreaName), this.AreaId);
                Logger.Debug("AreaMasterModel", "Update", "Formatting the special character.");


                Database db = new Database();
                Logger.Debug("AreaMasterModel", "Update", "Database object created.");

                Logger.Debug("AreaMasterModel", "Update", "Before Update value in database.");
                db.Update(cmdText);
                Logger.Debug("AreaMasterModel", "Update", "Updated value in database.");
            }
            catch (Exception ex)
            {
                Logger.Error("AreaMasterModel", "Update", "Error occured while updating area master detail", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("AreaMasterModel", "Update", "Killing sleep connection.");
                Database.KillConnections();
            }
        }
Example #3
0
        /// <summary>
        /// Updating existing record into Disease details
        /// </summary>
        public void Update()
        {
            try
            {
                string Q_UpdateDoctorDetail = "Update doctordetails set DoctorName = '{0}', Department = '{1}', MobileNumber = '{2}', Adderess = '{3}', AreaId = {4}, Username = '******', Password = '******', CreatedDate = '{7}' where Id = {8}";

                Logger.Debug("DoctorDetailsModel", "Update", "Assigning values to query.");
                string cmdText = string.Format(Q_UpdateDoctorDetail, ParameterFormater.FormatParameter(this.DoctorName), ParameterFormater.FormatParameter(this.Department), this.MobileNumber, ParameterFormater.FormatParameter(this.Address), this.AreaId, ParameterFormater.FormatParameter(this.UserName), ParameterFormater.FormatParameter(this.Password), this.CreateDate.ToString("yyyy/MM/dd HH:mm:ss.fff"), this.Id);
                Logger.Debug("DoctorDetailsModel", "Update", "Formatting the special character.");


                Database db = new Database();
                Logger.Debug("DoctorDetailsModel", "Update", "Database object created.");

                Logger.Debug("DoctorDetailsModel", "Update", "Before Update value in database.");
                db.Update(cmdText);
                Logger.Debug("DoctorDetailsModel", "Update", "Updated value in database.");
            }
            catch (Exception ex)
            {
                Logger.Error("DoctorDetailsModel", "Update", "Error occured while updating area master detail", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("DoctorDetailsModel", "Update", "Killing sleep connection.");
                Database.KillConnections();
            }
        }
Example #4
0
        public void Save()
        {
            try
            {
                string Q_DoctorDetailModel = "insert into doctordetails(Id, DoctorName, Department, MobileNumber, Address, AreaId, Username, Password, CreatedDate) values({0}, '{1}', '{2}', {3}, '{4}', {5}, '{6}', '{7}', '{8}')";

                Logger.Debug("DoctorDetailsModel", "Save", "Assigning values to query.");
                string cmdText = string.Format(Q_DoctorDetailModel, this.Id, ParameterFormater.FormatParameter(this.DoctorName), ParameterFormater.FormatParameter(this.Department), this.MobileNumber, ParameterFormater.FormatParameter(this.Address), this.AreaId, ParameterFormater.FormatParameter(this.UserName), this.Password, this.CreateDate.ToString("yyyy/MM/dd HH:mm:ss.fff"));

                Logger.Debug("DoctorDetailsModel", "Save", "Formatting the special character");
                Database db = new Database();
                Logger.Debug("DoctorDetailsModel", "Save", "Database object created.");

                Logger.Debug("DoctorDetailsModel", "Save", "Before inserting value in database");
                db.Insert(cmdText);
                Logger.Debug("DoctorDetailsModel", "Save", "After value inserted in database");
            }
            catch (Exception ex)
            {
                Logger.Error("DoctorDetailsModel", "Save", "Error occured while saving area master detail", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("DoctorDetailsModel", "Save", "Killing sleep connection.");
                Database.KillConnections();
            }
        }
Example #5
0
        /// <summary>
        /// Showing complete record from database
        /// </summary>
        /// <returns></returns>
        public List <AreaMasterModel> GetAreaMasterAll()
        {
            try
            {
                string Q_ShowAllAreaMasterDetail = "select * from areamaster";

                Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "Assigning value to the variable");
                string cmdText = string.Format(Q_ShowAllAreaMasterDetail, this.AreaId);

                Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "Creating database");
                Database db = new Database();
                Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "Database created");

                Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "reading data from database");
                DbDataReader reader = db.Select(cmdText);

                if (reader.HasRows)
                {
                    List <AreaMasterModel> areaMasterList = new List <AreaMasterModel>();

                    while (reader.Read())
                    {
                        AreaMasterModel areaMas = new AreaMasterModel();

                        Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "Id read from database");
                        areaMas.AreaId = Convert.ToInt32(reader["Id"]);

                        Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "AreaName read from database.");
                        areaMas.AreaName = ParameterFormater.UnescapeXML(reader["AreaName"].ToString());

                        Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "ShortAreaName read from database.");
                        areaMas.ShortAreaName = ParameterFormater.UnescapeXML(reader["ShortAreaName"].ToString());

                        Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "Adding object to list");
                        areaMasterList.Add(areaMas);
                    }

                    Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "Checking reader has closed the connection.");
                    if (!reader.IsClosed)
                    {
                        Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "closing database connection");
                        reader.Close();
                    }

                    Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "Object returning value");
                    return(areaMasterList);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.Error("AreaMasterModel", "GetAreaMasterAll", "Erro occured while Selecting data from area master detail for all", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("AreaMasterModel", "GetAreaMasterAll", "Closed sleeping connection");
                Database.KillConnections();
            }
        }
Example #6
0
        /// <summary>
        /// Showing the record from database by id
        /// </summary>
        /// <param name="areaMasterId"></param>
        /// <returns></returns>
        public AreaMasterModel GetAreaMasterById(int areaMasterId)
        {
            try
            {
                string Q_ShowAreaMasterDetail = "select * from areamaster where Id = {0}";

                Logger.Debug("AreaMasterModel", "GetAreaMasterById", "storing values in variable.");

                string cmdText = string.Format(Q_ShowAreaMasterDetail, areaMasterId);
                Logger.Debug("AreaMasterModel", "GetAreaMasterById", "storing values in variable after id check.");

                Logger.Debug("AreaMasterModel", "GetAreaMasterById", " creating Database");
                Database db = new Database();
                Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Database created");

                Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Reading value  from Database by Id");
                DbDataReader reader = db.Select(cmdText);
                Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Reading value done");

                Logger.Debug("AreaMasterModel", "GetAreaMasterById", "checking database has rows!");
                if (reader.HasRows)
                {
                    AreaMasterModel areaMaster = new AreaMasterModel();
                    Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Areamaster object created");

                    Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Reading database values");
                    while (reader.Read())
                    {
                        areaMaster.AreaId = Convert.ToInt32(reader["Id"]);
                        Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Id read from database");

                        areaMaster.AreaName = ParameterFormater.UnescapeXML(reader["AreaName"].ToString());
                        Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Areaname read from database");

                        areaMaster.ShortAreaName = ParameterFormater.UnescapeXML(reader["ShortAreaName"].ToString());
                        Logger.Debug("AreaMasterModel", "GetAreaMasterById", "ShortAreaName read from database.");
                    }

                    Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Checking reader has closed the connection.");
                    if (!reader.IsClosed)
                    {
                        Logger.Debug("AreaMasterModel", "GetAreaMasterById", "closing database connection");
                        reader.Close();
                        Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Connection closed");
                    }

                    Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Object returning value");
                    return(areaMaster);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.Error("AreaMasterModel", "Delete", "Erro occured while Selecting data from area master detail by id", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("AreaMasterModel", "GetAreaMasterById", "Closed sleeping connection");
                Database.KillConnections();
            }
        }
Example #7
0
        public DoctorDetailsModel GetDoctorDetailByUserName(string userName)
        {
            try
            {
                string Q_ShowDoctorDetailByUserName = "******";

                Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "storing values in variable.");

                string cmdText = string.Format(Q_ShowDoctorDetailByUserName, userName);
                Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "storing values in variable after id check.");

                Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", " creating Database");
                Database db = new Database();
                Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Database created");

                Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Reading value  from Database by Id");

                DbDataReader reader = db.Select(cmdText);
                Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Reading value done");

                Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "checking database has rows!");
                if (reader.HasRows)
                {
                    DoctorDetailsModel doctorDetails = new DoctorDetailsModel();
                    Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "DoctorDetail object created");

                    Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Reading database values");
                    while (reader.Read())
                    {
                        doctorDetails.Id = Convert.ToInt32(reader["Id"]);
                        Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Id read from database");

                        doctorDetails.DoctorName = ParameterFormater.UnescapeXML(reader["DoctorName"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Doctor Name read from database");

                        doctorDetails.Department = ParameterFormater.UnescapeXML(reader["Department"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Department read from database");



                        doctorDetails.MobileNumber = Convert.ToInt64(reader["MobileNumber"]);
                        Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Mobile Number read from database");

                        doctorDetails.Address = ParameterFormater.UnescapeXML(reader["Address"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Address read from database");

                        doctorDetails.AreaId = Convert.ToInt32(reader["AreaId"]);
                        Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "AreaId read from database");

                        doctorDetails.UserName = ParameterFormater.UnescapeXML(reader["Username"].ToString());
                        doctorDetails.Password = ParameterFormater.UnescapeXML(reader["Password"].ToString());

                        doctorDetails.CreateDate = Convert.ToDateTime(reader["CreatedDate"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDoctorDetailById", "Create Date read from database");

                        /*
                         * diseaseDetail.PatientAddDate = ParameterFormater.UnescapeXML(reader["PatientAddDate"].ToString());
                         * Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "ShortAreaName read from database.");diseaseDetail.DocId = Convert.ToInt32(reader["DocId"]);
                         * Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "DocId read from database");
                         */
                    }

                    Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailById", "Checking reader has closed the connection.");
                    if (!reader.IsClosed)
                    {
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailById", "closing database connection");
                        reader.Close();
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailById", "Connection closed");
                    }

                    Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailById", "Object returning value");
                    return(doctorDetails);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.Error("DoctorDetailsModel", "GetDiseaseDetailById", "Erro occured while Selecting data from disease master detail by id", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailById", "Closed sleeping connection");
                Database.KillConnections();
            }
        }
Example #8
0
        /// <summary>
        /// Showing the complete record from the diseasedetails database
        /// </summary>
        /// <returns></returns>
        public List <DoctorDetailsModel> GetDoctorDetailAll()
        {
            try
            {
                string Q_ShowAllDoctorDetail = "select * from doctordetails";

                Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Assigning value to the variable");
                string cmdText = string.Format(Q_ShowAllDoctorDetail);

                Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Creating database");
                Database db = new Database();
                Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Database created");

                Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "reading data from database");
                DbDataReader reader = db.Select(cmdText);

                if (reader.HasRows)
                {
                    List <DoctorDetailsModel> diseaseDetailList = new List <DoctorDetailsModel>();

                    while (reader.Read())
                    {
                        DoctorDetailsModel doctorDetail = new DoctorDetailsModel();

                        doctorDetail.Id = Convert.ToInt32(reader["Id"]);
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Id read from database");

                        doctorDetail.DoctorName = ParameterFormater.UnescapeXML(reader["DoctorName"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Gender read from database");

                        doctorDetail.Department = ParameterFormater.UnescapeXML(reader["Department"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "DoctorName read from database");

                        doctorDetail.MobileNumber = Convert.ToInt64(reader["MobileNumber"]);
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "MobileNumber read from database");

                        doctorDetail.Address = ParameterFormater.UnescapeXML(reader["Address"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Address read from database");

                        doctorDetail.AreaId = Convert.ToInt32(reader["AreaId"]);
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "AreaId read from database");

                        doctorDetail.UserName = ParameterFormater.UnescapeXML(reader["Username"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Username read from database");

                        doctorDetail.Password = ParameterFormater.UnescapeXML(reader["Password"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Password read from database");

                        doctorDetail.CreateDate = Convert.ToDateTime(reader["CreatedDate"].ToString());
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Patient admit date read from database");

                        diseaseDetailList.Add(doctorDetail);
                    }

                    Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Checking reader has closed the connection.");
                    if (!reader.IsClosed)
                    {
                        Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "closing database connection");
                        reader.Close();
                    }

                    Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Object returning value");
                    return(diseaseDetailList);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.Error("DoctorDetailsModel", "GetDiseaseDetailAll", "Error occured while Selecting data from disease detail for all", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("DoctorDetailsModel", "GetDiseaseDetailAll", "Closed sleeping connection");
                Database.KillConnections();
            }
        }
Example #9
0
        /// <summary>
        /// Updating existing record into Disease details
        /// </summary>
        public void Update()
        {
            try
            {
                string Q_UpdateDiseaseDetail = "Update diseasedetails set DocId = {0}, Age = {1}, Gender = '{2}', AreaId = {3}, PatientAddDate = '{4}', DiseaseId = {5} where Id = {6}";

                Logger.Debug("DiseaseDetailModel", "Update", "Assigning values to query.");
                string cmdText = string.Format(Q_UpdateDiseaseDetail, this.DocId, this.Age, ParameterFormater.FormatParameter(this.Gender), this.AreaId, this.PatientAddDate.ToString("yyyy/MM/dd HH:mm:ss.fff"), this.DiseaseId);
                Logger.Debug("DiseaseMasterModel", "Update", "Formatting the special character.");


                Database db = new Database();
                Logger.Debug("DiseaseMasterModel", "Update", "Database object created.");

                Logger.Debug("DiseaseMasterModel", "Update", "Before Update value in database.");
                db.Update(cmdText);
                Logger.Debug("DiseaseMasterModel", "Update", "Updated value in database.");
            }
            catch (Exception ex)
            {
                Logger.Error("DiseaseMasterModel", "Update", "Error occured while updating area master detail", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("DiseaseMasterModel", "Update", "Killing sleep connection.");
                Database.KillConnections();
            }
        }
Example #10
0
        /// <summary>
        /// Saving records into the database
        /// </summary>
        public void Save()
        {
            try
            {
                string Q_DiseaseDetailModel = "insert into diseasedetails(DocId, Age, Gender, AreaId, PatientAddDate, DiseaseId) values({0}, {1}, '{2}', {3}, '{4}', {5})";

                Logger.Debug("DiseaseMasterModel", "Save", "Assigning values to query.");
                string cmdText = string.Format(Q_DiseaseDetailModel, this.DocId, this.Age, ParameterFormater.FormatParameter(this.Gender), this.AreaId, this.PatientAddDate.ToString("yyyy/MM/dd HH:mm:ss.fff"), this.DiseaseId);

                Logger.Debug("DiseaseMasterModel", "Save", "Formatting the special character");
                Database db = new Database();
                Logger.Debug("DiseaseMasterModel", "Save", "Database object created.");

                Logger.Debug("DiseaseMasterModel", "Save", "Before inserting value in database");
                db.Insert(cmdText);
                Logger.Debug("DiseaseMasterModel", "Save", "After value inserted in database");
            }
            catch (Exception ex)
            {
                Logger.Error("DiseaseMasterModel", "Save", "Error occured while saving area master detail", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("DiseaseMasterModel", "Save", "Killing sleep connection.");
                Database.KillConnections();
            }
        }
Example #11
0
        /// <summary>
        /// Showing record by ID from database DiseaseDetails
        /// </summary>
        /// <param name="diseaseDetailId"></param>
        /// <returns></returns>

        public DiseaseDetailModel GetDiseaseDetailById(int diseaseDetailId)
        {
            try
            {
                string Q_ShowDiseaseDetailById = "select * from diseasedetails where Id = {0}";

                Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "storing values in variable.");

                string cmdText = string.Format(Q_ShowDiseaseDetailById, diseaseDetailId);
                Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "storing values in variable after id check.");

                Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", " creating Database");
                Database db = new Database();
                Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Database created");

                Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Reading value  from Database by Id");

                DbDataReader reader = db.Select(cmdText);
                Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Reading value done");

                Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "checking database has rows!");
                if (reader.HasRows)
                {
                    DiseaseDetailModel diseaseDetail = new DiseaseDetailModel();
                    Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Diseasemaster object created");

                    Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Reading database values");
                    while (reader.Read())
                    {
                        diseaseDetail.Id = Convert.ToInt32(reader["Id"]);
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Id read from database");

                        diseaseDetail.DocId = Convert.ToInt32(reader["DocId"]);
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "DocId read from database");

                        diseaseDetail.Age = Convert.ToInt32(reader["Age"]);
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Age read from database");

                        diseaseDetail.Gender = ParameterFormater.UnescapeXML(reader["Gender"].ToString());
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Gender read from database");

                        diseaseDetail.AreaId = Convert.ToInt32(reader["AreaId"]);
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "AreaId read from database");


                        diseaseDetail.DiseaseId = Convert.ToInt32(reader["DiseaseId"]);
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "DiseaseId read from database");


                        diseaseDetail.PatientAddDate = Convert.ToDateTime(reader["PatientAddDate"].ToString());
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Patient admit date read from database");

                        /*
                         * diseaseDetail.PatientAddDate = ParameterFormater.UnescapeXML(reader["PatientAddDate"].ToString());
                         * Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "ShortAreaName read from database.");diseaseDetail.DocId = Convert.ToInt32(reader["DocId"]);
                         * Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "DocId read from database");
                         */
                    }

                    Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Checking reader has closed the connection.");
                    if (!reader.IsClosed)
                    {
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "closing database connection");
                        reader.Close();
                        Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Connection closed");
                    }

                    Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Object returning value");
                    return(diseaseDetail);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.Error("DiseaseDetailModel", "GetDiseaseDetailById", "Erro occured while Selecting data from disease master detail by id", ex);
                throw ex;
            }
            finally
            {
                Logger.Debug("DiseaseDetailModel", "GetDiseaseDetailById", "Closed sleeping connection");
                Database.KillConnections();
            }
        }