/// <summary>
        /// This method is used for Login
        /// </summary>
        /// <param name="frmColl"></param>
        /// <returns></returns>

        public ActionResult Login(FormCollection frmColl)
        {
            if (!string.IsNullOrEmpty(frmColl["btnLogin"]) && (string.Compare(frmColl["btnLogin"].ToUpper(), "LOGIN") == 0))
            {
                objBLUsers = new BLUsers();
                DCUsers objDCUsers = objBLUsers.UserLogon(frmColl["txtEmailAddress"], frmColl["txtPassword"]);
                if (objDCUsers.Code > 0)
                {
                    Session["UserLogon"] = objDCUsers;
                    switch (objDCUsers.UserType)
                    {
                    case UserType.A:
                        return(Redirect("RiskCriteria/ViewRiskCriteria"));

                    case UserType.U:
                        return(Redirect("ClientInfo/AddUpdateClientInfo"));
                    }
                }
                else
                {
                    TempData["errorMessage"] = "The UserID/Password is Incorrect.";
                }
            }
            return(View());
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                String subKey = Request["subKey"];
                String email  = Request["email"];

                HashTableExp hash = new HashTableExp("Id", subKey);
                hash.Add("Email", email);
                TempData data = new BLTempData().Select(hash, String.Format(" and Expires>'{0}'", DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"))).SingleOrDefault();
                //删除过期数据
                new BLTempData().Delete(null, String.Format(" and Expires<'{0}'", DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss")));

                if (data == null)
                {
                    Response.Redirect("error.htm");
                }
                else
                {
                    new BLTempData().Delete(subKey);
                    Users user = new BLUsers().Select(new HashTableExp("Mail", email)).SingleOrDefault();
                    if (user == null)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), DateTime.Now.ToString(), "alert('邮件地址不存在');location.href='error.htm'", true);
                    }
                    else
                    {
                        this.LitUserName.Text = user.LoginId;
                        Session["TempUser"]   = user;
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <returns></returns>
        public String SelectByPage(int limit, int start)
        {
            int          total;
            List <Users> userss = new BLUsers().Select(limit, start, new HashTableExp(), out total, " and id<>'-1'");

            return(JsonConvert.JavaScriptSerializer(new ExtGridRecord(userss, total)));
        }
Esempio n. 4
0
        //获得所有用户信息
        public String GetAll()
        {
            List <Users> userss = new BLUsers().Select();

            userss = userss.Where(f => f.Id != "-1").ToList();
            return(JsonConvert.JavaScriptSerializer(userss));
        }
Esempio n. 5
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="users"></param>
 /// <returns></returns>
 public String Update(Users users)
 {
     try
     {
         int result = new BLUsers().Update(users);
         if (result > 0)
         {
             var roles = new String[] { };
             if (!String.IsNullOrEmpty(Request["Roles"]))
             {
                 roles = Request["Roles"].Split(',');
             }
             new BLUserToRole().Save(users.Id, roles);
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = true, msg = "修改成功"
             }));
         }
         else
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = false, msg = "修改失败"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             success = false, msg = "修改失败,失败原因:" + ex.Message
         }));
     }
 }
Esempio n. 6
0
        public ActionResult Index()
        {
            //检查Cookie是不为空就自动登录
            var cookie = Request.Cookies["LifeLogin"];

            if (cookie != null)
            {
                var data = cookie.Value.Replace("%2C", ",").Split(',');
                if (data.Length == 2)
                {
                    var loginUserName = data[0];
                    var loginPassword = MD5Encry.Encry(data[1]);
                    //直接登录
                    Users user = new BLUsers().Login(loginUserName, loginPassword);
                    if (user != null)
                    {
                        Session["user"] = user;
                        return(Redirect("/Default/Index"));
                    }
                }
            }

            List <SysConfig> list = new BLSysConfig().Select(new HashTableExp("SysKey", "SysVersion"));

            ViewData["version"]  = list[0].SysValue;
            ViewData["dataBase"] = ConfigurationManager.AppSettings["DAL"];
            return(View());
        }
