コード例 #1
0
        /// <summary>
        /// Get the details using a query based fetcher.
        /// </summary>
        /// <param name="queryFetcher"></param>
        /// <returns></returns>
        public virtual EntityActionResult Details(Func <IQuery <T> > queryFetcher)
        {
            var svc   = EntityRegistration.GetService <T>();
            var query = queryFetcher();

            return(Details(() => svc.Repository.First(query)));
        }
コード例 #2
0
        /// <summary>
        /// Delete the item represented by the id.
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public EntityActionResult Delete(int id)
        {
            if (!HasAccessTo("Delete"))
            {
                return(new EntityActionResult(success: false, message: "Not authorized to perform this action", isAuthorized: false));
            }

            var svc    = EntityRegistration.GetService <T>();
            var entity = svc.Get(id);

            // Check item is there.
            if (entity == null)
            {
                return(new EntityActionResult(success: false, message: "Entity has been deleted."));
            }

            // Check security.
            if (!entity.IsOwnerOrAdmin())
            {
                return(new EntityActionResult(success: false, message: "Not authorized to perform this action", item: entity, isAuthorized: false));
            }

            // Issues deleting?
            svc.Delete(entity);
            if (entity.Errors.HasAny)
            {
                return(new EntityActionResult(false, "Unable to delete item.", errors: entity.Errors, item: entity));
            }

            return(new EntityActionResult(true, "Item has been deleted.", item: entity));
        }
コード例 #3
0
        /// <summary>
        /// Delete the item represented by the id.
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public EntityActionResult Copy(int id)
        {
            if (!HasAccessTo("Create"))
            {
                return(new EntityActionResult(success: false, message: "Not authorized to perform this action", isAuthorized: false));
            }

            var svc    = EntityRegistration.GetService <T>();
            var entity = svc.Get(id);

            // Check item is there.
            if (entity == null)
            {
                return(new EntityActionResult(success: false, message: "Entity has been deleted."));
            }

            // Check security.
            if (!entity.IsOwnerOrAdmin())
            {
                return(new EntityActionResult(success: false, message: "Not authorized to perform this action", isAuthorized: false));
            }

            // Reset the id so it's not marked as persistant.
            entity.ToNewCopy();
            return(new EntityActionResult(true, string.Empty, null, entity));
        }
コード例 #4
0
        /// <summary>
        /// Turns an entity on or off.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public EntityActionResult OnOff(int id)
        {
            var result = Edit(id);

            if (!result.Success)
            {
                return(result);
            }

            T test = new T();

            if (!(test is IEntityActivatable))
            {
                return(new EntityActionResult(false, "This model is not activatable", isAuthorized: true, isAvailable: true));
            }

            T   entity = (T)result.Item;
            var onoff  = entity as IEntityActivatable;

            onoff.IsActive = !onoff.IsActive;
            var svc = EntityRegistration.GetService <T>();

            svc.Update(entity);

            // Check again.
            if (entity.Errors.HasAny)
            {
                return(new EntityActionResult(false, "Unable to activate/deactivate item.", errors: entity.Errors, item: entity));
            }

            var message = onoff.IsActive ? "Activated" : "Deactivated";

            return(new EntityActionResult(true, "Item has been " + message));
        }
コード例 #5
0
        /// <summary>
        /// Turns an entity on or off.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public EntityActionResult Clone(int id)
        {
            var result = Copy(id);

            if (!result.Success)
            {
                return(result);
            }

            T test = new T();

            if (!(test is IEntityClonable))
            {
                return(new EntityActionResult(false, "This model is not cloneable", isAuthorized: true, isAvailable: true));
            }

            T   entity = (T)result.Item;
            var svc    = EntityRegistration.GetService <T>();

            svc.Create(entity);

            // Check again.
            if (entity.Errors.HasAny)
            {
                return(new EntityActionResult(false, "Unable to clone item.", errors: entity.Errors, item: entity));
            }

            return(new EntityActionResult(true, "Item has been cloned."));
        }
