Beispiel #1
0
        public static SelectList LOVList(string LOVType, object selectedItem, string parentValue)
        {
            LOV selectLOV = new LOV()
            {
                LOV_Value = " ", LOV_Display_Value = " -- Select Value ---"
            };
            IEnumerable <LOV> selectList = new LOV[] { selectLOV };
            ILibrary <LOV>    lib        = new LOVLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
            IEnumerable <LOV> result;

            if (!string.IsNullOrEmpty(parentValue))
            {
                result = ((LOVLibrary)lib).GetByParentValue(parentValue);
            }
            else
            {
                result = ((LOVLibrary)lib).GetByLOVType(LOVType);
            }

            result     = result.OrderBy(o => o.LOV_Display_Value);
            selectList = selectList.Concat <LOV>(result);
            SelectList sList = new SelectList(selectList, "LOV_Value", "LOV_Display_Value", selectedItem);

            return(sList);
        }
        protected override void SaveChildEntities(string[] childEntityList, LOVType entity)
        {
            foreach (string ChildEntity in childEntityList)
            {
                switch (ChildEntity)
                {
                    #region /* Case Statements - All child grids */

                case "LOV":
                    if (Session[ChildEntity] != null)
                    {
                        LOVLibrary        lovLibrary = new LOVLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString());
                        IEnumerable <LOV> resultList = (IList <LOV>)Session[ChildEntity];
                        foreach (LOV lov in resultList)
                        {
                            lov.LOVType = new LOVType {
                                ID = entity.ID
                            };
                            if (lov.Parent != null)
                            {
                                lov.Parent = new LOV {
                                    ID = lov.Parent.ID
                                };
                            }
                            lovLibrary.Add(lov);
                        }
                    }
                    break;

                    #endregion
                }
            }
        }