Beispiel #1
0
        public ActionResult 修改消息(int id)
        {
            MotaiDataEntities dbContext = new MotaiDataEntities();
            tPromotion        promotion = dbContext.tPromotions.FirstOrDefault(p => p.PromotionId == id);

            if (promotion == null)
            {
                return(RedirectToAction("員工看產品頁面"));
            }
            DetailPromotionViewModel Promo = new DetailPromotionViewModel();

            Promo.pADimage             = promotion.pADimage;
            Promo.pCondition           = promotion.pCondition;
            Promo.pDiscount            = promotion.pDiscount;
            Promo.pPromotionDeadline   = promotion.pPromotionDeadline;
            Promo.pPromotionPostDate   = promotion.pPromotionPostDate;
            Promo.pPromotionStartDate  = promotion.pPromotionStartDate;
            Promo.pPromotionWeb        = promotion.pPromotionWeb;
            Promo.PromotionDescription = promotion.PromotionDescription;
            Promo.sPromotinoCategory   = promotion.tPromotionCategory.PromtionCategory;
            Promo.PromotionName        = promotion.PromotionName;
            Promo.pDiscountCode        = promotion.pDiscountCode;
            Promo.PromotionId          = promotion.PromotionId;

            Promo.sPromotinoCategory = promotion.tPromotionCategory.PromtionCategory;
            Promo.pCategory          = promotion.PromotinoCategory;
            var categories = new ProductRespoitory().GetCategoryAll();
            List <SelectListItem> Cateitems = new ProductRespoitory().GetPositionName(categories);

            Promo.Categories = Cateitems;
            return(View(Promo));
        }
        public ActionResult 修改產品(int id)
        {
            MotaiDataEntities db      = new MotaiDataEntities();
            tProduct          product = db.tProducts.FirstOrDefault(p => p.ProductId == id);

            if (product == null)
            {
                return(RedirectToAction("員工看產品頁面"));
            }
            EmpProductViewModel Prod = new EmpProductViewModel();

            Prod.ProductId     = id;
            Prod.pNumber       = product.pNumber;
            Prod.pName         = product.pName;
            Prod.psCategory    = product.tProductCategory.Category;
            Prod.psMaterial    = product.tProductMaterial.Material;
            Prod.psSize        = product.tProductSize.Size;
            Prod.pLxWxH        = product.pLxWxH;
            Prod.pWeight       = product.pWeight;
            Prod.pIntroduction = product.pIntroduction;
            Prod.pPrice        = product.pPrice;
            var categories = new ProductRespoitory().GetCategoryAll();
            List <SelectListItem> Cateitems = new ProductRespoitory().GetSelectList(categories);

            Prod.Categories = Cateitems;
            var materials = new ProductRespoitory().GetMaterialAll();
            List <SelectListItem> Mateitems = new ProductRespoitory().GetSelectList(materials);

            Prod.Materials = Mateitems;
            var sizes = new ProductRespoitory().GetSizeAll();
            List <SelectListItem> Sizeitems = new ProductRespoitory().GetSelectList(sizes);

            Prod.Sizes = Sizeitems;
            return(View(Prod));
        }
        public ActionResult 新增員工()
        {
            if (Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] == null)
            {
                return(RedirectToAction("員工登入", "Employee"));
            }

            EmployeeViewModels empall = new EmployeeViewModels();
            var vBranch = new ProductRespoitory().GetBranchName();
            List <SelectListItem> Branch = new ProductRespoitory().GetPositionName(vBranch);

            empall.Branch = Branch;
            var vPosition = new ProductRespoitory().GetPositionName();
            List <SelectListItem> Position = new ProductRespoitory().GetPositionName(vPosition);

            empall.Position = Position;
            return(View(empall));
        }
        public ActionResult 修改員工(int id)
        {
            if (CSession關鍵字.SK_LOGINED_EMPLOYEE == null)
            {
                return(RedirectToAction("員工登入", "Employee"));
            }
            MotaiDataEntities  dbcontext = new MotaiDataEntities();
            tEmployee          empse     = dbcontext.tEmployees.FirstOrDefault(c => c.EmployeeId == id);
            EmployeeViewModels empall    = new EmployeeViewModels();
            var vBranch = new ProductRespoitory().GetBranchName();
            List <SelectListItem> Branch = new ProductRespoitory().GetPositionName(vBranch);

            empall.Branch = Branch;
            var vPosition = new ProductRespoitory().GetPositionName();
            List <SelectListItem> Position = new ProductRespoitory().GetPositionName(vPosition);

            empall.Position   = Position;
            empall.eName      = empse.eName;
            empall.ePosition  = empse.ePosition;
            empall.EmployeeId = empse.EmployeeId;
            return(View(empall));
        }
        public ActionResult 新增日誌()
        {
            tEmployee emp = Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] as tEmployee;

            ViewBag.name  = emp.eName;
            ViewBag.empId = emp.EmployeeId;
            DiaryViewModel        newDiary   = new DiaryViewModel();
            var                   warehouses = new ProductRespoitory().GetCategoryAll();
            List <SelectListItem> WareList   = new List <SelectListItem>();

            foreach (var item in warehouses)
            {
                WareList.Add(new SelectListItem()
                {
                    Text  = item.Value,
                    Value = item.Key.ToString()
                });
            }
            newDiary.WarehouseName = WareList;

            return(View(newDiary));
        }
        public ActionResult 新增產品()
        {
            if (Session[CSession關鍵字.SK_LOGINED_EMPLOYEE] == null)
            {
                return(RedirectToAction("員工登入", "Employee"));
            }
            ProductViewModel newprod        = new ProductViewModel();
            var categories                  = new ProductRespoitory().GetCategoryAll();
            List <SelectListItem> Cateitems = new ProductRespoitory().GetPositionName(categories);

            newprod.Categories = Cateitems;

            var materials = new ProductRespoitory().GetMaterialAll();
            List <SelectListItem> Mateitems = new ProductRespoitory().GetPositionName(materials);

            newprod.Materials = Mateitems;

            var sizes = new ProductRespoitory().GetSizeAll();
            List <SelectListItem> Sizeitems = new ProductRespoitory().GetPositionName(sizes);

            newprod.Sizes = Sizeitems;
            return(View(newprod));
        }