示例#1
0
        public static List <WsFloatingField> GetProfileHistory(string engNum, string usrId, WsActivityType?wsActivityType = null, WsActivityType?wsActivitySubType = null)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    List <WsFloatingField> profHist = null;

                    if (string.IsNullOrWhiteSpace(engNum) && string.IsNullOrWhiteSpace(usrId))
                    {
                        profHist = db.WsFloatingField.Where(x => x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase) &&
                                                            x.EnteredBy.Equals(usrId, StringComparison.OrdinalIgnoreCase)).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(engNum) && !string.IsNullOrWhiteSpace(usrId))
                    {
                        profHist = db.WsFloatingField.ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(engNum))
                    {
                        profHist = db.WsFloatingField.Where(x => x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase)).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(usrId))
                    {
                        profHist = db.WsFloatingField.Where(x => x.EnteredBy.Equals(usrId, StringComparison.OrdinalIgnoreCase)).ToList();
                    }

                    //return profHist.OrderByDescending(x => x.EngNum).ThenByDescending(x => x.EnteredDate).ToList();

                    return(profHist.OrderByDescending(x => x.EnteredDate).ToList());
                }
            }
        }
示例#2
0
        public static void RequestAccess(string engNum, WsUserType wsUserType, string emailUsers, string comment = null)
        {
            var dtNow = DateTime.Now;

            var wsModel    = Workspace.GetEngByEngNum(engNum, WsLoadType.Groups, true).FirstOrDefault();
            var recepients = Workspace.GetEmailRecepientsForEng(wsModel, EmailRecepientType.ADMIN, true);

            emailUsers = emailUsers.ToUpper();
            var sp_emailUsers = emailUsers.Split(',').ToList();

            var filterRecepients = recepients.Where(x => (sp_emailUsers.Contains((x.Item2 + "@kpmg.com").ToUpper()) || (x.Item2.Equals(AuditManager.Common.AmUtil.GetCurrentUser, StringComparison.OrdinalIgnoreCase)))).ToList();

            var mailText       = AmUtil.SendMail_RequestAccess(WsActivityType.Workspace_RequestAccess.ToString(), wsModel.WsProfile.EngNum, wsModel.Name, filterRecepients, wsUserType.ToString(), comment);
            var recepientArray = string.Join(",", filterRecepients.Select(x => x.Item2).ToList());

            //INSERT INTO [AuditManager].[dbo].[WsActivity] VALUES (25, 'Workspace')
            //INSERT INTO [AuditManager].[dbo].[WsActivity] VALUES (26, 'Workspace_RequestAccess')

            using (var db = new AmDbContext())
            {
                var wsActivityHistory = db.WsActivityHistory.Add(
                    new WsActivityHistory
                {
                    EngNum              = engNum,
                    UserId              = AmUtil.GetCurrentUser,
                    WsActivityTypeId    = WsActivityType.Workspace,
                    WsSubActivityTypeId = WsActivityType.Workspace_RequestAccess,
                    Comment             = comment,
                    WsActivityInfo      = wsUserType.ToString(),
                    DateCreated         = dtNow
                }
                    );

                db.SaveChanges();

                var wsMail = db.WsMail.Add(new WsMail
                {
                    WsActivityHistoryId = wsActivityHistory.WsActivityHistoryId,
                    WsMailStatusTypeId  = WsMailStatusType.Success,
                    MailText            = mailText,
                    RecepientArray      = recepientArray
                });

                db.SaveChanges();
            }
        }
示例#3
0
        public static List<WsActivityHistory> GetClosureHistory(string engNum, string usrId, WsActivityType? wsActivityType = null, WsActivityType? wsActivitySubType = null)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    List<WsActivityHistory> actHist = null;

                    if (string.IsNullOrWhiteSpace(engNum) && string.IsNullOrWhiteSpace(usrId))
                    {
                        actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                            x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase) &&
                            x.UserId.Equals(usrId, StringComparison.OrdinalIgnoreCase)).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(engNum) && !string.IsNullOrWhiteSpace(usrId))
                    {
                        actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE
                            ).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(engNum))
                    {
                        actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                            x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase)).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(usrId))
                    {
                        actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                            x.UserId.Equals(usrId, StringComparison.OrdinalIgnoreCase)).ToList();
                    }

                    //return actHist.OrderByDescending(x => x.DateCreated).ThenByDescending(x => x.EngNum).ToList();

                    return actHist.OrderByDescending(x => x.DateCreated).ToList();
                }
            }
        }
