Beispiel #1
0
        public ActionResult HistoryList()
        {
            //Gets the logged user Id
            string userId = User.Identity.GetUserId();

            var history = this.db.History.ToArray();

            List <HistoryVM> historiesList = new List <HistoryVM>();

            for (int i = 0; i < history.Count(); i++)
            {
                var row = new HistoryVM
                {
                    Id = history[i].Id,
                    PredictedStartDate   = history[i].PredictedStartDate,
                    PredictedEndDate     = history[i].PredictedEndDate,
                    StartStorage         = GetStorageVM(history[i].StartStorageId),
                    EndStorage           = GetStorageVM(history[i].EndStorageId),
                    IsChecked            = history[i].IsChecked,
                    PerformerName        = history[i].Performer.UserName,
                    DateOfImplementation = history[i].Date,
                    Wastes = GetHistoryWastes(history[i]),
                };

                historiesList.Add(row);
            }
            return(View(historiesList));
        }
Beispiel #2
0
        public async Task <IActionResult> Update([FromBody] HistoryVM model)
        {
            try
            {
                History History = new History()
                {
                    _id = ObjectId.Parse(model._id),

                    Action      = model.Action,
                    Panel       = model.Panel,
                    Subject     = model.Subject,
                    CreatedBy   = model.CreatedBy,
                    CreatedDate = model.CreatedDate,
                    Button      = model.Button,
                    ActionId    = model.ActionId,
                    Completed   = model.Completed
                };
                await _historyRepository.UpdateHistory(History);

                return(new OkObjectResult(History));
            }
            catch (Exception ex)
            {
            }
            return(Ok());
        }
        public HistoryPage()
        {
            InitializeComponent();

            viewModel      = new HistoryVM();
            BindingContext = viewModel;
        }
Beispiel #4
0
        // GET
        public ActionResult Index()
        {
            var user = Session["Account"] as Account;

            if (user == null || !user.IsAdmin)
            {
                return(RedirectToAction("UnAuthorized", "Authentication"));
            }

            var histories = new List <HistoryVM>();
            var history   = db.History.Include(h => h.Account).ToList();

            foreach (var his in history)
            {
                if (histories.Exists(h =>
                                     h.Username == his.Account.UserName && h.Date.Day == his.VisitedDate.Day))
                {
                    histories.SingleOrDefault(h =>
                                              h.Username == his.Account.UserName && h.Date.Day == his.VisitedDate.Day).Times += 1;
                }
                else
                {
                    var newHis = new HistoryVM
                    {
                        Name     = his.Account.Name,
                        Username = his.Account.UserName,
                        Date     = his.VisitedDate,
                        Times    = 1
                    };
                    histories.Add(newHis);
                }
            }

            return(View(histories));
        }
        public HistoryPage()
        {
            InitializeComponent();

            historyVM = new HistoryVM();

            BindingContext = historyVM;
        }
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            HistoryDTO historyDTO = HistoryService.Get((Guid)id);

            if (historyDTO == null)
            {
                return(HttpNotFound());
            }

            HistoryVM historyVM = Mapper.Map <HistoryVM>(historyDTO);

            List <EquipmentSelectModel> equipmentSelectModel = new List <EquipmentSelectModel>();
            var eqipmentWithInventNumber = EquipmentService.GetAll();

            foreach (var item in eqipmentWithInventNumber)
            {
                equipmentSelectModel.Add(
                    new EquipmentSelectModel
                {
                    Id = item.Id,
                    TypeAndInventNumber = item.EquipmentType.Name + " (Номер: " + item.InventNumber + ")"
                }
                    );
            }
            ViewBag.ChangeDateNow = ((DateTime)historyVM.ChangeDate).ToString("dd.MM.yyyy HH:mm:ss");

            ViewBag.StatusTypeId = new SelectList(
                StatusTypeService.GetAll(),
                "Id",
                "Name",
                historyVM.StatusTypeId);

            ViewBag.RepairPlaceId = new SelectList(
                RepairPlaceService.GetAll(),
                "Id",
                "Name",
                historyVM.RepairPlaceId);

            ViewBag.EquipmentId = new SelectList(
                equipmentSelectModel,
                "Id",
                "TypeAndInventNumber",
                historyVM.EquipmentId);

            ViewBag.EmployeeId = new SelectList(
                EmployeeService.GetAll(),
                "EmployeeId",
                "EmployeeFullName",
                historyVM.EmployeeId);

            return(View(historyVM));
        }
