Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            User_Model usermodel = new User_Model();

            usermodel.LoginPwd = context.Request.Form["txtpwd"];
            usermodel.NickName = context.Request.Form["txtnick"];
            usermodel.Sex      = context.Request.Form["txtsex"];
            usermodel.Age      = Convert.ToInt32(context.Request.Form["txtage"]);
            usermodel.FaceId   = Convert.ToInt32(context.Request.Form["txtface"]);
            usermodel.Friend   = Convert.ToInt32(context.Request.Form["txtfriend"]);
            usermodel.Name     = context.Request.Form["txtname"];
            usermodel.StarId   = Convert.ToInt32(context.Request.Form["txtstar"]);
            usermodel.BloodId  = Convert.ToInt32(context.Request.Form["txtblood"]);
            User_Service userSer = new User_Service();

            if (userSer.AddUser(usermodel))
            {
                context.Response.Redirect("Index.ashx");
            }
            else
            {
                context.Response.Redirect("Error.html");
            }
        }
Exemplo n.º 2
0
        public JsonResult DeleteSubjectBox(int id)
        {
            AjaxResultModel Result = new AjaxResultModel();

            try
            {
                bool check = User_Service.Delete(id);


                if (check)
                {
                    Result.Code   = 0;
                    Result.Result = "Thành công";
                }
                else
                {
                    Result.Code   = 1;
                    Result.Result = "Thao tác không thành công";
                }
            }
            catch (Exception Ex)
            {
                Result.Code   = 1;
                Result.Result = "Thao tác không thành công";
                IOHelper.WriteLog(StartUpPath, IpAddress, "InsertOrUpdateUser:", Ex.Message, Ex.ToString());
            }
            return(Json(new JsonResult()
            {
                Data = Result
            }));
        }
Exemplo n.º 3
0
 public UserManagementUI(User user)
 {
     InitializeComponent();
     this.user = user;
     allUsers  = new List <User>();
     service   = new User_Service();
 }
