示例#1
0
文件: Form1.cs 项目: e74102tw/TEST
        private void ADDCompareResultToDS(int C_ID, DSCompare.DTECSDetailRow drECSD, DSCompare.DTESBDetailRow drESBD)
        {
            DSCompare.DTCompareDetailRow drDTCD = dSCompare.DTCompareDetail.NewDTCompareDetailRow();
            drDTCD.C_ID              = C_ID;
            drDTCD.ECSD_ID           = drECSD.ECSD_ID;
            drDTCD.ECSParameterName  = drECSD.ParameterName;
            drDTCD.ECSParameterValue = drECSD.ParameterValue;
            drDTCD.ECSParameterType  = drECSD.ParameterType;
            if (drESBD == null)
            {
                drDTCD.ESBD_ID           = -1;
                drDTCD.ESBParameterName  = "";
                drDTCD.ESBParameterValue = null;
                drDTCD.ESBParameterType  = "";
                drDTCD.CompareResult     = enum_CompareResult.符合.ToString();
            }
            else
            {
                drDTCD.ESBD_ID           = drESBD.ESBD_ID;
                drDTCD.ESBParameterName  = drESBD.ParameterName;
                drDTCD.ESBParameterValue = drESBD.ParameterValue;
                drDTCD.ESBParameterType  = drESBD.ParameterType;
                drDTCD.CompareResult     = drDTCD.ECSParameterValue.ToString() == drDTCD.ESBParameterValue.ToString() ? enum_CompareResult.符合.ToString() : enum_CompareResult.符合.ToString();
            }

            dSCompare.DTCompareDetail.AddDTCompareDetailRow(drDTCD);
        }
示例#2
0
文件: Form1.cs 项目: e74102tw/TEST
        private int ADDECSDataToDS(int C_ID, IMessage ECS_Data)
        {
            int ECS_ID = -1;

            if (ECS_Data == null)
            {
                return(ECS_ID);
            }
            //ECS
            DSCompare.DTECSRow drECS = dSCompare.DTECS.NewDTECSRow();
            drECS.C_ID       = C_ID;
            drECS.Action     = ECS_Data.Action;
            drECS.ResultCode = ECS_Data.ResultCode;
            drECS.Sender     = ECS_Data.Sender;
            ECS_ID           = drECS.ECS_ID;//紀錄ID
            dSCompare.DTECS.AddDTECSRow(drECS);
            //detail
            Dictionary <string, PElement> dicECS = ECS_Data.Parameters as Dictionary <string, PElement>;

            if (dicECS != null)
            {
                foreach (string key in dicECS.Keys)
                {
                    DSCompare.DTECSDetailRow drECSD = dSCompare.DTECSDetail.NewDTECSDetailRow();
                    drECSD.ECS_ID         = ECS_ID;
                    drECSD.ParameterName  = key;
                    drECSD.ParameterValue = dicECS[key].Value;
                    drECSD.ParameterType  = dicECS[key].Value.GetType().ToString();
                    dSCompare.DTECSDetail.AddDTECSDetailRow(drECSD);
                }
            }
            return(ECS_ID);
        }
