예제 #1
0
        private void GetListCount(ref PendingStatusCompareResult result)
        {
            try
            {
                var request = string.Format(SearchRequestListingCount, GetLoginText(_loginTrace), result.ModuleId,
                                            DateTime.Now.AddYears(-10).ToString("MM/dd/yyyyTHH:mm:ss") + "-" +
                                            DateTime.Now.ToString("MM/dd/yyyyTHH:mm:ss"));
                result.QaListingCount        = PsaHelper.GetListingCount(request, ConfigurationManager.AppSettings["TcsQaUrl"]);
                result.ProdutionListingCount = PsaHelper.GetListingCount(request, "");

                if (result.QaListingCount > 0 && result.ProdutionListingCount > 0)
                {
                    result.IncreaseInActiveCounts = ((int)(0.5f + 100f * (result.QaListingCount - result.ProdutionListingCount) / result.ProdutionListingCount)).ToString(CultureInfo.InvariantCulture) + "%";
                }
                if (!string.IsNullOrEmpty(result.CurrentRdcPendingStatus))
                {
                    result.RdcCurrentPendingListingCount = SearchByTmkCountRequest(result,
                                                                                   result.CurrentRdcPendingStatus,
                                                                                   _loginTrace);
                }
            }
            catch (Exception ex)
            {
                Log.Error(typeof(PsaManager), "Failed to get list count for Module ID: " + result.ModuleId + ex.Message + ex.StackTrace);
            }
        }
예제 #2
0
        private int SearchByTmkCountRequest(PendingStatusCompareResult compareResult, string status, LoginInfo loginInfo)
        {
            try
            {
                string statusName;
                string statusValue;
                string lastModidfyFieldName;
                string lastMoidfyFieldValue;
                var    helper = new PsaHelper();
                PsaHelper.GetStatusInfo(compareResult, status, out statusName, out statusValue, out lastModidfyFieldName,
                                        out lastMoidfyFieldValue);

                if (!string.IsNullOrEmpty(compareResult.CurrentRdcPendingStatus))
                {
                    var request = string.Format(SearchTMKCountRequest, GetLoginText(loginInfo),
                                                compareResult.BoardId.ToString(CultureInfo.InvariantCulture),
                                                PsaHelper.EncodeXml(compareResult.PropertyClass), statusName,
                                                statusValue, loginInfo.ByPassAuthentication);
                    return(PsaHelper.GetListingCount(request, ""));
                }
            }
            catch (Exception ex)
            {
                Log.Error(typeof(PsaManager), ex.Message);
            }

            return(0);
        }
