Пример #1
0
        public T Load(T obj, string[] primaryKeyNames, int langId)
        {
            Type     t       = typeof(T);
            IFactory factory = DBHelper.CreateFactory();

            try
            {
                obj = dal.Load(obj, primaryKeyNames, factory);
                string[] fields = { "MainId", "LangId" };


                PropertyInfo property = t.GetProperty(("Id"));
                int          id       = Convert.ToInt32(property.GetValue(obj, null));
                TDesc        objDesc  = dalDesc.LoadByObjectAndLang(id, langId, factory);
                property = t.GetProperty(Utils.GetPropertyDescName(typeof(TDesc)));
                property.SetValue(obj, objDesc, null);
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("Generic2C<T, TDesc>", string.Format("Load({0} obj, string[] primaryKeyNames, int langId, out TDesc objDesc)", t.Name), ex.Message);
            }
            finally
            {
                factory.Release();
            }
            return(obj);
        }
Пример #2
0
        public string LoadPage(string pageName, int id_xml, int idObject)
        {
            string re = string.Empty;
            XMLConfigSerializer serializer = new XMLConfigSerializer();

            sd_XML obj = new sd_XML()
            {
                Id = id_xml
            };

            obj = generic.Load(obj, new string[] { "Id" });

            XMLConfigCatalog obj_xml = serializer.Deserialize(obj.XmlContent);

            foreach (XMLConfig item in obj_xml.Lst)
            {
                if (item.Name == pageName)
                {
                    re = item.Value;
                    break;
                }
            }
            return(re);
        }
Пример #3
0
 public T Load(T obj, string[] primaryKeyNames)
 {
     return(dal.Load(obj, primaryKeyNames));
 }