示例#4
0
        public static List <WsActivityHistory> GetClosureHistory(string engNum, string usrId, WsActivityType?wsActivityType = null, WsActivityType?wsActivitySubType = null)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    List <WsActivityHistory> actHist = null;

                    if (string.IsNullOrWhiteSpace(engNum) && string.IsNullOrWhiteSpace(usrId))
                    {
                        actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                                                                                                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                                                                                                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                                                                                                            x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase) &&
                                                                                                            x.UserId.Equals(usrId, StringComparison.OrdinalIgnoreCase)).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(engNum) && !string.IsNullOrWhiteSpace(usrId))
                    {
                        actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                                                                                                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                                                                                                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE
                                                                                                            ).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(engNum))
                    {
                        actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                                                                                                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                                                                                                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                                                                                                            x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase)).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(usrId))
                    {
                        actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                                                                                                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                                                                                                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                                                                                                            x.UserId.Equals(usrId, StringComparison.OrdinalIgnoreCase)).ToList();
                    }

                    //return actHist.OrderByDescending(x => x.DateCreated).ThenByDescending(x => x.EngNum).ToList();

                    return(actHist.OrderByDescending(x => x.DateCreated).ToList());
                }
            }
        }
示例#5
0
        public static List<WsActivityHistory> GetClosureReport(DateTime fromD, DateTime toD, WsActivityType? wsActivityType = null, WsActivityType? wsActivitySubType = null)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    List<WsActivityHistory> actHist = null;

                    toD = toD.AddDays(1);

                    actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                            x.DateCreated >= fromD &&
                            x.DateCreated <= toD).ToList();

                    return actHist.OrderByDescending(x => x.DateCreated).ToList();
                }
            }
        }
示例#6
0
        public static dynamic GetClosureComment(string engNum)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    var result = db.Set<WsActivityHistory>().Where(
                        x => (
                            x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase) &&
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                            !(x.Comment == null || x.Comment.Trim() == string.Empty)
                            ))
                        .Select(x => new { Comment = x.Comment, UserId = x.UserId, DateCreated = x.DateCreated }).ToList();

                    var dynamicResult = result.Select(x => x.ToDynamic()).ToList();

                    return dynamicResult;
                }
            }
        }
示例#7
0
        public static List <WsActivityHistory> GetClosureReport(DateTime fromD, DateTime toD, WsActivityType?wsActivityType = null, WsActivityType?wsActivitySubType = null)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    List <WsActivityHistory> actHist = null;

                    toD = toD.AddDays(1);

                    actHist = db.WsActivityHistory.Include("WsActivity").Include("WsSubActivity").Where(x =>
                                                                                                        x.WsActivityTypeId == WsActivityType.CLOSURE &&
                                                                                                        x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                                                                                                        x.DateCreated >= fromD &&
                                                                                                        x.DateCreated <= toD).ToList();


                    return(actHist.OrderByDescending(x => x.DateCreated).ToList());
                }
            }
        }
示例#8
0
        public static dynamic GetClosureComment(string engNum)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    var result = db.Set <WsActivityHistory>().Where(
                        x => (
                            x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase) &&
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == WsActivityType.CLOSURE_INITIATE &&
                            !(x.Comment == null || x.Comment.Trim() == string.Empty)
                            ))
                                 .Select(x => new { Comment = x.Comment, UserId = x.UserId, DateCreated = x.DateCreated }).ToList();

                    var dynamicResult = result.Select(x => x.ToDynamic()).ToList();

                    return(dynamicResult);
                }
            }
        }
示例#9
0
        public static List <KeyValuePair <string, bool> > GetKPMGOnlyForAllEng()
        {
            List <KeyValuePair <string, bool> > kPMGOnlyForEng = new List <KeyValuePair <string, bool> >();

            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    var wsFloatingField = db.WsFloatingField.Where(x => x.IsActive).ToList();

                    wsFloatingField.ForEach(x =>
                    {
                        if (!string.IsNullOrWhiteSpace(x.TPAns))
                        {
                            var tpAns = x.TPAns.Split('|');

                            var tp_1 = tpAns[0].Split('=')[1];
                            var tp_2 = tpAns[1].Split('=')[1];
                            var tp_3 = tpAns[2].Split('=')[1];

                            if (string.IsNullOrWhiteSpace(tp_1) || string.IsNullOrWhiteSpace(tp_2) || string.IsNullOrWhiteSpace(tp_3))
                            {
                                kPMGOnlyForEng.Add(new KeyValuePair <string, bool>(x.EngNum, true));
                            }
                            else if (tp_1.ToBool <string>() && (string.Equals("NA", tp_2, StringComparison.OrdinalIgnoreCase) || tp_2.ToBool <string>() && !tp_3.ToBool <string>()))
                            {
                                kPMGOnlyForEng.Add(new KeyValuePair <string, bool>(x.EngNum, false));
                            }
                            else
                            {
                                kPMGOnlyForEng.Add(new KeyValuePair <string, bool>(x.EngNum, true));
                            }
                        }
                    }
                                            );
                }
            }

            return(kPMGOnlyForEng);
        }
