Esempio n. 1
0
        public bool LoadByObjectName(string objectName)
        {
            ENTWorkflow eNTWorkflow = new ENTWorkflowData().SelectByObjectName(objectName);

            MapEntityToProperties(eNTWorkflow);
            return(eNTWorkflow != null);
        }
Esempio n. 2
0
        public override bool Load(int id)
        {
            //Get the entity object from the DAL.
            ENTWorkflow eNTWorkflow = new ENTWorkflowData().Select(id);

            MapEntityToProperties(eNTWorkflow);
            return(true);
        }
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 ENTWorkflowData().Insert(db, WorkflowName, ENTWorkflowObjectName, userAccountId);
                    }
                    else
                    {
                        //Update
                        if (!new ENTWorkflowData().Update(db, ID, WorkflowName, ENTWorkflowObjectName, userAccountId, Version))
                        {
                            UpdateFailed(ref validationErrors);
                            return(false);
                        }
                    }

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