public ActionResult AddCategory(AdminPanel adminPanel, HttpPostedFileBase LogoPath)
 {
     if (User.Identity.IsAuthenticated)
     {
         if (adminPanel != null)
         {
             bool result;
             if (adminPanel.Id == 0)
             {
                 adminPanel.LogoPath = LogoPath.FileName;
                 result = db.insertAdminPanel(adminPanel);
             }
             else
             {
                 result = db.updateAdminPanel(adminPanel);
             }
             if (result)
             {
                 LogoPath.SaveAs(Server.MapPath("~/Content/LogoImage/" + LogoPath.FileName));
                 return(RedirectToAction("GetAdminPanel"));
             }
             return(HttpNotFound());
         }
         else
         {
             return(HttpNotFound());
         }
     }
     else
     {
         return(RedirectToAction("Login", "Logon"));
     }
 }
 public ActionResult UpdateCategory(int id)
 {
     if (User.Identity.IsAuthenticated)
     {
         if (id != 0)
         {
             AdminPanel admPanel = db.getAdminPanel(id);
             if (admPanel != null)
             {
                 adminView.AdminPanel     = db.getAdminPanel();
                 adminView.LeftAdminPanel = admPanel;
                 return(View("GetAdminPanel", adminView));
             }
             else
             {
                 return(HttpNotFound());
             }
         }
         else
         {
             return(HttpNotFound());
         }
     }
     else
     {
         return(RedirectToAction("Login", "Logon"));
     }
 }
        private void MenuButton_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            switch (btn.Tag.ToString())
            {
            case "1":
                sgrid.Children.Clear();
                sgrid.Children.Add(searchPanel = new SearchPanel(sgrid));
                break;

            case "2":
                sgrid.Children.Clear();
                sgrid.Children.Add(addNewPanel = new AddNewPanel(sgrid));
                break;

            case "3":
                sgrid.Children.Clear();
                sgrid.Children.Add(activityPanel = new ActivityPanel(sgrid));
                break;

            case "4":
                sgrid.Children.Clear();
                sgrid.Children.Add(adminPanel = new AdminPanel(sgrid));
                break;

            default:
                break;
            }
        }