示例#10
0
        public static dynamic GetClosurePastDue(int days, WsActivityType mailTypeEnum)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    var result = db.Set<WsActivityHistory>().Where(
                        x => (
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == mailTypeEnum &&
                            x.DateCreated <= DbFunctions.AddDays(DateTime.Now, -(days))
                            )).Select(x => new
                            {
                                EngNum = x.EngNum
                                //, RecepientArray = x
                            }).ToList();

                    var dynamicResult = result.Select(x => x.ToDynamic()).ToList();

                    return dynamicResult;
                }
            }
        }
示例#11
0
        public static dynamic GetClosurePastDue(int days, WsActivityType mailTypeEnum)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    var result = db.Set <WsActivityHistory>().Where(
                        x => (
                            x.WsActivityTypeId == WsActivityType.CLOSURE &&
                            x.WsSubActivityTypeId == mailTypeEnum &&
                            x.DateCreated <= DbFunctions.AddDays(DateTime.Now, -(days))
                            )).Select(x => new
                    {
                        EngNum = x.EngNum
                                 //, RecepientArray = x
                    }).ToList();

                    var dynamicResult = result.Select(x => x.ToDynamic()).ToList();

                    return(dynamicResult);
                }
            }
        }
示例#12
0
        public static List<WsFloatingField> GetProfileHistory(string engNum, string usrId, WsActivityType? wsActivityType = null, WsActivityType? wsActivitySubType = null)
        {
            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    List<WsFloatingField> profHist = null;

                    if (string.IsNullOrWhiteSpace(engNum) && string.IsNullOrWhiteSpace(usrId))
                    {
                        profHist = db.WsFloatingField.Where(x => x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase) &&
                            x.EnteredBy.Equals(usrId, StringComparison.OrdinalIgnoreCase)).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(engNum) && !string.IsNullOrWhiteSpace(usrId))
                    {
                        profHist = db.WsFloatingField.ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(engNum))
                    {
                        profHist = db.WsFloatingField.Where(x => x.EngNum.Equals(engNum, StringComparison.OrdinalIgnoreCase)).ToList();
                    }
                    else if (!string.IsNullOrWhiteSpace(usrId))
                    {
                        profHist = db.WsFloatingField.Where(x => x.EnteredBy.Equals(usrId, StringComparison.OrdinalIgnoreCase)).ToList();
                    }

                    //return profHist.OrderByDescending(x => x.EngNum).ThenByDescending(x => x.EnteredDate).ToList();

                    return profHist.OrderByDescending(x => x.EnteredDate).ToList();
                }
            }
        }