コード例 #6
0
        /// <summary>
        /// Delete the item represented by the id.
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public EntityActionResult Create(T entity, Action <T> onBeforeUpdateCallback = null)
        {
            // Check item is there.
            if (entity == null)
            {
                return(new EntityActionResult(success: false, message: "Item not supplied."));
            }

            if (!HasAccessTo("Create"))
            {
                return(new EntityActionResult(success: false, message: "Not authorized to perform this action", isAuthorized: false));
            }

            if (onBeforeUpdateCallback != null)
            {
                onBeforeUpdateCallback(entity);
            }

            if (entity.Errors.HasAny)
            {
                return(new EntityActionResult(false, "Unable to create item", errors: entity.Errors, item: entity));
            }

            var svc = EntityRegistration.GetService <T>();

            svc.Create(entity);

            if (entity.Errors.HasAny)
            {
                return(new EntityActionResult(false, "Unable to create item", errors: entity.Errors, item: entity));
            }

            return(new EntityActionResult(true, string.Empty, null, entity));
        }
コード例 #7
0
        public int GetRegister(EntityRegistration ent)
        {
            int           lintcnt    = 0;
            List <string> lstspNames = new List <string>();
            List <List <SqlParameter> > lstParamVals = new List <List <SqlParameter> >();
            List <SqlParameter>         lstParam;

            try
            {
                lstParam = new List <SqlParameter>();
                Commons.ADDParameter(ref lstParam, "@UserName", DbType.String, ent.UserName);
                Commons.ADDParameter(ref lstParam, "@ConfirmPass", DbType.String, ent.ConfirmPassword);
                Commons.ADDParameter(ref lstParam, "@UserType", DbType.String, ent.UserType);
                lstspNames.Add("sp_InsertPassInLoginTable");
                lstParamVals.Add(lstParam);

                lstParam = new List <SqlParameter>();
                Commons.ADDParameter(ref lstParam, "@UserCode", DbType.String, ent.UserName);
                Commons.ADDParameter(ref lstParam, "@ConfirmPass", DbType.String, ent.ConfirmPassword);
                Commons.ADDParameter(ref lstParam, "@UserType", DbType.String, ent.UserType);
                lstspNames.Add("sp_UpdatePassInEmpMaster");
                lstParamVals.Add(lstParam);

                lintcnt = mobjDataAccess.ExecuteTransaction(lstspNames, lstParamVals);
            }
            catch (Exception ex)
            {
                Commons.FileLog("RegistrationBLL - GetRegister(EntityRegistration ent)", ex);
            }

            return(lintcnt);
        }
コード例 #8
0
        /// <summary>
        /// Delete all entries based on the level.
        /// </summary>
        /// <param name="level"></param>
        public static void Delete(LogLevel level)
        {
            var logService = EntityRegistration.GetService <LogEventEntity>();

            logService.Repository.Delete(Query <LogEventEntity> .New().Where(l => l.LogLevel).Is((int)level));
            //entity => entity.LogLevel == level);
        }
コード例 #9
0
        /// <summary>
        /// Import items into the entity repository.
        /// </summary>
        /// <param name="items"></param>
        /// <returns></returns>
        public override BoolErrorsItem <IList <T> > Import(IList <T> items)
        {
            // Check for overriden handler.
            if (_importHandler != null)
            {
                return(base.Import(items));
            }

            // Get the service for the enitity of type T.
            IEntityService <T> service = EntityRegistration.GetService <T>();

            service.Create(items);
            bool success = true;
            IValidationResults errors = new ValidationResults();
            int ndx = 1;

            foreach (T item in items)
            {
                IEntity entity = item as IEntity;
                if (entity.Errors.HasAny)
                {
                    success = false;
                    // Now copy over the errors w/ context information( e.g. 1st entity imported ).
                    errors.Add("Item # [" + ndx + "] : ");
                    entity.Errors.EachFull(err => errors.Add(err));
                }
                ndx++;
            }
            string fullError = errors.Message();

            return(new BoolErrorsItem <IList <T> >(items, success, fullError, errors));
        }
コード例 #10
0
        /// <summary>
        /// Gets the by tags.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <returns></returns>
        public static IList <T> GetByTags <T>(string tag, Func <int[], IQuery <T> > queryBuilder)
        {
            int groupId = ModuleMap.Instance.GetId(typeof(T));

            // This is an NON-Optimized query done in 2 steps.
            // This is just to have compatibility between both the in-memory repository and real database.
            // Step 1: Get all the tags to get the refid's
            IList <Tag> tags = Tag.Find(Query <Tag> .New().Where(t => t.GroupId).Is(groupId).And(t => t.Name).Is(tag));

            // Check if tags available.
            if (tags == null || tags.Count == 0)
            {
                return(new List <T>());
            }

            var ids = from t in tags select t.RefId;

            int[] idsarray = ids.ToArray();

            // Check for empty ids.
            if (idsarray == null || idsarray.Length == 0)
            {
                return(new List <T>());
            }

            // Step 2:  Now get blogposts.
            var       service = EntityRegistration.GetService <T>();
            var       query   = queryBuilder(idsarray);
            IList <T> items   = service.Find(query);

            return(items);
        }