Exemplo n.º 4
0
        private void btnChangeStatus_Click(object sender, EventArgs e)
        {
            //for the checked items, if the status is closed then change it to open, if it is open then change it to close
            if (listViewTickets.CheckedItems.Count > 0)
            {
                foreach (ListViewItem item in listViewTickets.CheckedItems)
                {
                    Ticket ticket = GetTicketById(int.Parse(item.SubItems[0].Text));
                    ticket.IsOpen = !ticket.IsOpen;
                    if (!ticket.IsOpen)
                    {
                        User_Service userService = new User_Service();
                        ticket.ReportedByUser.nrTickets--;
                        userService.UpdateUserTickets(ticket.ReportedByUser);
                    }

                    ticketService.UpdateTicket(ticket);
                    LoadListView();
                }
            }
            else
            {
                MessageBox.Show("No tickets selected!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 5
0
        public PartialViewResult _Detail()
        {
            List <TB_SUBJECTS> subjects = new List <TB_SUBJECTS>();
            List <TB_BOXES>    boxes    = new List <TB_BOXES>();

            List <TB_USERS>      teachers   = new List <TB_USERS>();
            List <V_BOX_SUBJECT> boxSubject = new List <V_BOX_SUBJECT>();
            List <TB_ROOM_CLASS> room       = new List <TB_ROOM_CLASS>();
            int count = 0;

            try
            {
                room       = RoomClass_Service.GetAll();
                boxSubject = Subjects_Boxes_Service.GetAllBy("", 1, short.MaxValue, out count);
                subjects   = Subjects_Service.GetAll();
                boxes      = Boxes_Service.GetAll();
                teachers   = User_Service.GetAllTeacher();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            ViewBag.BoxSubject = boxSubject;
            ViewBag.subjects   = subjects;
            ViewBag.boxes      = boxes;
            ViewBag.teachers   = teachers;
            ViewBag.Room       = room;
            return(PartialView());
        }
Exemplo n.º 6
0
        public PartialViewResult _Tracking(string scheduleId = "", string startDate = "", string endDate = "", int pageNumber = 1, int pageSize = 10)
        {
            int count = 0;

            ViewBag.pageNumber = pageNumber;
            ViewBag.pageSize   = pageSize;
            ViewBag.maxNumber  = 0;
            List <V_TRACKING_USER_CLASS> list        = new List <V_TRACKING_USER_CLASS>();
            List <TB_USERS>            listUser      = new List <TB_USERS>();
            List <TB_SCHEDULES>        listSchedules = new List <TB_SCHEDULES>();
            List <DateTime>            listDate      = new List <DateTime>();
            List <V_TRACKING_SCHEDULE> a             = new List <V_TRACKING_SCHEDULE>();

            try
            {
                a             = Trackings_Service.GetTotalTrackingBy(scheduleId, startDate, endDate);
                listDate      = GetDateTimeToMonth(startDate, endDate);
                listUser      = User_Service.GetAllStudies();
                listSchedules = Schedules_Service.GetAll();
            }
            catch (Exception e)
            {
                ViewBag.Error = e.ToString();
            }
            ViewBag.ListDate  = listDate;
            ViewBag.maxNumber = Math.Ceiling((double)count / pageSize);
            ViewBag.User      = listUser;
            ViewBag.Schedule  = listSchedules;
            return(PartialView(a));
        }
Exemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //Reguster
            //string name = context.Request["name"];
            //User_Service userSer = new User_Service();
            //if (userSer.FindUser(name)!=null)
            //{
            //    context.Response.Write("此用户存在");
            //}
            //else
            //{
            //    context.Response.Write("可用");
            //}

            //Login
            string       userName  = context.Request["name"];
            string       userPwd   = context.Request["pwd"];
            User_Service userSer   = new User_Service();
            string       msg       = string.Empty;
            Users_Model  usermodel = null;

            if (userSer.CheckLoginUser(userName, userPwd, out msg, out usermodel))
            {
                context.Session["usermodel"] = usermodel;
                //ajax必须返回消息
                context.Response.Write("yes:" + msg);
            }
            else
            {
                context.Response.Write("no:" + msg);
            }
        }
Exemplo n.º 8
0
 private void BindData()
 {
     People_Service.ListMyPeople(p =>
     {
         List <EPeople> myPeople = p.GetData() as List <EPeople>;
         User_Service.SearchUser(SearchWord.text, u =>
         {
             List <EUser> plist = u.GetData() as List <EUser>;
             ListView.BindData <EUser>("PeopleSearchItem", plist, (i, e) =>
             {
                 i.name = "PlanItem_" + e.ID;
                 i.transform.Find("Name").GetComponent <Text>().text  = e.Name;
                 i.transform.Find("Phone").GetComponent <Text>().text = e.Phone;
                 if (myPeople.Any(c => c.PeopleID == e.ID))
                 {
                     i.transform.Find("Button").GetComponent <Button>().gameObject.SetActive(false);
                 }
                 else
                 {
                     i.transform.Find("Button").GetComponent <Button>().gameObject.SetActive(true);
                     EventListener.Get(i.transform.Find("Button").gameObject).onClick = OnBtnAddClicked;
                 }
                 App.Instance.ShowImage(i.transform.Find("Icon").GetComponent <RawImage>(), e.Face, 11);
             });
         });
     });
 }
Exemplo n.º 9
0
        public PartialViewResult _Index(string keyText = "", string boxId = "", string subjectId = "", string timeIn = "", string timeEnd = "", string status = "", int pageNumber = 1, int pageSize = 10)
        {
            ViewBag.pageNumber = pageNumber;
            ViewBag.pageSize   = pageSize;
            ViewBag.maxNumber  = 0;
            List <V_CLASS_DETAILS> cl = new List <V_CLASS_DETAILS>();
            var classes = new List <V_CLASS>();
            List <V_NUMBER_STUDIES> listCount = new List <V_NUMBER_STUDIES>();
            int count = 0;

            try
            {
                cl        = Classes_Service.GetInfoClass(keyText, boxId, subjectId, timeIn, timeEnd, status, pageNumber, pageSize, out count);
                listCount = Schedules_Service.GetCountStudieInClass("");
                //classes = Classes_Service.GetClassBy(keyText, boxId, subjectId, timeIn, timeEnd, status, pageNumber, pageSize, out count);
                ViewBag.maxNumber = Math.Ceiling((double)count / pageSize);
                ViewBag.users     = User_Service.GetAll();
                int count1 = 0;
                ViewBag.boxSubjects = Subjects_Boxes_Service.GetAllBy("", 1, short.MaxValue, out count1);
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, "ClassController :", ex.Message, ex.ToString());
            }
            ViewBag.Count = listCount;
            return(PartialView(cl));
        }
Exemplo n.º 10
0
        public ActionResult TrackingDetails(string scheduledId = "", string startDate = "", string endDate = "", string userId = "")
        {
            string url   = Request.RawUrl;
            string query = Request.Url.Query;

            scheduledId = Request.QueryString["scheduledId"];
            List <DateTime> listDate = new List <DateTime>();

            List <TB_USERS>              listUser     = new List <TB_USERS>();
            List <TB_SCHEDULES>          listSchedule = new List <TB_SCHEDULES>();
            List <V_TRACKING_USER_CLASS> list         = new List <V_TRACKING_USER_CLASS>();

            try
            {
                listDate     = GetDateTimeToMonth(startDate, endDate);
                listSchedule = Schedules_Service.GetAll();
                list         = Trackings_Service.GetTrackingUser(userId, scheduledId, startDate, endDate);
                listUser     = User_Service.GetAllStudies();
            }
            catch (Exception e)
            {
                ViewBag.Error = e.ToString();
            }
            ViewBag.ListDate = listDate.OrderByDescending(x => x).ToList();
            ViewBag.Schedule = listSchedule;
            ViewBag.User     = listUser;
            ViewBag.Url      = url;
            return(View(list));
        }
Exemplo n.º 11
0
        private void BtnEdit_userManager_Click(object sender, EventArgs e)
        {
            Control      txtBoxFirstName = FindControl("txtBox" + textBoxesNames[1]);
            Control      txtBoxLastName  = FindControl("txtBox" + textBoxesNames[2]);
            Control      txtBoxEmail     = FindControl("txtBox" + textBoxesNames[0]);
            Control      txtBoxTickets   = FindControl("txtBox" + textBoxesNames[3]);
            Control      lblID           = FindControl("lblUserId");
            User_Service userService     = new User_Service();
            User         user            = userService.GetUserByID(int.Parse(lblID.Tag.ToString()));
            BsonDocument replacement     = new BsonDocument
            {
                { "_id", lblID.Tag.ToString() },
                { "firstName", txtBoxFirstName.Text },
                { "lastName", txtBoxLastName.Text },
                { "email", txtBoxEmail.Text },
                { "userName", txtBoxFirstName.Text },
                { "password", user.Password },
                { "type", user.Type },
                { "ticket", txtBoxTickets.Text }
            };

            userService = new User_Service();
            foreach (var item in replacement)
            {
                userService.UpdateUserById(replacement, lblID.Tag.ToString(), item.Name, item.Value.ToString());
            }
            MessageBox.Show("chenged successfully");
            this.Close();
        }
Exemplo n.º 12
0
        private void BtnDelete_userManager_Click(object sender, EventArgs e)
        {
            Control      lblID       = FindControl("lblUserId");
            User_Service userService = new User_Service();

            userService.DeleteUser(lblID.Tag.ToString());
        }
Exemplo n.º 13
0
        // GET: Admin/HomeAdmin
        public ActionResult Index()
        {
            HomePage homePage = new HomePage();
            var      teachers = new List <TB_USERS>();

            try
            {
                homePage = ReportService.GetHomePage();
                var users = User_Service.GetAll();

                foreach (var user in users)
                {
                    if (user.UserType.Equals("TEACHER") && user.UserStatus.Equals("D"))
                    {
                        teachers.Add(user);
                    }
                }
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, "HomeController :", ex.Message, ex.ToString());
            }

            ViewBag.teachers = teachers;
            return(View(homePage));
        }
Exemplo n.º 14
0
        public PartialViewResult _Teachers(string status = "", string keyText = "", int pageNumber = 1, int pageSize = 10)
        {
            ViewBag.pageNumber = pageNumber;
            ViewBag.pageSize   = pageSize;
            ViewBag.maxNumber  = 0;
            var users = new List <TB_USERS>();

            try
            {
                int count = 0;
                users = User_Service.GetAllBy(keyText, status, "", "TEACHER", pageNumber, pageSize, out count);

                foreach (var user in users)
                {
                    user.UserStatus = user.UserStatus.Equals("A") ? "1" : "0";
                }

                ViewBag.maxNumber = Math.Ceiling((double)count / pageSize);
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, "UserController :", ex.Message, ex.ToString());
            }

            return(PartialView(users));
        }
