コード例 #1
0
        public void Test_1()
        {
            Browser.GoTo(TestData.url);

            LoginPage loginPg = new LoginPage(Browser);

            Menu menu = loginPg.Login(TestData.adminName, TestData.adminPass);

            Assert.AreEqual(Browser.Url, string.Concat(TestData.url, TestData.successfullLoginUrl),
                            string.Format("Login failed for cridentials: name: {0}, pass: {1}", TestData.adminName, TestData.adminPass));

            SystemUsers users = menu.Switch2AdminUserManagementUsers();

            Assert.AreEqual(Browser.Url, string.Concat(TestData.url, TestData.systemUsersUrl),
                            string.Format("Failed to open AdminUserManagementUsers page"));

            AddUserForm form = users.ClickAddUser();

            Assert.AreEqual(Browser.Url, string.Concat(TestData.url, TestData.addUsersUrl), "Failed to open AddUserForm");

            error = form.AddUser(UserRole.ESS, TestData.empName, TestData.userName, Status.Enabled, TestData.userPass);
            Assert.AreEqual("Success", error, error);

            Assert.AreEqual(string.Concat(TestData.url, TestData.systemUsersUrl), Browser.Url,
                            string.Format("Failed to add user, user data: name: {0}, pass: {1}", TestData.userName, TestData.userPass));

            Browser.GoTo(string.Concat(TestData.url, TestData.logoutUrl));

            menu = loginPg.Login(TestData.userName, TestData.userPass);
            Assert.AreEqual(Browser.Url, string.Concat(TestData.url, TestData.successfullLoginUrl),
                            string.Format("Login failed for cridentials: name: {0}, pass: {1}", TestData.userName, TestData.userPass));
        }
コード例 #2
0
        protected void btnSaveAccountSettings_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    UserLogic uLogic = new UserLogic();
                    System.Security.Principal.IPrincipal user = System.Web.HttpContext.Current.User;
                    SystemUsers currentUser = uLogic.GetCurrentUser(user);

                    using (FormContext ctx = new FormContext())
                    {
                        var updateUser = ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == currentUser.SystemUserID);

                        updateUser.Greeting    = txtGreeting.Text;
                        updateUser.DisplayName = txtDisplayName.Text;
                        updateUser.UserStatus  = ctx.UserStatuses.FirstOrDefault(x => x.StatusText == ddlUserStatus.SelectedText);

                        ctx.SaveChanges();

                        divSaveCancel.Visible      = false;
                        divLabelEdit.Visible       = true;
                        divDisplayNameEdit.Visible = false;
                        ddlUserStatus.Enabled      = false;
                        txtGreeting.Enabled        = false;

                        lblUser.Text = txtDisplayName.Text;
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
コード例 #3
0
        public void resetButton()
        {
            this.PQCopyFromPR.Active.SetItemValue("Enabled", false);
            this.PQCopyToPO.Active.SetItemValue("Enabled", false);
            PurchaseQuotation selectobject = (PurchaseQuotation)View.CurrentObject;
            SystemUsers       user         = ObjectSpace.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId);

            switch (selectobject.DocStatus.CurrDocStatus)
            {
            case DocStatus.Cancelled:
            case DocStatus.Closed:
            case DocStatus.Posted:
            case DocStatus.Accepted:
            case DocStatus.Submited:
                break;

            default:
                this.PQCopyFromPR.Active.SetItemValue("Enabled", true);
                break;
            }
            switch (selectobject.DocStatus.CurrDocStatus)
            {
            case DocStatus.Accepted:
                if (user.Roles.Where(pp => pp.Name == DocTypeCodes.PurchaseOrder).Count() > 0)
                {
                    this.PQCopyToPO.Active.SetItemValue("Enabled", true);
                }
                break;

            default:
                break;
            }
        }
