Beispiel #1
0
        private static void Insert_SMSMessage(DataTable table)
        {
            classDataAccess ebankDataAccess = new classDataAccess();
            classDataAccess dwDataAccess    = new classDataAccess();

            ebankDataAccess.OpenConnection("EBANK_GW");
            dwDataAccess.OpenConnection("CW_DW");

            string message = "";
            int    result  = 0;
            int    succ_eb = 0;
            int    err_eb  = 0;
            int    succ_dw = 0;
            int    err_dw  = 0;

            //OracleCommand cmd = ebankDataAccess.AddProcedureParameterToEBankGW();           l

            foreach (DataRow row in table.Rows)
            {
                result = 0;

                //message = CreateSMSMessage(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(),
                //                                        row.ItemArray[6].ToString(), row.ItemArray[7].ToString(),
                //                                        row.ItemArray[8].ToString(), row.ItemArray[9].ToString(),
                //                                        row.ItemArray[16].ToString(), row.ItemArray[17].ToString()
                //                                        ,row.ItemArray[19].ToString()
                //                                        );
                message = CreateSMSMessage_160(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(),
                                               row.ItemArray[6].ToString(), row.ItemArray[7].ToString(),
                                               row.ItemArray[8].ToString(), row.ItemArray[9].ToString(),
                                               row.ItemArray[16].ToString(), row.ItemArray[17].ToString()
                                               , row.ItemArray[19].ToString()
                                               );
                if (string.IsNullOrEmpty(message) == false)
                {
                    if (row.ItemArray[18].ToString().Trim() == "")//giao dich cua the chinh, phone the phu se khong co
                    {
                        //string mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[15].ToString(), row.ItemArray[10].ToString());
                        if (row.ItemArray[10].ToString() == "khong co")
                        {
                            int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(
                                SMS_TYPE
                                , message
                                , row.ItemArray[10].ToString()
                                , DateTime.Parse(row.ItemArray[0].ToString())
                                //, row.ItemArray[4].ToString()
                                , row.ItemArray[15].ToString()
                                , row.ItemArray[2].ToString()
                                , row.ItemArray[3].ToString()
                                , row.ItemArray[5].ToString()                                   //    , long.Parse(row.ItemArray[5].ToString())
                                , row.ItemArray[6].ToString()                                   //    , long.Parse(row.ItemArray[6].ToString())
                                , double.Parse(row.ItemArray[7].ToString())                     //    , long.Parse(row.ItemArray[7].ToString())
                                , row.ItemArray[8].ToString()                                   //    , int.Parse(row.ItemArray[8].ToString())
                                , row.ItemArray[9].ToString()
                                , row.ItemArray[11].ToString()
                                , row.ItemArray[12].ToString()
                                , row.ItemArray[1].ToString()
                                , "Y"
                                );
                            if (flag_fpt == 0)
                            {
                                classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB DW");
                                err_dw++;
                            }
                            else
                            {
                                result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                    row.ItemArray[14].ToString()
                                    , row.ItemArray[10].ToString()
                                    , message
                                    , 'Y'                                           //Y se ko gui tin nhan, N se gui tin nhan
                                    , SMS_TYPE);
                                if (result == 0)
                                {
                                    err_eb++;
                                    classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB EB");
                                }
                                else
                                {
                                    succ_eb++;
                                }
                            }
                        }
                        else // so phone hop le
                        {
                            int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(
                                SMS_TYPE
                                , message
                                , row.ItemArray[10].ToString()
                                , DateTime.Parse(row.ItemArray[0].ToString())
                                //, row.ItemArray[4].ToString()
                                , row.ItemArray[15].ToString()
                                , row.ItemArray[2].ToString()
                                , row.ItemArray[3].ToString()
                                , row.ItemArray[5].ToString()                                //    , long.Parse(row.ItemArray[5].ToString())
                                , row.ItemArray[6].ToString()                                //    , long.Parse(row.ItemArray[6].ToString())
                                , double.Parse(row.ItemArray[7].ToString())                  //    , long.Parse(row.ItemArray[7].ToString())
                                , row.ItemArray[8].ToString()                                //    , int.Parse(row.ItemArray[8].ToString())
                                , row.ItemArray[9].ToString()
                                , row.ItemArray[11].ToString()
                                , row.ItemArray[12].ToString()
                                , row.ItemArray[1].ToString()
                                , "N"                                 //hhhh
                                );
                            if (flag_fpt == 0)
                            {
                                classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB DW");
                                err_dw++;
                            }
                            else
                            {
                                result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                    row.ItemArray[14].ToString()
                                    , row.ItemArray[10].ToString()
                                    , message
                                    , 'N'                                           //hhhh Y se ko gui tin nhan, N se gui tin nhan
                                    , SMS_TYPE);
                                if (result == 0)
                                {
                                    dwDataAccess.Update_Status_SMS(//update status sms ve loi ko gui qua EW
                                        row.ItemArray[15].ToString(),
                                        row.ItemArray[5].ToString(),
                                        row.ItemArray[11].ToString(),
                                        "E"
                                        );
                                    classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB EB");
                                    err_eb++;
                                }
                                else
                                {
                                    succ_eb++;
                                }
                            }
                        }
                    }
                    else // giao dich the phu
                    {
                        string mobile = classUtilities.GetMobileFromCardNoOfSpecialList2(row.ItemArray[15].ToString());
                        if (mobile == "000")                                //the phu khong thuoc ds dac biet
                        {
                            if (row.ItemArray[18].ToString() == "khong co") //phone the phu
                            {
                                int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(
                                    SMS_TYPE
                                    , message
                                    , row.ItemArray[18].ToString()
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[15].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()                                   //    , long.Parse(row.ItemArray[5].ToString())
                                    , row.ItemArray[6].ToString()                                   //    , long.Parse(row.ItemArray[6].ToString())
                                    , double.Parse(row.ItemArray[7].ToString())                     //    , long.Parse(row.ItemArray[7].ToString())
                                    , row.ItemArray[8].ToString()                                   //    , int.Parse(row.ItemArray[8].ToString())
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[11].ToString()
                                    , row.ItemArray[12].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "Y"
                                    );
                                if (flag_fpt == 0)
                                {
                                    classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB DW");
                                    err_dw++;
                                }
                                else
                                {
                                    result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                        row.ItemArray[14].ToString()
                                        , row.ItemArray[18].ToString()
                                        , message
                                        , 'Y'                                           //Y se ko gui tin nhan, N se gui tin nhan
                                        , SMS_TYPE);
                                    if (result == 0)
                                    {
                                        err_eb++;
                                        classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB EB");
                                    }
                                    else
                                    {
                                        succ_eb++;
                                    }
                                }
                            }
                            else // so phone hop le
                            {
                                int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(
                                    SMS_TYPE
                                    , message
                                    , row.ItemArray[18].ToString()
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[15].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()                                //    , long.Parse(row.ItemArray[5].ToString())
                                    , row.ItemArray[6].ToString()                                //    , long.Parse(row.ItemArray[6].ToString())
                                    , double.Parse(row.ItemArray[7].ToString())                  //    , long.Parse(row.ItemArray[7].ToString())
                                    , row.ItemArray[8].ToString()                                //    , int.Parse(row.ItemArray[8].ToString())
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[11].ToString()
                                    , row.ItemArray[12].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "N"                                 //hhhh
                                    );
                                if (flag_fpt == 0)
                                {
                                    classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB DW");
                                    err_dw++;
                                }
                                else
                                {
                                    result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                        row.ItemArray[14].ToString()
                                        , row.ItemArray[18].ToString()
                                        , message
                                        , 'N'                                           //hhhh Y se ko gui tin nhan, N se gui tin nhan
                                        , SMS_TYPE);
                                    if (result == 0)
                                    {
                                        dwDataAccess.Update_Status_SMS(//update status sms ve loi ko gui qua EW
                                            row.ItemArray[15].ToString(),
                                            row.ItemArray[5].ToString(),
                                            row.ItemArray[11].ToString(),
                                            "E"
                                            );
                                        classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB EB");
                                        err_eb++;
                                    }
                                    else
                                    {
                                        succ_eb++;
                                    }
                                }
                            }
                            if (row.ItemArray[10].ToString() == "khong co") //phone the chinh
                            {
                                int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(
                                    SMS_TYPE
                                    , message
                                    , row.ItemArray[10].ToString()
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[15].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()                                   //    , long.Parse(row.ItemArray[5].ToString())
                                    , row.ItemArray[6].ToString()                                   //    , long.Parse(row.ItemArray[6].ToString())
                                    , double.Parse(row.ItemArray[7].ToString())                     //    , long.Parse(row.ItemArray[7].ToString())
                                    , row.ItemArray[8].ToString()                                   //    , int.Parse(row.ItemArray[8].ToString())
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[11].ToString()
                                    , row.ItemArray[12].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "Y"
                                    );
                                if (flag_fpt == 0)
                                {
                                    classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB DW");
                                    err_dw++;
                                }
                                else
                                {
                                    result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                        row.ItemArray[18].ToString()
                                        , row.ItemArray[10].ToString()
                                        , message
                                        , 'Y'                                           //Y se ko gui tin nhan, N se gui tin nhan
                                        , SMS_TYPE);
                                    if (result == 0)
                                    {
                                        err_eb++;
                                        classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB EB");
                                    }
                                    else
                                    {
                                        succ_eb++;
                                    }
                                }
                            }
                            else // so phone hop le
                            {
                                int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(
                                    SMS_TYPE
                                    , message
                                    , row.ItemArray[10].ToString()
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[15].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()                                //    , long.Parse(row.ItemArray[5].ToString())
                                    , row.ItemArray[6].ToString()                                //    , long.Parse(row.ItemArray[6].ToString())
                                    , double.Parse(row.ItemArray[7].ToString())                  //    , long.Parse(row.ItemArray[7].ToString())
                                    , row.ItemArray[8].ToString()                                //    , int.Parse(row.ItemArray[8].ToString())
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[11].ToString()
                                    , row.ItemArray[12].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "N"                                 //hhhh
                                    );
                                if (flag_fpt == 0)
                                {
                                    classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB DW");
                                    err_dw++;
                                }
                                else
                                {
                                    result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                        row.ItemArray[14].ToString()
                                        , row.ItemArray[10].ToString()
                                        , message
                                        , 'N'                                           //hhhh Y se ko gui tin nhan, N se gui tin nhan
                                        , SMS_TYPE);
                                    if (result == 0)
                                    {
                                        dwDataAccess.Update_Status_SMS(//update status sms ve loi ko gui qua EW
                                            row.ItemArray[15].ToString(),
                                            row.ItemArray[5].ToString(),
                                            row.ItemArray[11].ToString(),
                                            "E"
                                            );
                                        classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB EB");
                                        err_eb++;
                                    }
                                    else
                                    {
                                        succ_eb++;
                                    }
                                }
                            }
                        }
                        else // the phu thuoc ds dac biet
                        {
                            if (row.ItemArray[10].ToString() == "khong co")
                            {
                                int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(
                                    SMS_TYPE
                                    , message
                                    , mobile                                   //    ,long.Parse(row.ItemArray[10].ToString())
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[15].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()                                   //    , long.Parse(row.ItemArray[5].ToString())
                                    , row.ItemArray[6].ToString()                                   //    , long.Parse(row.ItemArray[6].ToString())
                                    , double.Parse(row.ItemArray[7].ToString())                     //    , long.Parse(row.ItemArray[7].ToString())
                                    , row.ItemArray[8].ToString()                                   //    , int.Parse(row.ItemArray[8].ToString())
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[11].ToString()
                                    , row.ItemArray[12].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "Y"
                                    );
                                if (flag_fpt == 0)
                                {
                                    classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB DW");
                                    err_dw++;
                                }
                                else
                                {
                                    result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                        row.ItemArray[14].ToString()
                                        , mobile
                                        , message
                                        , 'Y'                                           //Y se ko gui tin nhan, N se gui tin nhan
                                        , SMS_TYPE);
                                    if (result == 0)
                                    {
                                        err_eb++;
                                        classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB EB");
                                    }
                                    else
                                    {
                                        succ_eb++;
                                    }
                                }
                            }
                            else // so phone hop le
                            {
                                int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(
                                    SMS_TYPE
                                    , message
                                    , mobile                                //    ,long.Parse(row.ItemArray[10].ToString())
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[15].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()                                //    , long.Parse(row.ItemArray[5].ToString())
                                    , row.ItemArray[6].ToString()                                //    , long.Parse(row.ItemArray[6].ToString())
                                    , double.Parse(row.ItemArray[7].ToString())                  //    , long.Parse(row.ItemArray[7].ToString())
                                    , row.ItemArray[8].ToString()                                //    , int.Parse(row.ItemArray[8].ToString())
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[11].ToString()
                                    , row.ItemArray[12].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "N"                                 //hhhh
                                    );
                                if (flag_fpt == 0)
                                {
                                    classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB DW");
                                    err_dw++;
                                }
                                else
                                {
                                    result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                        row.ItemArray[14].ToString()
                                        , mobile
                                        , message
                                        , 'N'                                           //hhhh Y se ko gui tin nhan, N se gui tin nhan
                                        , SMS_TYPE);
                                    if (result == 0)
                                    {
                                        dwDataAccess.Update_Status_SMS(//update status sms ve loi ko gui qua EW
                                            row.ItemArray[15].ToString(),
                                            row.ItemArray[5].ToString(),
                                            row.ItemArray[11].ToString(),
                                            "E"
                                            );
                                        classDKIPPLogWriter.WriteLog("err: card no " + row.ItemArray[15].ToString() + " can't insert DB EB");
                                        err_eb++;
                                    }
                                    else
                                    {
                                        succ_eb++;
                                    }
                                }
                            }
                        }
                    }
                    //
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classDKIPPLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + succ_eb);
            classDKIPPLogWriter.WriteLog("Message loi khong Insert vao EbankGW: " + err_eb);
            classDKIPPLogWriter.WriteLog("Message da duoc Insert vao DW thanh cong: " + succ_dw);
            classDKIPPLogWriter.WriteLog("Message loi khong Insert vao DW: " + err_dw);
            return;
        }