コード例 #11
0
        /// <summary>
        /// Finds Items by owner if non-admin is logged in otherwise, all items if admin.
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public EntityActionResult Find(int page, int pageSize, IQuery <T> query)
        {
            var svc     = EntityRegistration.GetService <T>();
            var results = svc.Find(query, page, pageSize);

            return(new EntityActionResult(true, string.Empty, null, results));
        }
コード例 #12
0
        /// <summary>
        /// Run the application.
        /// </summary>
        public override BoolMessageItem Execute()
        {
            Console.WriteLine("====================================================");
            Console.WriteLine("Entity ");

            // Example 1 : Using Entity base class.
            IEntity entity = new Person()
            {
                Name = "kishore"
            };

            Console.WriteLine("Id, Persistant and Audit fields.");
            Console.WriteLine("These fields are set by EntityService if using CommonLibrary Entity-Model Services.");
            Console.WriteLine("Id            ", entity.Id);
            Console.WriteLine("IsPersistant  ", entity.IsPersistant());
            Console.WriteLine("CreateDate    ", entity.CreateDate);
            Console.WriteLine("CreateUser    ", entity.CreateUser);
            Console.WriteLine("UpdateDate    ", entity.UpdateDate);
            Console.WriteLine("UpdateUser    ", entity.UpdateUser);
            Console.WriteLine("UpdateComment ", entity.UpdateComment);

            // Example 2 : Using Entity<T> generic base class to get the parameterless CRUD methods.
            // 1st initialize the repositories.
            EntityRegistration.Register <Person2>(new RepositoryInMemory <Person2>("Id"), false);
            var p2 = new Person2()
            {
                Name = "kishore"
            };

            p2.Create();
            p2.Name = "updated";
            p2.Update();
            p2.GetAll();
            p2.Save();
            p2.Delete();

            // Example 3 : Implement IEntityVersionable to get versioning on the entities.
            // Wrap the real repository w/ the RepositoryVersionable decorator to get versioning behaviour.
            EntityRegistration.Register <Person3>(new RepositoryVersioned <Person3>(new RepositoryInMemory <Person3>("Id,Version,VersionRefId")), false);
            var p3 = new Person3();

            p3.Create();
            p3.Name = "updated";
            p3.Update();
            p3.GetAll();

            var p4 = new Person4();

            p4.Name         = "kishore";
            p4.Phone        = "111-111-1111";
            p4.RegisterDate = DateTime.Today;
            p4.About        = "artist";
            p4.Age          = 30;
            p4.Email        = "*****@*****.**";
            bool isValid = p4.IsValid;

            return(BoolMessageItem.True);
        }
コード例 #13
0
 /// <summary>
 /// Delete the item represented by the id.
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public EntityActionResult Edit(int id)
 {
     return(Edit(() =>
     {
         var svc = EntityRegistration.GetService <T>();
         var entity = svc.Get(id);
         return entity;
     }));
 }
コード例 #14
0
        /// <summary>
        /// Find paged items by using the query, current page, and items per page.
        /// </summary>
        /// <param name="query">The query used to get recent items.</param>
        /// <param name="page">The page of data to get.</param>
        /// <param name="pageSize">The number of items per page to get.</param>
        /// <returns></returns>
        public virtual T FindByUrl(string url)
        {
            string strId   = url.Substring(url.LastIndexOf("-") + 1);
            int    id      = Convert.ToInt32(strId);
            var    service = EntityRegistration.GetService <T>();
            T      entity  = service.Get(id);

            return(entity);
        }
コード例 #15
0
        /// <summary>
        /// Delete the photo.
        /// </summary>
        /// <param name="profile"></param>
        public static void DeletePhoto(this Profile profile)
        {
            var svc      = EntityRegistration.GetService <Profile>();
            var mservice = EntityRegistration.GetService <ComLib.Web.Modules.Media.MediaFile>();

            mservice.Delete(profile.ImageRefId);
            profile.ImageRefId = 0;
            profile.ImageUrl   = string.Empty;
            profile.Save();
        }