Beispiel #7
0
        public static XElement GetXML(HistoryVM historyVm)
        {
            XElement xml = new XElement("xml",
                                        new XAttribute("userName", historyVm.userName),
                                        new XAttribute("meterNum", historyVm.meterNum),
                                        new XAttribute("userPass", historyVm.userPass));

            return(xml);
        }
        public ActionResult History(int id)
        {
            var db = new SimchaDb(Properties.Settings.Default.ConStr);
            var vm = new HistoryVM
            {
                Trancactions = db.GetTrancactionsById(id),
                Name         = db.GetNameById(id),
                Balance      = db.GetBalanceOfAPerson(id)
            };

            return(View(vm));
        }
        public ActionResult Edit([Bind(Include = "Id,EquipmentId,ChangeDate,EmployeeId,RepairPlaceId,StatusTypeId,Comments")] HistoryVM historyVM)
        {
            if (ModelState.IsValid)
            {
                HistoryDTO historyDTO = Mapper.Map <HistoryDTO>(historyVM);
                HistoryService.Update(historyDTO);

                return(RedirectToAction("Index"));
            }

            List <EquipmentSelectModel> equipmentSelectModel = new List <EquipmentSelectModel>();
            var eqipmentWithInventNumber = EquipmentService.GetAll();

            foreach (var item in eqipmentWithInventNumber)
            {
                equipmentSelectModel.Add(
                    new EquipmentSelectModel
                {
                    Id = item.Id,
                    TypeAndInventNumber = item.EquipmentType.Name + " (Номер: " + item.InventNumber + ")"
                }
                    );
            }

            ViewBag.ChangeDateNow = DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss");

            ViewBag.StatusTypeId = new SelectList(
                StatusTypeService.GetAll(),
                "Id",
                "Name",
                historyVM.StatusTypeId);

            ViewBag.RepairPlaceId = new SelectList(
                RepairPlaceService.GetAll(),
                "Id",
                "Name",
                historyVM.RepairPlaceId);

            ViewBag.EquipmentId = new SelectList(
                equipmentSelectModel,
                "Id",
                "TypeAndInventNumber",
                historyVM.EquipmentId);

            ViewBag.EmployeeId = new SelectList(
                EmployeeService.GetAll(),
                "EmployeeId",
                "EmployeeFullName",
                historyVM.EmployeeId);

            return(View(historyVM));
        }
Beispiel #10
0
        public async Task <IActionResult> History()
        {
            var memoList = await _context.Memorabilia.Where(d => d.Active == true).OrderByDescending(d => d.Year)
                           .ProjectTo <MemorabiliaVM>(_mapper.ConfigurationProvider).ToListAsync();

            var years = memoList.Select(d => d.Year).Distinct();
            var vm    = new HistoryVM
            {
                Memorabilias = memoList,
                Years        = years
            };

            var url = Request.Path.ToString();

            ViewData["PageMeta"] = await _context.PageMetas.FirstOrDefaultAsync(d => d.ObjectId == url && d.ModuleType == (short)ModuleType.MENU);

            return(View(vm));
        }
        private async Task <string> GetTrans(HistoryVM historyVm)
        {
            string json = "";

            try
            {
                var content = Convertor.GetXML(historyVm);
                var resp    = await CallApi(content, SEDCOprations.SEARCH);

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(resp);
                json = JsonConvert.SerializeXmlNode(doc);
            }
            catch (Exception e)
            {
            }
            return(json);
        }
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            HistoryDTO historyDTO = HistoryService.Get((Guid)id);

            if (historyDTO == null)
            {
                return(HttpNotFound());
            }

            HistoryVM historyVM = Mapper.Map <HistoryVM>(historyDTO);

            return(View(historyVM));
        }
        // GET: History
        public ActionResult Index()
        {
            HistoryVM    historyVM = new HistoryVM();
            List <LogVM> logs      = new List <LogVM>();

            historyVM.logs = logs;
            IEnumerable <ILog> response = _logService.GetAllLogs();

            if (response != null)
            {
                foreach (var item in response)
                {
                    LogVM logVM = new LogVM(item.Id, item.Date, item.Thread, item.Level, item.Message);
                    historyVM.logs.Add(logVM);
                }
            }

            return(View(historyVM));
        }
Beispiel #14
0
        public ActionResult HistoryDetails(int historyId)
        {
            var historyDb = db.History.Find(historyId);

            var model = new HistoryVM()
            {
                Id = historyDb.Id,
                PredictedStartDate   = historyDb.PredictedStartDate,
                PredictedEndDate     = historyDb.PredictedEndDate,
                StartStorage         = GetStorageVM(historyDb.StartStorageId),
                EndStorage           = GetStorageVM(historyDb.EndStorageId),
                IsChecked            = historyDb.IsChecked,
                PerformerName        = historyDb.Performer.UserName,
                DateOfImplementation = historyDb.Date,
                Wastes = GetHistoryWastes(historyDb)
            };

            return(View(model));
        }