Exemplo n.º 15
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            _ = new User();
            User_Service userService = new User_Service();

            if ((UsernameTxtBox.Text.Length < 1) || (PasswordTxtBox.Text.Length < 1))
            {
                MessageBox.Show("Missing credentials!");
            }
            else
            {
                if (userService.IsUsernamePresent(UsernameTxtBox.Text))
                {
                    User user = userService.GetUserByName(UsernameTxtBox.Text);
                    if (PasswordTxtBox.Text.Equals(user.password))
                    {
                        this.Hide();
                        new Dashboard(user).Show();
                        user.rememberMe = RememberMeBox.Checked;
                    }
                    else
                    {
                        MessageBox.Show("Incorrect username or password"); //password doesn't match
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect username or password"); //username does not exist in the db
                }
            }
        }
Exemplo n.º 16
0
        public JsonResult UpdateStatusUser(TB_USERS value)
        {
            AjaxResultModel Result = new AjaxResultModel();

            try
            {
                value.UserStatus      = "A";
                value.UserDateCreated = DateTime.Now;
                bool check = false;
                check = User_Service.Update(value);
                if (check)
                {
                    Result.Code   = 0;
                    Result.Result = "Thành công";
                }
                else
                {
                    Result.Code   = 1;
                    Result.Result = "Thao tác không thành công";
                }
            }
            catch (Exception Ex)
            {
                Result.Code   = 1;
                Result.Result = "Thao tác không thành công";
                IOHelper.WriteLog(StartUpPath, IpAddress, "InsertOrUpdateUser:", Ex.Message, Ex.ToString());
            }
            return(Json(new JsonResult()
            {
                Data = Result
            }));
        }