コード例 #16
0
        /// <summary>
        /// Gets the total count of the items that can be exported.
        /// </summary>
        /// <returns></returns>
        public override int TotalExportable()
        {
            // Check for overriden handler.
            if (_totalHandler != null)
            {
                return(_totalHandler());
            }

            IRepository <T> repo = EntityRegistration.GetRepository <T>();

            return(repo.Count());
        }
コード例 #17
0
        /// <summary>
        /// Exports items in a batch/page.
        /// </summary>
        /// <returns></returns>
        public override BoolMessageItem <IList <T> > Export(int page, int pageSize)
        {
            // Check for overriden handler.
            if (_exportPageHandler != null)
            {
                return(base.Export(page, pageSize));
            }

            IEntityService <T> service = EntityRegistration.GetService <T>();
            IList <T>          items   = service.Get(1, pageSize);

            return(new BoolMessageItem <IList <T> >(items, true, string.Empty));
        }
コード例 #18
0
        /// <summary>
        /// Delete log entries before the specified date.
        /// </summary>
        /// <param name="date"></param>
        /// /// <returns></returns>
        public static void Delete(DateTime date, bool beforeDate)
        {
            IRepository <LogEventEntity> repo = EntityRegistration.GetRepository <LogEventEntity>();

            if (beforeDate)
            {
                repo.Delete(entity => entity.CreateDate < date);
            }
            else
            {
                repo.Delete(entity => entity.CreateDate > date);
            }
        }
コード例 #19
0
        /// <summary>
        /// Delete the item represented by the id.
        /// </summary>
        /// <param name="entity">The entity to update.</param>
        /// <param name="onBeforeUpdateCallback">Callback with the updated and original entity respectively.</param>
        /// <returns></returns>
        public EntityActionResult Edit(T entity, Action <T> onBeforeUpdateCallback = null)
        {
            // Check item is there.
            if (entity == null)
            {
                return(new EntityActionResult(success: false, message: "Item not supplied.", item: entity));
            }

            if (!HasAccessTo("Edit"))
            {
                return(new EntityActionResult(success: false, message: "Not authorized to perform this action", isAuthorized: false));
            }

            // Prevent override of audit fields.
            var svc  = EntityRegistration.GetService <T>();
            var orig = svc.Get(entity.Id);

            // apply back any audit fields from original.
            entity.DoUpdateModel <T>(orig);

            // Check security.
            if (!entity.IsOwnerOrAdmin())
            {
                return(new EntityActionResult(success: false, message: "Not authorized to perform this action", item: entity, isAuthorized: false));
            }

            if (onBeforeUpdateCallback != null)
            {
                onBeforeUpdateCallback(orig);
                if (entity.Errors.HasAny)
                {
                    return(new EntityActionResult(false, "Unable to edit item.", errors: entity.Errors, item: entity));
                }
            }

            // Callback may have done some actions.
            if (entity.Errors.HasAny)
            {
                return(new EntityActionResult(false, "Unable to edit item.", errors: entity.Errors, item: entity));
            }

            svc.Update(entity);

            // Check again.
            if (entity.Errors.HasAny)
            {
                return(new EntityActionResult(false, "Unable to edit item.", errors: entity.Errors, item: entity));
            }

            return(new EntityActionResult(true, string.Empty, null, entity));
        }
コード例 #20
0
        /// <summary>
        /// Save the orderings.
        /// </summary>
        /// <param name="orderings"></param>
        /// <returns></returns>
        public virtual BoolMessage SaveOrdering(string orderings)
        {
            if (!HasAccessTo("Edit"))
            {
                return(new BoolMessage(false, "Not authorized to perform this action"));
            }

            T test = new T();

            if (!(test is IEntitySortable))
            {
                return(new BoolMessage(false, "This model is not sortable"));
            }


            List <int> ids   = new List <int>();
            List <int> sorts = new List <int>();

            string[] entries = orderings.Split(',');

            // Each ordering id, sortindex
            foreach (string ordering in entries)
            {
                string[] props = ordering.Split(':');

                // Get id and sortindex.
                if (props != null && props.Length > 0 && !string.IsNullOrEmpty(props[0]))
                {
                    // Get the id, zone and sort index.
                    int id        = System.Convert.ToInt32(props[0]);
                    int sortIndex = System.Convert.ToInt32(props[1]);
                    ids.Add(id);
                    sorts.Add(sortIndex);
                }
            }
            var idArr = ids.ToArray();
            var svc   = EntityRegistration.GetService <T>();

            // Get only the items w/ matching ids.
            var items = svc.Repository.ToLookUp(Query <T> .New().Where(i => i.Id).In <int>(idArr));

            // Now save the new sortindex.
            for (int ndx = 0; ndx < ids.Count; ndx++)
            {
                T item = items[ids[ndx]];
                ((IEntitySortable)item).SortIndex = sorts[ndx];
                svc.Update(item);
            }

            return(new BoolMessage(true, "Order of items has been saved."));
        }
