예제 #1
0
        public void addNewPlan(PlanModel plan)
        {
            if (plan.component_id < 1)
            {
                throw new Exception("Please select component");
            }
            if (String.IsNullOrEmpty(plan.model_name) || String.IsNullOrWhiteSpace(plan.model_name))
            {
                throw new Exception("Plan model cannot leave empty");
            }
            if (plan.plan_data < 0)
            {
                throw new Exception("Plan data must greater than 0");
            }
            if (plan.plan_line < 0)
            {
                throw new Exception("Plan line must greater than 0");
            }
            decimal model_id = BomModelModelDAO.getInstance().getIdByName(plan.model_name);

            plan.model_id = model_id;
            if (PlanDao.getInstance().isExist(plan))
            {
                throw new Exception("Plan existed");
            }
            PlanDao.getInstance().add(plan);
        }
예제 #2
0
 public void deletePlan(PlanModel plan)
 {
     if (plan.plan_id < 1)
     {
         throw new Exception("Please select a plan first");
     }
     PlanDao.getInstance().delete(plan);
 }