Ejemplo n.º 1
0
        public ActionResult Invoice(int id)
        {
            JobCardManager manager = new JobCardManager();
            JobCardView    jobCard = manager.GetJobCard(id, true);

            return(View(jobCard));
        }
Ejemplo n.º 2
0
        public ActionResult InvoiceResult(JobCardView jobCard)
        {
            JobCardManager manager = new JobCardManager();

            manager.SetInvoice(User.Identity.Name, jobCard);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        private JobCardView GetViewModel(JobCard jobCard, bool includeDeleted)
        {
            JobCardView result = new JobCardView
            {
                CustomerID      = jobCard.CustomerID,
                Customers       = GetAllCustomers(includeDeleted),
                DesignerID      = jobCard.DesignerID,
                Designers       = GetAllDesigners(includeDeleted),
                IsDeleted       = jobCard.IsDeleted,
                JobCardID       = jobCard.JobCardID,
                JobTypeID       = jobCard.JobTypeID,
                JobTypes        = GetAllJobTypes(includeDeleted),
                JobDate         = jobCard.JobDate,
                MaterialID      = jobCard.MaterialID,
                Materials       = GetAllMaterials(includeDeleted),
                QuoteRef        = jobCard.QuoteRef,
                CreatedID       = jobCard.CreatedID,
                CreatedDate     = jobCard.CreatedDate,
                ApplicationDate = jobCard.ApplicationDate,
                ApplicationID   = jobCard.ApplicationID,
                CladingDate     = jobCard.CladingDate,
                CladingID       = jobCard.CladingID,
                InstallDate     = jobCard.InstalDate,
                InstallID       = jobCard.InstallID,
                InvoiceDate     = jobCard.InvoiceDate,
                InvoiceID       = jobCard.InvoiceID,
                UVPrinterID     = jobCard.UVPrinterID,
                UVPrintedDate   = jobCard.UVPrintedDate,
                TaskStep        = (TaskStep)jobCard.TaskStep,
                Description     = jobCard.Description,
            };

            return(result);
        }
Ejemplo n.º 4
0
        public void DeleteJobCard(JobCardView jobCard)
        {
            using (DigiFusionEntities db = new DigiFusionEntities())
            {
                JobCard jobCardDB = db.JobCards.Single(x => x.JobCardID == jobCard.JobCardID);
                jobCardDB.IsDeleted = true;

                db.SaveChanges();
            }
        }
Ejemplo n.º 5
0
        public ActionResult Delete(int id)
        {
            JobCardManager manager = new JobCardManager();
            JobCardView    jobCard = manager.GetJobCard(id, true);

            jobCard.Users     = manager.GetAllUsers();
            jobCard.Customers = manager.GetAllCustomers(true);
            jobCard.Designers = manager.GetAllDesigners(true);

            return(View(jobCard));
        }
Ejemplo n.º 6
0
        public ActionResult History(int id)
        {
            JobCardManager manager = new JobCardManager();
            JobCardView    jobCard = manager.GetJobCard(id, true);

            jobCard.Customers = manager.GetAllCustomers(true);
            jobCard.Designers = manager.GetAllDesigners(true);
            jobCard.JobTypes  = manager.GetAllJobTypes(true);
            jobCard.Materials = manager.GetAllMaterials(true);
            jobCard.Users     = manager.GetAllUsers();
            return(View(jobCard));
        }
Ejemplo n.º 7
0
        public void SetInvoice(string userName, JobCardView jobCard)
        {
            using (DigiFusionEntities db = new DigiFusionEntities())
            {
                JobCard dbItem = db.JobCards.Single(x => x.JobCardID == jobCard.JobCardID);
                dbItem.InvoiceID   = GetUserID(userName);
                dbItem.InvoiceDate = DateTime.Now;
                dbItem.TaskStep    = 5;

                db.SaveChanges();
            }
        }
Ejemplo n.º 8
0
        public void SetClading(string userName, JobCardView jobCard)
        {
            using (DigiFusionEntities db = new Database.DigiFusionEntities())
            {
                JobCard dbItem = db.JobCards.Single(x => x.JobCardID == jobCard.JobCardID);
                dbItem.CladingID   = GetUserID(userName);
                dbItem.CladingDate = DateTime.Now;
                dbItem.TaskStep    = 3;

                db.SaveChanges();
            }
        }
Ejemplo n.º 9
0
        public ActionResult Create()
        {
            JobCardManager manager = new JobCardManager();

            var jobCardView = new JobCardView()
            {
                Customers = manager.GetAllCustomers(false),
                Designers = manager.GetAllDesigners(false),
                JobTypes  = manager.GetAllJobTypes(false),
                Materials = manager.GetAllMaterials(false)
            };

            return(View(jobCardView));
        }
Ejemplo n.º 10
0
        public ActionResult Delete(JobCardView jobCard)
        {
            try
            {
                if (jobCard.JobCardID != 0)
                {
                    JobCardManager manager = new JobCardManager();
                    manager.DeleteJobCard(jobCard);
                    return(RedirectToAction("Index"));
                }

                return(View(jobCard));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 11
0
        public ActionResult Create(JobCardView jobCardView)
        {
            if (ModelState.IsValid)
            {
                if (jobCardView.CustomerID == null ||
                    jobCardView.DesignerID == null ||
                    jobCardView.JobTypeID == null ||
                    jobCardView.MaterialID == null)
                {
                    return(CreateAdmin());
                }

                JobCardManager manager = new JobCardManager();
                jobCardView.CreatedID   = manager.GetUserID(User.Identity.Name);
                jobCardView.CreatedDate = DateTime.Now;
                manager.CreateJobCard(jobCardView);

                return(RedirectToAction("Index"));
            }

            return(Create());
        }
Ejemplo n.º 12
0
        public void CreateJobCard(JobCardView jobCard)
        {
            using (DigiFusionEntities db = new DigiFusionEntities())
            {
                var dbJobCard = new JobCard
                {
                    CustomerID  = (Guid)jobCard.CustomerID,
                    DesignerID  = (Guid)jobCard.DesignerID,
                    IsDeleted   = jobCard.IsDeleted,
                    JobCardID   = jobCard.JobCardID,
                    JobDate     = jobCard.JobDate,
                    JobTypeID   = jobCard.JobTypeID,
                    MaterialID  = jobCard.MaterialID,
                    QuoteRef    = jobCard.QuoteRef,
                    CreatedID   = jobCard.CreatedID,
                    CreatedDate = jobCard.CreatedDate,
                    Description = jobCard.Description
                };

                db.JobCards.Add(dbJobCard);
                db.SaveChanges();
            }
        }