コード例 #21
0
        private BoolMessageItem <IList <T> > InternalImport(ImportExportActionContext <T> ctx)
        {
            IEntityService <T> service       = EntityRegistration.GetService <T>();
            IActionContext     actionContext = EntityRegistration.GetContext(typeof(T).FullName);

            actionContext.Errors               = ctx.Errors;
            actionContext.Messages             = ctx.Messages;
            actionContext.CombineMessageErrors = false;
            actionContext.Items = ctx.ItemList;
            actionContext.Args["isImporting"] = true;
            BoolMessage createResult = service.Create(actionContext);

            return(new BoolMessageItem <IList <T> >(ctx.ItemList, createResult.Success, createResult.Message));
        }
コード例 #22
0
        public void CanNotCloneOtherUsersItem()
        {
            var helper = new EntityHelper <Link>();

            Auth.Init(new AuthWin("Admin", new UserPrincipal(1, "johndoe", "User", "Custom", true)));

            var entity = EntityRegistration.GetService <Link>().First(null);
            var result = helper.Clone(entity.Id);

            Assert.AreEqual(result.Success, false);
            Assert.IsNotNull(result.Item);
            Assert.AreEqual(result.IsAvailable, true);
            Assert.AreEqual(result.IsAuthorized, false);
        }
コード例 #23
0
        public void CanGet()
        {
            var helper = new EntityHelper <Link>();
            var link   = EntityRegistration.GetService <Link>().GetAll()[0];
            var id     = link.Id;
            var result = helper.Details(id);

            Assert.AreEqual(result.Success, true);
            Assert.IsNotNull(result.Item);
            Assert.AreEqual(result.ItemAs <Link>().Id, id);
            Assert.AreEqual(result.ItemAs <Link>().Name, link.Name);
            Assert.AreEqual(result.IsAvailable, true);
            Assert.AreEqual(result.IsAuthorized, true);
        }
コード例 #24
0
        /// <summary>
        /// Find recent items in Json based format.
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public EntityActionResult FindByAsJson(int page, int pagesize, IList <PropertyInfo> columnProps,
                                               Func <IEntityService <T>, int, int, PagedList <T> > pagedListFetcher = null, Func <int, int, EntityActionResult> actionResultFetcher = null)
        {
            PagedList <T> result     = null;
            string        message    = string.Empty;
            string        resultText = string.Empty;
            bool          success    = false;
            int           totalPages = 0;

            try
            {
                EntityActionResult entityresult = null;
                if (actionResultFetcher != null)
                {
                    entityresult = actionResultFetcher(page, pagesize);
                }
                else if (pagedListFetcher != null)
                {
                    var svc     = EntityRegistration.GetService <T>();
                    var results = pagedListFetcher(svc, page, pagesize);
                    entityresult = new EntityActionResult(results != null, string.Empty, null, results);
                }
                else
                {
                    entityresult = FindByRecent(page, pagesize);
                }
                result     = entityresult.ItemAs <PagedList <T> >();
                totalPages = result.TotalPages;

                try
                {
                    resultText = ComLib.Web.Helpers.JsonHelper.ConvertToJsonString <T>(result, columnProps);
                    success    = true;
                }
                catch (Exception ex)
                {
                    message = "Unable to convert items of : " + typeof(T).Name + " to JSON format.";
                    ComLib.Logging.Logger.Error(message, ex);
                }
            }
            catch (Exception ex)
            {
                message = "Unable to get items for : " + typeof(T).Name;
                ComLib.Logging.Logger.Error(message, ex);
                success = false;
            }
            string jsontext = EntityJsonHelper.BuildManageJsonResult <T>(success, message, result, resultText, null);

            return(new EntityActionResult(success, message, null, jsontext));
        }
