Exemplo n.º 1
0
        public static string GetUserOffice(int UserID)
        {
            MbprosEntities mbprosEntities = new MbprosEntities();
            var            office         = mbprosEntities.Users.SingleOrDefault(u => u.UserId == UserID);

            return(office == null ? "" : office.OfficeName);
        }
Exemplo n.º 2
0
        public static log4net.ILog logger = log4net.LogManager.GetLogger(typeof(CommonFunctions));  //Declaring Log4Net
        public static IEnumerable GetAllDropdownList(string tableName)
        {
            MbprosEntities mbprosEntities = new MbprosEntities();

            switch (tableName)
            {
            case "STATES":
                var states = (from d in mbprosEntities.States
                              select new { ID = d.StateCode, NAME = d.StateName }).OrderBy(d => d.NAME).ToList();
                //if (states.Count > 0)
                //{
                //    states.Insert(0, new { ID = "", NAME = "" });
                //}
                return((IEnumerable)states);

            case "ArchiveOptions":
                List <Options> options = new List <Options>();
                options.Add(new Options()
                {
                    ID = 0, Name = "All"
                });
                options.Add(new Options()
                {
                    ID = 1, Name = "Archive"
                });
                options.Add(new Options()
                {
                    ID = 2, Name = "Un-Archive"
                });
                return(options);
            }

            return(Enumerable.Empty <string>());
        }
Exemplo n.º 3
0
        public List <User> GetUserSearch(UserModels userModel)
        {
            MbprosEntities mbprosEntities = new MbprosEntities();

            if (userModel == null)
            {
                userModel = new UserModels();
            }
            userModel.UserList = mbprosEntities.Users.Where(o => o.Status == true).OrderByDescending(s => s.UserId).ToList();

            if (!string.IsNullOrEmpty(userModel.UserName))
            {
                userModel.UserList = userModel.UserList.Where(x => x.UserName.ToLower().Contains(userModel.UserName.Trim().ToLower())).ToList();
            }
            if (!string.IsNullOrEmpty(userModel.OfficeName))
            {
                userModel.UserList = userModel.UserList.Where(x => x.OfficeName.ToLower().Contains(userModel.OfficeName.Trim().ToLower())).ToList();
            }
            if (!string.IsNullOrEmpty(userModel.EmailID))
            {
                userModel.UserList = userModel.UserList.Where(x => x.EmailID.ToLower().Contains(userModel.EmailID.Trim().ToLower())).ToList();
            }

            return(userModel.UserList);
        }
Exemplo n.º 4
0
        public static string GetUserEmailID(int UserID)
        {
            MbprosEntities mbprosEntities = new MbprosEntities();
            var            userEmail      = mbprosEntities.Users.SingleOrDefault(u => u.UserId == UserID);

            return(userEmail == null ? "" : userEmail.EmailID);
        }
Exemplo n.º 5
0
        public static User GetAdminUserDetails()
        {
            MbprosEntities mbprosEntities = new MbprosEntities();
            var            adminUsers     = mbprosEntities.Users.Where(u => u.IsAdmin == true).OrderBy(u => u.UserId).ToList();

            if (adminUsers.Count > 0)
            {
                return(adminUsers[0]);
            }
            return(new User());
        }
Exemplo n.º 6
0
        public static List <string> UserMenuAccess(int userid)
        {
            MbprosEntities en          = new MbprosEntities();
            var            lstFeatures = (from u in en.Feature_User
                                          join m in en.FeatureMasters on u.FeatureID equals m.FeatureID
                                          where u.UserID == userid && u.CanView == true
                                          select m.FeatureName).ToList();


            return(lstFeatures);
        }
