public ActionResult MedicalRegister(MedicalAccount aMedicalAccount)
        {
            string verifying = null;

            if (ModelState.IsValid)
            {
                if (aMedicalAccount.MedicalContactNo2 == null)
                {
                    aMedicalAccount.MedicalContactNo2 = "";
                }
                if (aMedicalAccount.AmbulanceContact == null)
                {
                    aMedicalAccount.AmbulanceContact = "";
                }
                aMedicalAccount.Role               = "Medical";
                aMedicalAccount.Password           = Crypto.Hash(aMedicalAccount.Password);
                aMedicalAccount.ActivationCode     = Guid.NewGuid();
                aMedicalAccount.IsEmailVerified    = true;
                aMedicalAccount.Status             = "Active";
                aMedicalAccount.AccountCreatedDate = DateTime.Now.ToLongDateString();
                verifying = aMedicalManager.Save(aMedicalAccount);
            }
            if (verifying == "Success")
            {
                //SendEmailVerificationLink(aMedicalAccount.MedicalEmail, aMedicalAccount.ActivationCode.ToString());
                ViewBag.Message = "Account request successfully completed. An activation link has been sent to your email. Please check your email to verified the account";
                ViewBag.Status  = true;
            }
            else
            {
                ViewBag.Message = verifying;
                ViewBag.Status  = false;
            }
            return(View());
        }
Beispiel #2
0
        public List <MedicalAccount> GetAllMedicals()
        {
            Query   = "SELECT * FROM MedicalAccounts ORDER BY Status DESC";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            List <MedicalAccount> medicalAccounts = new List <MedicalAccount>();

            while (Reader.Read())
            {
                MedicalAccount medicalAccount = new MedicalAccount();
                medicalAccount.MedicalId            = Convert.ToInt32(Reader["MedicalId"]);
                medicalAccount.MedicalType          = Reader["MedicalType"].ToString();
                medicalAccount.MedicalName          = Reader["MedicalName"].ToString();
                medicalAccount.ContactPersonName    = Reader["ContactPersonName"].ToString();
                medicalAccount.ContactPersonPhoneNo = Reader["ContactPersonPhoneNo"].ToString();
                medicalAccount.MedicalEmail         = Reader["MedicalEmail"].ToString();
                medicalAccount.Address            = Reader["Address"].ToString();
                medicalAccount.City               = Reader["City"].ToString();
                medicalAccount.Status             = Reader["Status"].ToString();
                medicalAccount.AccountCreatedDate = Reader["AccountCreatedDate"].ToString();
                DateTime newDate = Convert.ToDateTime(medicalAccount.AccountCreatedDate);
                medicalAccount.AccountCreatedDate = newDate.ToString("dd/MM/yyyy");
                medicalAccounts.Add(medicalAccount);
            }
            Reader.Close();
            Connection.Close();
            return(medicalAccounts);
        }
Beispiel #3
0
        public int Save(MedicalAccount aMedicalAccount)
        {
            Query   = "INSERT INTO MedicalAccounts VALUES(@role, @medicalType, @medicalName, @contactPersonName, @contactPersonPosition, @contactPersonPhoneNo, @medicalEmail, @medicalContactNo1, @medicalContactNo2, @address, @area, @city, @ambulanceService, @ambulanceContact, @password, @isEmailVerified, @activationCode, @status, @accountCreatedDate)";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("role", aMedicalAccount.Role);
            Command.Parameters.AddWithValue("medicalType", aMedicalAccount.MedicalType);
            Command.Parameters.AddWithValue("medicalName", aMedicalAccount.MedicalName);
            Command.Parameters.AddWithValue("contactPersonName", aMedicalAccount.ContactPersonName);
            Command.Parameters.AddWithValue("contactPersonPosition", aMedicalAccount.ContactPersonPosition);
            Command.Parameters.AddWithValue("contactPersonPhoneNo", aMedicalAccount.ContactPersonPhoneNo);
            Command.Parameters.AddWithValue("medicalEmail", aMedicalAccount.MedicalEmail);
            Command.Parameters.AddWithValue("medicalContactNo1", aMedicalAccount.MedicalContactNo1);
            Command.Parameters.AddWithValue("medicalContactNo2", aMedicalAccount.MedicalContactNo2);
            Command.Parameters.AddWithValue("address", aMedicalAccount.Address);
            Command.Parameters.AddWithValue("area", aMedicalAccount.Area);
            Command.Parameters.AddWithValue("city", aMedicalAccount.City);
            Command.Parameters.AddWithValue("ambulanceService", aMedicalAccount.AmbulanceService);
            Command.Parameters.AddWithValue("ambulanceContact", aMedicalAccount.AmbulanceContact);
            Command.Parameters.AddWithValue("password", aMedicalAccount.Password);
            Command.Parameters.AddWithValue("isEmailVerified", aMedicalAccount.IsEmailVerified);
            Command.Parameters.AddWithValue("activationCode", aMedicalAccount.ActivationCode);
            Command.Parameters.AddWithValue("status", aMedicalAccount.Status);
            Command.Parameters.AddWithValue("accountCreatedDate", aMedicalAccount.AccountCreatedDate);
            Connection.Open();
            int rowAffected = Command.ExecuteNonQuery();

            Connection.Close();
            return(rowAffected);
        }
