protected override void Init()
        {
            Products     = new List <TrainingProduct>();
            SearchEntity = new TrainingProduct();
            Entity       = new TrainingProduct();

            base.Init();
        }
        public bool Insert(TrainingProduct entity)
        {
            bool ret = false;

            ret = Validate(entity);
            if (ret)
            {
                //will add insert code
            }
            return(ret);
        }
        public bool Update(TrainingProduct entity)
        {
            bool ret = false;

            ret = Validate(entity);

            if (ret)
            {
                //need  create update code here
            }
            return(ret);
        }
        public TrainingProduct Get(int productId)
        {
            List <TrainingProduct> list = new List <TrainingProduct>();
            TrainingProduct        ret  = new TrainingProduct();

            //need to call data access method here
            list = CreateMockData();

            ret = list.Find(p => p.ProductId == productId);

            return(ret);
        }
 public bool Validate(TrainingProduct entity)
 {
     ValidationErrors.Clear();
     if (!string.IsNullOrEmpty(entity.ProductName))
     {
         if (entity.ProductName.ToLower() == entity.ProductName)
         {
             ValidationErrors.Add(new KeyValuePair <string, string>("ProductName", "Product Name must not be all lower case."));
         }
     }
     return(ValidationErrors.Count == 0);
 }
        protected override void Add()
        {
            IsValid = true;

            Entity = new TrainingProduct();
            Entity.IntroductionDate = DateTimeOffset.Now;
            Entity.Url   = "http://";
            Entity.Price = 0;

            //AddMode();
            base.Add();
        }
        protected override void Delete()
        {
            TrainingProductManager mgr = new TrainingProductManager();

            Entity           = new TrainingProduct();
            Entity.ProductId = Convert.ToInt32(EventArgument);

            mgr.Delete(Entity);
            Get();
            //ListMode();
            base.Delete();
        }
        public List <TrainingProduct> Get(TrainingProduct entity)
        {
            List <TrainingProduct> ret = new List <TrainingProduct>();

            ret = CreateMockData();

            if (!string.IsNullOrEmpty(entity.ProductName))
            {
                ret = ret.FindAll(p => p.ProductName.ToLower().StartsWith(entity.ProductName, StringComparison.CurrentCultureIgnoreCase));
            }

            return(ret);
        }
 public bool Delete(TrainingProduct entity)
 {
     //Delete code here
     return(true);
 }
        protected override void ResetSearch()
        {
            SearchEntity = new TrainingProduct();

            base.ResetSearch();
        }