Example #1
0
        // GET: Record
        public ActionResult Index()
        {
            MyBoutiqueEntities db = new MyBoutiqueEntities();
            string             id = User.Identity.GetUserId();
            var records           = db.VenderorsRecords.Where(x => x.Vendor_Id == id).ToList();
            List <RecordListViewModel> RecordList = new List <RecordListViewModel>();
            int Pending_Amount   = 0;
            int Total_Purchasing = 0;
            int Paid_Amount      = 0;

            foreach (var v in records)
            {
                RecordListViewModel r = new RecordListViewModel();
                r.Order_Id         = v.Order_Id;
                r.Article_No       = v.Article_No;
                r.No_Of_Suits      = Convert.ToInt32(v.No_Of_Suits);
                r.Colors           = Convert.ToInt32(v.Colors);
                r.Price            = Convert.ToInt32(v.Price_For_Each);
                r.Added_On         = Convert.ToDateTime(v.Added_On);
                r.ImagePath        = v.Image_Path;
                r.Paid_Amount      = Convert.ToInt32(v.Paid_Amount);
                r.Total_Price      = r.Price * r.No_Of_Suits;
                r.Remaining_Amount = r.Total_Price - r.Paid_Amount;
                Pending_Amount     = Pending_Amount + Convert.ToInt32(r.Remaining_Amount);
                Total_Purchasing   = Total_Purchasing + Convert.ToInt32(r.Total_Price);
                Paid_Amount        = Paid_Amount + Convert.ToInt32(v.Paid_Amount);
                RecordList.Add(r);
            }
            ViewBag.PendingAmount   = Pending_Amount;
            ViewBag.TotalPurchasing = Total_Purchasing;
            ViewBag.PaidAmount      = Paid_Amount;
            return(View(RecordList));
        }
Example #2
0
        public ActionResult SearchByDate(RecordListViewModel collection)
        {
            MyBoutiqueEntities         db = new MyBoutiqueEntities();
            List <RecordListViewModel> RecordListByDate    = new List <RecordListViewModel>();
            List <RecordListViewModel> RecordListByArticle = new List <RecordListViewModel>();
            string id             = User.Identity.GetUserId();
            var    VenderorRecord = db.VenderorsRecords.Where(x => x.Vendor_Id == id).ToList();



            var DateBasedList = db.VenderorsRecords.Where(x => x.Added_On == collection.DateList).ToList();

            foreach (var v in DateBasedList)
            {
                RecordListViewModel r = new RecordListViewModel();
                r.Order_Id         = v.Order_Id;
                r.Article_No       = v.Article_No;
                r.No_Of_Suits      = Convert.ToInt32(v.No_Of_Suits);
                r.Colors           = Convert.ToInt32(v.Colors);
                r.Price            = Convert.ToInt32(v.Price_For_Each);
                r.Added_On         = Convert.ToDateTime(v.Added_On);
                r.ImagePath        = v.Image_Path;
                r.Paid_Amount      = Convert.ToInt32(v.Paid_Amount);
                r.Total_Price      = r.Price * r.No_Of_Suits;
                r.Remaining_Amount = r.Total_Price - r.Paid_Amount;

                RecordListByDate.Add(r);
            }
            return(View(RecordListByDate));
        }
Example #3
0
 public async Task <IActionResult> Get()
 {
     return(await ExecuteAsync(async() =>
     {
         var pagedData = await _repository.GetAsync();
         return RecordListViewModel <HardwareDeviceViewModel> .ToViewModel(pagedData);
     }));
 }
Example #4
0
        public ActionResult SearchName(RecordListViewModel collection)
        {
            MyBoutiqueEntities         db = new MyBoutiqueEntities();
            List <RecordListViewModel> RecordListByArticle = new List <RecordListViewModel>();

            List <DateTime> DatesList = new List <DateTime>();

            var VenderorRecord = db.VenderorsRecords.ToList();

            foreach (var v in VenderorRecord)
            {
                DateTime date = Convert.ToDateTime(v.Added_On);
                DatesList.Add(date);
            }

            List <string> ArticleNumbers = new List <string>();

            foreach (var v in VenderorRecord)
            {
                string ArticleNumber = v.Article_No;
                ArticleNumbers.Add(ArticleNumber);
            }
            DatesList.Sort();
            ArticleNumbers.Sort();

            ViewBag.ListArticles = new SelectList(ArticleNumbers);

            var ArticleBasedList = db.VenderorsRecords.Where(x => x.Article_No == collection.ArticleList).ToList();

            foreach (var v in ArticleBasedList)
            {
                foreach (AspNetUser vendor in db.AspNetUsers)
                {
                    if (vendor.Id == v.Vendor_Id)
                    {
                        ViewBag.Name        = vendor.UserName;
                        ViewBag.Id          = v.Order_Id;
                        ViewBag.Article_No  = v.Article_No;
                        ViewBag.No_Of_Suits = Convert.ToInt32(v.No_Of_Suits);
                        ViewBag.Colors      = Convert.ToInt32(v.Colors);

                        ViewBag.Price_For_Each   = Convert.ToInt32(v.Price_For_Each);
                        ViewBag.Date_Of_Delivery = Convert.ToDateTime(v.Added_On);
                        ViewBag.Image            = v.Image_Path;
                        ViewBag.Paid_Amount      = Convert.ToInt32(v.Paid_Amount);
                        ViewBag.Date             = Convert.ToDateTime(v.Added_On);
                        ViewBag.Total_Price      = (Convert.ToInt32(v.Price_For_Each)) * (Convert.ToInt32(v.No_Of_Suits));
                        ViewBag.Remaining_Amount = ViewBag.Total_Price - ViewBag.Paid_Amount;
                        break;
                    }
                }
            }

            return(View());
        }