Exemplo n.º 7
0
        private bool IsUserExist(string userName)
        {
            MbprosEntities mbprosEntities = new MbprosEntities();
            var            user           = mbprosEntities.Users.Where(model => model.UserName == userName).ToList();

            if (user.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 8
0
        public static int GetNextPatientBillingID()
        {
            MbprosEntities mbprosEntities = new MbprosEntities();
            int            nextPatientID  = 1;
            var            patientBilling = mbprosEntities.PatientBillings.OrderByDescending(u => u.PatientBillingID).FirstOrDefault();

            if (patientBilling != null)
            {
                nextPatientID = patientBilling.PatientBillingID + 1;
            }
            return(nextPatientID);
        }
Exemplo n.º 9
0
        //Other Functions
        public JsonResult DeleteBillingRecord(int patientBillingID)
        {
            MbprosEntities mbprosEntities  = new MbprosEntities();
            var            patientBillings = mbprosEntities.PatientBillings.Where(aa => aa.PatientBillingID == patientBillingID).ToList();

            foreach (var patBill in patientBillings)
            {
                mbprosEntities.PatientBillings.Remove(patBill);
                mbprosEntities.SaveChanges();
            }
            TempData["EditMessage"] = "Y";
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 10
0
        public JsonResult ArchiveBillingRecord(int patientBillingID)
        {
            MbprosEntities mbprosEntities  = new MbprosEntities();
            var            patientBillings = mbprosEntities.PatientBillings.Where(aa => aa.PatientBillingID == patientBillingID).ToList();

            foreach (var patBill in patientBillings)
            {
                patBill.IsArchived = true;
                mbprosEntities.Entry(patBill).State = System.Data.Entity.EntityState.Modified;
                mbprosEntities.SaveChanges();
            }
            TempData["EditMessage"] = "Y";
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 11
0
        public JsonResult UnarchivePatientRecord(int patientID)
        {
            MbprosEntities mbprosEntities = new MbprosEntities();
            var            patients       = mbprosEntities.PatientMasters.Where(aa => aa.PatientID == patientID).ToList();

            foreach (var pat in patients)
            {
                pat.IsArchived = false;
                mbprosEntities.Entry(pat).State = System.Data.Entity.EntityState.Modified;
                mbprosEntities.SaveChanges();
            }
            TempData["EditMessage"] = "Y";
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 12
0
        public ActionResult PDFForPatient(int patientID)
        {
            MbprosEntities en = new MbprosEntities();
            //get the patient data with matching patient id
            PatientMaster objPatient = en.PatientMasters.Where(x => x.PatientID == patientID).FirstOrDefault();

            if (objPatient != null)
            {
                //Generates pdf for the patient data using PDFForPatient view.
                //return new Rotativa.ViewAsPdf("PDFForPatient", objPatient) { FileName = "PatientInformation.pdf" };
                return(new Rotativa.ViewAsPdf("PDFForPatient", objPatient));
                // return View(objPatient);
            }
            return(View(objPatient));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Generate PDF for patient billing form
        /// </summary>
        /// <param name="billingID">Billing Id</param>
        /// <returns>PDF File</returns>        ///
        public ActionResult PDFForPatientBilling(int billingID)
        {
            MbprosEntities en = new MbprosEntities();
            //get the patient billing data with matching billing form id
            List <PatientBilling> objPatientBilling = en.PatientBillings.Where(x => x.PatientBillingID == billingID).ToList();

            if (objPatientBilling != null)
            {
                //Generates pdf for the patient billing data using PDFForPatientBilling view.
                return(new Rotativa.ViewAsPdf("PDFForPatientBilling", objPatientBilling)
                {
                    PageOrientation = Orientation.Landscape
                });
            }

            return(View(objPatientBilling));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Verifies that the specified user name and password exist in the data source.
        /// </summary>
        /// <returns>
        /// true if the specified username and password are valid; otherwise, false.
        /// </returns>
        /// <param name="username">The name of the user to validate. </param><param name="password">The password for the specified user. </param>
        public override bool ValidateUser(string username, string password)
        {
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                return(false);
            }

            using (var context = new MbprosEntities())
            {
                var user = (from u in context.Users
                            where String.Compare(u.UserName, username, StringComparison.OrdinalIgnoreCase) == 0 &&
                            String.Compare(u.Password, password, StringComparison.OrdinalIgnoreCase) == 0 &&
                            u.Status == true
                            select u).FirstOrDefault();

                return(user != null);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Gets a list of the roles that a specified user is in for the configured applicationName.
        /// </summary>
        /// <returns>
        /// A string array containing the names of all the roles that the specified user is in for the configured applicationName.
        /// </returns>
        /// <param name="username">The user to return a list of roles for.</param>
        public override string[] GetRolesForUser(string username)
        {
            //Return if the user is not authenticated
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                return(null);
            }

            //Return if present in Cache
            var cacheKey = string.Format("UserRoles_{0}", username);

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((string[])HttpRuntime.Cache[cacheKey]);
            }

            //Get the roles from DB
            var userRoles = new string[] { };

            using (var context = new MbprosEntities())
            {
                var user = (from u in context.Users//.Include(usr => usr.UserRole)
                            where String.Compare(u.UserName, username, StringComparison.OrdinalIgnoreCase) == 0
                            select u).FirstOrDefault();

                if (user != null)
                {
                    if (user.IsAdmin)
                    {
                        userRoles[0] = "ADMIN";
                    }
                    else
                    {
                        userRoles[0] = "USER";
                    }
                }
            }

            //Store in cache
            HttpRuntime.Cache.Insert(cacheKey, userRoles, null, DateTime.Now.AddMinutes(_cacheTimeoutInMinutes), Cache.NoSlidingExpiration);

            // Return
            return(userRoles.ToArray());
        }
Exemplo n.º 16
0
        public ActionResult AddUser(int userID = 0, string message = "")
        {
            UserModels userModel = new UserModels();

            if (userID > 0)
            {
                MbprosEntities mbprosEntities = new MbprosEntities();
                var            userDetails    = mbprosEntities.Users.Find(userID);
                if (userDetails != null)
                {
                    userModel.UserId     = userID;
                    userModel.UserName   = userDetails.UserName;
                    userModel.Password   = userDetails.Password;
                    userModel.OfficeName = userDetails.OfficeName;
                    userModel.EmailID    = userDetails.EmailID;
                    userModel.IsAdmin    = userDetails.IsAdmin;
                }
            }
            ViewBag.UserMessage = message;
            return(View(userModel));
        }
Exemplo n.º 17
0
        public JsonResult DeleteUser(int userID)
        {
            MbprosEntities mbprosEntities = new MbprosEntities();
            var            user           = mbprosEntities.Users.Find(userID);

            if (user != null)
            {
                mbprosEntities.Users.Attach(user);
                mbprosEntities.Users.Remove(user);
                mbprosEntities.SaveChanges();

                //Delete from membership
                ((SimpleMembershipProvider)Membership.Provider).DeleteAccount(user.UserName);
                string[] allRoles = { "USER" };
                Roles.RemoveUserFromRoles(user.UserName, allRoles);
                Membership.Provider.DeleteUser(user.UserName, true);
                Membership.DeleteUser(user.UserName, true);
            }
            TempData["UserMessage"] = "Y";
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 18
0
        public ActionResult AddUser(UserModels userModel)
        {
            if (ModelState.IsValid)
            {
                var UserId = Convert.ToString(Session["USERID"]) == "" ? 0 : Convert.ToInt32(Session["USERID"]);
                if (userModel.UserId == 0)//ADD mode
                {
                    if (!IsUserExist(userModel.UserName))
                    {
                        using (MbprosEntities mbprosEntities = new MbprosEntities())
                        {
                            User user = new User();
                            user.UserName   = userModel.UserName;
                            user.OfficeName = userModel.OfficeName;
                            user.Password   = userModel.Password;
                            user.Status     = true;
                            user.IsAdmin    = true;
                            user.EmailID    = userModel.EmailID;
                            user.IsAdmin    = false;
                            //if (userModel.IsAdmin == null)
                            //    user.IsAdmin = false;
                            //else
                            //    user.IsAdmin = userModel.IsAdmin == true ? true : false;
                            user.CreatedDate = DateTime.Now.Date;
                            user.CreatedBy   = UserId;

                            mbprosEntities.Users.Add(user);

                            //Save user in membership
                            WebSecurity.CreateUserAndAccount(userModel.UserName, userModel.Password);
                            if (!Roles.RoleExists("USER"))
                            {
                                Roles.CreateRole("USER");
                            }
                            Roles.AddUserToRole(userModel.UserName, "USER");

                            mbprosEntities.SaveChanges();

                            //Add entries in FeatuereUser table for Normal user
                            var idParam = new SqlParameter
                            {
                                ParameterName = "UserID",
                                Value         = user.UserId
                            };
                            var idParamB = new SqlParameter
                            {
                                ParameterName = "IsAdminUser",
                                Value         = 0
                            };
                            mbprosEntities.Database.ExecuteSqlCommand("usp_AddFeatureUser @UserID, @IsAdminUser", idParam, idParamB);
                            //
                        }
                        ViewBag.IsUserExist     = "";
                        TempData["UserMessage"] = "Y";
                        //return RedirectToAction("AddUser", new { userID = 0, message = "User saved successfully." });
                        return(RedirectToAction("SearchUser", new { message = "User added successfully.", IsBack = true }));
                    }
                    else
                    {
                        ViewBag.IsUserExist = "YES";
                    }
                }
                else//EDIT mode
                {
                    using (MbprosEntities mbprosEntities = new MbprosEntities())
                    {
                        User user = mbprosEntities.Users.Find(userModel.UserId);
                        if (user != null)
                        {
                            WebSecurity.ChangePassword(userModel.UserName, user.Password, userModel.Password);

                            //user.UserName = userModel.UserName; //NEVER
                            user.OfficeName  = userModel.OfficeName;
                            user.Password    = userModel.Password;
                            user.EmailID     = userModel.EmailID;
                            user.UpdatedDate = DateTime.Now;
                            user.UpdatedBy   = UserId;
                            user.IsAdmin     = userModel.IsAdmin;

                            mbprosEntities.Entry(user).State = System.Data.Entity.EntityState.Modified;
                            mbprosEntities.SaveChanges();
                        }
                    }
                    TempData["UserMessage"] = "Y";
                    return(RedirectToAction("SearchUser", new { message = "User updated successfully.", IsBack = true }));
                }
            }
            return(View(userModel));
        }
Exemplo n.º 19
0
        public ActionResult BillingLog(BillingModel billingModel)
        {
            if (ModelState.IsValid)
            {
                var UserId = Convert.ToString(Session["USERID"]) == "" ? 0 : Convert.ToInt32(Session["USERID"]);
                // check captcha code is valid or not
                bool   isCaptchaCodeValid = false;
                string ReCaptchaMessage   = "";
                if (billingModel.BillingID == 0)// Code for Add Billing details
                {
                    if (UserId > 0)
                    {
                        isCaptchaCodeValid = true;
                    }
                    else
                    {
                        isCaptchaCodeValid = CommonFunctions.GetCaptchaResponse(Request.Form["recaptcha_challenge_field"], Request.Form["recaptcha_response_field"], billingModel.CaptchaSecretkey.ToString(), out ReCaptchaMessage);
                    }
                    if (isCaptchaCodeValid)
                    {
                        int patientBillingID = 0;
                        using (MbprosEntities mbprosEntities = new MbprosEntities())
                        {
                            patientBillingID = Common.CommonFunctions.GetNextPatientBillingID();
                            for (int i = 1; i <= 15; i++)
                            {
                                if (!string.IsNullOrEmpty(Request.Form["PatientName" + i]))
                                {
                                    PatientBilling patientBilling = new PatientBilling();
                                    patientBilling.PatientBillingID = patientBillingID;
                                    patientBilling.OfficeName       = billingModel.OfficeName;
                                    patientBilling.PatientName      = Request.Form["PatientName" + i];
                                    if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i]))
                                    {
                                        patientBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture);
                                    }
                                    patientBilling.CoPayType = Request.Form["CopayType" + i];
                                    if (!string.IsNullOrEmpty(patientBilling.CoPayType))
                                    {
                                        patientBilling.ChequeNo  = Request.Form["ChequeNo" + i];
                                        patientBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]);
                                    }
                                    patientBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i];
                                    patientBilling.DXCode         = Request.Form["NewDXCodes" + i];
                                    patientBilling.SrNo           = i;

                                    patientBilling.CreatedDate = DateTime.Now.Date;
                                    patientBilling.CreatedBy   = UserId;
                                    patientBilling.Active      = true;
                                    patientBilling.IsArchived  = false;
                                    patientBilling.Note        = billingModel.AdditionalComments;

                                    mbprosEntities.PatientBillings.Add(patientBilling);
                                }
                            }

                            mbprosEntities.SaveChanges();
                        }
                        ViewBag.ReCaptchaMessage = "";
                        return(RedirectToAction("Confirmation", "Billing", new { billingFormID = patientBillingID, officeName = billingModel.OfficeName }));
                    }
                    else
                    {
                        ViewBag.ReCaptchaMessage = ReCaptchaMessage;
                    }
                }
                else// Code for edit Billing details
                {
                    // here we will have to add 3 codes first for edit existing , other for add new if not exist in DB and one for for deleting if user deletes exisitng record.
                    MbprosEntities mbprosEntities   = new MbprosEntities();
                    var            billDetails      = mbprosEntities.PatientBillings.Where(x => x.PatientBillingID == billingModel.BillingID);
                    int            patientBillingID = 0;
                    for (int i = 1; i <= 15; i++)
                    {
                        PatientBilling objBilling = billDetails.Where(x => x.SrNo == i).FirstOrDefault();
                        if (!string.IsNullOrEmpty(Request.Form["PatientName" + i]))
                        {
                            if (objBilling != null) // it means update the record.
                            {
                                if (i == 1)
                                {
                                    patientBillingID = objBilling.PatientBillingID;
                                }
                                objBilling.OfficeName  = billingModel.OfficeName;
                                objBilling.PatientName = Request.Form["PatientName" + i];
                                if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i]))
                                {
                                    objBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture);
                                }
                                objBilling.CoPayType = Request.Form["CopayType" + i];
                                if (!string.IsNullOrEmpty(objBilling.CoPayType))
                                {
                                    objBilling.ChequeNo  = Request.Form["ChequeNo" + i];
                                    objBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]);
                                }
                                objBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i];
                                objBilling.DXCode         = Request.Form["NewDXCodes" + i];
                                objBilling.SrNo           = i;

                                objBilling.Active = true;
                                objBilling.Note   = billingModel.AdditionalComments;

                                objBilling.BillingFormID = objBilling.BillingFormID;
                                objBilling.UpdatedDate   = DateTime.Now;
                                objBilling.UpdatedBy     = UserId;
                                mbprosEntities.Entry(objBilling).State = System.Data.Entity.EntityState.Modified;
                                mbprosEntities.SaveChanges();
                            }
                            else
                            { // 2 conditions add
                                PatientBilling patientBilling = new PatientBilling();
                                patientBilling.PatientBillingID = patientBillingID;
                                patientBilling.OfficeName       = billingModel.OfficeName;
                                patientBilling.PatientName      = Request.Form["PatientName" + i];
                                if (!string.IsNullOrEmpty(Request.Form["ServiceDate" + i]))
                                {
                                    patientBilling.ServiceDate = DateTime.ParseExact(Request.Form["ServiceDate" + i], "MM/dd/yyyy", CultureInfo.InvariantCulture);
                                }
                                patientBilling.CoPayType = Request.Form["CopayType" + i];
                                if (!string.IsNullOrEmpty(patientBilling.CoPayType))
                                {
                                    patientBilling.ChequeNo  = Request.Form["ChequeNo" + i];
                                    patientBilling.CopayPaid = Convert.ToDecimal(Request.Form["CopayPaid" + i]);
                                }
                                patientBilling.ProcedureCodes = Request.Form["ProcedureCodes" + i];
                                patientBilling.DXCode         = Request.Form["NewDXCodes" + i];
                                patientBilling.SrNo           = i;

                                patientBilling.Active      = true;
                                patientBilling.Note        = billingModel.AdditionalComments;
                                patientBilling.CreatedDate = DateTime.Now.Date;
                                patientBilling.CreatedBy   = UserId;
                                patientBilling.IsArchived  = false;
                                mbprosEntities.PatientBillings.Add(patientBilling);
                                mbprosEntities.SaveChanges();
                            }
                        }
                        else
                        {
                            if (objBilling != null) // it means delete the record.
                            {
                                mbprosEntities.PatientBillings.Attach(objBilling);
                                mbprosEntities.PatientBillings.Remove(objBilling);
                                mbprosEntities.SaveChanges();
                            }
                        }
                    }
                    TempData["EditMessage"] = "Y";
                    return(RedirectToAction(billingModel.CallFrom, "Search", new { editMessage = "Patient billing details updated successfully", IsBack = true }));
                }
            }

            return(View(billingModel));
        }