示例#13
0
        public static List<KeyValuePair<string, bool>> GetKPMGOnlyForAllEng_Monika()
        {
            var obj = File.ReadAllLines(HostingEnvironment.ApplicationPhysicalPath + "//ENG.txt").ToList().Distinct();

            List<KeyValuePair<string, bool>> kPMGOnlyForEng = new List<KeyValuePair<string, bool>>();

            List<KeyValuePair<string, bool?>> kPMGOnlyForEng_1 = new List<KeyValuePair<string, bool?>>();
            List<KeyValuePair<string, bool?>> kPMGOnlyForEng_2 = new List<KeyValuePair<string, bool?>>();
            List<KeyValuePair<string, bool?>> kPMGOnlyForEng_3 = new List<KeyValuePair<string, bool?>>();

            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    var wsFloatingField = db.WsFloatingField.Where(x => x.IsActive).ToList();

                    wsFloatingField.ForEach(x =>
                    {
                        if (obj.Contains(x.EngNum))
                        {
                            if (!string.IsNullOrWhiteSpace(x.TPAns))
                            {
                                var tpAns = x.TPAns.Split('|');

                                var tp_1 = tpAns[0].Split('=')[1];
                                var tp_2 = tpAns[1].Split('=')[1];
                                var tp_3 = tpAns[2].Split('=')[1];

                                if (string.IsNullOrWhiteSpace(tp_1) || string.IsNullOrWhiteSpace(tp_2) || string.IsNullOrWhiteSpace(tp_3))
                                {
                                    kPMGOnlyForEng.Add(new KeyValuePair<string, bool>(x.EngNum, true));
                                    kPMGOnlyForEng_1.Add(new KeyValuePair<string, bool?>(x.EngNum, null));
                                }
                                else if (tp_1.ToBool<string>() && (string.Equals("NA", tp_2, StringComparison.OrdinalIgnoreCase) || tp_2.ToBool<string>() && !tp_3.ToBool<string>()))
                                {
                                    kPMGOnlyForEng.Add(new KeyValuePair<string, bool>(x.EngNum, false));
                                    kPMGOnlyForEng_2.Add(new KeyValuePair<string, bool?>(x.EngNum, false));
                                }
                                else
                                {
                                    kPMGOnlyForEng.Add(new KeyValuePair<string, bool>(x.EngNum, true));
                                    kPMGOnlyForEng_3.Add(new KeyValuePair<string, bool?>(x.EngNum, true));
                                }
                            }
                        }
                    }
                  );
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Workspace for which ThirdParty question was never answered, it only created in our system[Note: Workspace created after our new system implemented]");
            sb.AppendLine(string.Format("Count = {0}", kPMGOnlyForEng_1.Count));
            kPMGOnlyForEng_1.ForEach(x => sb.AppendLine(x.ToString()));

            sb.AppendLine("KPMG Flag = false/Contractor Allowed = true");
            sb.AppendLine(string.Format("Count = {0}", kPMGOnlyForEng_2.Count));
            kPMGOnlyForEng_2.ForEach(x => sb.AppendLine(x.ToString()));

            sb.AppendLine("KPMG Flag = true/Contractor Allowed = false");
            sb.AppendLine(string.Format("Count = {0}", kPMGOnlyForEng_3.Count));
            kPMGOnlyForEng_3.ForEach(x => sb.AppendLine(x.ToString()));

            return kPMGOnlyForEng;
        }
示例#14
0
        public static List<KeyValuePair<string, bool>> GetKPMGOnlyForAllEng()
        {
            List<KeyValuePair<string, bool>> kPMGOnlyForEng = new List<KeyValuePair<string, bool>>();

            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    var wsFloatingField = db.WsFloatingField.Where(x => x.IsActive).ToList();

                    wsFloatingField.ForEach(x =>
                    {
                        if (!string.IsNullOrWhiteSpace(x.TPAns))
                        {
                            var tpAns = x.TPAns.Split('|');

                            var tp_1 = tpAns[0].Split('=')[1];
                            var tp_2 = tpAns[1].Split('=')[1];
                            var tp_3 = tpAns[2].Split('=')[1];

                            if (string.IsNullOrWhiteSpace(tp_1) || string.IsNullOrWhiteSpace(tp_2) || string.IsNullOrWhiteSpace(tp_3))
                            {
                                kPMGOnlyForEng.Add(new KeyValuePair<string, bool>(x.EngNum, true));
                            }
                            else if (tp_1.ToBool<string>() && (string.Equals("NA", tp_2, StringComparison.OrdinalIgnoreCase) || tp_2.ToBool<string>() && !tp_3.ToBool<string>()))
                            {
                                kPMGOnlyForEng.Add(new KeyValuePair<string, bool>(x.EngNum, false));
                            }
                            else
                            {
                                kPMGOnlyForEng.Add(new KeyValuePair<string, bool>(x.EngNum, true));
                            }
                        }

                    }
                  );
                }
            }

            return kPMGOnlyForEng;
        }
示例#15
0
        public static void RequestAccess(string engNum, WsUserType wsUserType, string emailUsers, string comment = null)
        {
            var dtNow = DateTime.Now;

            var wsModel = Workspace.GetEngByEngNum(engNum, WsLoadType.Groups, true).FirstOrDefault();
            var recepients = Workspace.GetEmailRecepientsForEng(wsModel, EmailRecepientType.ADMIN, true);

            emailUsers = emailUsers.ToUpper();
            var sp_emailUsers = emailUsers.Split(',').ToList();

            var filterRecepients = recepients.Where(x => (sp_emailUsers.Contains((x.Item2 + "@kpmg.com").ToUpper()) || (x.Item2.Equals(AuditManager.Common.AmUtil.GetCurrentUser, StringComparison.OrdinalIgnoreCase)))).ToList();

            var mailText = AmUtil.SendMail_RequestAccess(WsActivityType.Workspace_RequestAccess.ToString(), wsModel.WsProfile.EngNum, wsModel.Name, filterRecepients, wsUserType.ToString(), comment);
            var recepientArray = string.Join(",", filterRecepients.Select(x => x.Item2).ToList());

            //INSERT INTO [AuditManager].[dbo].[WsActivity] VALUES (25, 'Workspace')
            //INSERT INTO [AuditManager].[dbo].[WsActivity] VALUES (26, 'Workspace_RequestAccess')

            using (var db = new AmDbContext())
            {
                var wsActivityHistory = db.WsActivityHistory.Add(
                    new WsActivityHistory
                    {
                        EngNum = engNum,
                        UserId = AmUtil.GetCurrentUser,
                        WsActivityTypeId = WsActivityType.Workspace,
                        WsSubActivityTypeId = WsActivityType.Workspace_RequestAccess,
                        Comment = comment,
                        WsActivityInfo = wsUserType.ToString(),
                        DateCreated = dtNow
                    }
                    );

                db.SaveChanges();

                var wsMail = db.WsMail.Add(new WsMail
                {
                    WsActivityHistoryId = wsActivityHistory.WsActivityHistoryId,
                    WsMailStatusTypeId = WsMailStatusType.Success,
                    MailText = mailText,
                    RecepientArray = recepientArray
                });

                db.SaveChanges();
            }
        }