Esempio n. 7
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids">Id的集合,如1,2,3</param>
        /// <returns></returns>
        public String Delete(String ids)
        {
            int num = new BLUsers().Delete(ids);

            return(JsonConvert.JavaScriptSerializer(new ExtResult()
            {
                success = true, msg = "成功删除" + num + "条数据"
            }));
        }
Esempio n. 8
0
        public JsonResult GetVersionsByProtocolId(int ClientDetailsId, int SponserDetailsId, int ProtocalDetailsId)
        {
            lstDCUsers = new List <DCUsers>();
            objBLUsers = new BLUsers();
            lstDCUsers = objBLUsers.GetVersionsByProtocolId(ClientDetailsId, SponserDetailsId, ProtocalDetailsId);
            var result = Json(lstDCUsers, JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = int.MaxValue;
            return(result);
        }
Esempio n. 9
0
        public JsonResult GetProtocolDetails(int SponserDetailsId)
        {
            lstDCUsers = new List <DCUsers>();
            objBLUsers = new BLUsers();
            lstDCUsers = objBLUsers.GetProtocolDetails(SponserDetailsId);
            var result = Json(lstDCUsers, JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = int.MaxValue;
            return(result);
        }
Esempio n. 10
0
        public JsonResult GetClientDetails()
        {
            lstDCUsers = new List <DCUsers>();
            objBLUsers = new BLUsers();
            lstDCUsers = objBLUsers.GetClientDetails();
            var result = Json(lstDCUsers, JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = int.MaxValue;
            return(result);
        }
Esempio n. 11
0
        /// <summary>
        /// This method is used for Get Users
        /// </summary>
        /// <returns></returns>
        public JsonResult GetUsers(string UserId)
        {
            lstDCUsers = new List <DCUsers>();
            objBLUsers = new BLUsers();
            lstDCUsers = objBLUsers.GetUsers(Convert.ToInt32(UserId));
            var result = Json(lstDCUsers, JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = int.MaxValue;
            return(result);
        }
Esempio n. 12
0
        /// <summary>
        /// 获得所有用户
        /// </summary>
        /// <returns></returns>
        public String GetAllUsers()
        {
            List <Users> list   = new BLUsers().Select();
            String       result = JsonConvert.JavaScriptSerializer(new ExtResult()
            {
                data    = list,
                success = true
            });

            return(result);
        }
        public ActionResult ForgotPassword(string txtEmailAddress)
        {
            List <DCUsers> lstDCUsers = new List <DCUsers>();

            string strMessage = string.Empty;

            if (!string.IsNullOrEmpty(txtEmailAddress))
            {
                objBLUsers = new BLUsers();
                objDataOperationResponse = new DataOperationResponse();

                lstDCUsers = objBLUsers.ForgotPassword(txtEmailAddress);
                if (lstDCUsers.Count > 0)
                {
                    EmailAttributesModel objEmailAttributes = new EmailAttributesModel();
                    objEmailAttributes.Subject = "IRMA™ Onboarding Portal Password";
                    string imagePath = Server.MapPath(@"~/Images/mail.png");

                    var linkedResource = new LinkedResource(imagePath, MediaTypeNames.Image.Jpeg);
                    linkedResource.ContentId = "logoImage";
                    string body = "Hello " + lstDCUsers[0].FirstName + "," + " <br/><br/>" + "We heard that you lost your IRMA™ Onboarding Portal password. Sorry about that!"
                                  + "<br/><br/>" + "<b style='margin-left:30px;'>Your Password: </b>" + lstDCUsers[0].LastName + "<br/><br/>" + " Please contact the applicable support group for any questions or assistance:" + "<br/><br/>"
                                  + "<li style='margin-left:30px;'>Adaptive Risk System (ARS™) support team for questions related to the use of the IRMA™ Onboarding and/or Live applications.</li>"
                                  + "<li type='circle' style='margin:5px 60px'> <a href='mailto:" + AppConfig.SMTPEmailARS + "'>" + AppConfig.SMTPEmailARS + " </a></li> "
                                  + "<li type='circle' style='margin:5px 60px'> Mobile: " + AppConfig.SMTPPHNNO + "</li>"

                                  + "<li style='margin-left:30px;'>IRMA™ IT support team for any questions related to logon, password or other IT related issues.</li>"
                                  + "<li type='circle' style='margin:5px 60px'> <a href='mailto:" + AppConfig.SMTPEmailIRMA + "'> " + AppConfig.SMTPEmailIRMA + " </a></li> "

                                  + "<br/><br/>" + " We will respond to emails within 24 hours of receipt." + "<br/><br/>" + " Thank you and have a great day!" + "<br/><b> IRMA™ Support Team</b>" + "<br/> <img src='cid:logoImage' alt='Red dot' width='122' height='48' />";
                    var altView = AlternateView.CreateAlternateViewFromString(body, null, "text/html");
                    altView.LinkedResources.Add(linkedResource);
                    objEmailAttributes.AlternateView = altView;
                    objEmailAttributes.MessageBody   = body;
                    objEmailAttributes.From          = AppConfig.SMTPEMAILFROM;
                    objEmailAttributes.To            = lstDCUsers[0].EmailAddress;
                    objEmailAttributes.CC            = "";
                    strMessage = SendMail(objEmailAttributes);
                    TempData["SuccessMessage"] = "Password has been sent to your mail";
                    return(RedirectToAction("Login"));
                }
                else
                {
                    TempData["ErrorMessage"] = "Email-id does not exist";
                    return(RedirectToAction("Login"));
                }
            }
            return(View());
        }
Esempio n. 14
0
 public IHttpActionResult UpdateUser([FromBody] User user)
 {
     try
     {
         bool isUpdated = BLUsers.updateUser(user);
         if (isUpdated)
         {
             return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.OK, "user updated successfully")));
         }
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Failed to update user")));
     }
     catch (Exception e)
     {
         return(InternalServerError());
     }
 }
Esempio n. 15
0
 public IHttpActionResult DeleteUser(string ID)
 {
     try
     {
         bool isDeleted = BLUsers.DeleteUser(ID);
         if (isDeleted)
         {
             return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.OK, "user Deleted successfully")));
         }
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Failed to delete user")));
     }
     catch
     {
         return(InternalServerError());
     }
 }