Example #5
0
        public ActionResult AddServicesToRecord(RecordListViewModel model)
        {
            var newRecordViewModel = new RecordListViewModel {
                DateTime          = model.DateTime,
                PriorityBox       = db.BoxesSet.FirstOrDefault(x => x.BoxId == model.PriorityBox.BoxId),
                PriorityCarWasher = db.CarWasherSet.FirstOrDefault(x => x.CarWasherId == model.PriorityCarWasher.CarWasherId),
                CurrentCar        = db.CarSet.FirstOrDefault(x => x.Model == model.CurrentCar.Model),
                RecordGuid        = model.RecordGuid
            };

            newRecordViewModel.ListOfServices = db.ServicesSet.ToList();
            return(View(newRecordViewModel));
        }
        public ActionResult Records(int?olympicEventId)
        {
            if (!olympicEventId.HasValue)
            {
                return(ChooseAnEvent());
            }

            var olympicEvent = _eventService.GetOlympicEventById(olympicEventId.Value);
            var records      = _recordService.GetRecordsByEventId(olympicEventId.Value, onlyBestForCompetitors: true);
            var viewModel    = RecordListViewModel.Build(records, olympicEvent);

            return(View(viewModel));
        }
Example #7
0
        public void RecordsToPDF(IEnumerable <RecordViewModel> records)
        {
            RecordListViewModel a = new RecordListViewModel()
            {
                Records = records
            };
            FileInfo file = new FileInfo(DEST);

            if (!file.Directory.Exists)
            {
                file.Directory.Create();
            }
            new ToPDF().CreatePdf(DEST, a);
        }
Example #8
0
        public ActionResult ShowRecordList(RecordSet model)
        {
            //var record = db.RecordSet.FirstOrDefault(x => x.RecordId )
            var recordViewModel = new RecordListViewModel();

            recordViewModel.PriorityBox       = db.BoxesSet.FirstOrDefault(x => x.BoxId == model.BoxesBoxId);
            recordViewModel.PriorityCarWasher = db.CarWasherSet.FirstOrDefault(x => x.CarWasherId == model.CarWasherCarWasherId);
            recordViewModel.DateTime          = model.DateTime;
            recordViewModel.RecordGuid        = model.RecordId;
            recordViewModel.CurrentCar        = db.CarSet.FirstOrDefault(x => x.CarId ==
                                                                         db.CarClientSet.FirstOrDefault(m => m.CarNumber == model.CarClientCarNumber).CarCarId);

            return(View(recordViewModel));
        }
Example #9
0
 public ActionResult Edit(int id, RecordListViewModel collection)
 {
     try
     {
         MyBoutiqueEntities db = new MyBoutiqueEntities();
         var v = db.VenderorsRecords.Where(x => x.Order_Id == id).First();
         if (collection.Image != null)
         {
             string filename = Path.GetFileNameWithoutExtension(collection.Image.FileName);
             string ext      = Path.GetExtension(collection.Image.FileName);
             filename = filename + DateTime.Now.Millisecond.ToString();
             filename = filename + ext;
             string filetodb = "/Image/" + filename;
             filename = Path.Combine(Server.MapPath("~/Image/"), filename);
             collection.Image.SaveAs(filename);
             collection.ImagePath = filetodb;
         }
         else
         {
             collection.ImagePath = v.Image_Path;
         }
         if (collection.Added_On == DateTime.MinValue)
         {
             collection.Added_On = DateTime.Now.Date;
         }
         else
         {
             collection.Added_On = Convert.ToDateTime(v.Added_On);
         }
         RecordListViewModel r = new RecordListViewModel();
         v.Article_No       = collection.Article_No;
         v.No_Of_Suits      = Convert.ToInt32(collection.No_Of_Suits);
         v.Colors           = Convert.ToInt32(collection.Colors);
         v.Price_For_Each   = Convert.ToInt32(collection.Price);
         v.Added_On         = Convert.ToDateTime(collection.Added_On);
         v.Image_Path       = collection.ImagePath;
         v.Paid_Amount      = Convert.ToInt32(collection.Paid_Amount);
         v.Total_Price      = v.Price_For_Each * v.No_Of_Suits;
         v.Remaining_Amount = v.Total_Price - v.Paid_Amount;
         db.SaveChanges();
         return(RedirectToAction("Index", "Account", new { Message = "Record Updated" }));
     }
     catch
     {
         return(View());
     }
 }
