Exemplo n.º 1
0
        // GET: Profile
        public ActionResult DisplayProfile(string name)
        {
            User user = null;

            if (String.IsNullOrEmpty(name))
            {
                user = Dal.Instance.GetUserByName(name);
            }
            else if (User.Identity.IsAuthenticated)
            {
                user = Dal.Instance.GetUserByName(User.Identity.Name);
            }
            else
            {
                RedirectToAction("Homepage", "Home");
            }
            List <Result>          results    = Dal.Instance.GetNLastResultByUser(user, 10);
            List <ResultViewModel> viewModels = new List <ResultViewModel>();

            foreach (Result result in results)
            {
                viewModels.Add(new ResultViewModel(result));
            }
            int userRank = UserInfoHelper.GetUserRank(user);

            return(View("Profile", new ProfileViewModel(viewModels, userRank)));
        }
Exemplo n.º 2
0
        public JobCoachController()
        {
            helper = new UserInfoHelper();
            DbHelper context = helper.getDBHelper();

            auth = new Auth(context);
        }
Exemplo n.º 3
0
        public async override Task Invoke(IOwinContext context)
        {
            var identity = new ClaimsIdentity(ClaimsPrincipal.Current.Identity);
            var groups   = await UserInfoHelper.GetAllGroups(identity);

            await Next.Invoke(context);
        }
Exemplo n.º 4
0
    protected void ddlUsers_SelectedIndexChanged(object sender, EventArgs e)
    {
        UserInfoHelper helper = new UserInfoHelper();

        ddlUsers.DataSource = helper.GetCFUserList(ddlDept.SelectedValue);
        ddlUsers.DataBind();
    }
Exemplo n.º 5
0
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                BookInfo    book        = listView1.SelectedItems[0].Tag as BookInfo;
                FrmDownload frmDownload = new FrmDownload(book);
                frmDownload.ShowDialog();

                UserBookListData ubld = new UserBookListData();

                UserInfo userInfo = UserInfoHelper.GetUserInfo();

                if (ubld.GetUserBookLists(t => t.BookID == book.ID && t.UserID == userInfo.ID).Count <= 0)
                {
                    BookInfoData bif      = new BookInfoData();
                    BookInfo     bookInfo = bif.GetBookInfos(t => book.Equals(t)).FirstOrDefault();
                    if (bookInfo == null)
                    {
                        ubld.Add(userInfo.ID, book.ID);
                    }
                    else
                    {
                        ubld.Add(userInfo.ID, bookInfo.ID);
                    }
                }
                //刷新我的书架
                frmMain.LoadListViewData();
            }
        }
Exemplo n.º 6
0
        public BookRefresh()
        {
            userinfo = UserInfoHelper.GetUserInfo();
            UserBookListData ubl = new UserBookListData();

            books = ubl.GetBooks(userinfo.ID);
        }
Exemplo n.º 7
0
        public static AjaxResult DeleteUserCommunityRef(string User)
        {
            UserInfoHelper helper = new UserInfoHelper();

            helper.DeleteCommunityRelationShip(User);
            return(AjaxResult.Success());
        }
Exemplo n.º 8
0
        private void FaceDevPriMgr_Load(object sender, EventArgs e)
        {
            if (!UserInfoHelper.HasPrivate(SYS_FUN_POINT.STAFF_MGR))
            {
                biRegister.Visible           = false;
                dgvStaffs.Columns[6].Visible = false;
            }
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_FACERECG_DEVICE faceBll = new Maticsoft.BLL.SMT_FACERECG_DEVICE();
                    string strWhere = "";
                    if (!UserInfoHelper.IsManager)
                    {
                        strWhere = "ID IN (SELECT RF.FUN_ID FROM SMT_ROLE_FUN RF,SMT_USER_INFO UI WHERE RF.ROLE_TYPE=4 AND RF.ROLE_ID=UI.ROLE_ID AND UI.ID=" + UserInfoHelper.UserID + ")";
                    }
                    _faceDevices = faceBll.GetModelList(strWhere);
                    var areas    = AreaDataHelper.GetAreas();
                    this.Invoke(new Action(() =>
                    {
                        var nodes    = AreaDataHelper.ToTree(areas);
                        var faceDevs = _faceDevices.ToList();
                        foreach (var item in nodes)
                        {
                            DoCreateAreaDevice(item, faceDevs);
                        }

                        for (int i = faceDevs.Count - 1; i >= 0; i--)
                        {
                            var item      = faceDevs[i];
                            Node devNode  = new Node("<font color='blue'>" + item.FACEDEV_NAME + "</font>");
                            devNode.Image = Properties.Resources.editor;
                            devNode.Tag   = item;
                            nodes.Insert(0, devNode);
                        }
                        Node root  = new Node("所有人脸识别设备");
                        root.Image = Properties.Resources.house1818;
                        root.Nodes.AddRange(nodes.ToArray());
                        nodes.Clear();
                        nodes.Add(root);


                        advTree.Nodes.Clear();
                        advTree.Nodes.AddRange(nodes.ToArray());
                        advTree.ExpandAll();
                    }));

                    DoSearch(null, null, null);
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载人脸设备列表异常!" + ex.Message);
                    log.Error("加载人脸设备列表异常:", ex);
                }
            });

            waiting.Show(this);
        }