Esempio n. 16
0
        /// <summary>
        /// 查询所有用户
        /// </summary>
        /// <returns></returns>
        public String Select()
        {
            List <Users> userss = new BLUsers().Select();
            List <ExtTreeNode <Users> > nodes = new List <ExtTreeNode <Users> >();

            foreach (var item in userss)
            {
                nodes.Add(new ExtTreeNode <Users>()
                {
                    id      = item.Id,
                    text    = item.Name,
                    leaf    = true,
                    Tobject = item
                });
            }
            return(JsonConvert.JavaScriptSerializer(nodes));
        }
Esempio n. 17
0
        public IHttpActionResult addUser(User userInfo)
        {
            bool isUserExist = BLUsers.getAllUsers().Any(user => user.ID == userInfo.ID);

            if (!isUserExist)
            {
                try
                {
                    BLUsers.addUser(userInfo);
                    return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.OK, "user created successfully")));
                }
                catch (Exception e)
                {
                    return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Failed to create new user")));
                }
            }
            return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "User already exist!")));
        }
Esempio n. 18
0
 public IHttpActionResult isAuthenticated(UserAuthenticated userInfo)
 {
     try
     {
         bool Auth = BLUsers.isAuthenticated(userInfo.email, userInfo.password);
         if (Auth)
         {
             User   currentUser = BLUsers.getAllUsers().FirstOrDefault(user => user.Email == userInfo.email);
             string fullName    = $"{currentUser.FirstName} {currentUser.LastName}";
             var    token       = jwtManager.GenerateToken(currentUser.UserID.ToString(), fullName, currentUser.RoleType);
             return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.OK, token)));
         }
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "failed to authenticate!")));
     }
     catch (Exception e)
     {
         return(InternalServerError());
     }
 }