示例#4
0
        //private void SetLanguageDictionary()
        //{
        //    ResourceDictionary dict = new ResourceDictionary();
        //    dict.Source = new Uri("Resources/StringResources.Srb.xaml", UriKind.Relative);
        //    this.Resources.MergedDictionaries.Add(dict);
        //}

        private void Button_Click(object sender, RoutedEventArgs ev)
        {
            String username = usernameBox.Text.Trim();
            String password = passwordBox.Password.Trim();
            var    u        = context.staffs.Where(e => e.username.Equals(username) && e.password.Equals(password));

            if (u.Count() > 0 && u.First().isActive == 1)
            {
                if ((bool)u.First().isAdmin)
                {
                    AdminPanel d = new AdminPanel(languagesComboBox.SelectedIndex, themeComboBox.SelectedIndex);
                    d.Show();
                    this.Close();
                }
                else
                {
                    Dashboard d = new Dashboard(u.First(), languagesComboBox.SelectedIndex, themeComboBox.SelectedIndex);

                    d.Show();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Wrong username/password combination", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            int check;

            if ((txtuserId.Text == "") && (txtPassword.Text == ""))
            {
                MessageBox.Show("Please Enter USERID & PASSWORD!");
            }

            else
            {
                check = lip.GetStatus(txtuserId.Text, txtPassword.Text);

                if (check == 1)
                {
                    AdminPanel ap = new AdminPanel(txtuserId.Text);
                    ap.Show();
                    this.Hide();
                }
                else if (check == 2)
                {
                    SalesPanel sp = new SalesPanel(txtuserId.Text);
                    sp.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Invalid username or password");
                }
            }
        }
 public ActionResult DeleteCategory(int id)
 {
     if (User.Identity.IsAuthenticated)
     {
         if (id != 0)
         {
             AdminPanel admPanel = db.getAdminPanel(id) as AdminPanel;
             string     imgPath;
             if (admPanel != null)
             {
                 imgPath = admPanel.LogoPath;
                 bool result = db.deleteAdminPanel(id);
                 if (result)
                 {
                     System.IO.File.Delete(Server.MapPath("~/Content/LogoImage/" + imgPath));
                     return(RedirectToAction("GetAdminPanel"));
                 }
                 return(HttpNotFound());
             }
             else
             {
                 return(HttpNotFound());
             }
         }
         else
         {
             return(HttpNotFound());
         }
     }
     else
     {
         return(RedirectToAction("Login", "Logon"));
     }
 }
示例#7
0
        public IActionResult Index()
        {
            var myadmin = new AdminPanel();

            myadmin.accounts = _context.Account.ToList();
            myadmin.orders   = _context.Order.ToList();
            myadmin.products = _context.Product.ToList();
            DateTime dt1 = DateTime.Now.AddMonths(-1);
            DateTime dt2 = DateTime.Now.AddMonths(-2);
            DateTime dt3 = DateTime.Now.AddMonths(-3);

            //charts
            ViewBag.HomeCage           = (from p in _context.Product where p.Brand == "HomeCage" select p).Count();
            ViewBag.ProPlan            = (from p in _context.Product where p.Brand == "Pro Plan" select p).Count();
            ViewBag.CleanDog           = (from p in _context.Product where p.Brand == "Clean Dog" select p).Count();
            ViewBag.Kong               = (from p in _context.Product where p.Brand == "Kong" select p).Count();
            ViewBag.CurrentMonth       = DateTime.Now.Month.ToString();
            ViewBag.LestMonth          = (DateTime.Now.Month - 1).ToString();
            ViewBag.Lest2Month         = ((DateTime.Now.Month) - (2)).ToString();
            ViewBag.CurrentMonthOrders = (from o in _context.Order where o.OrderTime > dt1 select o.SumToPay).Sum();
            ViewBag.LestMonthOrders    = (from o in _context.Order where o.OrderTime > dt2 && o.OrderTime < dt1 select o.SumToPay).Sum();
            ViewBag.Lest2MonthOrders   = (from o in _context.Order where o.OrderTime > dt3 && o.OrderTime < dt2 select o.SumToPay).Sum();
            //--------------

            return(View(myadmin));
        }
示例#8
0
        private void LogIn_Click(object sender, EventArgs e)
        {
            string Username = "******";
            string Code     = "123";

            if ((textBox1.Text.ToLower() == Username) && (textBox2.Text == Code))
            {
                AdminPanel admin = new AdminPanel();
                admin.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Wrong Username or Password");
            }

            if (AdminPanel.open == 1)
            {
                if ((textBox1.Text.ToLower() == Username) && (textBox2.Text == Code))
                {
                    Application.Exit();
                }
                else
                {
                    MessageBox.Show("Wrong Username or Password");
                }
            }


            AdminPanel.open = 0;
        }
        private void HandleSaveCommand(object parameter)
        {
            var passInfo     = (List <object>)parameter;
            var password     = ((PasswordBox)passInfo[0]).Password;
            var repeatedPass = ((PasswordBox)passInfo[1]).Password;

            if (password != repeatedPass)
            {
                MessageBox.Show("Passwords do not match");
                return;
            }

            try
            {
                var result = UserService.CreateUser(this.Username, password, this.SelectedClearenceType);

                MessageBox.Show(result);

                AdminPanel dash = ViewManager.ComposeObjects <AdminPanel>();
                dash.Show();
                this.CloseAction();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
示例#10
0
        public bool addPost(string postTitle, string username, int SectionId, string PostText, string lang, string hashtags, IFormFile PostImg)
        {
            AdminPanel admin = _db.admins.Where(a => a.Username == username).First();
            Post       post  = new Post()
            {
                AdminPanelId  = admin.AdminPanelId,
                SectionId     = SectionId,
                PostText      = PostText,
                Title         = postTitle,
                LanguageTitle = lang,
                Hashtags      = hashtags
            };

            if (PostImg != null)
            {
                post.PostImg = Guid.NewGuid() + Path.GetExtension(PostImg.FileName);
                string imagePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/posts/image", post.PostImg);

                using (var stream = new FileStream(imagePath, FileMode.Create))
                {
                    PostImg.CopyTo(stream);
                }
            }

            _db.Add(post);
            _db.SaveChanges();
            return(true);
        }
 private void ReturnToMainMenu(object sender, EventArgs e)
 {
     if (account.Role.Name.Equals("Admin"))
     {
         AdminPanel window = new AdminPanel(account);
         Close();
         window.Show();
     }
     else if (account.Role.Name.Equals("GroupOwner"))
     {
         GroupOwnerPanel window = new GroupOwnerPanel(account);
         Close();
         window.Show();
     }
     else if (account.Role.Name.Equals("User"))
     {
         MainPanel window = new MainPanel(account);
         Close();
         window.Show();
     }
     else
     {
         MessageBox.Show("Nieznany błąd.", "Niezany błąd", MessageBoxButton.OK);
     }
 }
示例#12
0
        public void AuthToken(ref HttpRequest request)
        {
            string     message        = null;
            string     admin_email    = request.FormField("admin_email");
            string     admin_password = request.FormField("admin_password");
            AdminCache admin          = new AdminCache();

            admin.admin_role = "admin";
            if (Database.admin.SelectAdmin(ref admin_email, ref admin))
            {
                if (Validator.VerifyHashedPassword(ref admin.admin_password, ref admin_password))
                {
                    string admin_bearer_token = AdminPanel.AddAdminSession(admin.admin_role, admin_email);
                    request.ResponseJsonData(admin_bearer_token);
                    Logger.WriteLog("Auth token for admin.admin_email->" + admin.admin_email, LogLevel.Usual);
                    return;
                }
                else
                {
                    message = "Wrong password.";
                }
            }
            else
            {
                message = "Server can't identify admin. Invalid email.";
            }
            request.ResponseJsonAnswer(false, message);
            Logger.WriteLog(message, LogLevel.Usual);
        }
示例#13
0
        private void pictureBox4_Click(object sender, EventArgs e)
        {
            AdminPanel ap2 = new AdminPanel(ap);

            ap2.Show();
            this.Hide();
        }
示例#14
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string sql = "select * from tbl_user where user_name = '" + txtUserName.Text.Trim() + "' and password = '******'";

            Console.WriteLine(sql);
            this.Ds = this.Da.ExecuteQuery(sql);

            if (this.Ds.Tables[0].Rows.Count == 1 && this.Ds.Tables[0].Rows[0][6].ToString() == "Admin")
            {
                //MessageBox.Show("Admin");

                this.Visible = false;
                AdminPanel ap = new AdminPanel();
                ap.Visible = true;
            }
            else if (this.Ds.Tables[0].Rows.Count == 1 && this.Ds.Tables[0].Rows[0][6].ToString() == "Sale")
            {
                //MessageBox.Show("Sale");

                this.Visible = false;
                CashierForm wfaMenu = new CashierForm();
                delPassData del     = new delPassData(wfaMenu.SaveUserName);

                del(this.txtUserName);

                wfaMenu.Visible = true;
            }
            else if (this.Ds.Tables[0].Rows.Count == 1 && this.Ds.Tables[0].Rows[0][6].ToString() == "Accountant")
            {
                //MessageBox.Show("Accountant");
                this.Visible = false;
                Accountant ac = new Accountant();
                ac.Visible = true;
            }
        }
示例#15
0
        private void button1_Click(object sender, EventArgs e)
        {
            AdminPanel ad = new AdminPanel();

            ad.Show();
            this.Hide();
        }
示例#16
0
        private void buttonLogIn_Click(object sender, EventArgs e)
        {
            var isAdmin = from user in dataContext.Users
                          where user.Login == textBoxLogin.Text && user.Password == textBoxPassword.Text && user.IsAdmin == true
                          select user;

            var isCustomer = from user in dataContext.Users
                             where user.Login == textBoxLogin.Text && user.Password == textBoxPassword.Text
                             select user;

            //Sprawdzenie, czy użytkownik jest administratorem. Jeśli tak, wyświetlenie panelu administratora
            if (isAdmin.Count() > 0)
            {
                User       tempUser   = (isAdmin).FirstOrDefault();
                AdminPanel adminPanel = new AdminPanel(tempUser);
                adminPanel.Show();
            }

            //Sprawdzenie, czy użytkownik jest klientem. Jeśli tak, wyświetlenie panelu klienta
            else if (isCustomer.Count() > 0)
            {
                User          tempUser      = (isCustomer).FirstOrDefault();
                CustomerPanel customerPanel = new CustomerPanel(tempUser);
                customerPanel.Show();
            }

            //Jeśli użytkownik nie istnieje, wyświetlenie błędu
            else
            {
                MessageBox.Show("Login or password incorrect!");
            }
        }
示例#17
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     updateInformation();
     AdminPanel admin = db.AdminPanels.FirstOrDefault();
     //txtPassword.Text = Exception.Exception.HashPassword(admin.Password);
     //txtUserName.Text = admin.AdminName;
 }
示例#18
0
        private void GoBackButton_Click(object sender, RoutedEventArgs e)
        {
            Window AdminElePanel = new AdminPanel();

            this.Close();
            AdminElePanel.Show();
        }
        private void updateButton_Click(object sender, EventArgs e)
        {
            emp.Name        = nameBox.Text;
            emp.Address     = addressBox.Text;
            emp.Gender      = genderBox.Text;
            emp.Phone       = phoneBox.Text;
            emp.Email       = emailBox.Text;
            emp.Designation = designationBox.Text;
            emp.Password    = passwordBox.Text;

            EmployeeService es = new EmployeeService();

            if (es.Edit(emp) > 0 && phoneBox.Text.Length == 11)
            {
                MessageBox.Show("Record Updated Successfully!");
                AdminPanel ap = new AdminPanel();
                ap.LoadData();
            }

            else

            {
                MessageBox.Show("Error Please provide a valid phone number");
            }
        }
示例#20
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtLgnUserName.Text))
            {
                MessageBox.Show("Nick daxil edin");
                return;
            }
            if (string.IsNullOrEmpty(txtLgnPassword.Text))
            {
                MessageBox.Show("Sifre daxil edin");
                return;
            }
            string crypt = Encryption.Encrypt(txtLgnPassword.Text);
            User   user  = _context.Users.FirstOrDefault(u => u.Status && u.Username == txtLgnUserName.Text && u.Password == crypt);

            if (user != null)
            {
                if (user.Level == userLevel.Moderator)
                {
                    Dashboard dashboard = new Dashboard(this, txtLgnUserName.Text, _context);
                    dashboard.Show();
                }
                else
                {
                    AdminPanel admin = new AdminPanel(this);
                    admin.Show();
                }
                return;
            }


            MessageBox.Show("E-poct ve ya Sifre yalnisdir");
        }
