private void getAllProductsInCart(int uname)
    {
        double         subTotal = 0;
        OnlinePurchase o        = new OnlinePurchase();

        List <cart> productsInCart = o.validateProduct(uname);

        CreateShopTable(productsInCart, out subTotal);

        AdminIndex admin = new AdminIndex();
        admin      a     = admin.getCost(1);


        double tax      = ((a.localtax * subTotal) / 100);
        double tx       = Math.Round((tax), 2);
        double shipping = a.shipping;
        double handling = a.handling;

        double totalAmount = subTotal + tax + shipping + handling;
        double finalamount = Math.Round((totalAmount), 2);
        double sbamount    = Math.Round((subTotal), 2);

        Session["TotalAmount"] = finalamount.ToString().Trim();

        litShowTax.Text     = a.localtax.ToString() + "  %";
        litTotal.Text       = sbamount.ToString();
        litTax.Text         = tx.ToString();
        litHandling.Text    = handling.ToString();
        litShipping.Text    = shipping.ToString();
        litTotalAmount.Text = finalamount.ToString();
        NoCart.Visible      = false;
    }
        public ActionResult AdminUpdateAvatar(AdminIndex post)
        {
            resetViewBagMessages();
            HttpPostedFileBase ImageUrl = Request.Files[0];

            if (ImageUrl != null && ImageUrl.ContentLength > 0)
            {
                var fileName = Path.GetFileName(ImageUrl.FileName);
                var path     = Path.Combine(Server.MapPath("~/Areas/Admin/Content/Avatar/"), fileName);
                ImageUrl.SaveAs(path);

                AdminModel admin = DataBase.Session.Load <AdminModel>(post.Admin.Admin_Id);
                //delete Previous file
                if (System.IO.File.Exists(admin.Image_url))
                {
                    System.IO.File.Delete(admin.Image_url);
                }
                //updating new file
                admin.Image_url  = path;
                admin.Image_name = fileName;
                DataBase.Session.Update(admin);
                Session["ADMINAVATAR"] = fileName;
                if (System.IO.File.Exists(path))
                {
                    message = "Avatar Sucessfully Updated";
                }
            }
            else
            {
                err = "Error Occured while updating Avatar";
            }
            return(RedirectToAction("AdminProfile"));
        }
 public ActionResult AdminEditDetails(AdminIndex post)
 {
     resetViewBagMessages();
     DataBase.Session.Update(post.Admin);
     message = "Personal Info Updated Sucessfully";
     return(RedirectToAction("AdminProfile"));
 }
Esempio n. 4
0
        // GET: Admin/Admin
        public ActionResult Index()
        {
            AdminIndex model = new AdminIndex();

            model.Users = Database.Session.Query <User>().ToList();

            return(View(model));
        }
        // GET: Admin/Profiles
        public ActionResult AdminProfile()
        {
            AdminIndex admin = new AdminIndex();

            admin.Admin = DataBase.Session.QueryOver <AdminModel>().Where(x => x.Admin_Id == Convert.ToInt32(Session["ADMINID"])).SingleOrDefault();
            ViewBag.msg = message;
            ViewBag.err = err;
            return(View(admin));
        }