Beispiel #15
0
        public ActionResult HistoryDetails(DateTime date)
        {
            HistoryVM histVM = new HistoryVM()
            {
                totalPrice    = 0,
                totalQuantity = 0,
                Products      = new List <ProductCart>(),
            };


            int _userId = (from s in db.Sessions select s.Id).FirstOrDefault();
            var all     = from x in db.ProductCarts where x.cartId == _userId select x;



            foreach (var a in all)
            {
                //if (DateTime.Compare(Convert.ToDateTime(a.checkoutDate), Convert.ToDateTime(date)) == 0)
                if (a.checkoutDate.ToString() == date.ToString())
                {
                    histVM.Products.Add(a);
                    histVM.totalPrice    += a.getTotalPrice();
                    histVM.totalQuantity += a.quantityPurchased;
                }
            }
            if (histVM.Products.Count == 0)
            {
                ViewBag.ErrorMsg = "Invalid date!";
                return(View("History", purchaseDates));
            }

            else
            {
                histVM.User         = (from s in db.Users where s.userId == _userId select s).FirstOrDefault();
                histVM.purchaseDate = date;
                return(View("HistoryDetails", histVM));
            }
        }
Beispiel #16
0
        public async Task <History> AddHistory(HistoryVM model)
        {
            try
            {
                History _history = new History()
                {
                    CreatedDate = DateTime.Now,
                    CreatedBy   = 1,
                    Subject     = model.Subject,
                    Action      = model.Action,
                    Panel       = model.Panel,
                    Button      = model.Button,
                    ActionId    = model.ActionId,
                    Completed   = model.Completed
                };
                await _context.History.InsertOneAsync(_history);

                return(_history);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #17
0
        public HistoryView()
        {
            InitializeComponent();

            BindingContext = vm = new HistoryVM();
        }
Beispiel #18
0
 public History()
 {
     InitializeComponent();
     DataContext = new HistoryVM(dataGrid);
 }
 public History()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     BindingContext = new HistoryVM();
 }
Beispiel #20
0
 public HistoryPage()
 {
     InitializeComponent();
     Hvm            = new HistoryVM();
     BindingContext = Hvm;
 }
Beispiel #21
0
 public async Task <IActionResult> Add([FromBody] HistoryVM History)
 {
     return(Ok(await _historyRepository.AddHistory(History)));
 }
Beispiel #22
0
        // TUTAJ123

        public History(int userID)
        {
            InitializeComponent();
            DataContext = new HistoryVM(userID);
        }
Beispiel #23
0
 public HistoryPage()
 {
     this.InitializeComponent();
     historyVM = new HistoryVM();
 }
Beispiel #24
0
        public HistoryPage()
        {
            InitializeComponent();

            vm = Resources["vm"] as HistoryVM;
        }
Beispiel #25
0
 /// <summary>
 /// Show shopping history
 /// </summary>
 /// <param name="p">HistoryVM</param>
 /// <returns></returns>
 public ActionResult RenderOrderHistory(HistoryVM p)
 {
     return(PartialView("_shopHistory", p));
 }
Beispiel #26
0
        /// <summary>
        /// Shopping history
        /// </summary>
        /// <returns></returns>
        public ActionResult ListShopHistory()
        {
            var    context = new AppDbContext();
            string wEmail  = " ";

            // If logged in, get email from Identity user

            if (User.Identity.IsAuthenticated)
            {
                var usid = User.Identity.GetUserName();
                var us   = context.Users.FirstOrDefault(x => x.UserName == usid);

                if (us != null)
                {
                    wEmail = us.Email;
                }
            }

            // Get order details
            var odet = context.OrderDetails.ToList().Select(x => new OrderDetail
            {
                OrderDetailId = x.OrderDetailId,
                OrderId       = x.OrderId,
                ItemId        = x.ItemId,
                UnitPrice     = x.UnitPrice,
                Quantity      = x.Quantity,
            }).ToList();

            List <HistoryVM> History = new List <HistoryVM>();

            if (odet != null)
            {
                foreach (var item in odet)
                {
                    // Get order head
                    var or = context.Orders.FirstOrDefault(x => x.OrderId == item.OrderId);

                    if (or != null && or.Email == wEmail)
                    {
                        // Get item name
                        var it = context.Items.FirstOrDefault(x => x.ItemId == item.ItemId);

                        if (it != null)
                        {
                            var hist = new HistoryVM();
                            hist.OrderId   = item.OrderId;
                            hist.ItemName  = it.Name;
                            hist.Price     = item.UnitPrice;
                            hist.Quantity  = item.Quantity;
                            hist.OrderDate = or.OrderDate;
                            History.Add(hist);
                        }
                    }
                }
            }

            // Get Invoice Address
            var ia = context.InvoiceAddresses.FirstOrDefault(x => x.Email == wEmail);

            if (ia != null)
            {
                ViewBag.Name    = "Name: " + ia.FirstName + " " + ia.LastName;
                ViewBag.City    = "City: " + ia.City;
                ViewBag.Address = "Address: " + ia.PostalCode + " " + ia.Address;
                ViewBag.Country = "Country: " + ia.Country;

                ViewBag.Email       = "Email: " + ia.Email;
                ViewBag.PhoneNumber = "Phone number: " + ia.PhoneNumber;
            }

            return(View("OrderHistory", History));
        }
Beispiel #27
0
 public HistoryCommand(HistoryVM model)
 {
     viewModel = model;
 }