コード例 #4
0
ファイル: Login.aspx.cs プロジェクト: califaxit/manhquang
        protected void Page_Load(object sender, EventArgs e)
        {
            SystemUsersBO aSystemUsersBO = new SystemUsersBO();
            PermitsBO     aPermitsBO     = new PermitsBO();

            if (IsPostBack == true)
            {
                string      Pass         = Library.StringUtility.md5(Page.Request.Form["txtPassword"].ToString());
                string      User         = Page.Request.Form["txtUsername"].ToString();
                bool        disable      = false;
                SystemUsers aSystemUsers = aSystemUsersBO.Sel_ByUsername_ByPassword(User, Pass, disable);

                if (aSystemUsers != null)
                {
                    Session["LoginAccount"] = aSystemUsers;
                    List <vw_PermitsViewAll> ListPermitViewAll = aPermitsBO.GetAllInfoLogin_ByUsername(aSystemUsers.Username);
                    Session["LoginPermitViewAll"] = ListPermitViewAll;


                    Response.Redirect("Main.aspx");
                }
                else
                {
                    Response.Redirect("Default.aspx");
                }
            }
        }
コード例 #5
0
        private void resetButton()
        {
            SystemUsers user       = (SystemUsers)SecuritySystem.CurrentUser;
            bool        IsPostUser = user.Roles.Where(p => p.Name == GeneralSettings.postrole).Count() > 0 ? true : false;

            this.PostClaim.Active.SetItemValue("Enabled", false);
            this.PostClaimV2.Active.SetItemValue("Enabled", false);
            if (IsPostUser)
            {
                if (View.GetType() == typeof(DetailView))
                {
                    ClaimTrxs selectedObject = (ClaimTrxs)View.CurrentObject;
                    if (selectedObject.IsNew)
                    {
                    }
                    else
                    {
                        if (selectedObject.IsClosed && !selectedObject.IsPosted)
                        {
                            this.PostClaimV2.Active.SetItemValue("Enabled", true);
                        }
                    }
                    this.PostClaimV2.Enabled.SetItemValue("EditMode", ((DetailView)View).ViewEditMode == ViewEditMode.View);
                }
                else if (View is ListView)
                {
                    //if (View.Id == "ClaimTrxs_ListView_Closed")
                    this.PostClaimV2.Active.SetItemValue("Enabled", true);
                }
            }
        }