Esempio n. 6
0
        public async Task <IActionResult> AdminIndex()
        {
            AdminIndex viewModel = new AdminIndex()
            {
                NewStudents = await _context.Students.Where(c => c.Approved == false).ToListAsync(),
                Requests    = await _context.TeachingRequests.Include(i => i.ProfessorEntity).Include(c => c.SemesterForAssignment).Where(c => c.Approved == false && c.SemesterForAssignment.Open == true).ToListAsync(),
                Commities   = await _context.Committees.Include(c => c.Chair).Include(c => c.CommitieMembers).ToListAsync(),
            };

            return(View(viewModel));
        }
        // GET: AdminPanel/Home
        public ActionResult Index()
        {
            AdminIndex adminIndex = new AdminIndex();

            adminIndex.Products = ctx.productBll.getAll();

            adminIndex.newReservationCount = ctx.rezervationBll.getAll().Count;
            adminIndex.defaultReservations = ctx.rezervationBll.getAll();
            adminIndex.Users          = ctx.userBll.getAll();
            adminIndex.managementTeam = ctx.userBll.getAll().Where(x => x.roleOfUsers.Any(y => y.roles.roleName != "customer")).ToList();
            ViewBag.OnlineVisitor     = HttpContext.Application["visitor"];
            return(View(adminIndex));
        }
 public ActionResult AdminUpdatePassword(AdminIndex post)
 {
     resetViewBagMessages();
     if (post.OldPassword != DataBase.Session.QueryOver <AdminModel>().Where(x => x.Admin_Id == post.Admin.Admin_Id).SingleOrDefault().Password)
     {
         err = "Old Password you enter is not correct";
     }
     else if (post.NewPassword == null || post.NewPassword != post.CnfrmPassword)
     {
         err = "Password do not match";
     }
     else
     {
         err     = "";
         message = "Password Sucessfully Updated";
         AdminModel temp = DataBase.Session.Load <AdminModel>(post.Admin.Admin_Id);
         temp.Password = post.NewPassword;
         DataBase.Session.Update(temp);
     }
     return(RedirectToAction("AdminProfile"));
 }
Esempio n. 9
0
        public ActionResult Index()
        {
            AdminIndex viewModel = new AdminIndex();

            var breweries = mongoService.GetBreweries();

            List <SelectListItem> breweryList = new List <SelectListItem>();

            foreach (Brewery brewery in breweries)
            {
                SelectListItem b = new SelectListItem()
                {
                    Text = brewery.Name, Value = brewery._id.ToString()
                };
                breweryList.Add(b);
            }

            viewModel.breweries = breweryList;


            return(View(viewModel));
        }
Esempio n. 10
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (radiobtnStudent.IsChecked == true)
            {
                BaseResult br = sts.login(txtUserName.Text, txtPassword.Password);
                if (br.code == 0)
                {
                    MessageBox.Show("恭喜你已登录成功");
                    int    sex = sts.getSexByStuSpecId(txtUserName.Text.ToString());
                    string pngfile;
                    //headImage是image控件名
                    if (sex == 0)
                    {
                        pngfile = @"..\..\Resources\女生头像.png";
                    }
                    else
                    {
                        pngfile = @"..\..\Resources\男生头像.png";
                    }
                    StudentMainForm smf = new StudentMainForm(txtUserName.Text, (string)br.data, pngfile);

                    smf.Show();
                    this.Visibility = Visibility.Hidden;
                }
                else
                {
                    MessageBox.Show(br.msg);
                }
            }
            else if (radiobtnTeacher.IsChecked == true)
            {
                BaseResult br = tts.login(txtUserName.Text, txtPassword.Password);
                if (br.code == 0)
                {
                    MessageBox.Show("恭喜你已登录成功");

                    int sex = tts.getSexByTeaSpecId(txtUserName.Text.ToString());

                    string pngfile;
                    //headImage是image控件名
                    if (sex == 0)
                    {
                        pngfile = @"..\..\Resources\女教师.png";
                    }
                    else
                    {
                        pngfile = @"..\..\Resources\男教师.png";
                    }
                    TeacherMainForm tmf = new TeacherMainForm(txtUserName.Text, (string)br.data, pngfile);
                    //txtUserName.Text是教师工号Z0004520
                    //(string)br.data是刘树栋
                    tmf.Show();
                    this.Visibility = System.Windows.Visibility.Hidden;
                }
                else
                {
                    MessageBox.Show(br.msg);
                }
            }
            else if (radiobtnAdmin.IsChecked == true)
            {
                BaseResult br = ats.login(txtUserName.Text, txtPassword.Password);
                if (br.code == 0)
                {
                    MessageBox.Show("恭喜你已登录成功");

                    AdminIndex sm = new AdminIndex(txtUserName.Text, (string)br.data);
                    sm.Show();
                }
                else
                {
                    MessageBox.Show(br.msg);
                }
            }
        }