Ejemplo n.º 1
0
        public static void SaveNomenclatureHeader(LookUpMetaData nomenclatureHedar)
        {
            List <LookUpMetaData> rez = new List <LookUpMetaData>(GetAllLookUpSpecific());

            rez.Add(nomenclatureHedar);
            SerializeUtil.SerializeToXML <List <LookUpMetaData> >(NOMENCLATURENOMENCLATURE, rez);
        }
Ejemplo n.º 2
0
        public static IEnumerable <IEnumerable <string> > GetNomenclatureContent(int idnomen)
        {
            List <List <string> > worker            = new List <List <string> >();
            LookUpMetaData        nomenclatureHedar = GetAllLookUpSpecific().Where(e => e.Id == idnomen).FirstOrDefault();
            List <LookUpMetaData> metadata          = new List <LookUpMetaData>(GetNomenlatureFields(idnomen));
            List <string>         fields            = new List <string>();

            foreach (LookUpMetaData m in metadata)
            {
                fields.Add(m.Name);
            }
            worker.Add(fields);
            if (nomenclatureHedar != null)
            {
                List <string> content = new List <string>(LoadContentinlist(nomenclatureHedar.Name + "nomen.xml"));
                List <string> row     = new List <string>();
                int           i       = 0;
                foreach (var current in content)
                {
                    row.Add(current);
                    i++;
                    if (i == metadata.Count)
                    {
                        worker.Add(row);
                        row = new List <string>();
                        i   = 0;
                    }
                }
            }
            return(worker);
        }
Ejemplo n.º 3
0
        public static IEnumerable <string> GetLookupByName(string tablename, string fieldname)
        {
            List <string>  result         = new List <string>();
            LookUpMetaData lookUpMetaData = GetAllLookups(string.Format(" where NAMEENG='{0}'", tablename)).FirstOrDefault();
            var            dbman          = new DBManager(DataProvider.Firebird);

            dbman.ConnectionString = Entrence.ConnectionString;
            if (lookUpMetaData != null)
            {
                LookupModel lookupModel = new LookupModel(GetLookUpFields(lookUpMetaData.Id).ToList(), lookUpMetaData);
                try
                {
                    dbman.Open();
                    dbman.ExecuteReader(CommandType.Text, string.Format("select \"{0}\" from \"{1}\" where FIRMAID={2}", fieldname, lookUpMetaData.Tablename, ConfigTempoSinglenton.GetInstance().CurrentFirma.Id));
                    while (dbman.DataReader.Read())
                    {
                        result.Add(dbman.DataReader[fieldname].ToString());
                    }
                }

                catch (Exception ex)
                {
                    Logger.Instance().WriteLogError(ex.Message, "public static IEnumerable<string> GetLookupByName(string tablename, string fieldname)");
                }

                finally
                {
                    dbman.Dispose();
                }
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static IEnumerable <LookUpMetaData> GetNomenlatureFields(int numer)
        {
            List <LookUpMetaData> list     = GetAllNomenclatureFields().ToList();
            List <LookUpMetaData> result   = new List <LookUpMetaData>();
            List <LookUpToFields> conector = GetAllConections().Where(e => e.IdLookUpField == numer).ToList();

            foreach (var curconector in conector)
            {
                LookUpMetaData newmetada = list.Where(e => e.Id == curconector.IdLookUp).FirstOrDefault();
                result.Add(newmetada);
            }
            return(result);
        }
Ejemplo n.º 5
0
        public static bool DeleteLookUp(LookUpMetaData lookup)
        {
            bool result = true;

            var dbman = new DBManager(DataProvider.Firebird);

            dbman.ConnectionString = Entrence.ConnectionString;
            try
            {
                dbman.Open();
                dbman.BeginTransaction();
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("Delete from \"lookups\" WHERE \"Id\"={0}", lookup.Id);
                dbman.ExecuteNonQuery(CommandType.Text, sb.ToString());
                sb.Clear();
                sb.AppendFormat("Delete from \"lookupsdetails\" WHERE \"IdLookUp\"={0}", lookup.Id);
                dbman.ExecuteNonQuery(CommandType.Text, sb.ToString());
                sb.Clear();
                sb.AppendFormat("DROP TRIGGER \"triger{0}\"", lookup.Tablename);
                dbman.ExecuteNonQuery(CommandType.Text, sb.ToString());
                sb.Clear();
                sb.AppendFormat("DROP GENERATOR GENERATOR{0}", lookup.Tablename.ToUpper());
                dbman.ExecuteNonQuery(CommandType.Text, sb.ToString());
                sb.Clear();
                sb.AppendFormat("Drop table \"{0}\"", lookup.Tablename);
                dbman.ExecuteNonQuery(CommandType.Text, sb.ToString());
                dbman.CommitTransaction();
            }
            catch (Exception ex)
            {
                dbman.RollBackTransaction();
                Logger.Instance().WriteLogError(ex.Message, "public static bool DeleteLookUp(LookUpMetaData lookup)");
                result = false;
            }

            finally
            {
                dbman.Dispose();
            }
            return(result);
        }
Ejemplo n.º 6
0
 public bool DeleteLookUp(LookUpMetaData lookUpMetaData)
 {
     return(RealDataContext.DeleteLookUp(lookUpMetaData));
 }