public ProposalItemViewModel()
 {
     Items        = new List <ProposalItem>();
     SearchEntity = new ProposalItem();
     Entity       = new ProposalItem();
     Init();
 }
        public bool Update(ProposalItem entity)
        {
            bool ret = false;

            ret = Validate(entity);
            if (ret)
            {
                //todo Create UPDATE code here
            }
            return(ret);
        }
        public bool Insert(ProposalItem entity)
        {
            bool ret = false;

            ret = Validate(entity);
            if (ret)
            {
                //todo Create Insert Code Here
            }
            return(ret);
        }
        public ProposalItem Get(int proposalId)
        {
            List <ProposalItem> list = new List <ProposalItem>();
            ProposalItem        ret  = new ProposalItem();

            //todo call your data access method here
            list = CreateMockData();

            ret = list.Find(p => p.Id == proposalId);

            return(ret);
        }
 public bool Validate(ProposalItem entity)
 {
     ValidationErrors.Clear();
     if (!string.IsNullOrEmpty(entity.ProjectName))
     {
         if (entity.ProjectName.ToLower() == entity.ProjectName)
         {
             ValidationErrors.Add(new KeyValuePair <string, string>("ProductName", "Product Name must not be all lower case."));
         }
     }
     return(ValidationErrors.Count == 0);
 }
        private void Delete()
        {
            ProposalItemManager mgr = new ProposalItemManager();

            Entity    = new ProposalItem();
            Entity.Id = Convert.ToInt32(EventArgument);

            mgr.Delete(Entity);

            Get();

            ListMode();
        }
        public List <ProposalItem> Get(ProposalItem entity)
        {
            List <ProposalItem> ret = new List <ProposalItem>();

            //TODO Add data access method Here

            ret = CreateMockData();

            if (!string.IsNullOrEmpty(entity.ProjectName))
            {
                ret = ret.FindAll(p => p.ProjectName.ToLower().StartsWith(entity.ProjectName));
            }

            return(ret);
        }
        private void Add()
        {
            DateTime sub = DateTime.Now.Date;
            DateTime exp = sub.AddMonths(1).Date;

            IsValid = true;

            Entity = new ProposalItem
            {
                ProjectName    = Entity.ProjectName,
                SubmitDateTime = sub.ToString("MM/dd/yyyy"),
                ExpDateTime    = exp.ToString("MM/dd/yyyy"),
                Cost           = 0.00.ToString("C"),
                Description    = Entity.Description,
                Id             = Entity.Id
            };

            AddMode();
        }
 private void ResetSearch()
 {
     SearchEntity = new ProposalItem();
 }
示例#10
0
        public bool Delete(ProposalItem entity)
        {
            //todo Create DELETE code here

            return(true);
        }