예제 #3
0
        public void CompareTcsRdcActivePendingStatus(PendingStatusCompareResult compareResult, StreamWriter streamWriterReport)
        {
            try
            {
                var helper      = new PsaHelper();
                var connections = helper.GetDefConnections(compareResult.ModuleId);

                foreach (var connection in connections)
                {
                    _loginTrace = null;
                    if (connection.connection_name.EndsWith(".sql", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    if (!connection.connection_name.EndsWith("re.def", StringComparison.OrdinalIgnoreCase) &&
                        !connection.connection_name.EndsWith("al.def", StringComparison.OrdinalIgnoreCase) &&
                        !connection.connection_name.EndsWith("cp.def", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    var resultByPropertyClass = new PendingStatusCompareResult
                    {
                        ModuleId       = compareResult.ModuleId,
                        ModuleName     = compareResult.ModuleName,
                        PropertyClass  = connection.connection_type,
                        ConnectionName = connection.connection_name,
                        DefFilePath    = connection.definition_file,
                        RdcCode        = compareResult.RdcCode,
                        BoardId        = connection.board_id ?? 0
                    };
                    helper.AnalyzeDef(ref resultByPropertyClass);
                    if (resultByPropertyClass.IsNotAvailableForOrca || resultByPropertyClass.IsOpenHouseOnlyModule)
                    {
                        continue;
                    }
                    CheckRdcAccountAccess(ref resultByPropertyClass);
                    if (resultByPropertyClass.IsDataSourceRemoved)
                    {
                        continue;
                    }

                    if (_loginTrace != null)
                    {
                        GetListCount(ref resultByPropertyClass);
                    }
                    helper.WriteToReport(streamWriterReport, resultByPropertyClass);
                    break;
                }
            }
            catch (Exception ex)
            {
                Log.Error(typeof(PsaManager), "Module ID = " + compareResult.ModuleId + "\r\n" + ex.Message + ex.StackTrace);
            }
        }
예제 #4
0
        public static void GetStatusInfo(PendingStatusCompareResult compareResult, string status, out string statusName, out string statusValue, out string lastModifyDateFieldName, out string lastModifyDateFiledValue)
        {
            statusValue = "";
            var iniReader = new IniFile(compareResult.DefFilePath);

            lastModifyDateFieldName = iniReader.Read("ST_LastMod", "Standard_Search") ?? "";
            var dateFormat = iniReader.Read("SDateFormat", "field_" + lastModifyDateFieldName) ?? "";

            if (string.IsNullOrEmpty(dateFormat))
            {
                dateFormat = "MM/dd/yyyyTHH:mm:ss";
            }
            lastModifyDateFiledValue = DateTime.Now.AddYears(-10).ToString(dateFormat) + "-" +
                                       DateTime.Now.ToString(dateFormat);
            statusName = iniReader.Read("ST_Status", "Standard_Search") ?? "";
            var statusFieldName = "field_" + statusName;
            var statusFormat    = iniReader.Read("Format", statusFieldName) ?? "";
            var sortingFormat   = iniReader.Read("Format", "Sorting");
            var formatFlag      = GetFormatFlag(statusFormat, sortingFormat);
            var delimiter       = GetFormatDelimiter(statusFormat);
            var initialValues   = new List <string>();

            for (var i = 1; i < 100; i++)
            {
                var val = iniReader.Read("Value" + i, statusFieldName);
                if (!string.IsNullOrEmpty(val))
                {
                    initialValues.Add(val);
                }
                else
                {
                    break;
                }
            }
            if (initialValues.Count > 0)
            {
                var statusList = status.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var item in statusList)
                {
                    statusValue += GetStStatus(item, delimiter, initialValues, formatFlag) + ",";
                }
                if (statusValue.EndsWith(","))
                {
                    statusValue = statusValue.Substring(0, statusValue.Length - 1);
                }
            }
            else
            {
                statusValue = "";
            }
        }
예제 #5
0
        private void GetTraceLogin(ref PendingStatusCompareResult compareResult)
        {
            using (var se = new SystemEntities())
            {
                try
                {
                    var loginTraceInfo =
                        se.spDA_RETSConnectionInfo_sel(compareResult.RdcCode, false).FirstOrDefault();
                    var dataSourceResult =
                        se.spDA_TCSDatasource_sel(compareResult.ModuleId.ToString(CultureInfo.InvariantCulture),
                                                  false).ToList();
                    if (dataSourceResult.Count == 0)
                    {
                        compareResult.IsDataSourceRemoved = true;
                        _loginTrace = null;
                        return;
                    }
                    foreach (var item in dataSourceResult)
                    {
                        if (!item.OriginalDataSourceID.Equals(compareResult.RdcCode))
                        {
                            continue;
                        }
                        compareResult.TraceName = item.datasourcename.Trim();
                        break;
                    }
                    if (string.IsNullOrEmpty(compareResult.TraceName) || compareResult.TraceName.EndsWith("Test", StringComparison.OrdinalIgnoreCase))
                    {
                        compareResult.IsDataSourceRemoved = true;
                        _loginTrace = null;
                    }

                    if (loginTraceInfo != null)
                    {
                        _loginTrace = new LoginInfo
                        {
                            UserName             = loginTraceInfo.RETSUserName,
                            Password             = loginTraceInfo.RETSPassword,
                            UserAgent            = loginTraceInfo.RETSUserAgent,
                            UaPassword           = loginTraceInfo.RETSUserAgentPassword,
                            ByPassAuthentication = "1"
                        };
                    }
                }
                catch (Exception ex)
                {
                    compareResult.IsDataSourceRemoved = true;
                    Log.Error(typeof(PsaManager), "Cannot retrieve log in info from Trace for Module:" + compareResult.ModuleId + ex.Message + ex.StackTrace);
                }
            }
        }
예제 #6
0
        public void WriteToReport(StreamWriter sw, PendingStatusCompareResult result)
        {
            var sb = new StringBuilder();

            sb.Append(result.ModuleId).Append(",");
            sb.Append("\"").Append(result.ModuleName).Append("\",");
            sb.Append(result.RdcCode).Append(",");
            sb.Append(result.TraceName).Append(",");
            //sb.Append(result.PropertyClass).Append(",");
            sb.Append("\"").Append(result.TcsPending).Append("\",");
            sb.Append("\"").Append(result.RdcPending).Append("\",");
            sb.Append("\"").Append(result.PendingGap).Append("\",");
            //sb.Append("\"").Append(result.TcsActive).Append("\",");
            //sb.Append("\"").Append(result.RdcActive).Append("\",");
            sb.Append("\"").Append(result.ActiveDifNotInTcs).Append("\",");
            sb.Append("\"").Append(result.ActiveDifNotInRdc).Append("\",");
            //sb.Append("\"").Append(result.TcsSold).Append("\",");
            //sb.Append("\"").Append(result.RdcSold).Append("\",");
            sb.Append("\"").Append(result.SoldDifNotInTcs).Append("\",");
            sb.Append("\"").Append(result.SoldDifNotInRdc).Append("\",");
            //sb.Append("\"").Append(result.TcsOffMarket).Append("\",");
            //sb.Append("\"").Append(result.RdcOffMarket).Append("\",");
            sb.Append("\"").Append(result.OffMarketDifNotInTcs).Append("\",");
            sb.Append("\"").Append(result.OffMarketDifNotInRdc).Append("\",");
            sb.Append("\"").Append(result.TestResult).Append("\",");
            //sb.Append("\"").Append(result.StatusRdcAccountSuccess).Append("\",");
            //sb.Append("\"").Append(result.StatusRdcAccountRequestFailed).Append("\",");
            sb.Append("\"").Append(result.StatusRdcAccountReturnNoRecord ?? "").Append("\",");
            if (result.IsTpAccountLoginSuccess || string.IsNullOrEmpty(result.StatusRdcAccountReturnNoRecord))
            {
                sb.Append("\"").Append(result.StatusHasNoListing ?? "").Append("\",");
            }
            else if (!string.IsNullOrEmpty(result.TpAccountCheckResult))
            {
                sb.Append(result.TpAccountCheckResult).Append(",");
            }
            else
            {
                sb.Append("Error - Authentication failed").Append(",");
            }
            sb.Append(result.ProdutionListingCount).Append(",");
            sb.Append(result.QaListingCount).Append(",");
            sb.Append(result.IncreaseInActiveCounts ?? "").Append(",");
            sb.Append(result.RdcCurrentPendingListingCount == 0?"":result.RdcCurrentPendingListingCount.ToString(CultureInfo.InvariantCulture)).Append(",");
            sw.WriteLine(sb.ToString());
        }
예제 #7
0
        private void CheckTpAccountAccess(ref PendingStatusCompareResult compareResult, string status)
        {
            var resultClone = compareResult;

            using (var dbPro = new TCSEntitiesProduction())
            {
                var tcsRequestLog = dbPro.tcs_request_log.Where(x => x.board_id == resultClone.BoardId && (x.function_id == 6 || x.function_id == 3)).OrderByDescending(x => x.when_created).Take(5);
                if (!tcsRequestLog.Any())
                {
                    compareResult.TpAccountCheckResult = "Error -- No account found in TCS";
                    return;
                }
                foreach (var item in tcsRequestLog)
                {
                    var request = item.request_xml;
                    if (!File.Exists(item.location_path))
                    {
                        continue;
                    }
                    var loginInfo = GetLoginInfoFromXml(File.ReadAllText(item.location_path));
                    if (loginInfo != null && !string.IsNullOrEmpty(loginInfo.UserName))
                    {
                        var returnCode = SearchByTmkRequest(compareResult, status, loginInfo);
                        if (returnCode != Enums.CheckAccountReturnCode.RequestFailed60310)
                        {
                            if (returnCode == Enums.CheckAccountReturnCode.Success)
                            {
                                if (!string.IsNullOrEmpty(compareResult.TpHasAccessStatusInRemainGap))
                                {
                                    compareResult.TpHasAccessStatusInRemainGap += "," + status;
                                }
                                else
                                {
                                    compareResult.TpHasAccessStatusInRemainGap = status;
                                }
                            }
                            compareResult.IsTpAccountLoginSuccess = true;
                            break;
                        }
                    }
                }
            }
        }
예제 #8
0
        private Enums.CheckAccountReturnCode SearchByTmkRequest(PendingStatusCompareResult compareResult, string status, LoginInfo loginInfo)
        {
            string statusName;
            string statusValue;
            string lastModidfyFieldName;
            string lastMoidfyFieldValue;
            var    helper = new PsaHelper();

            PsaHelper.GetStatusInfo(compareResult, status, out statusName, out statusValue, out lastModidfyFieldName, out lastMoidfyFieldValue);

            if (!string.IsNullOrEmpty(statusValue))
            {
                var request = string.Format(SearchRequest, GetLoginText(loginInfo),
                                            compareResult.BoardId.ToString(CultureInfo.InvariantCulture),
                                            PsaHelper.EncodeXml(compareResult.PropertyClass), statusName, statusValue, loginInfo.ByPassAuthentication);
                //, lastModidfyFieldName, DateTime.Now.AddYears(-10).ToString("MM/dd/yyyyTHH/mm/ss") + "-" + DateTime.Now.ToString("MM/dd/yyyyTHH/mm/ss"));
                return(helper.CheckRdcAccount(request));
            }

            return(Enums.CheckAccountReturnCode.NoRecordFound);
        }
예제 #9
0
        private void ProcessSearchResult(Enums.CheckAccountReturnCode code, ref PendingStatusCompareResult compareResult, string status)
        {
            switch (code)
            {
            case Enums.CheckAccountReturnCode.Success:
                if (!string.IsNullOrEmpty(compareResult.StatusRdcAccountSuccess))
                {
                    compareResult.StatusRdcAccountSuccess += "," + status;
                }
                else
                {
                    compareResult.StatusRdcAccountSuccess = status;
                }
                break;

            case Enums.CheckAccountReturnCode.RequestFailed:
                compareResult.TestResult = PsaConstants.ResultError;
                return;

            case Enums.CheckAccountReturnCode.RequestFailed60310:
                compareResult.TestResult = PsaConstants.ResultError + "Authentication Error";
                return;

            case Enums.CheckAccountReturnCode.RequestFailed60320:
                compareResult.TestResult = PsaConstants.ResultError + "Search Failed";
                return;

            case Enums.CheckAccountReturnCode.NoRecordFound:
                if (!string.IsNullOrEmpty(compareResult.StatusRdcAccountReturnNoRecord))
                {
                    compareResult.StatusRdcAccountReturnNoRecord += "," + status;
                }
                else
                {
                    compareResult.StatusRdcAccountReturnNoRecord = status;
                }
                break;
            }
        }
예제 #10
0
        public void AnlyzeAccountAccessResult(ref PendingStatusCompareResult result)
        {
            if (!string.IsNullOrEmpty(result.TestResult))
            {
                return;
            }

            if (!string.IsNullOrEmpty(result.StatusRdcAccountRequestFailed))
            {
                result.TestResult = PsaConstants.ResultError;
                return;
            }

            if (!string.IsNullOrEmpty(result.StatusRdcAccountSuccess))
            {
                if (string.IsNullOrEmpty(FindGap(result.StatusRdcAccountSuccess, result.TcsPending)))
                {
                    result.TestResult = PsaConstants.AllPendingPresent;
                }
                else
                {
                    result.TestResult = PsaConstants.PartialPending;
                }
                //else if (!string.IsNullOrEmpty(FindCommon(result.StatusRdcAccountSuccess, result.PendingGap)))
                //    result.TestResult = PsaConstants.PartialPendingImprovement;
                //else if (string.IsNullOrEmpty(FindCommon(result.StatusRdcAccountSuccess, result.PendingGap)) && string.IsNullOrEmpty(FindGap(result.StatusRdcAccountSuccess,result.RdcPending)))
                //    result.TestResult = PsaConstants.PartialPendingNoImprovement;
                //else if (!string.IsNullOrEmpty(FindGap(result.StatusRdcAccountSuccess, result.RdcPending)))
                //    result.TestResult = PsaConstants.PartialPendingWorse;
                //else if (string.IsNullOrEmpty(FindCommon(result.StatusRdcAccountSuccess, result.TcsPending)))
                //    result.TestResult = PsaConstants.NoPending;
            }
            else
            {
                result.TestResult = PsaConstants.NoPending;
            }
        }
예제 #11
0
        public void AnalyzeDef(ref PendingStatusCompareResult result)
        {
            var iniReader = new IniFile(result.DefFilePath);
            //DEFNotAvailableTo=ORCA
            var defNotAvailable = iniReader.Read("DEFNotAvailableTo", "Common") ?? "";

            if (defNotAvailable.Equals("ORCA", StringComparison.OrdinalIgnoreCase))
            {
                result.IsNotAvailableForOrca = true;
                return;
            }
            else
            {
                result.IsNotAvailableForOrca = false;
            }
            var tcpIp = iniReader.Read("TcpIp", "Common");

            if (tcpIp.Equals("10"))
            {
                result.IsOpenHouseOnlyModule = true;
                return;
            }

            result.IsOpenHouseOnlyModule = false;
            result.TcsActive             = iniReader.Read("Active", "Sorting") ?? "";
            result.TcsPending            = iniReader.Read("Pending", "Sorting") ?? "";
            result.RdcActive             = iniReader.Read("Active", "SortingPublicListingStatus") ?? "";
            result.RdcSold      = iniReader.Read("Sold", "SortingPublicListingStatus") ?? "";
            result.TcsSold      = iniReader.Read("Sold", "Sorting") ?? "";
            result.RdcOffMarket = iniReader.Read("OffMarketOrOther", "SortingPublicListingStatus") ?? "";
            result.TcsOffMarket = iniReader.Read("Expired", "Sorting") ?? "";
            if (!string.IsNullOrEmpty(result.RdcActive))
            {
                result.TcsPendingGap           = FindGap(result.TcsActive + "," + result.TcsPending, result.RdcActive);
                result.RdcPendingGap           = FindGap(result.RdcActive, result.TcsActive + "," + result.TcsPending);
                result.RdcPending              = FindCommon(result.TcsPending, result.RdcActive);
                result.PendingGap              = FindGap(result.RdcPending, result.TcsPending);
                result.ActiveDifNotInRdc       = FindGap(result.RdcActive, result.TcsActive);
                result.ActiveDifNotInTcs       = FindGap(result.TcsActive + "," + result.TcsPending, result.RdcActive);
                result.CurrentRdcPendingStatus = FindCommon(result.TcsPending, result.RdcActive);
            }
            else
            {
                result.RdcActive         = result.TcsActive;
                result.TcsPendingGap     = "";
                result.RdcPendingGap     = "";
                result.PendingGap        = result.TcsPending;
                result.RdcPending        = "";
                result.ActiveDifNotInRdc = "";
            }
            if (!string.IsNullOrEmpty(result.RdcSold))
            {
                result.SoldDifNotInTcs = FindGap(result.TcsSold, result.RdcSold);
                result.SoldDifNotInRdc = FindGap(result.RdcSold, result.TcsSold);
            }
            else
            {
                result.SoldDifNotInRdc = "";
                result.SoldDifNotInTcs = "";
            }
            if (!string.IsNullOrEmpty(result.RdcOffMarket))
            {
                result.OffMarketDifNotInTcs = FindGap(result.TcsOffMarket + "," + result.TcsPending, result.RdcOffMarket);
                result.OffMarketDifNotInRdc = FindGap(result.RdcOffMarket, result.TcsOffMarket);
            }
            else
            {
                result.OffMarketDifNotInRdc = "";
                result.OffMarketDifNotInTcs = "";
            }
        }
예제 #12
0
        private void CheckRdcAccountAccess(ref PendingStatusCompareResult compareResult)
        {
            try
            {
                GetTraceLogin(ref compareResult);
                if (compareResult.IsDataSourceRemoved)
                {
                    return;
                }

                if (string.IsNullOrEmpty(compareResult.PendingGap))
                {
                    compareResult.TestResult = PsaConstants.NoGapExisted;
                    return;
                }

                if (_loginTrace != null)
                {
                    var helper = new PsaHelper();
                    foreach (
                        var item in
                        (compareResult.TcsPending ?? "" + "," + compareResult.PendingGap + "," + compareResult.RdcPending).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Distinct())
                    {
                        var returnCode = SearchByTmkRequest(compareResult, item, _loginTrace);
                        if (returnCode == Enums.CheckAccountReturnCode.RequestFailed60310)
                        {
                            returnCode = SearchByTmkRequest(compareResult, item, _loginTrace);
                            if (returnCode == Enums.CheckAccountReturnCode.RequestFailed60310)
                            {
                                returnCode = SearchByTmkRequest(compareResult, item, _loginTrace);
                            }
                        }
                        ProcessSearchResult(returnCode, ref compareResult, item);
                    }
                    helper.AnlyzeAccountAccessResult(ref compareResult);
                    if (!string.IsNullOrEmpty(compareResult.StatusRdcAccountReturnNoRecord))
                    {
                        foreach (
                            var item in
                            (compareResult.StatusRdcAccountReturnNoRecord).Split(
                                new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Distinct())
                        {
                            CheckTpAccountAccess(ref compareResult, item);
                        }
                        compareResult.StatusHasNoListing = PsaHelper.FindGap(
                            compareResult.TpHasAccessStatusInRemainGap, compareResult.StatusRdcAccountReturnNoRecord);
                    }
                    else
                    {
                        compareResult.IsTpAccountLoginSuccess = true;
                    }
                }
                else
                {
                    compareResult.TestResult = PsaConstants.ResultError + " -- Cannot retrieve RDC credential";
                }
            }
            catch (Exception ex)
            {
                Log.Error(typeof(PsaManager), ex.Message + ex.StackTrace);
            }
        }