Esempio n. 1
0
        public override bool Load(int id)
        {
            //Get the entity object from the DAL.
            ENTWFItem eNTWFItem = new ENTWFItemData().Select(id);

            if (eNTWFItem != null)
            {
                MapEntityToProperties(eNTWFItem);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool LoadByItemId(int entWorkflowId, int itemId)
        {
            //Get the entity object from the DAL.
            ENTWFItem eNTWFItem = new ENTWFItemData().SelectByItemId(entWorkflowId, itemId);

            if (eNTWFItem != null)
            {
                MapEntityToProperties(eNTWFItem);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        public override bool Save(HRPaidTimeOffDataContext db, ref ENTValidationErrors validationErrors, int userAccountId)
        {
            if (DBAction == DBActionEnum.Save)
            {
                //Validate the object
                Validate(db, ref validationErrors);

                //Check if there were any validation errors
                if (validationErrors.Count == 0)
                {
                    if (IsNewRecord())
                    {
                        //Add
                        ID = new ENTWFItemData().Insert(db, ENTWorkflowId, ItemId, SubmitterENTUserAccountId, CurrentWFStateId, userAccountId);
                    }
                    else
                    {
                        //Update
                        if (!new ENTWFItemData().Update(db, ID, ENTWorkflowId, ItemId, SubmitterENTUserAccountId, CurrentWFStateId, userAccountId, Version))
                        {
                            UpdateFailed(ref validationErrors);
                            return(false);
                        }
                    }

                    return(true);
                }
                else
                {
                    //Didn't pass validation.
                    return(false);
                }
            }
            else
            {
                throw new Exception("DBAction not Save.");
            }
        }