Example #1
0
        protected void AssignExisitingPassword()
        {
            try
            {
                DataControl.HiDoctorFactoryClasses.BL_ChangePassword _objBLChangePass = new DataControl.HiDoctorFactoryClasses.BL_ChangePassword();
                StringBuilder passBuilder = new StringBuilder();
                CurrentInfo   objCurInfo  = new CurrentInfo();

                string companyCode          = objCurInfo.GetCompanyCode();
                string userCode             = objCurInfo.GetUserCode();
                string passwordHistoryCount = objCurInfo.GetPrivilegeValue("PASSWORD_HISTORY_COUNT", "0");

                if (passwordHistoryCount != "0")
                {
                    IEnumerable <MVCModels.PasswordHistory> iePassHis = _objBLChangePass.GetPasswordHistory(companyCode, userCode, passwordHistoryCount);

                    foreach (MVCModels.PasswordHistory objPassHisModel in iePassHis)
                    {
                        passBuilder.Append(objPassHisModel.User_Pass + ",");
                    }

                    ViewBag.PassHistory = passBuilder.ToString().TrimEnd(',');
                }
            }
            catch (Exception ex)
            {
                DataControl.Impl.ExceptionHandler.WriteLog(ex, null);
            }
        }
Example #2
0
        public int InsertMenuVistDetails(string menuID)
        {
            CurrentInfo objCurInfo = new CurrentInfo();

            DataControl.HiDoctorFactoryClasses.BL_ChangePassword objBLChangePass = new DataControl.HiDoctorFactoryClasses.BL_ChangePassword();
            int count = objBLChangePass.InsertVisitedScreen(objCurInfo.GetCompanyCode(), menuID, objCurInfo.GetUserCode(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"));

            return(count);
        }
Example #3
0
        public string UpdatePassword(string newPassword, string oldPassword, string confirmPassword)
        {
            try
            {
                string outPutMsg = string.Empty;

                DataControl.HiDoctorFactoryClasses.BL_ChangePassword objBLChangePass = new DataControl.HiDoctorFactoryClasses.BL_ChangePassword();
                CurrentInfo objCurInfo = new CurrentInfo();
                string      message    = string.Empty;

                string companyCode = objCurInfo.GetCompanyCode();
                string userCode    = objCurInfo.GetUserCode();
                string userName    = objCurInfo.GetUserName();

                bool result = objBLChangePass.UpdatePassword(companyCode: companyCode, userCode: userCode, userName: userName, oldPassword: oldPassword, newPassword: newPassword, confirmPassword: confirmPassword, outputMsg: out message);
                // TO DO: Check Kangle customer.

                if (result)
                {
                    // Creates instance config settings.
                    DataControl.Abstraction.IConfigSettings config_Settings = new DataControl.Impl.Config_Settings();

                    // Check company is Kangle Integrated.
                    string Is_Kangle_Integrated = config_Settings.GetConfigDefaultValue(companyCode, DataControl.EnumType.CONFIG_TYPE.USER, DataControl.EnumType.CONFIG_KEY.IS_KANGLE_INTEGRATED);

                    if (Is_Kangle_Integrated.ToUpper() == "YES")
                    {
                        // Retriev the Kangle URL from WebConfig
                        string url = ConfigurationManager.AppSettings[KANGLEURL_KEY];
                        if (!string.IsNullOrEmpty(url))
                        {
                            using (WebClient client = new WebClient())
                            {
                                // Build the URL.
                                StringBuilder strUrl = new StringBuilder();
                                strUrl.Append(url);
                                strUrl.Append(companyCode);
                                strUrl.Append("/");
                                strUrl.Append(userCode);
                                strUrl.Append("/");
                                strUrl.Append(newPassword);
                                client.UploadString(strUrl.ToString(), "POST");
                                // Call the Kangle Update Password.
                                // client.DownloadString(strUrl.ToString());
                            }
                        }
                    }

                    AssignExisitingPassword();
                    Session["IsMenuShow"] = "YES";
                    Session["CurPage"]    = "";

                    outPutMsg = "1:" + message;
                }
                else
                {
                    outPutMsg = "0:" + message;
                }

                return(outPutMsg);
            }
            catch (Exception ex)
            {
                Dictionary <string, string> dicObj = new Dictionary <string, string>();
                dicObj.Add("NewPassword", newPassword);
                dicObj.Add("OldPassword", oldPassword);
                dicObj.Add("ConfirmPassword", confirmPassword);

                DataControl.Impl.ExceptionHandler.WriteLog(ex, dicObj);
                throw;
            }
        }