Beispiel #1
0
        public ActionResult Login(string userName, string password)
        {
            try
            {
                if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password))
                {
                    DoctorDetailsModel dbm = new DoctorDetailsModel().UserAuthentication(userName, password);
                    if (dbm != null)
                    {
                        Session["DocName"] = dbm.UserName;
                        Session["DocId"] = dbm.Id;

                        return RedirectToAction("AddPatient", "Disease");
                    }
                    else
                    {
                        TempData["Error"] = "Invalid Username or Password.";
                    }

                }
                else
                {
                    TempData["Error"] = "Please enter Username or Password.";
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }

            return View();
        }
Beispiel #2
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();
            }
        }
Beispiel #3
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();
            }
        }
Beispiel #4
0
 public ActionResult Registration()
 {
     var model = new DoctorDetailsModel()
     {
         Areas = GetAreas()
     };
     return View(model);
 }
Beispiel #5
0
        public ActionResult Registration(DoctorDetailsModel doctorDetailsModel)
        {
            try
            {

                if (ModelState.IsValid)
                {
                    DoctorDetailsModel dbm = new DoctorDetailsModel().GetDoctorDetailByUserName(doctorDetailsModel.UserName);
                    if (dbm == null)
                    {
                        doctorDetailsModel.CreateDate = DateTime.Now;
                        doctorDetailsModel.Save();
                        TempData["Success"] = "You have successfully registered";

                        ModelState.Clear();
                        //making form empty after submission of the data.
                        var model1 = new DoctorDetailsModel()
                        {
                            Areas = GetAreas()
                        };
                        return View(model1);
                    }
                    else
                    {
                        TempData["Error"] = "User Name already exist. Please choose another User name.";

                    }
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }

            var model = new DoctorDetailsModel()
            {
                Areas = GetAreas()
            };

            return View(model);
        }
Beispiel #6
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();
            }
        }
Beispiel #7
0
        public DoctorDetailsModel UserAuthentication(string userName, string password)
        {
            try
            {
                string Q_CheckUserName = "******";

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

                string cmdText = string.Format(Q_CheckUserName, ParameterFormater.FormatParameter(userName), ParameterFormater.FormatParameter(password));

                Database db = new Database();

                DbDataReader reader = db.Select(cmdText);

                if (reader.HasRows)
                {
                    DoctorDetailsModel doctorDetails = new DoctorDetailsModel();

                    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();
            }
        }