示例#1
0
        public ActionResult CreateAdmin()
        {
            JobCardManager manager = new JobCardManager();

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

            return(View(jobCardView));
        }
示例#2
0
        public ActionResult CreateAdmin(JobCardAdminView 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(CreateAdmin());
        }
示例#3
0
        public void CreateJobCard(JobCardAdminView 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();
            }
        }