Esempio n. 19
0
 public IHttpActionResult getUsersByRole([FromUri] char roleType)
 {
     try
     {
         List <User> users = BLUsers.getUsersByRole(roleType);
         if (users.Count > 0)
         {
             return(Ok(users));
         }
         else
         {
             return(NotFound());
         }
     }
     catch
     {
         return(InternalServerError());
     }
 }
Esempio n. 20
0
 public IHttpActionResult GetUsers()
 {
     try
     {
         List <User> users = BLUsers.getAllUsers();
         if (users != null)
         {
             return(Ok(users));
         }
         else
         {
             return(NotFound());
         }
     }
     catch
     {
         return(InternalServerError());
     }
 }
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            var identity = new ClaimsIdentity(context.Options.AuthenticationType);

            var IsUserExist = new BLUsers().Get().Where(x => x.UserName == context.UserName && x.Password == context.Password).FirstOrDefault();

            if (IsUserExist != null)
            {
                identity.AddClaim(new Claim(ClaimTypes.Role, IsUserExist.Type));
                identity.AddClaim(new Claim("username", IsUserExist.UserName));
                identity.AddClaim(new Claim(ClaimTypes.Name, IsUserExist.UserName));
                identity.AddClaim(new Claim(ClaimTypes.Email, "*****@*****.**"));
                context.Validated(identity);
            }
            else
            {
                context.SetError("invalid_grant", "Provided username and password is incorrect");
                return;
            }
        }
Esempio n. 22
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="users"></param>
 /// <returns></returns>
 public String Add(Users users)
 {
     try
     {
         users.Id       = Guid.NewGuid().ToString();
         users.LoginPwd = MD5Encry.Encry("123456");//默认密码123456
         int result = new BLUsers().Add(users);
         if (result > 0)
         {
             var roles = new String [] {};
             if (!String.IsNullOrEmpty(Request["Roles"]))
             {
                 roles = Request["Roles"].Split(',');
             }
             new BLUserToRole().Save(users.Id, roles);
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = true, msg = "新增成功,初始密码:123456"
             }));
         }
         else
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = false, msg = "新增失败"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             success = false, msg = "新增失败,失败原因:" + ex.Message
         }));
     }
 }