示例#21
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var login = textbox2.Text;
            var pass  = textbox1.Text;
            var user  = avtorizationControl.Avtorize(login, pass);

            if (user.Role == (int)Role.trener)
            {
                Trener_Panel winTool = new Trener_Panel(user);
                winTool.Owner = this;
                winTool.Show();
                mainwindow.Visibility = Visibility.Hidden;
            }
            else if (user.Role == (int)Role.admin)
            {
                AdminPanel winTool = new AdminPanel(user);
                winTool.Owner = this;
                winTool.Show();
                mainwindow.Visibility = Visibility.Hidden;
            }
            else if (user.Role == (int)Role.client)
            {
                ClientPanel winTool = new ClientPanel(user);
                winTool.Owner = this;
                winTool.Show();
                mainwindow.Visibility = Visibility.Hidden;
            }
            else
            {
                label1.Visibility = Visibility.Visible;
                label1.Content    = "ошибка";
            }
        }
        private void BackProfile_Click(object sender, EventArgs e)
        {
            AdminPanel ap = new AdminPanel();

            this.Hide();
            ap.ShowDialog();
            this.Close();
        }
示例#23
0
        public void ChangePassword(ChangePasswordViewModel ChangePasswordViewModel)
        {
            AdminPanel admin = _db.admins.Where(a => a.Password == PasswordHelper.EncodePasswordMd5(ChangePasswordViewModel.OldPassword)).FirstOrDefault();

            admin.Password = PasswordHelper.EncodePasswordMd5(ChangePasswordViewModel.NewPassword);
            _db.Update(admin);
            _db.SaveChanges();
        }