コード例 #25
0
        public void CanCopy()
        {
            var helper    = CreateHelper <Link>();
            var firstItem = EntityRegistration.GetService <Link>().GetAll()[0];
            var result    = helper.Copy(firstItem.Id);

            // This is a viewmodel
            Assert.AreEqual(result.Success, true);
            Assert.AreEqual(result.Message, string.Empty);
            Assert.IsNotNull(result.Item);
            Assert.AreEqual(result.ItemAs <Link>().Id, 0);
            Assert.AreEqual(result.ItemAs <Link>().Name, firstItem.Name);
            Assert.IsTrue(result.IsAuthorized);
            Assert.IsTrue(result.IsAvailable);
        }
コード例 #26
0
        public ScaffoldController(IScaffoldingView view, NameValueCollection parameters)
        {
            _view             = view;
            _service          = new ScaffoldService();
            _service.Settings = new ScaffoldSettings();
            _params           = parameters;
            if (!_view.IsPostBack)
            {
                _view.BusinessEntities = EntityRegistration.GetManagableEntities();
            }
            _propertiesToExclude = new StringDictionary();
            _propertiesToExclude.Add("Service", "Service");
            _propertiesToExclude.Add("Validator", "Validator");

            _scaffoldUtils = new ScaffoldUtils(_params);
        }
コード例 #27
0
        public override ActionResult Edit(WidgetInstance instance)
        {
            DashboardLayout(true);
            // 1. Get the entity.
            // 2. Load its state back into it's properties.
            // 3. Clearn any errors ( used to compatibility between In-Memory repo and real )
            // 4. Update it's data using the form
            var service = EntityRegistration.GetService <WidgetInstance>();
            var entity  = service.Get(instance.Id);

            // NOTE: Since widgets extend from WidgetInstance, so there can be any properties.
            // not just the ones from WidgetInstance.
            // Custom UpdateModel support since the MVC base controller's UpdateModel doesn't handle interfaces/derived classes.
            MapperSupport.MapperWebForms.UpdateModel(entity, this.Request.Form, null, _excludeMappingProps);
            return(base.Edit(entity));
        }
コード例 #28
0
        /// <summary>
        /// Delete files associated w/ the specified entity.
        /// </summary>
        /// <param name="refId"></param>
        /// <param name="entityGroup"></param>
        public static bool DeleteFilesForEntity(int refId, string entityGroup)
        {
            int  entityGroupid = ModuleMap.Instance.GetId(entityGroup);
            var  service       = EntityRegistration.GetService <MediaFile>();
            bool result        = true;

            try
            {
                service.Repository.Delete(Query <MediaFile> .New().Where(m => m.RefGroupId).Is(entityGroupid).And(m => m.RefId).Is(refId));
            }
            catch (Exception ex)
            {
                result = false;
            }
            return(result);
        }
コード例 #29
0
        /// <summary>
        /// Get all the properties of the entity.
        /// </summary>
        /// <param name="entityName">The name of any of the supported entities that
        /// are manageable.</param>
        /// <example>Given "Category" Returns :
        /// 1. Name
        /// 2. Id
        /// 3. Description. etc.</example>
        /// <returns></returns>
        public IList <PropertyInfo> GetProperties(string entityName)
        {
            // Validate.
            if (string.IsNullOrEmpty(entityName))
            {
                return(null);
            }
            if (!EntityRegistration.ContainsEntity(entityName))
            {
                return(null);
            }

            Type typ = Type.GetType(entityName);
            IList <PropertyInfo> props = ReflectionUtils.GetWritableProperties(typ, null);

            return(props);
        }
コード例 #30
0
        public int GetInsertPass(EntityRegistration ent)
        {
            int lintCnt = 0;
            List <SqlParameter> lstParam = new List <SqlParameter>();

            try
            {
                Commons.ADDParameter(ref lstParam, "@UserName", DbType.String, ent.UserName);
                Commons.ADDParameter(ref lstParam, "@ConfirmPass", DbType.String, ent.ConfirmPassword);
                lintCnt = mobjDataAccess.ExecuteQuery("sp_UpdatePassInEmpMaster", lstParam);
            }
            catch (Exception ex)
            {
                Commons.FileLog("RegistrationBLL - GetInsertPass(EntityRegistration ent)", ex);
            }
            return(lintCnt);
        }