private DoBase Update()
        {
            object ChangedValues    = null;
            bool   HasChangedRecord = false;

            ChangedValues = GetChangedValues(idoBase, ref HasChangedRecord);
            if (HasChangedRecord == true)
            {
                SqlResult sqlResult  = BlQuery.GetUpdateQuery(idoBase, ChangedValues);
                int       updatedRow = DataAccess.Execute(sqlResult);
                if (updatedRow > 0)
                {
                    idoBase.State           = ObjState.Updated;
                    idoBase.OldValues       = ConstructOldValues(idoBase);
                    idoBase.InfoMsg.Message = "Data Updated Successfully.";
                }
            }
            else
            {
                idoBase.State           = ObjState.NoChanges;
                idoBase.InfoMsg.Message = "No Changes Made To Data.";
            }

            return(null);
        }
        private DoBase Insert()
        {
            SqlResult sqlResult = BlQuery.GetInsertQuery(idoBase);
            object    Id        = DataAccess.ExecuteScalar(sqlResult);

            idoBase.SetPrimaryValue(Id);
            idoBase.State           = ObjState.Inserted;
            idoBase.OldValues       = ConstructOldValues(idoBase);
            idoBase.InfoMsg.Message = "New Data Saved Successfully.";
            return(idoBase);
        }
        private void SaveAudit(string OldRecord, string NewRecord, string Action, string UserId)
        {
            Audit lAudit = new Audit();

            lAudit.Action       = Action;
            lAudit.OldRecord    = OldRecord;
            lAudit.NewRecord    = NewRecord;
            lAudit.CreatedBy    = UserId;
            lAudit.ModifiedBy   = UserId;
            lAudit.CreatedDate  = DateTime.Now;
            lAudit.ModifiedDate = DateTime.Now;
            SqlResult sqlResult = BlQuery.GetInsertQuery(lAudit);
            object    Id        = DataAccess.ExecuteScalar(sqlResult);
        }
        public DoBase Open()
        {
            SqlResult sqlResult = BlQuery.GetOpenQuery(idoBase);

            idoBase = DataAccess.QueryFirstOrDefault(sqlResult);
            if (idoBase != null)
            {
                idoBase.State   = ObjState.Selected;
                idoBase.InfoMsg = new InfoMessage {
                    Message = "Data selected & Opened Successfully."
                };
            }
            return(idoBase);
        }
        public DoBase Delete()
        {
            SqlResult sqlResult  = BlQuery.GetDeleteQuery(idoBase);
            int       DeletedRow = DataAccess.Execute(sqlResult);

            if (DeletedRow > 0)
            {
                idoBase.State   = ObjState.Deleted;
                idoBase.InfoMsg = new InfoMessage {
                    Message = "Data Deleted Successfully."
                };
            }
            return(idoBase);
        }