Beispiel #4
0
        public MedicalAccount GetMedicalSearchViewInfo(int medicalId)
        {
            Query   = "SELECT * FROM MedicalAccounts WHERE MedicalId = @medicalId";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("medicalId", medicalId);
            Command.Connection.Open();
            Reader = Command.ExecuteReader();
            MedicalAccount aMedicalAccount = null;

            if (Reader.HasRows)
            {
                Reader.Read();
                aMedicalAccount                       = new MedicalAccount();
                aMedicalAccount.MedicalId             = Convert.ToInt32(Reader["MedicalId"]);
                aMedicalAccount.MedicalType           = Reader["MedicalType"].ToString();
                aMedicalAccount.MedicalName           = Reader["MedicalName"].ToString();
                aMedicalAccount.ContactPersonName     = Reader["ContactPersonName"].ToString();
                aMedicalAccount.ContactPersonPosition = Reader["ContactPersonPosition"].ToString();
                aMedicalAccount.ContactPersonPhoneNo  = Reader["ContactPersonPhoneNo"].ToString();
                aMedicalAccount.MedicalEmail          = Reader["MedicalEmail"].ToString();
                aMedicalAccount.MedicalContactNo1     = Reader["MedicalContact1"].ToString();
                aMedicalAccount.MedicalContactNo2     = Reader["MedicalContact2"].ToString();
                aMedicalAccount.Address               = Reader["Address"].ToString();
                aMedicalAccount.Area                  = Reader["Area"].ToString();
                aMedicalAccount.City                  = Reader["City"].ToString();
                aMedicalAccount.AmbulanceService      = Reader["AmbulanceService"].ToString();
                aMedicalAccount.AmbulanceContact      = Reader["AmbulanceContact"].ToString();
            }
            Reader.Close();
            Command.Connection.Close();
            return(aMedicalAccount);
        }
 public string Save(MedicalAccount aMedicalAccount)
 {
     if (aMedicalGateway.IsEmailExists(aMedicalAccount.MedicalEmail) == false)
     {
         if (aMedicalGateway.IsMobileNoExists(aMedicalAccount.MedicalContactNo1) == false)
         {
             int rowAffected = aMedicalGateway.Save(aMedicalAccount);
             if (rowAffected > 0)
             {
                 return("Success");
             }
             else
             {
                 return("Medical registration is not successful!");
             }
         }
         else
         {
             return("Medical contact number is already used. Try another!");
         }
     }
     else
     {
         return("The email is already exists. Please, Try to give another Email.");
     }
 }
Beispiel #6
0
 public ActionResult MedicalProfile()
 {
     if (User.IsInRole("Medical"))
     {
         MedicalAccount aMedicalAccount = aMedicalManager.GetMedicalData(MedicalUsername);
         ViewBag.GetMedical = aMedicalAccount;
     }
     ViewBag.GetName = GetMedicalData().MedicalName;
     return(View());
 }
Beispiel #7
0
        //
        private MedicalAccount GetMedicalData()
        {
            MedicalAccount aMedicalAccount = new MedicalAccount();

            if (User.IsInRole("Medical"))
            {
                aMedicalAccount = aMedicalManager.GetMedicalData(MedicalUsername);
            }
            return(aMedicalAccount);
        }