Esempio n. 23
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="loginusername">登录名称</param>
        /// <param name="loginpassword">登录密码</param>
        /// <param name="checkCode">验证码</param>
        /// <returns></returns>
        public String Login(String loginUserName, String loginPassword, String checkCode)
        {
            try
            {
                if (Request["actionkeys"] != ConfigurationManager.AppSettings["actionkeys"])
                {
                    //if (Session["CheckCode"].ToString().ToLower() != checkCode.ToLower())
                    //    return JsonConvert.JavaScriptSerializer(new ExtResult() { success = false, msg = "验证码错误" });
                }

                loginPassword = MD5Encry.Encry(loginPassword);
                Users user = new BLUsers().Login(loginUserName, loginPassword);
                if (user != null)
                {
                    Session["user"] = user;
                    return(JsonConvert.JavaScriptSerializer(new ExtResult()
                    {
                        success = true, msg = "登录成功", data = user
                    }));
                }
                else
                {
                    return(JsonConvert.JavaScriptSerializer(new ExtResult()
                    {
                        success = false, msg = "用户名或密码错误"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.JavaScriptSerializer(new ExtResult()
                {
                    success = false, msg = "登录失败,失败原因:" + ex.Message
                }));
            }
        }
Esempio n. 24
0
        /// <summary>
        /// 找回密码
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public String ForgotPwd(String email)
        {
            String msg = "";
            //查询邮件是否有效
            List <Users> users = new BLUsers().Select(new HashTableExp("Mail", email));

            if (users.Count == 0)
            {
                msg = "邮箱信息无效";
            }
            else
            {
                Users    user = users[0];
                TempData data = new TempData()
                {
                    Id         = Guid.NewGuid().GetString(),
                    Email      = email,
                    CreateTime = DateTime.Now,
                    Expires    = DateTime.Now.AddMinutes(3)
                };
                new BLTempData().Add(data);

                String html = "尊敬的客户您好: <p style=\"padding-left:40px\"> 感谢您使用生活费管理系统,请<a href=\"{url}\" target=\"_blank\">点击这里</a>找回密码</p>";
                String url  = String.Format("?subKey={0}&email={1}", data.Id, data.Email);
                html = html.Replace("{url}", "http://" + Request.UrlReferrer.Authority + "/BackPwd/index.aspx" + url);
                SOCNetSendMail.AsyncSender(EmailType.QQ, new EmailUser()
                {
                    UserName = "******", UserPwd = "duanjiangtao"
                }, email, html, "找回密码");
                msg = "邮件已发送到你的邮箱,请注意查收";
            }
            return(JsonConvert.JavaScriptSerializer(new ExtResult()
            {
                success = true, msg = msg
            }));
        }
Esempio n. 25
0
 public UsersController()
 {
     _repo = new BLUsers();
 }
Esempio n. 26
0
        /// <summary>
        /// This method is used for Add Update Users
        /// </summary>
        /// <param name="frmColl"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public ActionResult AddUpdateUsers(FormCollection frmColl)
        {
            if (Session["UserLogon"] != null)
            {
                objDCUsers = new DCUsers();
                //if (!string.IsNullOrEmpty(frmColl["btnSave"]) && string.Compare(frmColl["btnSave"].ToUpper(), "SAVE") == 0)

                objDataOperationResponse = new DataOperationResponse();
                objBLUsers = new BLUsers();

                StringBuilder objStrBuilder = new StringBuilder();
                if (!string.IsNullOrEmpty(frmColl["ddlAssessmentType"]))
                {
                    string[] strUserAssessmentTypeIds = frmColl["ddlAssessmentType"].Split(',');
                    objStrBuilder.Append("<UserAssessmentTypeIds>");
                    foreach (string UserAssessmentTypeId in strUserAssessmentTypeIds)
                    {
                        objStrBuilder.Append("<UserAssessmentTypeId>" + Convert.ToInt32(UserAssessmentTypeId) + "</UserAssessmentTypeId>");
                    }
                    objStrBuilder.Append("</UserAssessmentTypeIds>");
                }
                objDCUsers.UserId          = string.IsNullOrEmpty(frmColl["hdnUserId"]) ? 0 : Convert.ToInt32(frmColl["hdnUserId"]);
                objDCUsers.FirstName       = frmColl["txtFirstName"];
                objDCUsers.LastName        = frmColl["txtLastName"];
                objDCUsers.EmailAddress    = frmColl["txtEmail"];
                objDCUsers.SponsorApproval = frmColl["ddlSponserApproval"];
                objDCUsers.ExpiryDate      = Convert.ToDateTime(frmColl["txtExpiryDate"]);
                if (Convert.ToInt32(frmColl["ddlClientName"]) == 0)
                {
                    objDCUsers.ClientName     = frmColl["txtNewClientName"];
                    objDCUsers.ClientNameAbbr = frmColl["txtClientNameABBR"];
                }
                else
                {
                    objDCUsers.ClientName = frmColl["hdnClientName"];
                }
                if (Convert.ToInt32(frmColl["ddlSponserName"]) == 0)
                {
                    objDCUsers.SponserName     = frmColl["txtNewSponserName"];
                    objDCUsers.SponserNameAbbr = frmColl["txtSponserNameABBR"];
                }
                else
                {
                    objDCUsers.SponserName = frmColl["hdnSponserName"];
                }
                if (Convert.ToInt32(frmColl["ddlProtocalName"]) == 0)
                {
                    objDCUsers.ProtocalName     = frmColl["txtNewProtocalName"];
                    objDCUsers.ProtocolNameAbbr = frmColl["txtProtocolNameABBR"];
                }
                else
                {
                    objDCUsers.ProtocalName = frmColl["hdnProtocalName"];
                }

                string XMLData = objStrBuilder.ToString();
                objDataOperationResponse = objBLUsers.AddUpdateUser(objDCUsers, XMLData);
                if (objDataOperationResponse.Code > 0)
                {
                    if (objDCUsers.UserId == 0)
                    {
                        string strMessage  = string.Empty;
                        string strPassword = string.Empty;
                        objDCUsers = (DCUsers)Session["UserLogon"];
                        EmailAttributesModel objEmailAttributes = new EmailAttributesModel();
                        objEmailAttributes.Subject = "Welcome to the IRMA™ Onboarding Portal";
                        string imagePath = Server.MapPath(@"~/Images/mail.png");

                        var linkedResource = new LinkedResource(imagePath, MediaTypeNames.Image.Jpeg);
                        linkedResource.ContentId = "logoImage";
                        string body = "Hello " + frmColl["txtFirstName"] + "," + " <br/><br/>" + "Welcome to Adaptive Risk Systems (ARS™) Intelligent Risk Monitoring Assessment ( IRMA™) Onboarding application [" + AppConfig.IRMAVERSION + "]. The web-link to login to the IRMA™ Onboarding portal and user name details are provided below. Password will be provided in a separate email."
                                      + "<br/><br/>" + "<b style='margin-left:30px;'> IRMA™ Onboarding web-link:</b> <a href='http://onboarding.besymple.com/'> http://onboarding.besymple.com/ </a>" + "<br/><b style='margin-left:30px;'>User Name: </b>" + frmColl["txtEmail"] + "<br/><b style='margin-left:30px;'> Password:</b> to be provided in a separate email<br/><br/>" + " Please contact the applicable support group for any questions or assistance:" + "<br/><br/>"
                                      + "<li style='margin-left:30px;'>Adaptive Risk System (ARS™) support team for questions related to the use of the IRMA™ Onboarding and/or Live applications.</li>"
                                      + "<li type='circle' style='margin:5px 60px'> <a href='mailto:" + AppConfig.SMTPEmailARS + "'>" + AppConfig.SMTPEmailARS + " </a></li> "
                                      + "<li type='circle' style='margin:5px 60px'> Mobile: " + AppConfig.SMTPPHNNO + "</li>"

                                      + "<li style='margin-left:30px;'>IRMA™ IT support team for any questions related to logon, password or other IT related issues.</li>"
                                      + "<li type='circle' style='margin:5px 60px'> <a href='mailto:" + AppConfig.SMTPEmailIRMA + "'> " + AppConfig.SMTPEmailIRMA + " </a></li> "

                                      + "<br/><br/>" + " We will respond to emails within 24 hours of receipt." + "<br/><br/>" + " Thank you and have a great day!" + "<br/><b> IRMA™ Support Team</b>" + "<br/> <img src='cid:logoImage' alt='Red dot' width='122' height='48' />";
                        var altView = AlternateView.CreateAlternateViewFromString(body, null, "text/html");
                        altView.LinkedResources.Add(linkedResource);
                        objEmailAttributes.AlternateView = altView;
                        objEmailAttributes.MessageBody   = body;
                        objEmailAttributes.From          = AppConfig.SMTPEMAILFROM;
                        objEmailAttributes.To            = frmColl["txtEmail"];
                        objEmailAttributes.CC            = AppConfig.SMTPEmailCC;
                        strMessage = SendMail(objEmailAttributes);

                        EmailAttributesModel objEmailAttributesForPassword = new EmailAttributesModel();
                        objEmailAttributesForPassword.Subject = "";
                        string imagePathPwd = Server.MapPath(@"~/Images/mail.png");

                        var linkedResourcePwd = new LinkedResource(imagePathPwd, MediaTypeNames.Image.Jpeg);
                        linkedResourcePwd.ContentId = "logoImagePwd";
                        string bodyPwd = "Hello " + frmColl["txtFirstName"] + "," + " <br/><br/>" + "Welcome to Adaptive Risk Systems (ARS™) Intelligent Risk Monitoring Assessment ( IRMA™) Onboarding application [" + AppConfig.IRMAVERSION + "]."
                                         + "<br/><br/>" + frmColl["txtLastName"] + "<br/><br/>" + " Please contact the applicable support group for any questions or assistance:" + "<br/><br/>"
                                         + "<li style='margin-left:30px;'>Adaptive Risk System (ARS™) support team for questions related to the use of the IRMA™ Onboarding and/or Live applications.</li>"
                                         + "<li type='circle' style='margin:5px 60px'> <a href='mailto:" + AppConfig.SMTPEmailARS + "'>" + AppConfig.SMTPEmailARS + " </a></li> "
                                         + "<li type='circle' style='margin:5px 60px'> Mobile: " + AppConfig.SMTPPHNNO + "</li>"

                                         + "<li style='margin-left:30px;'>IRMA™ IT support team for any questions related to logon, password or other IT related issues.</li>"
                                         + "<li type='circle' style='margin:5px 60px'> <a href='mailto:" + AppConfig.SMTPEmailIRMA + "'> " + AppConfig.SMTPEmailIRMA + " </a></li> "

                                         + "<br/><br/>" + " We will respond to emails within 24 hours of receipt." + "<br/><br/>" + " Thank you and have a great day!" + "<br/><b> IRMA™ Support Team</b>" + "<br/> <img src='cid:logoImagePwd' alt='Red dot' width='122' height='48' />";
                        var altViewPwd = AlternateView.CreateAlternateViewFromString(bodyPwd, null, "text/html");
                        altViewPwd.LinkedResources.Add(linkedResourcePwd);
                        objEmailAttributesForPassword.AlternateView = altViewPwd;
                        objEmailAttributesForPassword.MessageBody   = bodyPwd;
                        objEmailAttributesForPassword.From          = AppConfig.SMTPEMAILFROM;
                        objEmailAttributesForPassword.To            = frmColl["txtEmail"];
                        objEmailAttributesForPassword.CC            = "";
                        strPassword = SendMail(objEmailAttributesForPassword);
                    }
                    objDCUsers.Activetab = frmColl["hdnActivetab"];
                    if (objDCUsers.Activetab == "1")
                    {
                        if (objDataOperationResponse.Code > 0)
                        {
                            TempData["successMessage"] = objDataOperationResponse.Message;
                        }
                        else
                        {
                            TempData["errorMessage"] = objDataOperationResponse.Message;
                        }
                        TempData["hdnActivetab"] = "1";
                        return(Redirect("~/User/ViewUsers"));
                    }
                    else
                    {
                        TempData["hdnActivetab"] = "2";
                        return(Json(objDataOperationResponse, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    objDCUsers.Activetab = frmColl["hdnActivetab"];
                    if (objDCUsers.Activetab == "1")
                    {
                        TempData["hdnActivetab"] = "1";
                        TempData["errorMessage"] = objDataOperationResponse.Message;
                        return(Redirect("~/User/ViewUsers"));
                    }
                    else
                    {
                        TempData["hdnActivetab"] = "2";
                        return(Json(objDataOperationResponse.Message, JsonRequestBehavior.AllowGet));
                    }
                }

                //return View("ViewUsers");
            }
            else
            {
                return(Redirect("~/Account/Login"));
            }
        }
Esempio n. 27
0
 /// <summary>
 /// This method is used for Delete Uers
 /// </summary>
 /// <param name="UserId"></param>
 /// <returns></returns>
 public string DeleteUers(string UserId)
 {
     objBLUsers = new BLUsers();
     objDataOperationResponse = objBLUsers.DeleteUser(Convert.ToInt32(UserId));
     return(objDataOperationResponse.Message);
 }