public void Remove(Guid id)
        {
            WeeklyPlan weeklyPlan = GetById(id);

            weeklyPlan.Status = DAL.Entity.Enum.Status.Deleted;
            Update(weeklyPlan);
        }
        private void PopulateModel(WeeklyPlan model, IDictionary values)
        {
            string BAR_CODE  = nameof(WeeklyPlan.BarCode);
            string ITEM_CODE = nameof(WeeklyPlan.ItemCode);

            string QTY_ORDER   = nameof(WeeklyPlan.QtyOrder);
            string SERIES_LOT  = nameof(WeeklyPlan.SeriesLot);
            string WSTATUS     = nameof(WeeklyPlan.WStatus);
            string CREATE_DATE = nameof(WeeklyPlan.CreateDate);
            string UPDATE_DATE = nameof(WeeklyPlan.UpdateDate);
            string CREATE_BY   = nameof(WeeklyPlan.CreateBy);
            string UPDATE_BY   = nameof(WeeklyPlan.UpdateBy);

            if (values.Contains(BAR_CODE))
            {
                model.BarCode = Convert.ToString(values[BAR_CODE]);
            }

            if (values.Contains(ITEM_CODE))
            {
                model.ItemCode = Convert.ToString(values[ITEM_CODE]);
            }

            if (values.Contains(QTY_ORDER))
            {
                model.QtyOrder = Convert.ToInt32(values[QTY_ORDER]);
            }

            if (values.Contains(SERIES_LOT))
            {
                model.SeriesLot = Convert.ToString(values[SERIES_LOT]);
            }

            if (values.Contains(WSTATUS))
            {
                model.WStatus = Convert.ToString(values[WSTATUS]);
            }

            if (values.Contains(CREATE_DATE))
            {
                model.CreateDate = Convert.ToDateTime(values[CREATE_DATE]);
            }

            if (values.Contains(UPDATE_DATE))
            {
                model.UpdateDate = Convert.ToDateTime(values[UPDATE_DATE]);
            }

            if (values.Contains(CREATE_BY))
            {
                model.CreateBy = Convert.ToString(values[CREATE_BY]);
            }

            if (values.Contains(UPDATE_BY))
            {
                model.UpdateBy = Convert.ToString(values[UPDATE_BY]);
            }
        }