Exemplo n.º 9
0
        protected void Unnamed_LoggingOut(object sender, LoginCancelEventArgs e)
        {
            // remove the signed in user from the MS Graph groups cache
            var identity = new ClaimsIdentity(ClaimsPrincipal.Current.Identity);

            UserInfoHelper.RemoveUserFromCache(identity);
            Context.GetOwinContext().Authentication.SignOut();
        }
Exemplo n.º 10
0
        public static AjaxResult RemoveUserCommunity(string DataJSON)
        {
            UserInfoHelper helper = new UserInfoHelper();
            var            data   = new JavaScriptSerializer().Deserialize <List <Dictionary <string, object> > >(DataJSON);

            foreach (var item in data)
            {
                helper.DeleteCommunityRelationship(item["t_fun_guid"].ToString());
            }
            return(AjaxResult.Success());
        }
Exemplo n.º 11
0
        private void ButtonCall_Click(object sender, RoutedEventArgs e)
        {
            var email = TextBox_Email.Text;
            var name  = TextBox_Name.Text;

            if (!UserInfoHelper.CheckUser(email, name))
            {
                MessageBox.Show("Invalid email or name");
                return;
            }
            _repo.SaveUserInfo(email, name);
        }
Exemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            UserInfoHelper helper = new UserInfoHelper();

            ddlDept.DataSource = helper.GetDeptList();
            ddlDept.DataBind();

            ddlUsers.DataSource = helper.GetCFUserList(ddlDept.SelectedValue);
            ddlUsers.DataBind();
        }
    }
 private void bDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.listView.SelectedItems.Count > 0)
         {
             UserInfoHelper.DeleteUserInfo(urs[listView.SelectedItems[0].Index]);
             this.listView.Items.Remove(listView.SelectedItems[0]);
         }
     }
     catch
     {
     }
 }
 private void UpdateUserInfo()
 {
     urs = UserInfoHelper.GetAllUsers();
     listView.Items.Clear();
     for (int i = 0; i < urs.Count; i++)
     {
         ListViewItem li = new ListViewItem();
         li.SubItems.Add(urs[i].UserId.ToString());
         li.SubItems.Add(urs[i].LoginUserName);
         li.SubItems.Add(urs[i].Role);
         li.SubItems.Add(urs[i].NoteName);
         this.listView.Items.Add(li);
     }
 }
Exemplo n.º 15
0
        public static AjaxResult UpdateUserCommunityRef(string User, string DataJSON)
        {
            var            data   = new JavaScriptSerializer().Deserialize <List <Dictionary <string, object> > >(DataJSON);
            UserInfoHelper helper = new UserInfoHelper();

            DeleteUserCommunityRef(User);
            foreach (var item in data)
            {
                RentInfoHelper rHelper = new RentInfoHelper();
                string         Region  = item["LSID"].ToString();
                helper.InsertCommunityRelationShip(User, Region);
            }
            return(AjaxResult.Success());
        }
Exemplo n.º 16
0
        public static AjaxResult GetUserAreaRef(string userId)
        {
            var            data    = new List <Dictionary <string, object> >();
            var            regions = "0";
            UserInfoHelper helper  = new UserInfoHelper();
            DataTable      dt      = helper.GetUserRegRelationList(userId);

            foreach (DataRow row in dt.Rows)
            {
                regions += "," + row["t_ad_reg_dept_id"].ToString();
            }

            return(AjaxResult.Success(data, regions));
        }
Exemplo n.º 17
0
        public IActionResult Index()
        {
            if (!httpContextAccessor.HttpContext.User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new
                {
                    controller = "Auth",
                    action = "Login"
                }));
            }

            var diagnoses = patient.GetDiagnoses(UserInfoHelper.GetId(httpContextAccessor));

            return(View(diagnoses));
        }
 void PrintClipboardText()
 {
     try
     {
         Beaprint.MainPrint("Clipboard text");
         string clipboard = UserInfoHelper.GetClipboardText();
         if (!string.IsNullOrEmpty(clipboard))
         {
             Beaprint.BadPrint(clipboard);
         }
     }
     catch (Exception ex)
     {
         Beaprint.PrintException(ex.Message);
     }
 }
Exemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            UserInfoHelper helper     = new UserInfoHelper();
            RentInfoHelper rentHelper = new RentInfoHelper();

            ddlStation.DataSource = rentHelper.dtPoliceStation("0");
            ddlStation.DataBind();

            ddlPolice.DataSource = rentHelper.dtPoliceStation(ddlStation.SelectedValue);
            ddlPolice.DataBind();

            ddlUsers.DataSource = helper.GetCFUserList("7");
            ddlUsers.DataBind();
        }
    }
Exemplo n.º 20
0
        public IActionResult Delete(int id)
        {
            try
            {
                var reservationToDelete = reservation.GetById(id);

                if (reservationToDelete.PatientId == UserInfoHelper.GetId(httpContextAccessor))
                {
                    reservation.Delete(id);
                }
            }
            catch
            {
            }

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 21
0
        public async Task InfoAboutMeAsync()
        {
            var user = Context.User is SocketGuildUser usr ? usr : await Context.Guild.GetUserFromGuildAsync(Context.User.Id);

            using var service = GetService <UserService>();
            var detail = await service.Service.GetUserAsync(Context.Guild, user);

            if (detail == null)
            {
                await ReplyAsync("Uživatel nebyl v databázi nalezen. Buď ještě není na tomto serveu, nebo neprojevil aktivitu.");

                return;
            }

            var embed = await UserInfoHelper.CreateSimpleEmbedAsync(detail, Context);

            await ReplyAsync(embed : embed.Build());
        }
Exemplo n.º 22
0
        public static AjaxResult UpdateUserAreaRef(string User, string DataJSON)
        {
            var            data   = new JavaScriptSerializer().Deserialize <List <Dictionary <string, object> > >(DataJSON);
            UserInfoHelper helper = new UserInfoHelper();

            DeleteUserAreaRef(User);
            foreach (var item in data)
            {
                RentInfoHelper rHelper = new RentInfoHelper();
                DataTable      dt      = rHelper.GetDataTable("select * from Rent_PoliceStation where parentId=" + item["PSID"].ToString());
                if (dt.Rows.Count <= 0)
                {
                    string Region = item["PSID"].ToString();
                    helper.InsertRelationShip(User, Region);
                }
            }
            return(AjaxResult.Success());
        }
Exemplo n.º 23
0
        public bool RegisterUser(User user, ref string errMessage)
        {
            if (!UserInfoHelper.CheckUser(user))
            {
                errMessage = "Empty login";
                return(false);
            }
            User found = context.Users.SingleOrDefault(x => x.Login == user.Login);

            if (found != null)
            {
                errMessage = "User with same login already exists";
                return(false);
            }

            context.Users.Add(user);
            context.SaveChanges();
            return(true);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 加载listView数据
        /// </summary>
        public void LoadListViewData()
        {
            listView1.Items.Clear();

            UserBookListData ubld = new UserBookListData();

            UserInfo userInfo = UserInfoHelper.GetUserInfo();

            List <BookInfo> bookInfo = ubld.GetBooks(userInfo.ID);

            foreach (var item in bookInfo)
            {
                ListViewItem viewItem = new ListViewItem(item.Name);
                viewItem.SubItems.Add(item.Loeva);
                viewItem.SubItems.Add(item.UpdateTime.ToString("yyyy-MM-dd"));
                viewItem.Tag = item;
                listView1.Items.Add(viewItem);
            }
        }
Exemplo n.º 25
0
 private void bUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckText() && this.listView.SelectedItems.Count > 0)
         {
             UserInfo ur = new UserInfo();
             ur.Permission    = CommonHelper.GetPermession(treeView).ToString();
             ur.LastLoginTime = DateTime.Now;
             ur.LoginUserName = tLoginName.Text;
             ur.Pwd           = CommonHelper.GetMD5Code(tPassword.Text);
             ur.NoteName      = tNoteInfo.Text;
             if (rB_Manager.Checked)
             {
                 ur.Role = "Manager";
             }
             if (rB_Engineer.Checked)
             {
                 ur.Role = "Engineer";
             }
             if (rB_Techinical.Checked)
             {
                 ur.Role = "Technician";
             }
             if (rB_Operator.Checked)
             {
                 ur.Role = "Operator";
             }
             ur.UserId = int.Parse(listView.SelectedItems[0].SubItems[1].Text);
             urs.Add(ur);
             listView.SelectedItems[0].SubItems[1].Text = ur.UserId.ToString();
             listView.SelectedItems[0].SubItems[2].Text = ur.LoginUserName;
             listView.SelectedItems[0].SubItems[3].Text = ur.Role;
             listView.SelectedItems[0].SubItems[4].Text = ur.NoteName;
             UserInfoHelper.UpdateUserInfo(ur);
             UpdateUserInfo();
         }
     }
     catch
     {
         msgDiv1.MsgDivShow("操作失败!", 1);
     }
 }