示例#16
0
        public static List <KeyValuePair <string, bool> > GetKPMGOnlyForAllEng_Monika()
        {
            var obj = File.ReadAllLines(HostingEnvironment.ApplicationPhysicalPath + "//ENG.txt").ToList().Distinct();

            List <KeyValuePair <string, bool> > kPMGOnlyForEng = new List <KeyValuePair <string, bool> >();

            List <KeyValuePair <string, bool?> > kPMGOnlyForEng_1 = new List <KeyValuePair <string, bool?> >();
            List <KeyValuePair <string, bool?> > kPMGOnlyForEng_2 = new List <KeyValuePair <string, bool?> >();
            List <KeyValuePair <string, bool?> > kPMGOnlyForEng_3 = new List <KeyValuePair <string, bool?> >();

            using (var db = new AmDbContext())
            {
                using (var tran = db.Database.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted))
                {
                    var wsFloatingField = db.WsFloatingField.Where(x => x.IsActive).ToList();

                    wsFloatingField.ForEach(x =>
                    {
                        if (obj.Contains(x.EngNum))
                        {
                            if (!string.IsNullOrWhiteSpace(x.TPAns))
                            {
                                var tpAns = x.TPAns.Split('|');

                                var tp_1 = tpAns[0].Split('=')[1];
                                var tp_2 = tpAns[1].Split('=')[1];
                                var tp_3 = tpAns[2].Split('=')[1];

                                if (string.IsNullOrWhiteSpace(tp_1) || string.IsNullOrWhiteSpace(tp_2) || string.IsNullOrWhiteSpace(tp_3))
                                {
                                    kPMGOnlyForEng.Add(new KeyValuePair <string, bool>(x.EngNum, true));
                                    kPMGOnlyForEng_1.Add(new KeyValuePair <string, bool?>(x.EngNum, null));
                                }
                                else if (tp_1.ToBool <string>() && (string.Equals("NA", tp_2, StringComparison.OrdinalIgnoreCase) || tp_2.ToBool <string>() && !tp_3.ToBool <string>()))
                                {
                                    kPMGOnlyForEng.Add(new KeyValuePair <string, bool>(x.EngNum, false));
                                    kPMGOnlyForEng_2.Add(new KeyValuePair <string, bool?>(x.EngNum, false));
                                }
                                else
                                {
                                    kPMGOnlyForEng.Add(new KeyValuePair <string, bool>(x.EngNum, true));
                                    kPMGOnlyForEng_3.Add(new KeyValuePair <string, bool?>(x.EngNum, true));
                                }
                            }
                        }
                    }
                                            );
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Workspace for which ThirdParty question was never answered, it only created in our system[Note: Workspace created after our new system implemented]");
            sb.AppendLine(string.Format("Count = {0}", kPMGOnlyForEng_1.Count));
            kPMGOnlyForEng_1.ForEach(x => sb.AppendLine(x.ToString()));

            sb.AppendLine("KPMG Flag = false/Contractor Allowed = true");
            sb.AppendLine(string.Format("Count = {0}", kPMGOnlyForEng_2.Count));
            kPMGOnlyForEng_2.ForEach(x => sb.AppendLine(x.ToString()));

            sb.AppendLine("KPMG Flag = true/Contractor Allowed = false");
            sb.AppendLine(string.Format("Count = {0}", kPMGOnlyForEng_3.Count));
            kPMGOnlyForEng_3.ForEach(x => sb.AppendLine(x.ToString()));

            return(kPMGOnlyForEng);
        }