Beispiel #8
0
        public MedicalAccount GetMedicalSearchViewInfo(int medicalId)
        {
            MedicalAccount aMedicalAccount = aHomeGateway.GetMedicalSearchViewInfo(medicalId);

            aMedicalAccount.ViewDoctors        = aMedicalGateway.GetAllDoctors(medicalId);
            aMedicalAccount.HospitalSerives    = aMedicalGateway.GetHospitalServices(medicalId);
            aMedicalAccount.DiagnosticServices = aMedicalGateway.GetDiagnosticServices(medicalId);
            aMedicalAccount.OtherServices      = aMedicalGateway.GetOtherServices(medicalId);
            aMedicalAccount.MedicalFacilities  = aMedicalGateway.GetMedicalFacilities(medicalId);
            aMedicalAccount.Consultants        = aMedicalGateway.GetMedicalConsultants(medicalId);
            aMedicalAccount.MedicalService     = aMedicalGateway.GetEmergencyDetails(medicalId);
            return(aMedicalAccount);
        }
        public string UpdateMedicalProfile(MedicalAccount aMedicalAccount)
        {
            int rowAffected = aMedicalGateway.UpdateMedicalProfile(aMedicalAccount);

            if (rowAffected > 0)
            {
                return("Medical profile updated successfully.");
            }
            else
            {
                return("Medical profile updating failed.");
            }
        }
        public List <MedicalAccount> GetMedicalSearchResult(SearchModel aSearchModel, string keyword)
        {
            List <MedicalAccount> medicalAccounts = new List <MedicalAccount>();

            if (keyword == "Medical")
            {
                Query   = "SELECT * FROM MedicalAccounts WHERE Address LIKE '%'+@address+'%' OR Area LIKE '%'+@area+'%' OR City LIKE '%'+@city+'%' AND Role = 'Medical'";
                Command = new SqlCommand(Query, Connection);
                Command.Parameters.AddWithValue("address", aSearchModel.Location);
                Command.Parameters.AddWithValue("area", aSearchModel.Location);
                Command.Parameters.AddWithValue("city", aSearchModel.Location);
                Command.Parameters.AddWithValue("searchKeyword", keyword);
            }
            else
            {
                Query   = "SELECT * FROM MedicalAccounts WHERE (Address LIKE '%'+@address+'%' OR Area LIKE '%'+@area+'%' OR City LIKE '%'+@city+'%') AND (MedicalName LIKE '%' + @searchKeyword2 + '%' OR MedicalType LIKE '%'+@searchKeyword3+'%')";
                Command = new SqlCommand(Query, Connection);
                Command.Parameters.AddWithValue("address", aSearchModel.Location);
                Command.Parameters.AddWithValue("area", aSearchModel.Location);
                Command.Parameters.AddWithValue("city", aSearchModel.Location);
                Command.Parameters.AddWithValue("searchKeyword2", aSearchModel.SearchString);
                Command.Parameters.AddWithValue("searchKeyword3", aSearchModel.SearchString);
            }
            Connection.Open();
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                MedicalAccount aMedicalAccount = new MedicalAccount();
                aMedicalAccount.MedicalId         = Convert.ToInt32(Reader["MedicalId"]);
                aMedicalAccount.MedicalName       = Reader["MedicalName"].ToString();
                aMedicalAccount.MedicalEmail      = Reader["MedicalEmail"].ToString();
                aMedicalAccount.MedicalContactNo1 = Reader["MedicalContact1"].ToString();
                aMedicalAccount.MedicalContactNo2 = Reader["MedicalContact2"].ToString();
                aMedicalAccount.Address           = Reader["Address"].ToString();
                aMedicalAccount.Area             = Reader["Area"].ToString();
                aMedicalAccount.City             = Reader["City"].ToString();
                aMedicalAccount.AmbulanceService = Reader["AmbulanceService"].ToString();
                aMedicalAccount.AmbulanceContact = Reader["AmbulanceContact"].ToString();
                medicalAccounts.Add(aMedicalAccount);
            }
            Reader.Close();
            Connection.Close();
            return(medicalAccounts);
        }