コード例 #6
0
 public JsonResult DeleteUser(string ids)
 {
     try
     {
         int[] idArray = ids.GetArray();
         if (idArray.Length == 0)
         {
             return(Json(new { result = 0, content = RetechWing.LanguageResources.Common.DeleteFailed }, JsonRequestBehavior.AllowGet));
         }
         if (_userManager.BatchDeleteUser(idArray))
         {
             foreach (var item in idArray)
             {
                 var user = SystemUsers.FirstOrDefault(p => p.UserId == item);
                 if (user == null)
                 {
                     continue;
                 }
                 user.Status = 1;
             }
         }
         //RetechWing.BusinessCache.SystemCache.Instance.RemoveCacheUser(1);
         return(Json(new { result = 1, content = RetechWing.LanguageResources.Common.DeleteSuccess }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { result = 0, content = RetechWing.LanguageResources.Common.DeleteFailed }, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #7
0
        //个人信息
        public ActionResult My(int id)
        {
            SysUser model = SystemUsers.First(p => p.UserId == id);

            ViewBag.id = model.UserId;
            return(View(model));
        }
コード例 #8
0
        //6投资统计(投资统计)
        public ActionResult TotalInvestment()
        {
            ViewBag.MenuIndex = 6;
            SystemUsers user = Session["UserInfo"] as SystemUsers;

            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            user = http.DoGetObject <SystemUsers>(ApplicationPropertys.WEBAPI_URL + "/User/GetUserInfo/" + user.ID);
            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            Session["UserInfo"] = user;
            ViewBag.PageName    = "投资统计";

            Earnings_Parameter par = new Earnings_Parameter();

            par.UserID    = user.ID;
            par.SearchWay = 1;
            par.Datas     = 0;
            //查询统计总数
            Earnings_Return result = http.DoPostObject <Earnings_Return>(ApplicationPropertys.WEBAPI_URL + "/User/Totalrevenue", par);

            //已购买的债权
            DataTable[] model = http.DoGetObject <DataTable[]>(ApplicationPropertys.WEBAPI_URL + "/Claims/GetInvestment_Ing/" + user.ID);

            ViewBag.Result = result;
            ViewBag.Record = model;
            return(View());
        }
コード例 #9
0
        //1用户中心首页
        public ActionResult Index()
        {
            SystemUsers user = Session["UserInfo"] as SystemUsers;

            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            user = http.DoGetObject <SystemUsers>(ApplicationPropertys.WEBAPI_URL + "/User/GetUserInfo/" + user.ID);
            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            ViewBag.UserName    = user.UserName;
            ViewBag.UserBalance = user.Balance;
            ViewBag.UserFreeze  = user.Freeze;
            ViewBag.UserIDNumberIsAuthenticate = user.IDNumberIsAuthenticate;
            ViewBag.UserCellPhone = "*******" + user.CellPhone.Substring(user.CellPhone.Length - 4, 4);
            ViewBag.UserCellPahoneIsAuthenticate = user.CellPahoneIsAuthenticate;
            if (user.IDNumberIsAuthenticate)
            {
                ViewBag.UserIDNumber = "***************" + user.IDNumber.Substring(user.IDNumber.Length - 3, 3);
                ViewBag.UserRealName = user.RealName.Substring(0, 1) + "**";
            }
            return(View());
        }
コード例 #10
0
        //5登录日志
        public ActionResult UserRecord(int id = 1)
        {
            ViewBag.MenuIndex = 5;
            SystemUsers user = Session["UserInfo"] as SystemUsers;

            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            user = http.DoGetObject <SystemUsers>(ApplicationPropertys.WEBAPI_URL + "/User/GetUserInfo/" + user.ID);
            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            Session["UserInfo"] = user;
            ViewBag.PageName    = "登录日志";

            RQPagerDto pag = new RQPagerDto();

            pag.PageSize    = 15;
            pag.PageIndex   = id;
            pag.QueryFileds = " [Id],[OperatorUserId],[OperatorUserName],[OperatorType],[BusinessType],[OperatorTime],[OperatorContent],[OperatorIP] ";
            pag.Where       = " BusinessType = '登陆' AND OperatorUserId = " + user.ID + " AND DATEDIFF(day,OperatorTime,getdate()) <= 10 ";
            pag.OrderBy     = " ID DESC";
            ModelByCount <SystemLog> model = http.DoPostObject <ModelByCount <SystemLog> >(ApplicationPropertys.WEBAPI_URL + "/SystemLog/GetList/", pag);

            ViewBag.Datas = model;
            return(View());
        }
コード例 #11
0
        //6投资统计(收益统计)
        public ActionResult Totalrevenue()
        {
            ViewBag.MenuIndex = 6;
            SystemUsers user = Session["UserInfo"] as SystemUsers;

            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            user = http.DoGetObject <SystemUsers>(ApplicationPropertys.WEBAPI_URL + "/User/GetUserInfo/" + user.ID);
            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            Session["UserInfo"] = user;
            ViewBag.PageName    = "投资统计";

            Earnings_Parameter par = new Earnings_Parameter();

            par.UserID    = user.ID;
            par.SearchWay = 1;
            par.Datas     = 0;

            Earnings_Return result = http.DoPostObject <Earnings_Return>(ApplicationPropertys.WEBAPI_URL + "/User/Totalrevenue", par);

            ViewBag.Datas = result;

            return(View());
        }
コード例 #12
0
        public IActionResult Login(SystemUsers u)
        {
            var LoggedInUser = ORM.SystemUsers.Where(x => x.UserName == u.UserName && x.Password == u.Password).FirstOrDefault();

            if (LoggedInUser == null)
            {
                ViewBag.Message = "用户名或密码错误";
                return(View());
            }

            //以下是使用AddDistributedMemoryCache把session存放在服务器内存中
            //HttpContext.Session.SetString("UserName", LoggedInUser.UserName);
            //HttpContext.Session.SetString("Role", LoggedInUser.Role);

            //以下是使用AddDistributedSqlServerCache储存Session时,把信息(不是用于本例中登陆的信息,因为这样写入是面对所有浏览器的)写入Session的方法 可以使用 SetAsync及SetStringAsync两种方法
            //byte[] currentVersion= Encoding.UTF8.GetBytes("Version 1.0");
            //var options = new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromDays(300));
            //await _cache.SetAsync("Version", currentVersion, options);
            //await _cache.SetStringAsync("testSave", "abc",options);

            //以下是使用Sqlserver存放登陆信息是的语句
            HttpContext.Session.SetString("UserName", LoggedInUser.UserName);
            HttpContext.Session.SetString("Role", LoggedInUser.Role);

            Response.Cookies.Append("LastLoggedInTime", DateTime.Now.ToString());

            return(RedirectToAction("Dashboard"));
        }
コード例 #13
0
        /// <summary>
        /// 身份认证
        /// </summary>
        /// <returns></returns>
        public BaseResultDto <bool> AuthenticateIDCard(SystemUsers user)
        {
            BaseResultDto <bool> resu = new BaseResultDto <bool>();
            SqlCommand           cmd  = db.GetStoredProcedureCommand("Proc_AuthenticateIDCard");

            db.AddInputParameter(cmd, "@UserID", DbType.Int32, user.ID);
            db.AddInputParameter(cmd, "@UserRealName", DbType.String, user.RealName);
            db.AddInputParameter(cmd, "@UserIDCard", DbType.String, user.IDNumber);
            db.AddInputParameter(cmd, "@UserAddress", DbType.String, user.UserAddress);
            db.AddOutputParameter(cmd, "@ErrorMsg", DbType.String, 500);
            db.AddReturnValueParameter(cmd, "@ReturnValue", DbType.Int32, 4);
            db.ExecuteNonQuery(cmd);
            int result = db.GetParameter(cmd, "@ReturnValue").Value.ToInt();

            if (result > 0)
            {
                resu.IsSeccess = true;
            }
            else
            {
                resu.IsSeccess = false;
                resu.ErrorMsg  = db.GetParameter(cmd, "@ErrorMsg").Value.ToString();
            }
            return(resu);
        }
コード例 #14
0
        public bool Update(SystemUsers model, List <string> fileds, string sqlWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.AppendFormat("update {0} set ", model.GetType().Name);
            List <string>       filedsList   = new List <string>();
            List <SqlParameter> sqlParameter = new List <SqlParameter>();
            SqlParameter        Param        = new SqlParameter("@ID", SqlDbType.Int, 4);

            if (string.IsNullOrEmpty(sqlWhere))
            {
                Param.Value = model.ID;
                sqlParameter.Add(Param);
            }
            foreach (string filed in fileds)
            {
                filedsList.Add(string.Format("{0}=@{0}", filed));
                Param = new SqlParameter(string.Format("@{0}", filed), model.GetType().GetProperty(filed).GetValue(model, null));
                sqlParameter.Add(Param);
            }
            strSql.AppendFormat("{0}", string.Join(",", filedsList.ToArray()));
            if (string.IsNullOrEmpty(sqlWhere))
            {
                strSql.Append(" where ID=@ID ");
            }
            else
            {
                strSql.AppendFormat(" where 1=1 and {0} ", sqlWhere);
            }
            SqlParameter[] parameters = sqlParameter.ToArray();
            return(db.ExecNon(strSql.ToString(), parameters) > 0 ? true : false);
        }
コード例 #15
0
        public ActionResult UnbindBankCardCallBack(YeePayCallBack id)
        {
            StringBuilder postData = new StringBuilder();

            postData.Append("req=" + dataFornat.UrlEncode(id.resp));   //编码
            postData.Append("&sign=" + dataFornat.UrlEncode(id.sign)); //编码

            MoneyCarCar.Models.YeePay.response _response = id.resp.XmlDeserialize <MoneyCarCar.Models.YeePay.response>();

            if (_response.code.Equals("1") && _response.service.Equals(EnumServiceType.toUnbindBankCard.ToEnumDesc()))
            {
                string strHttpPost = HttpHelper.CreatHelper().HttpPost(yeePayConfig._verifyUrl, postData.ToString());
                // 2. 验证签名
                if (strHttpPost.Contains("SUCCESS"))
                {
                    SystemUsers userInfo = (SystemUsers)Session["UserInfo"];
                    HttpHelper.CreatHelper().DoGetObject <BaseResultDto <bool> >(ApplicationPropertys.WEBAPI_URL + "/User/UnBindBank/" + userInfo.ID);
                    ViewBag.ResultStatu = true;
                    ViewBag.Message     = "恭喜你,取消绑卡成功。";
                }
                else
                {
                    ViewBag.Message = "对不起,签名验证失败。";
                }
            }
            else
            {
                ViewBag.Message = "对不起,取消绑卡失败。";
            }
            return(View("Index"));
        }
コード例 #16
0
        //14提现记录
        public ActionResult WithdrawRecord(int id = 1)
        {
            ViewBag.MenuIndex = 14;
            SystemUsers user = Session["UserInfo"] as SystemUsers;

            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            user = http.DoGetObject <SystemUsers>(ApplicationPropertys.WEBAPI_URL + "/User/GetUserInfo/" + user.ID);
            if (null == user)
            {
                return(RedirectToAction("Login", "Home"));
            }
            Session["UserInfo"] = user;
            ViewBag.PageName    = "提现记录";

            TransactionRecord_Parameter pag = new TransactionRecord_Parameter();

            pag.PageSize  = 15;
            pag.PageIndex = id;
            pag.UserId    = user.ID;
            ModelByCount <SystemRequestRecord> model = http.DoPostObject <ModelByCount <SystemRequestRecord> >(ApplicationPropertys.WEBAPI_URL + "/User/GetWithdrawRecord/", pag);

            ViewBag.Datas = model;
            return(View());
        }
コード例 #17
0
ファイル: Login.aspx.cs プロジェクト: ahmedfahim/PMMS
    protected void lnkData_Click(object sender, EventArgs e)
    {
        try
        {
            lblError.Text = "";
            UserLogonDetails user = new SystemUsers().GetDataBrowsingUser();
            if (user.UserID == 0)
            {
                lblError.Text = "بيانات الدخول غير صحيحة!";
            }
            else
            {
                Session["UserID"]      = user.UserID;
                Session["UserName"]    = user.UserName;
                Session["Permissions"] = user.Permissions;
                Session["Login_Date"]  = DateTime.Now.ToString("dd/MM/yyyy HH:mm");
                Session["Admin"]       = user.IsAdmin.ToString();
                Session["canEdit"]     = user.CanEdit.ToString();

                Shared.SaveLogfile("SYSTEM_USERS", user.UserID.ToString(), "User login", Session["UserName"].ToString());
                Response.Redirect("~/aspx/home/Default.aspx", false);
            }
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
コード例 #18
0
        public JsonResult GetPromotionUserStatus(int id, string org, string rname, string status)
        {
            var list = promotionReportManager.GetPromotionDetail(org, rname, id);

            if (!string.IsNullOrEmpty(status))
            {
                list = list.Where(p => p.ApproveStatusStr == status).ToList();
            }
            var users    = SystemUsers.AsParallel();
            var dataList = new List <dynamic>();

            foreach (var way in list)
            {
                var userInfo = users.First(p => p.UserId == way.UserId);
                dataList.Add(new
                {
                    userInfo.Username,
                    userInfo.Realname,
                    userInfo.DeptLevelPath,
                    userInfo.PostName,
                    way.ApproveStatusStr,
                    userInfo.UserId,
                    way.PromotionId,
                    way.PromotionName,
                    way.ApplyId
                });
            }
            return(Json(new { dataList }, JsonRequestBehavior.AllowGet));
        }
コード例 #19
0
        public JsonResult GetUserByDeptIds(string deptIds, string exists)
        {
            int[] dids          = deptIds.GetArray();
            int[] existsUserIds = exists.GetArray();
            if (dids.Length == 0)
            {
                return(Json(new { result = 0, msg = string.Format(RetechWing.LanguageResources.Common.PleaseChoose, "") }));
            }

            //string sqlwhere = "Sys_Users.Status = 0 and Sys_Users.DeptId IN (" + deptIds + ")";
            //if (existsUserIds.Length != 0)
            //{
            //    sqlwhere += " AND Sys_Users.UserId NOT IN (" + existsUserIds.GetString() + ")";
            //}
            //int total;
            //IEnumerable<SysUser> users = _userManager.GetAllUsers(out total, sqlwhere);
            //var result = users.Where(p => !existsUserIds.Contains(p.UserId)).Select(p => new
            //{
            //    id = p.UserId,
            //    name = p.Realname
            //});
            var result = SystemUsers.Where(p => p.Status == 0 && dids.Contains(p.DeptId) && (existsUserIds.Length > 0 ? (!existsUserIds.Contains(p.UserId)) : true)).Select(p => new
            {
                id   = p.UserId,
                name = p.Realname
            });

            return(Json(new { result = 1, dataList = result }, JsonRequestBehavior.AllowGet));
        }
コード例 #20
0
ファイル: AddSellerForm.cs プロジェクト: Pavel228322/mywork
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text == "" || textBox3.Text == "")
                {
                    MessageBox.Show("Введите данные");
                    return;
                }
                Prodavets p = new Prodavets();
                p.FullName = textBox1.Text;
                p.Phone    = textBox3.Text;
                db.Prodavets.Add(p);
                db.SaveChanges();

                SystemUsers u = new SystemUsers();
                u.IdProdavets = p.idprodavets;
                u.Login       = textBox2.Text;
                u.Password    = textBox4.Text;
                db.SystemUsers.Add(u);
                db.SaveChanges();
                MessageBox.Show("Готово. Сохраните логин и пароль: " + u.Login + " " + u.Password);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                this.Close();
            }
        }
コード例 #21
0
 public JsonResult SaveUserExtend(string data)
 {
     try
     {
         var model    = JsonConvert.DeserializeObject <SysUser>(data);
         var userInfo = SystemUsers.First(p => p.UserId == model.UserId);
         userInfo.Birthday     = model.Birthday;
         userInfo.Phone        = model.Phone;
         userInfo.QqNo         = model.QqNo;
         userInfo.Height       = model.Height;
         userInfo.MaritalState = model.MaritalState;
         userInfo.WorkYear     = model.WorkYear;
         userInfo.IDType       = model.IDType;
         userInfo.IDCard       = model.IDCard;
         userInfo.HomeTel      = model.HomeTel;
         userInfo.HomeAddr     = model.HomeAddr;
         //SysUser user = _userManager.GetUserById(model.UserId);
         //user.Birthday = model.Birthday;
         //user.Phone = model.Phone;
         _userManager.UpdateUser(userInfo);
         return(Json(new { result = 1, content = RetechWing.LanguageResources.Common.SaveSuccess }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { result = 0, content = RetechWing.LanguageResources.Common.SaveFailed }, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #22
0
        private int GetRelationship(int userId, int userId2)
        {
            if (userId == userId2)
            {
                return(3);
            }
            var user  = SystemUsers.First(p => p.UserId == userId);
            var user2 = SystemUsers.FirstOrDefault(p => p.UserId == userId2);

            if (user2 == null)
            {
                return(1);
            }
            //判断领导
            if (user2.Leader == userId)
            {
                return(0);
            }
            //下属
            if (user.Leader == userId2)
            {
                return(2);
            }
            //同事
            return(1);
        }
コード例 #23
0
ファイル: CustomViewEngine.cs プロジェクト: nk-rotten/ant
        public IViewComponentResult Invoke()
        {
            //检查是否登录
            //从cookie 拿到token
            var token = CodingUtils.AesDecrypt(WebUtils.GetCookie(GlobalSetting.CurrentLoginUserGuid));

            if (string.IsNullOrEmpty(token))
            {
                return(Content(string.Empty));
            }

            try
            {
                var         tokenObj   = new Token(token);
                SystemUsers systemUser = AccountRespository.Entity.FirstOrDefault(r => r.Eid.Equals(tokenObj.Eid));
                if (systemUser == null || !systemUser.IsActive)
                {
                    return(Content(string.Empty));
                }

                var menuList = MenuRespository.GetAllRightsMenus(systemUser.Eid, systemUser.MenuRights);
                ////拼接Menu
                var html = RenderMenu(menuList);
                return(new HtmlContentViewComponentResult(new HtmlString(html)));
            }
            catch (Exception)
            {
                return(Content(string.Empty));
            }
        }
コード例 #24
0
        protected override ServiceOutcome DoWork()
        {
            //Initialize all of the providers.
            EmailProvider ep = new EmailProvider();

            ep.Initialize();

            SMSProvider smsp = new SMSProvider();

            smsp.Initialize();

//            SkypeProvider skp = new SkypeProvider();
//            skp.Initialize();

            EdgeMessengerProvider emp = new EdgeMessengerProvider();

            emp.Initialize();

            _providers.Add(ep.Type, ep);
            _providers.Add(smsp.Type, smsp);
//            _providers.Add(skp.Type, skp);
            _providers.Add(emp.Type, emp);

            _systemUsers = new SystemUsers(AppSettings.GetAbsolute("Easynet.Edge.Core.Domain"));

            return(ServiceOutcome.Unspecified);
        }
コード例 #25
0
        /// <summary>
        /// 用户充值
        /// </summary>
        /// <returns></returns>
        public ActionResult Rechare(SystemUsers model)
        {
            BaseResultDto <PostBaseYeePayPar> resu = null;

            if (null != Session["UserInfo"])
            {
                SystemUsers user = (SystemUsers)Session["UserInfo"];
                if (!user.IDNumberIsAuthenticate)
                {
                    resu           = new BaseResultDto <PostBaseYeePayPar>();
                    resu.IsSeccess = false;
                    resu.ErrorMsg  = "请先进行实名认证!";
                    resu.ErrorCode = -3; //用户未登录
                    return(Content(resu.ToJsonString()));
                }
                model.ID = user.ID;
                resu     = http.DoPostObject <BaseResultDto <PostBaseYeePayPar> >(ApplicationPropertys.WEBAPI_URL + "/User/Rechare/", model);
            }
            else
            {
                resu           = new BaseResultDto <PostBaseYeePayPar>();
                resu.IsSeccess = false;
                resu.ErrorMsg  = "用户未登录或登录超时";
                resu.ErrorCode = -2; //用户未登录
            }
            return(Content(resu.ToJsonString()));
        }
コード例 #26
0
        public void Update(SystemUsers userParam, string password = null)
        {
            var user = _context.SystemUsers.Find(userParam.Id);

            if (user == null)
            {
                throw new AppException("User not found");
            }

            if (userParam.Username != user.Username)
            {
                // username has changed so check if the new username is already taken
                if (_context.SystemUsers.Any(x => x.Username == userParam.Username))
                {
                    throw new AppException("Username " + userParam.Username + " is already taken");
                }
            }

            // update user properties
            user.Username = userParam.Username;

            // update password if it was entered
            if (!string.IsNullOrWhiteSpace(password))
            {
                byte[] passwordHash, passwordSalt;
                CreatePasswordHash(password, out passwordHash, out passwordSalt);

                user.PasswordHash = passwordHash;
                user.PasswordSalt = passwordSalt;
            }

            _context.SystemUsers.Update(user);
            _context.SaveChanges();
        }
コード例 #27
0
        public ActionResult EditTeacher(int userid, string mode = "edit")
        {
            ViewBag.mode = mode;
            var model = _teacherManager.GetTeacher(userid);
            var user  = SystemUsers.FirstOrDefault(p => p.UserId == userid) ?? new SysUser();

            if (model == null)
            {
                model = new ResTeacher()
                {
                    UserInfo = user, UserId = user.UserId
                };
                //model.UserExtend = new SysUserExtend();
                //return View(model);
            }
            else
            {
                model.UserInfo = user;
            }
            //model.UserExtend = _userManager.GetUserExtend(userid);
            //if (model.UserExtend == null)
            //{
            //model.UserExtend = new SysUserExtend();
            //model.UserExtend.UserId = model.UserId;
            //}
            return(View(model));
        }
コード例 #28
0
ファイル: ProfileController.cs プロジェクト: radtek/yiqixicai
        public JsonResult SaveUserExtend(int userId, DateTime?birthday, string phone, string qqNo, string height, string maritalState,
                                         string workYear, string idType, string idCard, string homeTel, string homeAddr)
        {
            try
            {
                var userInfo = SystemUsers.First(p => p.UserId == userId);
                userInfo.Birthday     = birthday;
                userInfo.Phone        = phone;
                userInfo.QqNo         = qqNo;
                userInfo.Height       = height;
                userInfo.MaritalState = maritalState;
                userInfo.WorkYear     = workYear;
                userInfo.IDType       = idType;
                userInfo.IDCard       = idCard;
                userInfo.HomeTel      = homeTel;
                userInfo.HomeAddr     = homeAddr;

                _userManager.UpdateUser(userInfo);

                return(Json(new { result = 1, content = RetechWing.LanguageResources.Common.SaveSuccess }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new { result = 0, content = RetechWing.LanguageResources.Common.SaveFailed }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #29
0
        public bool GetCurrentUserViewPriceStatus()
        {
            bool         rtn  = false;
            IObjectSpace ios  = Application.CreateObjectSpace();
            SystemUsers  user = null;

            if (!string.IsNullOrEmpty(SecuritySystem.CurrentUserId.ToString()))
            {
                user = ios.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId);
            }
            if (user != null)
            {
                string   temp      = View.ObjectTypeInfo.Type.ToString();
                string[] classname = temp.Split('.');
                temp = classname[classname.Length - 1];
                //temp = temp.Replace("Ajiya.Module.BusinessObjects.", "");
                temp = temp.Replace("Detail", "");
                rtn  = user.CheckAccessVP(temp);
                //if (user.Roles.Where(p => p.Name == "C_" + temp + GeneralValues.viewpricestring).Count() > 0)
                //    rtn = true;

                //if (!rtn)
                //    rtn = user.Roles.Where(p => p.IsAdministrative).Count() > 0 ? true : false;
            }
            ios.Dispose();
            return(rtn);
        }
コード例 #30
0
        public BaseResultDto <PostBaseYeePayPar> AuthenticateIDCard(SystemUsers model)
        {
            BaseResultDto <PostBaseYeePayPar> result = null;

            BaseResultDto <bool> re = oper.AuthenticateIDCard(model);

            if (re.IsSeccess)
            {
                MoneyCarCar.Models.YeePay.RequestModel.ToRegister toRegister = new MoneyCarCar.Models.YeePay.RequestModel.ToRegister();

                toRegister.email          = model.UserEmail;
                toRegister.idCardNo       = model.IDNumber;
                toRegister.mobile         = model.CellPhone;
                toRegister.nickName       = model.UserName;
                toRegister.realName       = model.RealName;
                toRegister.platformUserNo = model.ID + "";
                toRegister.requestNo      = DateTime.Now.Ticks.ToString();
                result = yeepay.ToRegister(toRegister);
            }
            else
            {
                result           = new BaseResultDto <PostBaseYeePayPar>();
                result.IsSeccess = false;
                result.ErrorMsg  = re.ErrorMsg;
            }

            return(result);
        }