Esempio n. 1
0
        List <Models.BBV3.CodeTypes> CodeTypes()
        {
            List <Models.BBV3.CodeTypes> codetypes = null;

            try
            {
                using (CommonLib.SQL.Access access = new CommonLib.SQL.Access())
                {
                    codetypes = (from s in (access.Table("hpb_edi", new List <string>()
                    {
                        "select * from MetaData.CodeTypes"
                    }, null, CommandType.Text)).AsEnumerable()
                                 select new Models.BBV3.CodeTypes()
                    {
                        Id = s["Id"] != null ? (short)s["Id"] : default(short),
                        VendorID = s["VendorID"].ToString(),
                        CodeType = s["CodeType"].ToString(),
                        AssociatedColumn = s["AssociatedColumn"].ToString(),
                        MaxChars = s["MaxChars"] != null ? (byte)s["MaxChars"] : default(byte)
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            return(codetypes);
        }
Esempio n. 2
0
        public List <Models.BBV3.Codes> Codes()
        {
            List <Models.BBV3.Codes> codes = null;

            try
            {
                using (CommonLib.SQL.Access access = new CommonLib.SQL.Access())
                {
                    codes = (from s in (access.Table("hpb_edi", new List <string>()
                    {
                        "select * from MetaData.Codes"
                    }, null, CommandType.Text)).AsEnumerable()
                             select new Models.BBV3.Codes()
                    {
                        Code = s["Code"].ToString(),
                        CodeDescription = s["CodeDescription"].ToString(),
                        CodeId = s["CodeID"] != null ? (short)s["CodeID"] : default(short),
                        CodeName = s["CodeName"].ToString(),
                        Id = s["Id"] != null ? (int)s["Id"] : default(int)
                    }
                             ).ToList();
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            return(codes);
        }
Esempio n. 3
0
        public List <Models.MetaData.AllCodes> AllCodes()
        {
            List <Models.MetaData.AllCodes> all = new List <Models.MetaData.AllCodes>();

            try
            {
                using (CommonLib.SQL.Access access = new CommonLib.SQL.Access())
                {
                    DataTable dt = access.Table
                                   (
                        Tools.dbConn[$"EDI-{Globals.Env}"],
                        new List <string>()
                    {
                        "MetaData.uspGetCodes"
                    },
                        null
                                   );

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        all = (from DataRow r in dt.Rows
                               select new Models.MetaData.AllCodes
                        {
                            FileFormatId = r["FileFormatId"] != null ? (byte)r["FileFormatId"] : default(byte),
                            CodesTypeId = r["CodeTypeId"] != null ? (short)r["CodeTypeId"] : default(short),
                            CodesdId = r["CodesId"] != null ? (short)r["CodesId"] : default(short),
                            FileFormat = r["FileFormat"].ToString(),
                            Vers = r["Vers"].ToString(),
                            Active = r["Active"] != null ? (bool)r["Active"] : false,
                            VendorId = r["VendorID"].ToString(),
                            CodeType = r["CodeType"].ToString(),
                            AssociatedColumn = r["AssociatedColumn"].ToString(),
                            MaxChars = r["MaxChars"] != null ? (byte)r["MaxChars"] : default(byte),
                            Code = r["Code"].ToString(),
                            CodeName = r["CodeName"].ToString(),
                            CodeDescription = r["CodeDescription"].ToString()
                        }).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            return(all);
        }