Пример #1
0
        private static string makeListFromXML(string ListXML, ListType listType)
        {
            List <int> IDs   = new List <int>();
            Hashtable  table = new Hashtable();

            IDs = Serialization.DeserializeToList <List <int> >(ListXML);
            string listData = "";

            switch (listType)
            {
            case ListType.FE:
                List <FE_Model> feList = GlobalConfig.Connection.GenericGetAll <FE_Model>("tblFE", "LastName");
                foreach (var fe in feList)
                {
                    table.Add(fe.ID, fe);
                }

                if (IDs != null)
                {
                    foreach (var item in IDs)
                    {
                        FE_Model data = (FE_Model)table[item];
                        if (data != null)
                        {
                            listData += data.FullName + " / ";
                        }
                    }
                }
                break;

            case ListType.Product:
                List <ProductModel> productList = GlobalConfig.Connection.GenericGetAll <ProductModel>("tblProducts", "Product");
                foreach (var product in productList)
                {
                    table.Add(product.ID, product);
                }


                if (IDs != null)
                {
                    foreach (var item in IDs)
                    {
                        ProductModel data = (ProductModel)table[item];
                        if (data != null)
                        {
                            listData += data.Product + " / ";
                        }
                    }
                }
                break;

            default:
                break;
            }
            string returnData = "";

            if (listData.Length > 3)
            {
                returnData = listData.Substring(0, listData.Length - 3);
            }
            return(returnData);
        }