Example #10
0
        // GET: Record/Edit/5
        public ActionResult Edit(int id)
        {
            MyBoutiqueEntities db = new MyBoutiqueEntities();
            var v = db.VenderorsRecords.Where(x => x.Order_Id == id).First();
            RecordListViewModel r = new RecordListViewModel();

            r.Article_No       = v.Article_No;
            r.No_Of_Suits      = Convert.ToInt32(v.No_Of_Suits);
            r.Colors           = Convert.ToInt32(v.Colors);
            r.Price            = Convert.ToInt32(v.Price_For_Each);
            r.Added_On         = Convert.ToDateTime(v.Added_On);
            r.ImagePath        = v.Image_Path;
            r.Paid_Amount      = Convert.ToInt32(v.Paid_Amount);
            r.Total_Price      = r.Price * r.No_Of_Suits;
            r.Remaining_Amount = r.Total_Price - r.Paid_Amount;
            return(View(r));
        }
Example #11
0
        public virtual void CreatePdf(String dest, RecordListViewModel records)
        {
            //Initialize PDF writer
            PdfWriter writer = new PdfWriter(dest);
            //Initialize PDF document
            PdfDocument pdf = new PdfDocument(writer);
            // Initialize document
            Document document = new Document(pdf);
            // Create a PdfFont
            PdfFont font = PdfFontFactory.CreateFont(iText.IO.Font.Constants.StandardFonts.TIMES_ROMAN);

            // Add a Paragraph
            document.Add(new Paragraph("Record report").SetFont(font).SetFontSize(18).SetTextAlignment(TextAlignment.CENTER));
            // Add ListItem objects
            float[] columnWidths = { 2, 2, 2, 5, 2, 4 };
            Table   table        = new Table(columnWidths, true);

            table.SetFontSize(11);
            table.AddCell("Record ID");
            table.AddCell("Project Name");
            table.AddCell("Task Name");
            table.AddCell("Note");
            table.AddCell("Work time");
            table.AddCell("Start date and time");
            foreach (var record in records.Records)
            {
                table.AddCell(record.Id.ToString());
                table.AddCell(record.ProjectName);
                table.AddCell(record.TaskName.ToString());
                table.AddCell(record.Note);
                table.AddCell(record.Hours.ToString());
                table.AddCell(record.RecordDateTime.ToString());
            }
            table.SetBorder(new SolidBorder(1));
            document.Add(table);

            //Close document
            document.Close();
        }
Example #12
0
        // GET: Record/Details/5
        public ActionResult Details(int id)
        {
            MyBoutiqueEntities db = new MyBoutiqueEntities();
            //string VendorId = User.Identity.GetUserId();
            var v = db.VenderorsRecords.Where(x => x.Order_Id == id).First();
            RecordListViewModel r = new RecordListViewModel();

            r.Article_No       = v.Article_No;
            r.No_Of_Suits      = Convert.ToInt32(v.No_Of_Suits);
            r.Colors           = Convert.ToInt32(v.Colors);
            r.Price            = Convert.ToInt32(v.Price_For_Each);
            r.Added_On         = Convert.ToDateTime(v.Added_On);
            r.ImagePath        = v.Image_Path;
            r.Paid_Amount      = Convert.ToInt32(v.Paid_Amount);
            r.Total_Price      = r.Price * r.No_Of_Suits;
            r.Remaining_Amount = r.Total_Price - r.Paid_Amount;
            var Name = db.AspNetUsers.Where(x => x.Id == v.Vendor_Id).First();

            r.name      = Name.UserName;
            ViewBag.pic = v.Image_Path;
            return(View(r));
        }