Beispiel #11
0
 public ActionResult MedicalProfile(MedicalAccount aMedicalAccount)
 {
     if (aMedicalAccount.MedicalContactNo2 == null)
     {
         aMedicalAccount.MedicalContactNo2 = "";
     }
     if (aMedicalAccount.AmbulanceContact == null)
     {
         aMedicalAccount.AmbulanceContact = "";
     }
     if (User.IsInRole("Medical"))
     {
         ViewBag.Message    = aMedicalManager.UpdateMedicalProfile(aMedicalAccount);
         aMedicalAccount    = aMedicalManager.GetMedicalData(MedicalUsername);
         ViewBag.GetMedical = aMedicalAccount;
     }
     ViewBag.GetName = GetMedicalData().MedicalName;
     return(View());
 }
Beispiel #12
0
        public MedicalAccount IsMedicalLoginVerified(string aLoginEmail)
        {
            Query   = "SELECT IsEmailVerified, Status FROM MedicalAccounts WHERE MedicalEmail = @aLoginEmail";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("aLoginEmail", aLoginEmail);
            Connection.Open();
            Reader = Command.ExecuteReader();
            MedicalAccount medicalAccount = null;

            while (Reader.Read())
            {
                medicalAccount = new MedicalAccount();
                medicalAccount.IsEmailVerified = Convert.ToBoolean(Reader["IsEmailVerified"]);
                medicalAccount.Status          = Reader["Status"].ToString();
            }
            Reader.Close();
            Connection.Close();
            return(medicalAccount);
        }
Beispiel #13
0
        public string GetMedicalRole(string username)
        {
            Query   = "SELECT Role FROM MedicalAccounts WHERE MedicalEmail = @username";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("username", username);
            Connection.Open();
            Reader = Command.ExecuteReader();
            MedicalAccount aMedicalAccount = null;
            string         role            = "";

            if (Reader.Read())
            {
                aMedicalAccount      = new MedicalAccount();
                aMedicalAccount.Role = Reader["Role"].ToString();
                role = aMedicalAccount.Role;
            }
            Reader.Close();
            Connection.Close();
            return(role);
        }
