Пример #1
0
        public static double GetPrjIdForEngNum(string engNum)
        {
            using (new TransactionScope(
                       TransactionScopeOption.Required,
                       new TransactionOptions {
                IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
            }))
            {
                using (var db = new iMDbContext())
                {
                    //var result = db.Set<DOCMASTER>().Include("PROJECTS")
                    //    .Where(x => x.C2ALIAS.Equals(engNum, StringComparison.OrdinalIgnoreCase)
                    //    && x.C_ALIAS.Equals("WEBDOC", StringComparison.OrdinalIgnoreCase)
                    //    && x.DOCNAME.Equals(string.Empty, StringComparison.OrdinalIgnoreCase)
                    //    ).FirstOrDefault().PROJECTS.FirstOrDefault().PRJ_ID;

                    var result = db.Set <PROJECT>().Include("DOCMASTER")
                                 .Where(x => x.DOCMASTER.C2ALIAS.Equals(engNum, StringComparison.OrdinalIgnoreCase) &&
                                        x.DOCMASTER.C_ALIAS.Equals("WEBDOC", StringComparison.OrdinalIgnoreCase) &&
                                        x.DOCMASTER.DOCNAME.Equals(string.Empty, StringComparison.OrdinalIgnoreCase)
                                        ).FirstOrDefault().PRJ_ID;

                    return(result);
                }
            }
        }
Пример #2
0
        public static double GetPrjIdForEngNum(string engNum)
        {
            using (new TransactionScope(
                    TransactionScopeOption.Required,
                    new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
            {
                using (var db = new iMDbContext())
                {
                    //var result = db.Set<DOCMASTER>().Include("PROJECTS")
                    //    .Where(x => x.C2ALIAS.Equals(engNum, StringComparison.OrdinalIgnoreCase)
                    //    && x.C_ALIAS.Equals("WEBDOC", StringComparison.OrdinalIgnoreCase)
                    //    && x.DOCNAME.Equals(string.Empty, StringComparison.OrdinalIgnoreCase)
                    //    ).FirstOrDefault().PROJECTS.FirstOrDefault().PRJ_ID;

                    var result = db.Set<PROJECT>().Include("DOCMASTER")
                        .Where(x => x.DOCMASTER.C2ALIAS.Equals(engNum, StringComparison.OrdinalIgnoreCase)
                        && x.DOCMASTER.C_ALIAS.Equals("WEBDOC", StringComparison.OrdinalIgnoreCase)
                        && x.DOCMASTER.DOCNAME.Equals(string.Empty, StringComparison.OrdinalIgnoreCase)
                        ).FirstOrDefault().PRJ_ID;

                    return result;
                }
            }
        }