Exemple #1
0
        //public ReturnInfo Create(SmartDB dbInstance, ref Model.User info)
        //{
        //    IInfo info2 = _dal.Insert(dbInstance, info);
        //    info.IsNew = false;
        //    info.IsDirty = true;
        //    return new ReturnInfo(info2.Code, info2.Message);
        //}
        //public ReturnInfo Update(SmartDB dbInstance, Model.User info)
        //{
        //    IInfo info2 = _dal.GetRecord(dbInstance, info.Id);
        //    bool flag = info2.Code == ErrorEnum.NoError;
        //    ReturnInfo result;
        //    if (flag)
        //    {
        //        bool flag2 = (info2.BizObject as Model.User).LockCount == info.LockCount;
        //        if (!flag2)
        //        {
        //            result = new ReturnInfo(ErrorEnum.ColumnReference, "Record has been changed.");
        //            return result;
        //        }
        //        info.LockCount++;
        //        info2 = _dal.Update(dbInstance, info);
        //    }
        //    result = new ReturnInfo(info2.Code, info2.Message, info2.RowsAffected);
        //    return result;
        //}
        //public ReturnInfo Delete(SmartDB dbInstance, string Id)
        //{
        //    bool flag = Id == null;
        //    ReturnInfo result;
        //    if (flag)
        //    {
        //        result = new ReturnInfo(ErrorEnum.InvalidInput, "Invalid input. ID not found.");
        //    }
        //    else
        //    {
        //        IInfo info = _dal.Delete(dbInstance, Id);
        //        result = new ReturnInfo(info.Code, info.Message, info.RowsAffected);
        //    }
        //    return result;
        //}
        public ReturnInfo GetUserById(SmartDB dbInstance, int Id)
        {
            IInfo record = _dal.GetRecord(dbInstance, Id);

            return(new ReturnInfo
            {
                BizObject = ((record.Code == ErrorEnum.NoError) ? record.BizObject : null),
                Code = record.Code,
                Message = record.Message,
                RowsAffected = record.RowsAffected
            });
        }