Beispiel #14
0
        public int UpdateMedicalProfile(MedicalAccount aMedicalAccount)
        {
            Query   = "UPDATE MedicalAccounts SET MedicalType = @medicalType, MedicalName = @medicalName, ContactPersonName = @contactPersonName, ContactPersonPosition = @contactPersonPosition, ContactPersonPhoneNo = @contactPersonPhoneNo, MedicalContact1 = @medicalContactNo1, MedicalContact2 = @medicalContactNo2, Address = @address, Area = @area, City = @city, AmbulanceService = @ambulanceService, AmbulanceContact= @ambulanceContact WHERE MedicalEmail = @medicalEmail";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("medicalType", aMedicalAccount.MedicalType);
            Command.Parameters.AddWithValue("medicalName", aMedicalAccount.MedicalName);
            Command.Parameters.AddWithValue("contactPersonName", aMedicalAccount.ContactPersonName);
            Command.Parameters.AddWithValue("contactPersonPosition", aMedicalAccount.ContactPersonPosition);
            Command.Parameters.AddWithValue("contactPersonPhoneNo", aMedicalAccount.ContactPersonPhoneNo);
            Command.Parameters.AddWithValue("medicalContactNo1", aMedicalAccount.MedicalContactNo1);
            Command.Parameters.AddWithValue("medicalContactNo2", aMedicalAccount.MedicalContactNo2);
            Command.Parameters.AddWithValue("address", aMedicalAccount.Address);
            Command.Parameters.AddWithValue("area", aMedicalAccount.Area);
            Command.Parameters.AddWithValue("city", aMedicalAccount.City);
            Command.Parameters.AddWithValue("ambulanceService", aMedicalAccount.AmbulanceService);
            Command.Parameters.AddWithValue("ambulanceContact", aMedicalAccount.AmbulanceContact);
            Command.Parameters.AddWithValue("medicalEmail", aMedicalAccount.MedicalEmail);
            Connection.Open();
            int rowAffected = Command.ExecuteNonQuery();

            Connection.Close();
            return(rowAffected);
        }
        public ActionResult AjaxMethod(string City)
        {
            KeystoneProject.Buisness_Logic.PharmacyMaster.BL_MedicalAccount BL_obj = new BL_MedicalAccount();
            KeystoneProject.Models.PharmacyMaster.MedicalAccount            obj    = new MedicalAccount();
            List <string> searchList = new List <string>();

            DataTable td = new DataTable();
            DataSet   ds = M_account.GetCity(City, "%");

            td = M_account.GetCountryStateID(Convert.ToInt16(ds.Tables[0].Rows[0]["CityID"].ToString()));

            obj.state     = td.Rows[0]["StateName"].ToString();
            obj.country   = td.Rows[0]["CountryName"].ToString();
            obj.StateID   = td.Rows[0]["StateID"].ToString();
            obj.CountryID = td.Rows[0]["CountryID"].ToString();


            searchList.Add(obj.state);
            searchList.Add(obj.country);
            searchList.Add(obj.StateID);
            searchList.Add(obj.CountryID);

            return(Json(searchList));
        }
 public ActionResult MedicalAccount(MedicalAccount obj, FormCollection fc)
 {
     try
     {
         BL_MedicalAccount med_save = new BL_MedicalAccount();
         if (med_save.CheckAccounts(obj.AccountID, obj.AccountName))
         {
             if (med_save.Save(obj))
             {
                 if (obj.AccountID > 0)
                 {
                     ModelState.Clear();
                     TempData["Msg"] = " Medical Account Updated Successfully";
                     return(RedirectToAction("MedicalAccount", "MedicalAccount"));
                 }
                 else
                 {
                     ModelState.Clear();
                     TempData["Msg"] = " Medical Account Saved Successfully";
                     return(RedirectToAction("MedicalAccount", "MedicalAccount"));
                 }
             }
         }
         else
         {
             ViewData["flag"] = "Error";
             TempData["Msg"]  = "Medical Accounts Already Exist ";
             //TempData["msg"] = "Accounts Not Save";
         }
         return(RedirectToAction("MedicalAccount", "MedicalAccount"));
     }
     catch (Exception)
     {
         return(RedirectToAction("MedicalAccount", "MedicalAccount"));
     }
 }
        public bool Save(MedicalAccount obj)
        {
            try
            {
                Connect();
                SqlCommand cmd = new SqlCommand("IUMedicalAccounts", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
                cmd.Parameters.AddWithValue("@LocationID", LocationId);

                if (obj.AccountID == 0)
                {
                    cmd.Parameters.AddWithValue("@AccountsID", 0);
                    cmd.Parameters.AddWithValue("@Mode", "Add");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@AccountsID", obj.AccountID);
                    cmd.Parameters.AddWithValue("@Mode", "Edit");
                }

                cmd.Parameters.AddWithValue("@AccountName", obj.AccountName);
                cmd.Parameters.AddWithValue("@ReferenceCode", 0);
                cmd.Parameters.AddWithValue("@ScheduleID", obj.ScheduleID);
                cmd.Parameters.AddWithValue("@OPBalance", obj.OBType);
                if (obj.OBType == "Credit")
                {
                    cmd.Parameters.AddWithValue("@CrAmount", obj.OPBalance);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@CrAmount", 0.00);
                }


                if (obj.OBType == "Debit")
                {
                    cmd.Parameters.AddWithValue("@DrAmount", obj.OPBalance);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@DrAmount", 0.00);
                }
                cmd.Parameters.AddWithValue("@CrLimit", obj.CrLimit);
                cmd.Parameters.AddWithValue("@PrintName", obj.PrintName);
                cmd.Parameters.AddWithValue("@CreditDays", obj.CreditDays);
                cmd.Parameters.AddWithValue("@AccountType", obj.AccountType);
                cmd.Parameters.AddWithValue("@Address", obj.Address);
                cmd.Parameters.AddWithValue("@CityID", obj.CityID);
                cmd.Parameters.AddWithValue("@PinCode", obj.PinCode);
                cmd.Parameters.AddWithValue("@StateID", obj.StateID);
                cmd.Parameters.AddWithValue("@CountryID", obj.CountryID);
                cmd.Parameters.AddWithValue("@PhoneNo", obj.PhoneNo);
                cmd.Parameters.AddWithValue("@MobileNo", obj.MobileNo);
                cmd.Parameters.AddWithValue("@EmailID", obj.EmailID);
                cmd.Parameters.AddWithValue("@Remark", obj.Remark);
                cmd.Parameters.AddWithValue("@FAX", obj.FAX);
                cmd.Parameters.AddWithValue("@TinNo", obj.TinNo);
                cmd.Parameters.AddWithValue("@Pan", obj.Pan);
                cmd.Parameters.AddWithValue("@TinDate", obj.TinDate);
                cmd.Parameters.AddWithValue("@CSTNO", obj.CSTNO);
                cmd.Parameters.AddWithValue("@CreationID", UserID);

                con.Open();
                int i = cmd.ExecuteNonQuery();
                con.Close();

                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Error", new { message = ex.Message }));
            }
        }
        public ActionResult Login(Login aLogin, string returnUrl = "")
        {
            if (ModelState.IsValid)
            {
                aLogin.Password = Crypto.Hash(aLogin.Password);
                //Check User Login
                if (aUserManager.IsValid(aLogin.LoginId, aLogin.Password))
                {
                    int    timeout   = aLogin.RememberMe ? 525600 : 60; // 525600 min = 1year
                    var    ticket    = new FormsAuthenticationTicket(aLogin.LoginId, aLogin.RememberMe, timeout);
                    string encrypted = FormsAuthentication.Encrypt(ticket);
                    var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                    cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                    cookie.HttpOnly = true;
                    Response.Cookies.Add(cookie);

                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "User"));
                    }
                }
                //Check Doctor Login
                else if (aDoctorManager.IsValid(aLogin.LoginId, aLogin.Password))
                {
                    Doctors doctor = aDoctorManager.IsLoginVerified(aLogin.LoginId);
                    if (doctor.PasswordVerified)
                    {
                        if (doctor.Status == "Active")
                        {
                            int    timeout   = aLogin.RememberMe ? 525600 : 60; // 525600 min = 1year
                            var    ticket    = new FormsAuthenticationTicket(aLogin.LoginId, aLogin.RememberMe, timeout);
                            string encrypted = FormsAuthentication.Encrypt(ticket);
                            var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                            cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                            cookie.HttpOnly = true;
                            Response.Cookies.Add(cookie);

                            if (Url.IsLocalUrl(returnUrl))
                            {
                                return(Redirect(returnUrl));
                            }
                            else
                            {
                                return(RedirectToAction("Index", "Doctor"));
                            }
                        }
                        else
                        {
                            ViewBag.AccountWarningMessage = "Your account has been suspended. Please contact us to activate your account.";
                        }
                    }
                    else
                    {
                        TempData["WarningMessage"] = "Please change your temporary password";
                        ChangePassword aChangePassword = new ChangePassword();
                        aChangePassword.DoctorLoginId = aLogin.LoginId;
                        aChangePassword.OldPassword   = aLogin.Password;
                        Session["UserLoginId"]        = aChangePassword;
                        return(RedirectToAction("ChangeTemporaryPassword", "Register"));
                    }
                }
                //Check Medical Login
                else if (aMedicalManager.IsValid(aLogin.LoginId, aLogin.Password))
                {
                    MedicalAccount medicalAccount = aMedicalManager.IsMedicalLoginVerified(aLogin.LoginId);
                    if (medicalAccount.IsEmailVerified)
                    {
                        if (medicalAccount.Status == "Active")
                        {
                            int    timeout   = aLogin.RememberMe ? 525600 : 60; // 525600 min = 1year
                            var    ticket    = new FormsAuthenticationTicket(aLogin.LoginId, aLogin.RememberMe, timeout);
                            string encrypted = FormsAuthentication.Encrypt(ticket);
                            var    cookie    = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted);
                            cookie.Expires  = DateTime.Now.AddMinutes(timeout);
                            cookie.HttpOnly = true;
                            Response.Cookies.Add(cookie);

                            if (Url.IsLocalUrl(returnUrl))
                            {
                                return(Redirect(returnUrl));
                            }
                            else
                            {
                                return(RedirectToAction("Index", "Medical"));
                            }
                        }
                        else if (medicalAccount.Status == "Pending")
                        {
                            ViewBag.AccountWarningMessage = "This account request is pending. Please contact us if you want to activate.";
                        }
                        else
                        {
                            ViewBag.AccountWarningMessage = "This account has been suspended. Please contact us to activate the account.";
                        }
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "Your email has not verified yet. Please check your email and verified your account";
                    }
                }
                else
                {
                    ViewBag.ErrorMessage = "Your Email or Password is incorrect!";
                }
            }
            return(View());
        }