/// <summary>
        ///1.目的:將上傳檔案內容,存入暫存檔

        ///2.傳入參數:@處理檔名、@使用者
        ///  回傳參數:@處理筆數、@正確筆數、@錯誤筆數、@錯誤訊息

        ///3.處理表格:VDS_ALO_STORESPEC_TMP(T)

        ///4.處理邏輯:

        ///  4.1) 先清除前一次,同一使用者執行的匯入暫存資訊與錯誤資訊。
        ///       相關Table:VDS_ALO_STORESPEC_TM
        ///  4.2) 讀取匯入檔案到暫存資料集。
        ///  4.3) 檢查匯入檔案格式內容是否正確,如有任何錯誤,則停止上傳流程,並回傳錯誤訊息。
        ///       『XX檔案,檔案內容錯誤:@錯誤說明』 (格式請參考資料庫Table Shcema)
        ///         * 日期:檢查日期格式。
        ///         * 數字:檢查內容是否為數字。
        ///         * 文字:檢查長度是否溢位。
        ///         * 檔案欄位數是否不足。
        ///         * 檢查必填欄位是否有值:通路、店號、品號、數量、原因代碼、設定類別
        ///         * 工作表匯入內容有任一筆錯,皆視為錯誤,整批放棄。
        ///         * 匯入表格細節說明請參考:Excel文件
        ///  4.4) 格式檢查正確無誤後
        ///       a) 暫存檔中的[狀態]欄位調整為1:FILE TO TMP
        ///       b) 呼叫 [CheckData] ,檢查資料內容邏輯正確性 
        ///  4.5) 無論CheckData()檢查結果是否為True,
        ///       皆將上傳檔案內容新增到資料庫Tmp Table:,
        ///       並記錄錯誤原因、匯入者、匯入日期、處理檔案名稱=上傳檔名。

        ///5. 回傳處理結果(@處理筆數、@正確筆數、@錯誤筆數、@錯誤訊息(無錯誤時=null) )   
        /// </summary>
        public ArrayList FileToTmp(DataSet ds_Excel, DateTime d_CreateDate, string s_LoginUser, string s_VendorID, string s_DBConnString, string s_AP_FileName)
        //public ArrayList FileToTmp(DataSet ds_Excel, DateTime d_CreateDate)
        {
            #region
            int i_newTable_Count = 0;
            ArrayList arl_Return = new ArrayList();
            int i_FileToTemp_Total_count = 0;
            int ChkCount = 0;
            string strErrMsg = "";
            Int32 iErrCount = 0;
            Double doubleVal;
            ArrayList pList = new ArrayList();

            try
            {
                ParameterList.Clear();
                DataTable dt_PUR_IMPORT_TMP = GetTempTableSchema();
                PUR_PurchaseOrderDBO PUR_POSOURCE_NO_TMP = new PUR_PurchaseOrderDBO(ref USEDB);
                DBO.PUR_PurchaseOrderDBO dbo = new PUR_PurchaseOrderDBO(ref USEDB);

                foreach (System.Data.DataRow dRow in ds_Excel.Tables[0].Rows)
                {
                    iErrCount = 0;
                    strErrMsg = "";
                    //檢查資料邏輯正確性

                    //將資料寫入 TEMP TABLE
                    DataRow dRow_Temp = dt_PUR_IMPORT_TMP.NewRow();
                    dRow_Temp["CREATEDATE"] = DateTime.Parse(d_CreateDate.ToString("yyyy/MM/dd"));
                    dRow_Temp["CREATEUID"] = s_LoginUser;
                    dRow_Temp["ID"] = Convert.ToInt64(d_CreateDate.ToString("yyyyMMddHHmmss") + (i_newTable_Count + 1).ToString());
                    dRow_Temp["UPDATEDATE"] = DateTime.Parse(d_CreateDate.ToString("yyyy/MM/dd"));
                    dRow_Temp["UPDATEUID"] = s_LoginUser;
                    dRow_Temp["VENDOR"] = s_VendorID;
                    dRow_Temp["DATASOURCE"] = s_AP_FileName;
                    dRow_Temp["STATUS"] = 1;//File To TMP                    

                    string sItem = dRow[1].ToString().Trim();     //高見品號
                    string sGift = dRow[2].ToString().Trim();    //贈品品號
                    string sPeriod = dRow[3].ToString().Trim();   //期別
                    string sItemName = dRow[4].ToString().Trim(); //品名
                    string sQty = dRow[5].ToString().Trim();      //採購數量
                    string sDate = dRow[6].ToString().Trim();     //交貨日期
                    string strMsg = dRow[7].ToString().Trim();    //商品訊息

                    if ((sItem != "") || (sPeriod != "") || (sItemName != "") || (sQty != "") || (sDate != "") || (strMsg != ""))
                    {
                        // 驗證新增資料欄位是否為必填。
                        //品號                    
                        if (sItem == string.Empty)
                        {
                            strErrMsg += "品號欄位為必填,";
                        }
                        else if (CheckLength(sItem, 6, "品號", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            sItem = SubStr(sItem, 0, 6);
                        }
                        else
                        {
                            pList.Clear();
                            pList.Add(sItem);
                            DataTable dt = dbo.doQueryItem(pList);

                            if (dt.Rows.Count > 0)
                            {
                                if (s_VendorID.Trim() != dt.Rows[0]["MANUFACTURE"].ToString().Trim())
                                {
                                    strErrMsg += "該品號不屬於此供應商,";
                                }
                                else
                                {
                                    string strNowDate = DateTime.Now.ToString("yyyy/MM/dd");
                                    if (string.Compare(dt.Rows[0]["mdc_end_date"].ToString(), strNowDate) < 0)
                                    {
                                        strErrMsg += "該品號已過期,";
                                    }
                                }

                            }
                            else
                            {
                                strErrMsg += "該品號不存在商品主檔內,";
                            }
                        }
                        dRow_Temp["ITEM"] = sItem;

                        //贈品
                        if (sGift == string.Empty)
                        {
                            strErrMsg += "贈品品號為必填,";
                        }
                        else if (CheckLength(sGift, 10, "贈品品號", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            sGift = SubStr(sGift, 0, 10);
                        }
                        else if (sGift.Length < sItem.Length)
                        {
                            strErrMsg += "贈品品號前六碼需與高見品號一樣,";
                        }
                        else
                        {
                            if (sGift.Length == sItem.Length)
                            {
                                if (sGift != sItem)
                                {
                                    strErrMsg += "贈品品號前六碼需與高見品號一樣,";
                                }
                            }
                            else
                            {
                                if (sGift.Substring(0, 6) != sItem)
                                {
                                    strErrMsg += "贈品品號前六碼需與高見品號一樣,";
                                }
                                else
                                {
                                    PIC.VDS2G.BSM.MKT.MKT_GiftDBO dboGift = new PIC.VDS2G.BSM.MKT.MKT_GiftDBO(ref USEDB);
                                    pList.Clear();
                                    pList.Add(sItem);
                                    pList.Add(sPeriod);
                                    pList.Add(-1);
                                    DataTable dtGift = dboGift.doQueryGift(pList);
                                    if (dtGift.Select("ITEM='" + sItem + "' And PERIOD='" + sPeriod + "' And VIRTUAL_CODE='" + sGift + "'").Length == 0)
                                    {
                                        strErrMsg += "找不到對應的贈品品號,";
                                    }
                                }
                            }
                        }
                        dRow_Temp["VIRTUAL_CODE"] = sGift;

                        //期別
                        ChkCount = 0;
                        if (sPeriod == string.Empty)
                        {
                            strErrMsg += "期別欄位為必填,";
                        }
                        else if (CheckLength(sPeriod, 6, "期別", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            sPeriod = SubStr(sPeriod, 0, 6);
                        }
                        else
                        {
                            pList.Clear();
                            pList.Add(sItem);
                            pList.Add(sPeriod);
                            ChkCount = dbo.doCheck_Exist_Period(pList);
                            pList.Clear();

                            if (ChkCount == 0)
                            {
                                strErrMsg += "期別不存在期別主檔內,";
                            }
                        }
                        dRow_Temp["PERIOD"] = sPeriod;

                        //檢查品名                    
                        if (CheckLength(sItemName, 50, "品名", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            sItemName = SubStr(sItemName, 0, 50);
                        }
                        dRow_Temp["ITEM_NAME"] = sItemName;

                        //採購數                             
                        if (sQty == string.Empty)
                        {
                            strErrMsg += "採購數欄位為必填,";
                            dRow_Temp["PURCHASE_QTY"] = DBNull.Value;
                        }
                        else if (double.TryParse(sQty, out doubleVal) == false)
                        {
                            strErrMsg += "採購數欄位必須為數值型態,";
                            dRow_Temp["PURCHASE_QTY"] = DBNull.Value;
                        }
                        else if (CheckLength(sQty, 6, "採購數", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            sQty = SubStr(sQty, 0, 6);
                            dRow_Temp["PURCHASE_QTY"] = sQty;
                        }
                        else if (int.Parse(sQty) <= 0)
                        {
                            if (sGift != sItem && (int.Parse(sQty) == 0))
                            {
                                //贈品可以輸入零
                            }
                            else
                            {
                                strErrMsg += "採購數欄位必須大於0,";
                            }
                            dRow_Temp["PURCHASE_QTY"] = sQty;
                        }
                        else
                        {
                            dRow_Temp["PURCHASE_QTY"] = sQty;
                        }

                        //交貨日                    
                        if (sDate == string.Empty || sDate == "")
                        {
                            strErrMsg += "交貨日欄位為必填,";
                            dRow_Temp["PLAN_ACCEPT_DATE"] = DBNull.Value;
                        }
                        else if (double.TryParse(sDate, out doubleVal) == false)//(DateTime.TryParse(dRow[5].ToString().Trim(), out dateVal) == false)
                        {   //因日期格式設定為yyyyMMdd,故由此可知皆是數值,若輸入格式為yyyy-MM-dd or YYYY/MM/DD等,則代表格式輸入錯誤;
                            //或者輸入非日期值時,則代表型輸入錯。
                            //在這裡不使用 DateTime.TryParse 原因是,user的格式設定為yyyyMMdd,而TryParse對此格式會斷讀成False
                            strErrMsg += "交貨日欄位必須為日期型態或日期格式錯誤,";
                            dRow_Temp["PLAN_ACCEPT_DATE"] = DBNull.Value;
                        }
                        else
                        {
                            string sDateTmp = sDate.Insert(6, "/");
                            sDateTmp = sDateTmp.Insert(4, "/");

                            //驗證日期格式 YYYYMMDD, 範圍00010101~99991231
                            Match m = Regex.Match(sDate, "(^0000|0001|9999|[0-9]{4})+(0[1-9]|1[0-2])+(0[1-9]|[12][0-9]|3[01])$");
                            if (sDate.Substring(4, 2) == "00" || sDate.Substring(6, 2) == "00")
                            {
                                strErrMsg += "交貨日欄位資料有誤,";
                                dRow_Temp["PLAN_ACCEPT_DATE"] = DBNull.Value;
                            }
                            else if (m.Success == false)
                            {
                                strErrMsg += "交貨日欄位格式不符,";
                                dRow_Temp["PLAN_ACCEPT_DATE"] = DBNull.Value;
                            }
                            else if (DateTime.Parse(sDateTmp) < DateTime.Today)
                            {
                                strErrMsg += "交貨日欄位必須大於等於系統日期,";
                                dRow_Temp["PLAN_ACCEPT_DATE"] = sDate;
                            }
                            else
                            {
                                dRow_Temp["PLAN_ACCEPT_DATE"] = sDate;
                            }
                        }


                        //商品訊息                    
                        if (CheckLength(strMsg, 60, "商品訊息", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            strMsg = SubStr(strMsg, 0, 60);
                        }
                        dRow_Temp["MSG"] = strMsg;


                        if (strErrMsg.Trim() == string.Empty)
                        {
                            dRow_Temp["ERROR_MEMO"] = System.DBNull.Value;
                        }
                        else
                        {
                            dRow_Temp["ERROR_MEMO"] = strErrMsg;
                            iErrCount++;
                        }

                        if (iErrCount != 0)
                        {
                            dRow_Temp["DATATYPE"] = "2"; //錯誤資料                        
                        }
                        else
                        {
                            dRow_Temp["DATATYPE"] = "1"; //正常資料
                        }

                        dt_PUR_IMPORT_TMP.Rows.Add(dRow_Temp);
                        i_newTable_Count += 1;

                        i_FileToTemp_Total_count += 1;
                    }
                }

                #region 先清除前一次,同一使用者執行的匯入暫存資訊與錯誤資訊,並將 Excel 資料匯入 TEMP TABLE

                ParameterList.Clear();
                ParameterList.Add(s_LoginUser);

                DELETE_AND_INSERT_TEMP_TABLE(ParameterList, null, dt_PUR_IMPORT_TMP);
                #endregion

                int i_FileToTemp_Right_count = 0;
                int i_FileToTemp_Wrong_count = 0;

                DataTable dtCount = dbo.doQueryTmpCount(ParameterList);

                for (int i = 0; i < dtCount.Rows.Count; i++)
                {
                    if (dtCount.Rows[i]["DATATYPE"].ToString() == "1")
                        i_FileToTemp_Right_count = int.Parse(dtCount.Rows[i]["COUNTS"].ToString());

                    if (dtCount.Rows[i]["DATATYPE"].ToString() == "2")
                        i_FileToTemp_Wrong_count = int.Parse(dtCount.Rows[i]["COUNTS"].ToString());
                }

                if (i_FileToTemp_Wrong_count > 0)
                {
                    arl_Return.Add("FALSE");
                }
                else
                {
                    arl_Return.Add("TRUE");
                }

                arl_Return.Add(i_FileToTemp_Total_count);
                arl_Return.Add(i_FileToTemp_Right_count);
                arl_Return.Add(i_FileToTemp_Wrong_count);
            }
            catch (Exception ex)
            {
                arl_Return.Add("FALSE");
                arl_Return.Add(ex.Message);
            }

            return arl_Return;
            #endregion
        }
Example #2
0
        public ArrayList FileToTmp(DataSet ds_Excel, string strUID, string strPLAN_ACCEPT_DATE, string strKind, string strPICK_BATCH, string ConnectionDB, string strOrg_FileName, DataTable dtExist)
        {
            #region
            int i_newTable_Count = 0;
            ArrayList arl_Return = new ArrayList();
            int i_FileToTemp_Total_count = 0;
            string strErrMsg = "";
            string strTempMsg = "";
            Int32 iErrCount = 0;
            ArrayList ParameterList = new ArrayList();
            try
            {
                if (ds_Excel.Tables[0].Columns.Count != 4)
                {
                    arl_Return.Add("ERROR");
                    arl_Return.Add("匯入檔案發生錯誤,請檢查EXCEL檔案格式是否正確");
                    return arl_Return;
                }
                if (!((ds_Excel.Tables[0].Columns[0].Caption.Trim() == "品號") &&
                      (ds_Excel.Tables[0].Columns[1].Caption.Trim() == "期別") &&
                      (ds_Excel.Tables[0].Columns[2].Caption.Trim() == "贈品品號") &&
                      (ds_Excel.Tables[0].Columns[3].Caption.Trim() == "理貨/管制")))
                {
                    arl_Return.Add("ERROR");
                    arl_Return.Add("匯入檔案發生錯誤,請檢查EXCEL檔案格式是否正確");
                    return arl_Return;
                }

                ParameterList.Clear();
                DataTable dtTMP = new DataTable();
                dtTMP.Columns.Add("ID");
                dtTMP.Columns.Add("CREATEDATE");
                dtTMP.Columns.Add("CREATEUID");
                dtTMP.Columns.Add("UPDATEDATE");
                dtTMP.Columns.Add("UPDATEUID");
                dtTMP.Columns.Add("ITEM");
                dtTMP.Columns.Add("PERIOD");
                dtTMP.Columns.Add("VIRTUAL_CODE");
                dtTMP.Columns.Add("PICK_SELECT");
                dtTMP.Columns.Add("ERROR_MEMO");
                dtTMP.Columns.Add("STATUS");
                dtTMP.Columns.Add("DATATYPE");
                dtTMP.Columns.Add("DATASOURCE");
                dtTMP.Columns.Add("DATAKIND");

                foreach (System.Data.DataRow dRow in ds_Excel.Tables[0].Rows)
                {
                    iErrCount = 0;
                    strErrMsg = "";
                    //檢查資料邏輯正確性

                    //將資料寫入 TEMP TABLE
                    DataRow drTMP = dtTMP.NewRow();
                    DateTime dtNow = DateTime.Now;
                    drTMP["ID"] = Convert.ToInt64(dtNow.ToString("yyyyMMddHHmmss") + (i_newTable_Count + 1).ToString());
                    drTMP["CREATEDATE"] = dtNow.ToString("yyyy/MM/dd HH:mm:ss");
                    drTMP["CREATEUID"] = strUID;
                    drTMP["UPDATEDATE"] = dtNow.ToString("yyyy/MM/dd HH:mm:ss");
                    drTMP["UPDATEUID"] = strUID;
                    drTMP["STATUS"] = "1";//File To TMP                             
                    drTMP["DATASOURCE"] = strOrg_FileName;
                    drTMP["DATAKIND"] = strKind;

                    drTMP["ITEM"] = "";
                    drTMP["PERIOD"] = "";
                    drTMP["VIRTUAL_CODE"] = "";
                    drTMP["PICK_SELECT"] = "";

                    drTMP["ERROR_MEMO"] = "";
                    drTMP["DATATYPE"] = "";

                    string strITEM = dRow[0].ToString().Trim();         //品號
                    string strPERIOD = dRow[1].ToString().Trim();       //期別
                    string strVIRTUAL_CODE = dRow[2].ToString().Trim(); //贈品品號
                    string strPICK_SELECT = dRow[3].ToString().Trim();  //理貨/管制                 

                    if ((strITEM != "") || (strPERIOD != "") || (strVIRTUAL_CODE != "") || (strPICK_SELECT != ""))
                    {
                        // 驗證新增資料欄位是否為必填。
                        //品號                    
                        if (strITEM == string.Empty)
                        {
                            strErrMsg += "品號欄位為必填,";
                        }
                        else if (CheckLength(strITEM, 6, "品號", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            strITEM = SubStr(strITEM, 0, 6);
                        }
                        else
                        {
                            //檢查品號是否存在主檔
                            strTempMsg = "";
                            ParameterList.Clear();
                            ParameterList.Add(strITEM);
                            ParameterList.Add(null);
                            CheckItemData(ParameterList, out strTempMsg);
                            if (strTempMsg != "")
                            {
                                strErrMsg += strTempMsg + ",";
                            }
                        }
                        drTMP["ITEM"] = strITEM;

                        //期別                        
                        if (strPERIOD == string.Empty)
                        {
                            strErrMsg += "期別欄位為必填,";
                        }
                        else if (CheckLength(strPERIOD, 6, "期別", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            strPERIOD = SubStr(strPERIOD, 0, 6);
                        }
                        else
                        {
                            if (strErrMsg == "")//假如前面品號就有錯誤了,就不必檢查期別是否存在品號內了
                            {
                                strTempMsg = "";
                                ParameterList.Clear();
                                ParameterList.Add(strITEM);
                                ParameterList.Add(strPERIOD);
                                CheckItemData(ParameterList, out strTempMsg);
                                if (strTempMsg != "")
                                {
                                    strErrMsg += strTempMsg + ",";
                                }
                            }
                        }

                        drTMP["PERIOD"] = strPERIOD;

                        //贈品
                        if (strVIRTUAL_CODE == string.Empty)
                        {
                            strErrMsg += "贈品品號為必填,";
                        }
                        else if (CheckLength(strVIRTUAL_CODE, 10, "贈品品號", strErrMsg, iErrCount, out  strErrMsg, out  iErrCount) == false)
                        {
                            //過長
                            strVIRTUAL_CODE = SubStr(strVIRTUAL_CODE, 0, 10);
                        }
                        else if (!((strVIRTUAL_CODE.Length == 6) || (strVIRTUAL_CODE.Length == 10)))
                        {
                            strErrMsg += "贈品品號為六碼或十碼,";
                        }
                        else
                        {
                            if (strVIRTUAL_CODE.Substring(0, 6) != strITEM)
                            {
                                strErrMsg += "贈品品號前六碼需與品號一樣,";
                            }
                            else
                            {
                                if (strErrMsg == "")//假如前面品號期別就有錯誤了,就不檢查了
                                {
                                    if (strVIRTUAL_CODE.Length == 10)
                                    {
                                        PIC.VDS2G.BSM.MKT.MKT_GiftDBO dboGift = new PIC.VDS2G.BSM.MKT.MKT_GiftDBO(ref USEDB);
                                        ParameterList.Clear();
                                        ParameterList.Add(strITEM);
                                        ParameterList.Add(strPERIOD);
                                        ParameterList.Add(-1);
                                        DataTable dtGift = dboGift.doQueryGift(ParameterList);
                                        if (dtGift.Select("ITEM='" + strITEM + "' And PERIOD='" + strPERIOD + "' And VIRTUAL_CODE='" + strVIRTUAL_CODE + "'").Length == 0)
                                        {
                                            strErrMsg += "找不到對應的贈品品號,";
                                        }
                                    }
                                }
                            }
                        }

                        drTMP["VIRTUAL_CODE"] = strVIRTUAL_CODE;

                        //20130312 顏筱盈:檢查匯入的資料中,是否有重複的【品號 + 期別 + 贈品品號】
                        DataRow[] drDouble = dtTMP.Select("ITEM='" + drTMP["ITEM"].ToString().Trim() + "' And PERIOD='" + drTMP["PERIOD"].ToString().Trim() + "' And VIRTUAL_CODE='" + drTMP["VIRTUAL_CODE"].ToString().Trim() + "'");
                        if (drDouble.Length > 0)
                        {
                            strErrMsg += "品號:" + drTMP["ITEM"].ToString().Trim() + ",期別:" + drTMP["PERIOD"] + ",贈品品號:" + drTMP["VIRTUAL_CODE"] + ",重複出現在匯入的檔案中,";
                        }

                        //理貨管制設定
                        if (strPICK_SELECT == string.Empty)
                        {
                            strErrMsg += "理貨管制設定為必填,";
                        }
                        else if (!((strPICK_SELECT == "1") || (strPICK_SELECT == "2")))
                        {
                            //過長
                            strErrMsg += "理貨管制設定的值應為1或2,";
                            strPICK_SELECT = SubStr(strPICK_SELECT, 0, 1);
                        }
                        drTMP["PICK_SELECT"] = strPICK_SELECT;

                        if (strErrMsg == "")
                        {
                            string strCheckMsg = ChkDupData(dtExist, strPLAN_ACCEPT_DATE, strVIRTUAL_CODE, strPERIOD, strPICK_BATCH, strKind);
                            if (strCheckMsg != "")
                            {
                                strErrMsg = strCheckMsg + ",";
                            }
                        }

                        if (strErrMsg.Trim() == string.Empty)
                        {
                            drTMP["ERROR_MEMO"] = System.DBNull.Value;
                        }
                        else
                        {
                            if (strErrMsg.Substring(strErrMsg.Length - 1, 1) == ",")
                                strErrMsg = strErrMsg.Substring(0, strErrMsg.Length - 1);
                            drTMP["ERROR_MEMO"] = strErrMsg;
                            iErrCount++;
                        }

                        if (iErrCount != 0)
                            drTMP["DATATYPE"] = "2"; //錯誤資料                                                
                        else
                            drTMP["DATATYPE"] = "1"; //正常資料                        

                        dtTMP.Rows.Add(drTMP);
                        i_newTable_Count += 1;

                        i_FileToTemp_Total_count += 1;
                    }
                }

                #region 先清除前一次,同一使用者執行的匯入暫存資訊與錯誤資訊,並將 Excel 資料匯入 TEMP TABLE

                ParameterList.Clear();
                ParameterList.Add(strUID);

                DELETE_AND_INSERT_TEMP_TABLE(ParameterList, dtTMP);
                #endregion

                int i_FileToTemp_Right_count = 0;
                int i_FileToTemp_Wrong_count = 0;

                DBO.PUR09_DBO dbo = new PUR09_DBO(ref USEDB);
                ParameterList.Clear();
                ParameterList.Add(strUID);
                DataTable dtCount = dbo.doQueryTmpCount(ParameterList);

                for (int i = 0; i < dtCount.Rows.Count; i++)
                {
                    if (dtCount.Rows[i]["DATATYPE"].ToString() == "1")
                        i_FileToTemp_Right_count = int.Parse(dtCount.Rows[i]["COUNTS"].ToString());

                    if (dtCount.Rows[i]["DATATYPE"].ToString() == "2")
                        i_FileToTemp_Wrong_count = int.Parse(dtCount.Rows[i]["COUNTS"].ToString());
                }

                if (i_FileToTemp_Wrong_count > 0)
                {
                    arl_Return.Add("FALSE");
                }
                else
                {
                    arl_Return.Add("TRUE");
                }

                arl_Return.Add(i_FileToTemp_Total_count);
                arl_Return.Add(i_FileToTemp_Right_count);
                arl_Return.Add(i_FileToTemp_Wrong_count);
            }
            catch (Exception ex)
            {
                arl_Return.Add("ERROR");
                arl_Return.Add(ex.Message);
            }

            return arl_Return;
            #endregion
        }