Exemplo n.º 20
0
        public ActionResult AddPatient(PatientModel patientModel)
        {
            patientModel.Sex                  = Request.Form["hdnSex"];
            patientModel.IsPatInsured         = Request.Form["hdnIsInsured"];
            patientModel.IsConditionRelatedTo = Request.Form["hdnIsConditionRelatedTo"];
            patientModel.IsSecondaryInsurance = Request.Form["hdnIsSecInsurance"];
            patientModel.IsVerifyEligibility  = Request.Form["hdnIsVerify"];
            //        var errors = ModelState
            //.Where(x => x.Value.Errors.Count > 0)
            //.Select(x => new { x.Key, x.Value.Errors })
            //.ToArray();

            if (ModelState.IsValid)
            {
                var UserId = Convert.ToString(Session["USERID"]) == "" ? 0 : Convert.ToInt32(Session["USERID"]);
                // check captcha code is valid or not
                bool   isCaptchaCodeValid = false;
                string CaptchaMessage     = "";
                if (UserId > 0)
                {
                    isCaptchaCodeValid = true;
                }
                else
                {
                    isCaptchaCodeValid = CommonFunctions.GetCaptchaResponse(Request.Form["recaptcha_challenge_field"], Request.Form["recaptcha_response_field"], patientModel.CaptchaSecretkey.ToString(), out CaptchaMessage);
                }
                if (isCaptchaCodeValid)
                {
                    int patientID = 0;
                    using (MbprosEntities mbprosEntities = new MbprosEntities())
                    {
                        PatientMaster patientMaster = new PatientMaster();
                        if (patientModel.PatientID != 0)
                        {
                            patientMaster                     = mbprosEntities.PatientMasters.Find(patientModel.PatientID);
                            patientModel.Sex                  = Request.Form["hdnSex"];
                            patientModel.IsPatInsured         = Request.Form["hdnIsInsured"];
                            patientModel.IsConditionRelatedTo = Request.Form["hdnIsConditionRelatedTo"];
                            patientModel.IsSecondaryInsurance = Request.Form["hdnIsSecInsurance"];
                            patientModel.IsVerifyEligibility  = Request.Form["hdnIsVerify"];
                        }
                        patientMaster.OfficeName    = patientModel.OfficeName;
                        patientMaster.PatientName   = patientModel.PatientName;
                        patientMaster.StreetAddress = patientModel.StreetAddress;
                        patientMaster.City          = patientModel.City;
                        patientMaster.StateCode     = patientModel.StateCode;
                        patientMaster.ZipCode       = patientModel.ZipCode;
                        if (!string.IsNullOrEmpty(patientModel.DateofBirth))
                        {
                            patientMaster.DateofBirth = DateTime.ParseExact(patientModel.DateofBirth, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }

                        patientMaster.SSN = patientModel.SSN;
                        patientMaster.Sex = patientModel.Sex == "" ? "M" : patientModel.Sex;
                        patientMaster.InsuranceCompanyName    = patientModel.InsuranceCompanyName;
                        patientMaster.InsuranceCompanyAddress = patientModel.InsuranceCompanyAddress;
                        patientMaster.InsuranceCompanyPhone   = patientModel.InsuranceCompanyPhone;

                        patientMaster.EDIPayerNumber = patientModel.EDIPayerNumber;



                        patientMaster.PolicyID    = patientModel.PolicyID;
                        patientMaster.GroupNumber = patientModel.GroupNumber;

                        if (patientModel.IsPatInsured == "NO")
                        {
                            patientMaster.PrimaryInsuredName = patientModel.PrimaryInsuredName;
                            if (!string.IsNullOrEmpty(patientModel.PrimaryInsuredDOB))
                            {
                                patientMaster.PrimaryInsuredDOB = DateTime.ParseExact(patientModel.PrimaryInsuredDOB, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                            }

                            patientMaster.IsInsured = false;
                        }
                        else if (patientModel.IsPatInsured == "YES")
                        {
                            patientMaster.IsInsured = true;
                        }

                        patientMaster.ConditionRelatedTo = patientModel.IsConditionRelatedTo;

                        if (!string.IsNullOrEmpty(patientModel.DateofAccident))
                        {
                            patientMaster.DateofAccident = DateTime.ParseExact(patientModel.DateofAccident, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }
                        patientMaster.InsuranceFax = patientModel.InsuranceFax;
                        patientMaster.AdjusterName = patientModel.AdjusterName;

                        if (patientModel.IsSecondaryInsurance == "True")// "Y")// IsSecInsurance == "YES")
                        {
                            patientMaster.SecondaryInsuranceCompanyName  = patientModel.SecondaryInsuranceCompanyName;
                            patientMaster.SecondaryInsuranceCompanyAddr  = patientModel.SecondaryCompanyAddr;
                            patientMaster.SecondaryInsuranceCompanyPhone = patientModel.SecondaryInsuranceCompanyPhone;
                            patientMaster.SecondaryInsuranceID           = patientModel.SecondaryInsuranceID;
                            patientMaster.SecondaryInsuranceGroupID      = patientModel.SecondaryInsuranceGroupID;
                            patientMaster.SecondaryInsuredName           = patientModel.SecondaryInsuredName;

                            if (!string.IsNullOrEmpty(patientModel.SecondaryInsuredDOB))
                            {
                                patientMaster.SecondaryInsuredDOB = DateTime.ParseExact(patientModel.SecondaryInsuredDOB, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                            }
                            patientMaster.IsSecondaryInsurance = true;
                        }
                        else
                        {
                            patientMaster.IsSecondaryInsurance = false;
                        }

                        patientMaster.IsVerifyEligibility = patientModel.IsVerifyEligibility == "True" ? true : false;
                        patientMaster.FacilityName        = patientModel.FacilityName;
                        if (!string.IsNullOrEmpty(patientModel.AdmissionDate))
                        {
                            patientMaster.AdmissionDate = DateTime.ParseExact(patientModel.AdmissionDate, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }
                        if (!string.IsNullOrEmpty(patientModel.LastSeenByRefProvider))
                        {
                            patientMaster.LastSeenByRefProvider = DateTime.ParseExact(patientModel.LastSeenByRefProvider, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }
                        patientMaster.ReferringProviderName = patientModel.ReferringProviderName;
                        patientMaster.ReferringProviderNPI  = patientModel.ReferringProviderNPI;
                        if (!string.IsNullOrEmpty(patientModel.InitialTreatmentDate))
                        {
                            patientMaster.InitialTreatmentDate = DateTime.ParseExact(patientModel.InitialTreatmentDate, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                        }
                        patientMaster.LastXRayDateORPARTCodes = patientModel.LastXRayDateORPARTCodes;
                        patientMaster.DiagnosisCodes          = patientModel.DiagnosisCodes;
                        patientMaster.AdditionalInfo          = patientModel.AdditionalInfo;
                        //patientMaster.InsuranceVerification = patientModel.InsVerification;
                        patientMaster.Active = true;
                        //patientMaster.UserEmailID = patientModel.UserEmailID;
                        if (patientModel.PatientID == 0)
                        {
                            patientMaster.CreatedDate = DateTime.Now.Date;
                            patientMaster.CreatedBy   = UserId;

                            mbprosEntities.PatientMasters.Add(patientMaster);
                            mbprosEntities.SaveChanges();
                            patientID = patientMaster.PatientID;
                        }
                        else
                        {
                            patientID = patientMaster.PatientID;
                            patientMaster.UpdatedDate = DateTime.Now;
                            patientMaster.UpdatedBy   = UserId;
                            mbprosEntities.Entry(patientMaster).State = System.Data.Entity.EntityState.Modified;
                            mbprosEntities.SaveChanges();
                        }
                    }
                    ViewBag.CaptchaMessage = "";
                    if (patientModel.PatientID == 0)
                    {
                        return(RedirectToAction("Confirmation", new { patientID = patientID, officeName = patientModel.OfficeName }));
                    }
                    else
                    {
                        TempData["EditMessage"] = "Y";
                        return(RedirectToAction(patientModel.CallFrom, "Search", new { editMessage = "Patient details updated successfully", IsBack = true }));
                    }
                }
                else
                {
                    ViewBag.CaptchaMessage = CaptchaMessage;
                }
            }
            patientModel.StateList = new SelectList(CommonFunctions.GetAllDropdownList("STATES"), "ID", "NAME", 0);

            return(View(patientModel));
        }
Exemplo n.º 21
0
        public ActionResult AddPatient(int patientID = 0, string callFrom = "")
        {
            MbprosEntities en            = new MbprosEntities();
            var            lstconfigkeys = en.Configs.ToList();

            PatientModel patientModel = new PatientModel();

            patientModel.CaptchaSitekeychallenge = "https://www.google.com/recaptcha/api/challenge?k=" + lstconfigkeys.Where(x => x.key == "CaptchaSitekey").FirstOrDefault().value; //ConfigurationManager.AppSettings["CaptchaSitekey"].ToString().Trim();
            patientModel.CaptchaSitekeynoscript  = "https://www.google.com/recaptcha/api/noscript?k=" + lstconfigkeys.Where(x => x.key == "CaptchaSitekey").FirstOrDefault().value;  //ConfigurationManager.AppSettings["CaptchaSitekey"].ToString().Trim();
            patientModel.CaptchaSecretkey        = lstconfigkeys.Where(x => x.key == "CaptchaSecretkey").FirstOrDefault().value;                                                     //ConfigurationManager.AppSettings["CaptchaSecretkey"].ToString().Trim();

            patientModel.CallFrom  = callFrom;
            patientModel.StateList = new SelectList(CommonFunctions.GetAllDropdownList("STATES"), "ID", "NAME", 0);
            int UserID = Session["USERID"] == null ? 0 : Convert.ToInt32(Session["USERID"]);

            if (patientID > 0)
            {
                MbprosEntities mbprosEntities = new MbprosEntities();
                var            patientDetails = mbprosEntities.PatientMasters.Find(patientID);
                if (patientDetails != null)
                {
                    patientModel.PatientID = patientID;
                    if (patientDetails.CreatedDate != null)
                    {
                        patientModel.CreatedDate = Convert.ToDateTime(patientDetails.CreatedDate).ToString("MM/dd/yyyy");
                    }
                    patientModel.OfficeName     = patientDetails.OfficeName;
                    patientModel.Active         = patientDetails.Active;
                    patientModel.AdditionalInfo = patientDetails.AdditionalInfo;
                    patientModel.AdjusterName   = patientDetails.AdjusterName;
                    if (patientDetails.AdmissionDate != null)
                    {
                        patientModel.AdmissionDate = Convert.ToDateTime(patientDetails.AdmissionDate).ToString("MM/dd/yyyy");
                    }
                    patientModel.City = patientDetails.City;
                    if (patientDetails.DateofAccident != null)
                    {
                        patientModel.DateofAccident = Convert.ToDateTime(patientDetails.DateofAccident).ToString("MM/dd/yyyy");
                    }
                    if (patientDetails.DateofBirth != null)
                    {
                        patientModel.DateofBirth = Convert.ToDateTime(patientDetails.DateofBirth).ToString("MM/dd/yyyy");
                    }
                    patientModel.DiagnosisCodes = patientDetails.DiagnosisCodes;
                    patientModel.EDIPayerNumber = patientDetails.EDIPayerNumber;
                    patientModel.FacilityName   = patientDetails.FacilityName;
                    patientModel.GroupNumber    = patientDetails.GroupNumber;
                    if (patientDetails.InitialTreatmentDate != null)
                    {
                        patientModel.InitialTreatmentDate = Convert.ToDateTime(patientDetails.InitialTreatmentDate).ToString("MM/dd/yyyy");
                    }
                    patientModel.InsuranceCompanyAddress = patientDetails.InsuranceCompanyAddress;
                    patientModel.InsuranceCompanyName    = patientDetails.InsuranceCompanyName;
                    patientModel.InsuranceCompanyPhone   = patientDetails.InsuranceCompanyPhone;
                    patientModel.InsuranceFax            = patientDetails.InsuranceFax;
                    patientModel.IsConditionRelatedTo    = patientDetails.ConditionRelatedTo;
                    patientModel.IsInsured = patientDetails.IsInsured ?? false;
                    //patientModel.IsPatInsured= patientDetails.ins;
                    if (patientModel.IsInsured == false)
                    {
                        patientModel.IsPatInsured = "NO";
                    }
                    else if (patientModel.IsInsured == true)
                    {
                        patientModel.IsPatInsured = "YES";
                    }

                    patientModel.IsSecondaryInsurance = patientDetails.IsSecondaryInsurance.ToString();
                    patientModel.IsVerifyEligibility  = patientDetails.IsVerifyEligibility.ToString();
                    if (patientDetails.LastSeenByRefProvider != null)
                    {
                        patientModel.LastSeenByRefProvider = Convert.ToDateTime(patientDetails.LastSeenByRefProvider).ToString("MM/dd/yyyy");
                    }
                    patientModel.LastXRayDateORPARTCodes = patientDetails.LastXRayDateORPARTCodes;
                    patientModel.PatientName             = patientDetails.PatientName;
                    patientModel.PolicyID = patientDetails.PolicyID;
                    if (patientDetails.PrimaryInsuredDOB != null)
                    {
                        patientModel.PrimaryInsuredDOB = Convert.ToDateTime(patientDetails.PrimaryInsuredDOB).ToString("MM/dd/yyyy");
                    }
                    patientModel.PrimaryInsuredName             = patientDetails.PrimaryInsuredName;
                    patientModel.ReferringProviderName          = patientDetails.ReferringProviderName;
                    patientModel.ReferringProviderNPI           = patientDetails.ReferringProviderNPI;
                    patientModel.SecondaryCompanyAddr           = patientDetails.SecondaryInsuranceCompanyAddr;
                    patientModel.SecondaryInsuranceCompanyName  = patientDetails.SecondaryInsuranceCompanyName;
                    patientModel.SecondaryInsuranceCompanyPhone = patientDetails.SecondaryInsuranceCompanyPhone;
                    patientModel.SecondaryInsuranceGroupID      = patientDetails.SecondaryInsuranceGroupID;
                    patientModel.SecondaryInsuranceID           = patientDetails.SecondaryInsuranceID;
                    if (patientDetails.SecondaryInsuredDOB != null)
                    {
                        patientModel.SecondaryInsuredDOB = Convert.ToDateTime(patientDetails.SecondaryInsuredDOB).ToString("MM/dd/yyyy");
                    }
                    patientModel.SecondaryInsuredName = patientDetails.SecondaryInsuredName;
                    patientModel.Sex           = patientDetails.Sex;
                    patientModel.SSN           = patientDetails.SSN;
                    patientModel.StateCode     = patientDetails.StateCode;
                    patientModel.StreetAddress = patientDetails.StreetAddress;
                    patientModel.ZipCode       = patientDetails.ZipCode;
                    //patientModel.InsVerification = patientDetails.InsuranceVerification;
                    var statecode = mbprosEntities.States.Where(x => x.StateCode == patientDetails.StateCode).FirstOrDefault();
                    if (statecode != null)
                    {
                        patientModel.StateList = new SelectList(CommonFunctions.GetAllDropdownList("STATES"), "ID", "NAME", statecode.StateID);
                    }
                }
            }
            else
            {
                if (UserID > 0)
                {
                    patientModel.OfficeName = CommonFunctions.GetUserOffice(UserID);
                }
            }
            patientModel.UserID = UserID;
            return(View(patientModel));
        }
Exemplo n.º 22
0
        public static void SendEmail(string officeName, string callFrom)
        {
            MbprosEntities en = new MbprosEntities();
            var            lstconfigkeys = en.Configs.ToList();
            string         emailFrom = "", emailFromName = "", subject = "", password = "";
            string         smtpAddress = lstconfigkeys.Where(x => x.key == "SmtpAddress").FirstOrDefault().value;                 //ConfigurationManager.AppSettings["SmtpAddress"].ToString().Trim();
            int            portNumber  = Convert.ToInt32(lstconfigkeys.Where(x => x.key == "PortNumber").FirstOrDefault().value); //ConfigurationManager.AppSettings["PortNumber"].ToString().Trim() == "" ? 0 : Convert.ToInt32(ConfigurationManager.AppSettings["PortNumber"].ToString().Trim());

            if (callFrom == "PATIENT_FORM")
            {
                emailFrom     = lstconfigkeys.Where(x => x.key == "EmailSenderForPatientForm").FirstOrDefault().value;     //ConfigurationManager.AppSettings["EmailSenderForPatientForm"].ToString().Trim();
                emailFromName = lstconfigkeys.Where(x => x.key == "EmailSenderNameForPatientForm").FirstOrDefault().value; // ConfigurationManager.AppSettings["EmailSenderNameForPatientForm"].ToString().Trim();
                subject       = officeName + " has submitted a patient form";
                password      = lstconfigkeys.Where(x => x.key == "PasswordForPatientSender").FirstOrDefault().value;      //ConfigurationManager.AppSettings["PasswordForPatientSender"].ToString().Trim();
            }
            else if (callFrom == "BILLING_FORM")
            {
                emailFrom     = lstconfigkeys.Where(x => x.key == "EmailSenderForBillingLog").FirstOrDefault().value;     //ConfigurationManager.AppSettings["EmailSenderForBillingLog"].ToString().Trim();
                emailFromName = lstconfigkeys.Where(x => x.key == "EmailSenderNameForBillingLog").FirstOrDefault().value; // ConfigurationManager.AppSettings["EmailSenderNameForBillingLog"].ToString().Trim();
                subject       = officeName + " has submitted a billing form";
                password      = lstconfigkeys.Where(x => x.key == "PasswordForBillingSender").FirstOrDefault().value;     //ConfigurationManager.AppSettings["PasswordForBillingSender"].ToString().Trim();
            }

            string pathToFiles = HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToLower();

            string body = "Dear Medical Billing Professionals," +
                          "<br/><br/>" +
                          subject +
                          "<br/>" +
                          "Click here to go to Form Management Center: <a href='" + pathToFiles + "/Account/Login'>https://www.mbpros.com/Account/Login</a>" +
                          "<br/><br/>" +
                          "Regards," +
                          "<br/>" +
                          "Notification Mailer";

            try
            {
                using (MailMessage mail = new MailMessage())
                {
                    mail.From = new MailAddress(emailFrom, emailFromName);
                    User user = CommonFunctions.GetAdminUserDetails();
                    if (user != null)
                    {
                        mail.To.Add(new MailAddress(user.EmailID, user.UserName));
                        mail.Subject    = subject;
                        mail.Body       = body;
                        mail.IsBodyHtml = true;

                        using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                        {
                            smtp.Credentials = new NetworkCredential(emailFrom, password);
                            smtp.EnableSsl   = false;
                            smtp.Send(mail);
                        }
                    }
                }
            }
            catch (Exception ex) {
                logger.Error(ex.ToString());
                logger.Info("Action send mail has been fired.");
            }
        }
Exemplo n.º 23
0
        log4net.ILog logger = log4net.LogManager.GetLogger(typeof(BillingController));  //Declaring Log4Net

        public ActionResult BillingLog(int billingID = 0, string callFrom = "")
        {
            MbprosEntities en            = new MbprosEntities();
            var            lstconfigkeys = en.Configs.ToList();

            BillingModel billingModel = new BillingModel();

            billingModel.CaptchaSitekeychallenge = "https://www.google.com/recaptcha/api/challenge?k=" + lstconfigkeys.Where(x => x.key == "CaptchaSitekey").FirstOrDefault().value; //ConfigurationManager.AppSettings["CaptchaSitekey"].ToString().Trim();
            billingModel.CaptchaSitekeynoscript  = "https://www.google.com/recaptcha/api/noscript?k=" + lstconfigkeys.Where(x => x.key == "CaptchaSitekey").FirstOrDefault().value;  //ConfigurationManager.AppSettings["CaptchaSitekey"].ToString().Trim();
            billingModel.CaptchaSecretkey        = lstconfigkeys.Where(x => x.key == "CaptchaSecretkey").FirstOrDefault().value;                                                     //ConfigurationManager.AppSettings["CaptchaSecretkey"].ToString().Trim();

            billingModel.CallFrom = callFrom;
            if (billingID > 0)
            {
                MbprosEntities mbprosEntities = new MbprosEntities();
                var            billDetails    = mbprosEntities.PatientBillings.Where(x => x.PatientBillingID == billingID);
                if (billDetails != null)
                {
                    billingModel.OfficeName         = billDetails.FirstOrDefault().OfficeName;
                    billingModel.AdditionalComments = billDetails.FirstOrDefault().Note;
                    billingModel.BillingID          = billingID;
                    if (billDetails.FirstOrDefault().CreatedDate != null)
                    {
                        billingModel.CreatedDate = Convert.ToDateTime(billDetails.FirstOrDefault().CreatedDate).ToString("MM/dd/yyyy");
                    }
                    foreach (var a in billDetails)
                    {
                        if (a.SrNo == 1)
                        {
                            billingModel.ChequeNo1 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid1 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes1     = a.DXCode;
                            billingModel.PatientName1    = a.PatientName;
                            billingModel.ProcedureCodes1 = a.ProcedureCodes;
                            billingModel.CopayType1      = a.CoPayType;
                            billingModel.ServiceDate1    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo1           = a.SrNo;
                        }
                        else if (a.SrNo == 2)
                        {
                            billingModel.ChequeNo2 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid2 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes2     = a.DXCode;
                            billingModel.PatientName2    = a.PatientName;
                            billingModel.ProcedureCodes2 = a.ProcedureCodes;
                            billingModel.ServiceDate2    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo2           = a.SrNo;
                            billingModel.CopayType2      = a.CoPayType;
                        }
                        else if (a.SrNo == 3)
                        {
                            billingModel.ChequeNo3 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid3 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes3     = a.DXCode;
                            billingModel.PatientName3    = a.PatientName;
                            billingModel.ProcedureCodes3 = a.ProcedureCodes;
                            billingModel.ServiceDate3    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo3           = a.SrNo;
                            billingModel.CopayType3      = a.CoPayType;
                        }
                        else if (a.SrNo == 4)
                        {
                            billingModel.ChequeNo4 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid4 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes4     = a.DXCode;
                            billingModel.PatientName4    = a.PatientName;
                            billingModel.ProcedureCodes4 = a.ProcedureCodes;
                            billingModel.ServiceDate4    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo4           = a.SrNo;
                            billingModel.CopayType4      = a.CoPayType;
                        }
                        else if (a.SrNo == 5)
                        {
                            billingModel.ChequeNo5 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid5 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes5     = a.DXCode;
                            billingModel.PatientName5    = a.PatientName;
                            billingModel.ProcedureCodes5 = a.ProcedureCodes;
                            billingModel.ServiceDate5    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo5           = a.SrNo;
                            billingModel.CopayType5      = a.CoPayType;
                        }
                        else if (a.SrNo == 6)
                        {
                            billingModel.ChequeNo6 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid6 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes6     = a.DXCode;
                            billingModel.PatientName6    = a.PatientName;
                            billingModel.ProcedureCodes6 = a.ProcedureCodes;
                            billingModel.ServiceDate6    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo6           = a.SrNo;
                            billingModel.CopayType6      = a.CoPayType;
                        }
                        else if (a.SrNo == 7)
                        {
                            billingModel.ChequeNo7 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid7 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes7     = a.DXCode;
                            billingModel.PatientName7    = a.PatientName;
                            billingModel.ProcedureCodes7 = a.ProcedureCodes;
                            billingModel.ServiceDate7    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo7           = a.SrNo;
                            billingModel.CopayType7      = a.CoPayType;
                        }
                        else if (a.SrNo == 8)
                        {
                            billingModel.ChequeNo8 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid8 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes8     = a.DXCode;
                            billingModel.PatientName8    = a.PatientName;
                            billingModel.ProcedureCodes8 = a.ProcedureCodes;
                            billingModel.ServiceDate8    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo8           = a.SrNo;
                            billingModel.CopayType8      = a.CoPayType;
                        }
                        else if (a.SrNo == 9)
                        {
                            billingModel.ChequeNo9 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid9 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes9     = a.DXCode;
                            billingModel.PatientName9    = a.PatientName;
                            billingModel.ProcedureCodes9 = a.ProcedureCodes;
                            billingModel.ServiceDate9    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo9           = a.SrNo;
                            billingModel.CopayType9      = a.CoPayType;
                        }
                        else if (a.SrNo == 10)
                        {
                            billingModel.ChequeNo10 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid10 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes10     = a.DXCode;
                            billingModel.PatientName10    = a.PatientName;
                            billingModel.ProcedureCodes10 = a.ProcedureCodes;
                            billingModel.ServiceDate10    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo10           = a.SrNo;
                            billingModel.CopayType10      = a.CoPayType;
                        }
                        else if (a.SrNo == 11)
                        {
                            billingModel.ChequeNo11 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid11 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes11     = a.DXCode;
                            billingModel.PatientName11    = a.PatientName;
                            billingModel.ProcedureCodes11 = a.ProcedureCodes;
                            billingModel.ServiceDate11    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo11           = a.SrNo;
                            billingModel.CopayType11      = a.CoPayType;
                        }
                        else if (a.SrNo == 12)
                        {
                            billingModel.ChequeNo12 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid12 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes12     = a.DXCode;
                            billingModel.PatientName12    = a.PatientName;
                            billingModel.ProcedureCodes12 = a.ProcedureCodes;
                            billingModel.ServiceDate12    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo12           = a.SrNo;
                            billingModel.CopayType12      = a.CoPayType;
                        }
                        else if (a.SrNo == 13)
                        {
                            billingModel.ChequeNo13 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid13 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes13     = a.DXCode;
                            billingModel.PatientName13    = a.PatientName;
                            billingModel.ProcedureCodes13 = a.ProcedureCodes;
                            billingModel.ServiceDate13    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo13           = a.SrNo;
                            billingModel.CopayType13      = a.CoPayType;
                        }
                        else if (a.SrNo == 14)
                        {
                            billingModel.ChequeNo14 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid14 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes14     = a.DXCode;
                            billingModel.PatientName14    = a.PatientName;
                            billingModel.ProcedureCodes14 = a.ProcedureCodes;
                            billingModel.ServiceDate14    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo14           = a.SrNo;
                            billingModel.CopayType14      = a.CoPayType;
                        }
                        else if (a.SrNo == 15)
                        {
                            billingModel.ChequeNo15 = a.ChequeNo;
                            if (a.CopayPaid != null)
                            {
                                billingModel.CopayPaid15 = Convert.ToDouble(a.CopayPaid);
                            }
                            billingModel.NewDXCodes15     = a.DXCode;
                            billingModel.PatientName15    = a.PatientName;
                            billingModel.ProcedureCodes15 = a.ProcedureCodes;
                            billingModel.ServiceDate15    = Convert.ToDateTime(a.ServiceDate).ToString("MM/dd/yyyy");
                            billingModel.SrNo15           = a.SrNo;
                            billingModel.CopayType15      = a.CoPayType;
                        }
                    }
                }
            }
            else
            {
                int UserID = Session["USERID"] == null ? 0 : Convert.ToInt32(Session["USERID"]);
                if (UserID > 0)
                {
                    billingModel.OfficeName = CommonFunctions.GetUserOffice(UserID);
                }
            }
            return(View(billingModel));
        }
Exemplo n.º 24
0
        log4net.ILog logger           = log4net.LogManager.GetLogger(typeof(AccountController)); //Declaring Log4Net
        public ActionResult Login()
        {
            Session["NONLOGIN"] = "******";
            ////
            try
            {
                var lstUsers = mbprosEntities.Users.ToList();
                if (lstUsers.Count() == 0)
                {
                    MbprosEntities en            = new MbprosEntities();
                    var            lstconfigkeys = en.Configs.ToList();

                    string FirstAdminUserName    = lstconfigkeys.Where(x => x.key == "FirstAdminUserName").FirstOrDefault().value;    //ConfigurationManager.AppSettings["FirstAdminUserName"].ToString().Trim();
                    string FirstAdminUserPswd    = lstconfigkeys.Where(x => x.key == "FirstAdminUserPswd").FirstOrDefault().value;    //ConfigurationManager.AppSettings["FirstAdminUserPswd"].ToString().Trim();
                    string FirstAdminUserOffice  = lstconfigkeys.Where(x => x.key == "FirstAdminUserOffice").FirstOrDefault().value;  // ConfigurationManager.AppSettings["FirstAdminUserOffice"].ToString().Trim();
                    string FirstAdminUserEmailID = lstconfigkeys.Where(x => x.key == "FirstAdminUserEmailID").FirstOrDefault().value; //ConfigurationManager.AppSettings["FirstAdminUserEmailID"].ToString().Trim();

                    //create a admin user with websecurity
                    WebSecurity.CreateUserAndAccount(FirstAdminUserName, FirstAdminUserPswd);

                    //Create ADMIN role if not exist in the system.
                    if (!Roles.RoleExists("ADMIN"))
                    {
                        Roles.CreateRole("ADMIN");
                    }
                    Roles.AddUserToRole(FirstAdminUserName, "ADMIN");

                    //Add entries in Users table
                    User user = new User();
                    user.UserName    = FirstAdminUserName;
                    user.OfficeName  = FirstAdminUserOffice;
                    user.Password    = FirstAdminUserPswd;
                    user.Status      = true;
                    user.IsAdmin     = true;
                    user.EmailID     = FirstAdminUserEmailID;
                    user.IsAdmin     = true;
                    user.CreatedDate = DateTime.Now.Date;
                    user.CreatedBy   = 1;

                    mbprosEntities.Users.Add(user);
                    mbprosEntities.SaveChanges();

                    //Add entries in FeatuereUser table for Admin user
                    var idParam = new SqlParameter
                    {
                        ParameterName = "UserID",
                        Value         = user.UserId
                    };
                    var idParamB = new SqlParameter
                    {
                        ParameterName = "IsAdminUser",
                        Value         = 1
                    };
                    mbprosEntities.Database.ExecuteSqlCommand("usp_AddFeatureUser @UserID, @IsAdminUser", idParam, idParamB);
                }
            }
            catch (Exception ex)
            {
                // log.WriteLog("Page= addeditevent.aspx" + DateTime.Now + "\n" + ex.Message + "\n" + ex.StackTrace);
                logger.Error(ex.ToString());
                logger.Info("Action Index has been fired.");
                return(RedirectToAction("Login", "Account"));
            }
            ////
            if (Session["USERNAME"] != null)
            {
                return(RedirectToAction("AddPatient", "Patient"));
            }
            return(View());
        }