Beispiel #2
0
        private static void Insert_SMSMessage(DataTable table)
        {
            classDataAccess ebankDataAccess = new classDataAccess();
            classDataAccess dwDataAccess    = new classDataAccess();

            ebankDataAccess.OpenConnection("EBANK_GW");//hhhh
            dwDataAccess.OpenConnection("CW_DW");

            string message = "";
            int    result  = 0;
            int    succ_eb = 0;
            int    err_eb  = 0;
            int    succ_dw = 0;
            int    err_dw  = 0;

            //OracleCommand cmd = ebankDataAccess.AddProcedureParameterToEBankGW();           l

            foreach (DataRow row in table.Rows)
            {
                result  = 0;
                message = CreateSMSMessage(row.ItemArray[2].ToString(), row.ItemArray[3].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(),
                                           row.ItemArray[6].ToString(), row.ItemArray[10].ToString(), row.ItemArray[11].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString());

                if (string.IsNullOrEmpty(message) == false)
                {
                    //string mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[15].ToString(), row.ItemArray[10].ToString());
                    if (row.ItemArray[10].ToString() == "khong co")
                    {
                        int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(SMS_TYPE, message, row.ItemArray[7].ToString(),
                                                                      DateTime.Parse(row.ItemArray[0].ToString()), row.ItemArray[9].ToString()
                                                                      , row.ItemArray[2].ToString(), "", row.ItemArray[4].ToString(), row.ItemArray[5].ToString()
                                                                      , double.Parse(row.ItemArray[6].ToString()), "", "", "", "", row.ItemArray[1].ToString(), "Y");

                        if (flag_fpt == 0)
                        {
                            classCapPhepGDLogWriter.WriteLog("err: card no " + row.ItemArray[9].ToString() + " can't insert DB DW");
                            err_dw++;
                        }
                        else
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW_2(row.ItemArray[8].ToString(), row.ItemArray[7].ToString(), message,
                                                                                 'Y'
                                                                                 , SMS_TYPE);


                            if (result == 0)
                            {
                                err_eb++;
                                classCapPhepGDLogWriter.WriteLog("err: card no " + row.ItemArray[9].ToString() + " can't insert DB EB");
                            }
                            else
                            {
                                succ_eb++;
                            }
                        }
                    }
                    else     // so phone hop le
                    {
                        int flag_fpt = dwDataAccess.InsertGD_SMS_ToDW(SMS_TYPE, message, row.ItemArray[7].ToString(),
                                                                      DateTime.Parse(row.ItemArray[0].ToString()), row.ItemArray[9].ToString()
                                                                      , row.ItemArray[2].ToString(), "", row.ItemArray[4].ToString(), row.ItemArray[5].ToString()
                                                                      , double.Parse(row.ItemArray[6].ToString()), "", "", "", "", row.ItemArray[1].ToString(), "N");
                        if (flag_fpt == 0)
                        {
                            classCapPhepGDLogWriter.WriteLog("err: card no " + row.ItemArray[9].ToString() + " can't insert DB DW");
                            err_dw++;
                        }
                        else
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW_2(row.ItemArray[8].ToString(), row.ItemArray[7].ToString(), message,
                                                                                 'N'
                                                                                 , SMS_TYPE);
                            if (result == 0)
                            {
                                dwDataAccess.Update_Status_SMS_CPGD(    //update status sms ve loi ko gui qua EW
                                    row.ItemArray[9].ToString(),
                                    row.ItemArray[4].ToString(),
                                    row.ItemArray[1].ToString(),
                                    "E"
                                    );
                                classCapPhepGDLogWriter.WriteLog("err: card no " + row.ItemArray[9].ToString() + " can't insert DB EB");
                                err_eb++;
                            }
                            else
                            {
                                succ_eb++;
                            }
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classCapPhepGDLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + succ_eb);
            classCapPhepGDLogWriter.WriteLog("Message loi khong Insert vao EbankGW: " + err_eb);
            classCapPhepGDLogWriter.WriteLog("Message da duoc Insert vao DW thanh cong: " + succ_dw);
            classCapPhepGDLogWriter.WriteLog("Message loi khong Insert vao DW: " + err_dw);
            return;
        }