Exemplo n.º 26
0
        public IActionResult Detail(int id)
        {
            if (!httpContextAccessor.HttpContext.User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new
                {
                    controller = "Auth",
                    action = "Login"
                }));
            }

            var diagnoseModel = diagnose.GetById(id);

            if (diagnoseModel == null || diagnoseModel.PatientId != UserInfoHelper.GetId(httpContextAccessor))
            {
                return(NotFound());
            }

            return(View(diagnoseModel));
        }
 private void bAdd_Click(object sender, EventArgs e)
 {
     try
     {
         UserInfo ur = new UserInfo();
         ur.Permission    = "0";
         ur.LastLoginTime = DateTime.Now;
         ur.LoginUserName = "******";
         ur.Pwd           = CommonHelper.GetMD5Code("666666");
         ur.NoteName      = "Operator";
         ur.Role          = "Operator";
         ur.UserId        = urs.Count;
         urs.Add(ur);
         UserInfoHelper.AddUserInfo(ur);
         UpdateUserInfo();
     }
     catch (Exception)
     {
     }
 }
 private void btnLogin_Click(object sender, EventArgs e)
 {
     //帐号和密码不为空
     if (CheckText())
     {
         string ur;
         int    permission;
         string msg = "";
         //判断用户登录是否成功
         string pwd = CommonHelper.GetMD5Code(tLoginPassword.Text);
         if (UserInfoHelper.IsLoginByLoginName(tLoginName.Text, pwd, out msg, out ur, out permission))
         {
             Variable.sPermission_CurerentUserName = tLoginName.Text;
             Variable.sPermission_CurerentRole     = ur;
             Variable.iPermission_CurerentUser     = permission;
         }
         else
         {
             tLoginPassword.Text = "";
         }
     }
 }
Exemplo n.º 29
0
        public IActionResult Index()
        {
            if (!httpContextAccessor.HttpContext.User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new
                {
                    controller = "Auth",
                    action = "Login"
                }));
            }

            var reservations = patien.GetReservations(UserInfoHelper.GetId(httpContextAccessor));

            foreach (var reservation in reservations)
            {
                vet.GetById(reservation.VetId);
                ambulance.GetById(vet.AmbulanceId);

                reservation.Vet = new VetAmbulance.BL.Models.Vet()
                {
                    Id   = vet.Id,
                    Name = vet.Name,

                    AmbulanceId  = vet.AmbulanceId,
                    PasswordHash = vet.PasswordHash,
                    PasswordSalt = vet.PasswordSalt
                };

                reservation.Vet.Ambulance = new Ambulance()
                {
                    Id          = ambulance.Id,
                    Address     = ambulance.Address,
                    ClosingHour = ambulance.ClosingHour,
                    OpeningHour = ambulance.OpeningHour
                };
            }

            return(View(reservations));
        }
Exemplo n.º 30
0
        public ActionResult getUserInfo()
        {
            // get connection from session
            AuthorizationCodeConnection connection = HttpContext.Session["AuthorizationCodeConnection"] as AuthorizationCodeConnection;
            UserInfo user = null;

            if (connection == null || ((AuthorizationCodeConfiguration)connection.connectionConfiguration).authorizationCode == null)
            {
                //is the connection available in session or is the
                // cached connection expired then lets re-authorize
                ViewBag.Message = "Not logged in or no connection available";
            }
            else
            {
                try
                {
                    connection.connect();

                    // connection was successfull
                    if (connection.isConnectedIndicator())
                    {
                        ViewBag.Message = "Successfully connected to ADP API";

                        // so get the worker like we wanted
                        UserInfoHelper helper = new UserInfoHelper(connection);
                        user = helper.getUserInfo();
                    }
                }
                catch (Exception e)
                {
                    ViewBag.isError = true;
                    ViewBag.Message = e.Message;
                }
            }

            ViewBag.user = user;
            return(View("Index", user));
        }