示例#3
0
文件: Form1.cs 项目: e74102tw/TEST
        private enum_CompareResult GetCompareResult(int C_ID, int ECSDATACount, int ESBDATACount)
        {
            enum_CompareResult Result = enum_CompareResult.待比較;

            try
            {
                DSCompare.DTECSRow[] drECSArray = dSCompare.DTECS.Cast <DSCompare.DTECSRow>().Where(w => w.C_ID == C_ID).ToArray();
                DSCompare.DTESBRow[] drESBArray = dSCompare.DTESB.Cast <DSCompare.DTESBRow>().Where(w => w.C_ID == C_ID).ToArray();
                int ECS_ID = -1, ESB_ID = -1;
                if (drECSArray != null && drECSArray.Length > 0)
                {
                    ECS_ID = drECSArray[0].ECS_ID;
                }
                if (drESBArray != null && drESBArray.Length > 0)
                {
                    ESB_ID = drESBArray[0].ESB_ID;
                }

                DSCompare.DTECSDetailRow[] drECSDArray = dSCompare.DTECSDetail.Cast <DSCompare.DTECSDetailRow>().Where(w => w.ECS_ID == ECS_ID).ToArray();
                DSCompare.DTESBDetailRow[] drESBDArray = dSCompare.DTESBDetail.Cast <DSCompare.DTESBDetailRow>().Where(w => w.ESB_ID == ESB_ID).ToArray();

                if (ECS_ID == -1 || ESB_ID == -1 || drECSDArray == null || drESBDArray == null)
                {
                    throw new Exception("無比對資料");
                }
                List <string> Childkeys    = ESBSetting.GetChildkeys(m_Func.Trim().ToUpper());
                List <string> ChildColumns = ESBSetting.GetChildColumns(m_Func.Trim().ToUpper());
                #region 寫Compare明細
                if (Childkeys != null && Childkeys.Count() > 0)//針對Child多筆做處理
                {
                    Dictionary <string, string> lstParam = new Dictionary <string, string>();
                    for (int i = 0; i < ECSDATACount; i++)
                    {
                        lstParam.Clear();
                        foreach (string sParamName in Childkeys)
                        {
                            DSCompare.DTECSDetailRow drECSD = drECSDArray.Cast <DSCompare.DTECSDetailRow>().Where(w => w.ParameterName.Trim().ToUpper() == (sParamName + i.ToString())).FirstOrDefault();
                            if (drECSD == null)
                            {
                                continue;
                            }
                            if (lstParam.ContainsKey(sParamName))
                            {
                                lstParam[sParamName] = drECSD.ParameterValue.ToString().Trim();
                            }
                            else
                            {
                                lstParam.Add(sParamName, drECSD.ParameterValue.ToString().Trim());
                            }
                        }
                        int intESBIndex = -1;
                        intESBIndex = GetIndexWithBaseParamWithMutiKey(lstParam, C_ID, ESBDATACount);
                        foreach (string strChildColumns in ChildColumns)
                        {
                            if (strChildColumns.Trim() == "")
                            {
                                continue;
                            }
                            if (ESBSetting.isRemoveCompareItem(strChildColumns))
                            {
                                continue;
                            }
                            DSCompare.DTECSDetailRow[] drECSDSelectDArray = drECSDArray.Cast <DSCompare.DTECSDetailRow>().Where(w => w.ParameterName.Trim().ToUpper() == (strChildColumns + i.ToString())).ToArray();
                            if (drECSDSelectDArray == null || drECSDSelectDArray.Length == 0)
                            {
                                continue;
                            }
                            DSCompare.DTECSDetailRow   drECSD            = drECSDSelectDArray[0];
                            DSCompare.DTESBDetailRow[] drESBSelectDArray = drESBDArray.Cast <DSCompare.DTESBDetailRow>().Where(w => w.ParameterName.Trim().ToUpper() == (strChildColumns + intESBIndex.ToString())).ToArray();
                            if (drESBSelectDArray == null || drESBSelectDArray.Length == 0)
                            {
                                ADDCompareResultToDS(C_ID, drECSD, null);
                            }
                            else
                            {
                                ADDCompareResultToDS(C_ID, drECSD, drESBSelectDArray[0]);
                            }
                        }
                    }
                }
                else
                {
                    foreach (DSCompare.DTECSDetailRow drECSD in drECSDArray)
                    {
                        if (drECSD.ParameterName.Trim() == "")
                        {
                            continue;
                        }
                        if (ESBSetting.isRemoveCompareItem(drECSD.ParameterName.Trim(), ECSDATACount))
                        {
                            continue;
                        }
                        DSCompare.DTESBDetailRow[] drESBSelectDArray = drESBDArray.Cast <DSCompare.DTESBDetailRow>().Where(w => w.ParameterName.Trim().ToUpper() == drECSD.ParameterName.ToUpper()).ToArray();
                        if (drESBSelectDArray == null || drESBSelectDArray.Length == 0)
                        {
                            ADDCompareResultToDS(C_ID, drECSD, null);
                        }
                        else
                        {
                            ADDCompareResultToDS(C_ID, drECSD, drESBSelectDArray[0]);
                        }
                    }
                }
                #endregion
                int NotCompareCount = dSCompare.DTCompareDetail.Cast <DSCompare.DTCompareDetailRow>().Where(w => w.C_ID == C_ID && w.CompareResult == enum_CompareResult.符合.ToString()).Count();
                Result = NotCompareCount > 0 ? enum_CompareResult.符合 : enum_CompareResult.符合;
            }
            catch (Exception ex)
            {
                this.m_Log.WriteLog("GetCompareResult", ex.Message);
                Result = enum_CompareResult.比對錯誤;
            }

            return(Result);
        }