예제 #3
0
 public IActionResult Create(WeeklyPlan model)
 {
     if (ModelState.IsValid)
     {
         weeklyPlanService.Add(model);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
예제 #4
0
 public ActionResult Edit(WeeklyPlan model)
 {
     if (ModelState.IsValid)
     {
         weeklyPlanService.Update(model);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View());
     }
 }
예제 #5
0
        public ActionResult Delete(WeeklyPlan model)
        {
            try
            {
                weeklyPlanService.Remove(model.ID);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        public IActionResult Post(string values)
        {
            var model   = new WeeklyPlan();
            var _values = JsonConvert.DeserializeObject <IDictionary>(values);

            PopulateModel(model, _values);

            if (!TryValidateModel(model))
            {
                return(BadRequest(GetFullErrorMessage(ModelState)));
            }

            var result = _context.WeeklyPlan.Add(model);

            _context.SaveChanges();

            return(Json(result.Entity.BarCode));
        }
예제 #7
0
    public void HideByDefaultStudyMaterials()
    {
        if (BoxFilled != null)
        {
            BoxFilled.SetActive(false);
        }
        if (YellowPaper != null)
        {
            YellowPaper.SetActive(false);
        }
        if (BluePaper != null)
        {
            BluePaper.SetActive(false);
        }
        if (WorkSheet != null)
        {
            WorkSheet.SetActive(false);
        }
        if (NoteBook != null)
        {
            NoteBook.SetActive(false);
        }
        if (Tablet != null)
        {
            Tablet.SetActive(false);
        }
        if (Book != null)
        {
            Book.SetActive(false);
        }
        if (OpenBook != null)
        {
            OpenBook.SetActive(false);
        }
        if (PencilBox != null)
        {
            PencilBox.SetActive(false);
        }
        if (Pencil != null)
        {
            Pencil.SetActive(false);
        }
        if (Pen != null)
        {
            Pen.SetActive(false);
        }
        if (LunchBox != null)
        {
            LunchBox.SetActive(false);
        }
        if (MilkBottle != null)
        {
            MilkBottle.SetActive(false);
        }
        if (Bag != null)
        {
            Bag.SetActive(false);
        }
        if (Ruler != null)
        {
            Ruler.SetActive(false);
        }
        if (Eraser != null)
        {
            Eraser.SetActive(false);
        }
        if (Glue != null)
        {
            Glue.SetActive(false);
        }
        if (Scissor != null)
        {
            Scissor.SetActive(false);
        }
        if (RippedPaper != null)
        {
            RippedPaper.SetActive(false);
        }
        if (Apple != null)
        {
            Apple.SetActive(false);
        }

        if (WeeklyPlan != null)
        {
            WeeklyPlan.SetActive(false);
        }
    }
예제 #8
0
    public void SetStudyMaterialVisiblity(StudyMaterial studyMaterial, bool visibleOrNot)
    {
        switch (studyMaterial)
        {
        case StudyMaterial.BoxFilled:
            BoxFilled.SetActive(visibleOrNot);
            break;

        case StudyMaterial.YellowPaper:
            YellowPaper.SetActive(visibleOrNot);
            break;

        case StudyMaterial.BluePaper:
            BluePaper.SetActive(visibleOrNot);
            break;

        case StudyMaterial.WorkSheet:
            WorkSheet.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Book:
            Book.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Tablet:
            Tablet.SetActive(visibleOrNot);
            break;

        case StudyMaterial.NoteBook:
            NoteBook.SetActive(visibleOrNot);
            break;

        case StudyMaterial.OpenBook:
            OpenBook.SetActive(visibleOrNot);
            break;

        case StudyMaterial.PencilBox:
            PencilBox.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Pencil:
            Pencil.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Pen:
            Pen.SetActive(visibleOrNot);
            break;

        case StudyMaterial.LunchBox:
            LunchBox.SetActive(visibleOrNot);
            break;

        case StudyMaterial.MilkBottle:
            MilkBottle.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Bag:
            Bag.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Ruler:
            Ruler.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Eraser:
            Eraser.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Glue:
            Glue.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Scissor:
            Scissor.SetActive(visibleOrNot);
            break;

        case StudyMaterial.RippedPaper:
            RippedPaper.SetActive(visibleOrNot);
            break;

        case StudyMaterial.Apple:
            Apple.SetActive(visibleOrNot);
            break;

        case StudyMaterial.WeeklyPlan:
            WeeklyPlan.SetActive(visibleOrNot);
            break;

        default:
            BluePaper.SetActive(visibleOrNot);
            break;
        }
    }
예제 #9
0
        public ActionResult Edit(Guid id)
        {
            WeeklyPlan weeklyPlan = weeklyPlanService.GetById(id);

            return(View(weeklyPlan));
        }
 public void Update(WeeklyPlan weeklyPlan)
 {
     context.Entry(weeklyPlan).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     context.SaveChanges();
 }
 public void Add(WeeklyPlan weeklyPlan)
 {
     context.WeeklyPlans.Add(weeklyPlan);
     context.SaveChanges();
 }
 public static WeeklyPlan CreateWeeklyPlan(int weeklyPlanID)
 {
     WeeklyPlan weeklyPlan = new WeeklyPlan();
     weeklyPlan.WeeklyPlanID = weeklyPlanID;
     return weeklyPlan;
 }
 public void AddToWeeklyPlan(WeeklyPlan weeklyPlan)
 {
     base.AddObject("WeeklyPlan", weeklyPlan);
 }