Example #13
0
        public ActionResult OrdersThisWeek()
        {
            MyBoutiqueEntities db               = new MyBoutiqueEntities();
            var AllOrders                       = db.VenderorsRecords.ToList();
            List <RecordListViewModel> List     = new List <RecordListViewModel>();
            List <DateTime>            ThisWeek = LastSevenDays();

            foreach (var v in AllOrders)
            {
                foreach (DateTime Date in ThisWeek)
                {
                    if (v.Added_On == Date)
                    {
                        RecordListViewModel r = new RecordListViewModel();
                        foreach (AspNetUser vendor in db.AspNetUsers)
                        {
                            if (vendor.Id == v.Vendor_Id)
                            {
                                r.name = vendor.UserName;
                                break;
                            }
                        }
                        r.Order_Id         = v.Order_Id;
                        r.Article_No       = v.Article_No;
                        r.No_Of_Suits      = Convert.ToInt32(v.No_Of_Suits);
                        r.Colors           = Convert.ToInt32(v.Colors);
                        r.Price            = Convert.ToInt32(v.Price_For_Each);
                        r.Added_On         = Convert.ToDateTime(v.Added_On);
                        r.ImagePath        = v.Image_Path;
                        r.Paid_Amount      = Convert.ToInt32(v.Paid_Amount);
                        r.Total_Price      = r.Price * r.No_Of_Suits;
                        r.Remaining_Amount = r.Total_Price - r.Paid_Amount;

                        List.Add(r);
                    }
                }
            }
            return(View(List));
        }
Example #14
0
        public ActionResult RefreshServicesToRecord(RecordListViewModel model)
        {
            var currentCar      = db.CarSet.FirstOrDefault(m => m.Model == model.CurrentCar.Model);
            var serviceToRecord = db.ServicesByCategorySet.FirstOrDefault(x => x.ServicesCodeService == model.PickedService.CodeService &&
                                                                          x.CategoryOfCarCategoryId == currentCar.CategoryOfCarCategoryId);

            var currentOrder = db.OrderSet.FirstOrDefault(x => x.RecordRecordId == model.RecordGuid);

            serviceToRecord.OrderSet.Add(currentOrder);
            currentOrder.ServicesByCategorySet1.Add(serviceToRecord);

            db.SaveChanges();

            var newRecordViewModel = new RecordListViewModel {
                DateTime          = model.DateTime,
                PriorityBox       = db.BoxesSet.FirstOrDefault(x => x.BoxId == model.PriorityBox.BoxId),
                PriorityCarWasher = db.CarWasherSet.FirstOrDefault(x => x.CarWasherId == model.PriorityCarWasher.CarWasherId),
                CurrentCar        = db.CarSet.FirstOrDefault(x => x.Model == model.CurrentCar.Model),
                RecordGuid        = model.RecordGuid
            };

            newRecordViewModel.ListOfServices = db.ServicesSet.ToList();
            return(View(newRecordViewModel));
        }
Example #15
0
        public MainWindow()
        {
            InitializeComponent();

            DataContext = new RecordListViewModel();
        }
Example #16
0
        // sort Action
        public RecordListViewModel SortBy(SortState sortParam, IEnumerable <RecordViewModel> records)
        {
            RecordListViewModel model = new RecordListViewModel();

            switch (sortParam)
            {
            case SortState.IdAsc:
            {
                model.Records = records.OrderBy(s => s.Id);
                break;
            }

            case SortState.IdDesc:
            {
                model.Records = records.OrderByDescending(s => s.Id);
                break;
            }

            case SortState.UserIdAsc:
            {
                model.Records = records.OrderBy(s => s.UserId);
                break;
            }

            case SortState.UserIdDesc:
            {
                model.Records = records.OrderByDescending(s => s.UserId);
                break;
            }

            case SortState.ProjectNameAsc:
            {
                model.Records = records.OrderBy(s => s.ProjectName);
                break;
            }

            case SortState.ProjectNameDesc:
            {
                model.Records = records.OrderByDescending(s => s.ProjectName);
                break;
            }

            case SortState.TaskNameAsc:
            {
                model.Records = records.OrderBy(s => s.TaskName);
                break;
            }

            case SortState.TaskNameDesc:
            {
                model.Records = records.OrderByDescending(s => s.TaskName);
                break;
            }

            case SortState.NoteAsc:
            {
                model.Records = records.OrderBy(s => s.Note);
                break;
            }

            case SortState.NoteDesc:
            {
                model.Records = records.OrderByDescending(s => s.Note);
                break;
            }

            case SortState.HourAsc:
            {
                model.Records = records.OrderBy(s => s.Hours);
                break;
            }

            case SortState.HourDesc:
            {
                model.Records = records.OrderByDescending(s => s.Hours);
                break;
            }

            case SortState.DataTimeAsc:
            {
                model.Records = records.OrderBy(s => s.RecordDateTime);
                break;
            }

            case SortState.DataTimeDesc:
            {
                model.Records = records.OrderByDescending(s => s.RecordDateTime);
                break;
            }

            default:
            {
                model.Records = records.OrderBy(s => s.Id);
                break;
            }
            }
            return(model);
        }