Exemplo n.º 17
0
        private int UserIdAutoIncrement()
        {
            User_Service userService = new User_Service();
            int          id          = int.Parse(userService.GetLastUserID());

            id++;
            return(id);
        }
Exemplo n.º 18
0
        private string TestUser()
        {
            User_Service userService = new User_Service();
            User         user        = userService.GetLastUser();
            string       userString  = user.Email;

            return(userString);
        }
Exemplo n.º 19
0
 public TransferTicketsUI(Ticket ticket)
 {
     InitializeComponent();
     this.ticket        = ticket;
     this.ticketService = new Ticket_Service();
     this.userService   = new User_Service();
     users = userService.getAllUsers();
 }
Exemplo n.º 20
0
 void LoginEvent(GameObject g)
 {
     User_Service.Login(IptLoginPhone.text, IptLoginPsw.text, PlatformDifferences.GetPushClientID(), t =>
     {
         EUser user = t.GetData() as EUser;
         OnLoginServerBack(user);
     });
 }
Exemplo n.º 21
0
        private void btn_tableOverview_Click(object sender, EventArgs e)
        {
            User_Service     userService = new User_Service();
            Employee         user        = userService.GetUser(lbl_UserName.Text);
            TablesOverviewUI overview    = new TablesOverviewUI(user);

            Hide();
            overview.ShowDialog();
        }
Exemplo n.º 22
0
        // this is only available for user type Manager
        private void btn_Back_Click(object sender, EventArgs e)
        {
            User_Service userService = new User_Service();
            Employee     user        = userService.GetUser(lbl_UserName.Text);
            ManagerUI    manager     = new ManagerUI(user);

            Hide();
            manager.ShowDialog();
        }
Exemplo n.º 23
0
 void OnGetUserInfoComplated(string name, string face)
 {
     User_Service.PlatformLogin(OpenID, name, face
                                , PlatformDifferences.GetPushClientID(), t =>
     {
         EUser user = t.GetData() as EUser;
         OnLoginServerBack(user);
     });
 }
Exemplo n.º 24
0
    void RegistEvent(GameObject g)
    {
        EUser user = new EUser();

        user.Phone    = IptRegistPhone.text;
        user.Name     = IptRegistName.text;
        user.Password = IptRegistPsw.text;
        User_Service.Regist(user, t =>
        {
            App.Instance.HintBox.Show("注册成功!");
        });
    }
Exemplo n.º 25
0
        private void FillUserManagerPanel()
        {
            List <User>  users       = new List <User>();
            User_Service userService = new User_Service();

            users = userService.GetUsers();

            foreach (var user in users)
            {
                fillGridView(user);
            }
        }