示例#24
0
        private void btn_back_student_show_Click(object sender, EventArgs e)
        {
            this.Hide();
            AdminPanel obj = new AdminPanel();

            obj.ShowDialog();
            this.Close();
        }
示例#25
0
        public void ToAdminPanel()
        {
            var adminPanel   = new AdminPanel();
            var activeWindow = Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive);

            adminPanel.Show();
            activeWindow.Close();
        }
示例#26
0
        private void EventGoToAdminPanel(object sender, RoutedEventArgs e)
        {
            var AdminPanelUI = new AdminPanel();

            AdminPanelUI.Owner           = Window.GetWindow(this);
            AdminPanelUI.Owner.IsEnabled = false;
            AdminPanelUI.Show();
        }
示例#27
0
 public IActionResult PostAdmin([FromBody] AdminPanel adminPanel)
 {
     if (adminPanel == null)
     {
         return(BadRequest("Admin is null !!!"));
     }
     _dataRepository.Add(adminPanel);
     return(CreatedAtRoute("GetAdmin", new { Id = adminPanel.AdminPanelId }, adminPanel));
 }
 // GET: Admin/Home
 public ActionResult Login(AdminPanel adminPanel)
 {
     if (adminPanel.Name == db.AdminPanels.FirstOrDefault().Name&& adminPanel.Password == db.AdminPanels.FirstOrDefault().Password)
     {
         Session["mySession"] = true;
         return(RedirectToAction("index"));
     }
     return(View());
 }
        private void fill()
        {
            AdminPanel ap    = (AdminPanel)App.Current.MainWindow;
            var        c_old = (Customer)ap.CustomersListView.SelectedItem;

            NameTextBlock.Text  = c_old.Name;
            PhoneTextBlock.Text = c_old.Phone;
            EmailTextBlcok.Text = c_old.Email;
        }
        private void fill()
        {
            AdminPanel ap     = (AdminPanel)App.Current.MainWindow;
            var        or_old = (Order)ap.OrderListView.SelectedItem;

            CustomeridTextBlock.Text  = or_old.CustomerId.ToString();
            TripIdTextBlock.Text      = or_old.TripId.ToString();
            PlaceNumberTextBlock.Text = or_old.PlaceNumber.ToString();
        }