Exemplo n.º 26
0
        public ActionResult Login(string username, string password, string url, string remember)
        {
            if (string.IsNullOrEmpty(username))
            {
                ViewBag.error                = "Tên đăng nhập không được để trống";
                AppCookieInfo.UserID         = "";
                AppCookieInfo.HashedPassword = "";
                return(View());
            }
            else if (string.IsNullOrEmpty(password))
            {
                ViewBag.error                = "Mật khẩu không được để trống";
                AppCookieInfo.UserID         = "";
                AppCookieInfo.HashedPassword = "";
                return(View());
            }

            V_INFO_LOGIN_CLIENT user;

            try
            {
                user = User_Service.CheckLogin(username, password, "ADMIN");
            }
            catch (Exception ex)
            {
                user = null;
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Login :"******"200")
            {
                Session[AppSessionKeys.USER_INFO] = user.user;

                if (remember == "on")
                {
                    AppCookieInfo.UserID         = username;
                    AppCookieInfo.HashedPassword = password;
                }
                else
                {
                    AppCookieInfo.UserID         = "";
                    AppCookieInfo.HashedPassword = "";
                }
            }
            else
            {
                ViewBag.error                = "Đăng nhập không thành công";
                AppCookieInfo.UserID         = "";
                AppCookieInfo.HashedPassword = "";
            }

            return(Login(url));
        }
        public ActionResult Buy(string name)
        {
            if (Session["userId"] == null || Session["userId"].ToString() == "")
            {
                return(RedirectToAction("Index", "Home"));
            }
            ModelContext db        = new ModelContext();
            Service      service   = db.Services.SingleOrDefault(a => a.Name == name);
            DateTime     startDate = DateTime.Now;
            double       amount    = service.Amount;
            // List<Transaction> tl = db.Transactions.OrderByDescending(a => a.TransactionId).ToList();
            //string l = tl[0].TransactionId;
            //string l = db.Transactions.Max(x => x.TransactionId);
            //int n = Convert.ToInt32(l.Substring(1, l.Length - 1)) + 1;
            int n = db.Transactions.ToList().Count + 1;
            //string str = l.Substring(0, 1) + n ;
            Transaction transaction = new Transaction();

            transaction.ServiceId     = service.ServiceId;
            transaction.EmailId       = Session["userId"].ToString();
            transaction.StartTime     = startDate;
            transaction.TransactionId = "T" + n;
            db.Transactions.Add(transaction);
            db.SaveChanges();

            User_Service user_Service = new User_Service();

            user_Service.EmailId   = transaction.EmailId;
            user_Service.ServiceId = service.ServiceId;
            db.User_Services.Add(user_Service);
            db.SaveChanges();


            List <Transaction> transactionList = db.Transactions.ToList();

            List <TransactionDetail> list = new List <TransactionDetail>();

            foreach (Transaction t in transactionList)
            {
                if (t.EmailId == Session["userId"].ToString())
                {
                    TransactionDetail temp = new TransactionDetail();
                    temp.TransactionId = t.TransactionId;
                    temp.ServiceName   = name;
                    temp.StartDate     = startDate;
                    temp.Amount        = amount;

                    list.Add(temp);
                }
            }
            return(View("History", list));
        }
Exemplo n.º 28
0
        public ActionResult Schedules()
        {
            List <TB_USERS> list = new List <TB_USERS>();

            try
            {
                list = User_Service.GetAllTeacher();
            }catch (Exception e)
            {
                ViewBag.Error = e.ToString();
            }
            ViewBag.Teacher = list;
            return(View());
        }
Exemplo n.º 29
0
        private User CheckEmail()                                 //checks if user with email is
        {                                                         //present in db and returns User object
            _ = new User();
            User_Service userService = new User_Service();

            if (userService.IsEmailPresent(EmailTxtBox.Text))
            {
                User user = userService.GetUserByEmail(EmailTxtBox.Text);
                return(user);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 30
0
        public PartialViewResult _Students_Details(string userID)
        {
            TB_USERS user = new TB_USERS();

            try
            {
                user = User_Service.GetById(int.Parse(userID));
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, "UserController :", ex.Message, ex.ToString());
            }

            return(PartialView(user));
        }