Example #1
0
        private static void SendSMSForCrea_Card(string mobile, string sms)
        {
            try
            {
                string          SMS_TYPE        = "SMSME";
                classDataAccess ebankDataAccess = new classDataAccess();
                ebankDataAccess.OpenConnection("EBANK_GW");



                ebankDataAccess.InsertSMSMessateToEBankGW_2(classDataAccess.IDALERT
                                                            , mobile //classUtilities.GetRandomMobile()
                                                            , sms
                                                            , 'N'    //Y: (se ko gui tin nhan),//N: se gui tin nhan
                                                            , SMS_TYPE);
                ebankDataAccess.CloseConnection();
            }
            catch (Exception ex)
            {
                classCheckDueDateLogWriter.WriteLog("Error SendSMSForCrea_Card():" + ex.Message);
            }
        }
Example #2
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    count     = 0;
            int    count_err = 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[16].ToString(), row.ItemArray[17].ToString());
                /////////
                //string month = System.DateTime.Today.ToString("yyyyMM");
                //message = CreateSMSMessage_new(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[16].ToString(), row.ItemArray[17].ToString(), month);
                if (string.IsNullOrEmpty(message) == false)
                {
                    //string mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[4].ToString(), row.ItemArray[10].ToString());
                    string mobile = row.ItemArray[10].ToString();
                    if (row.ItemArray[10].ToString() == "khong co")
                    {
                        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);
                    }
                    else
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                            row.ItemArray[14].ToString()
                            , mobile
                            , message
                            , 'N'                                                //Y se ko gui tin nhan, N se gui tin nhan
                            , SMS_TYPE);
                    }
                    if (result == 1)
                    {
                        if (row.ItemArray[10].ToString() == "khong co")
                        {
                            count += dwDataAccess.InsertGDTangTienSMSToDW(
                                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"
                                );
                        }
                        else
                        {
                            count += dwDataAccess.InsertGDTangTienSMSToDW(
                                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"
                                );
                        }
                    }
                    else
                    {
                        count_err += dwDataAccess.InsertGDTangTienSMSToDW(
                            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()
                            , "E"
                            );
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classGDTangTienLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + count);
            classGDTangTienLogWriter.WriteLog("Message loi khong Insert vao EbankGW: " + count_err);
            return;
        }
Example #3
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;
        }
Example #4
0
        private static void Insert_SMSMessage_S(DataTable table)
        {
            classDataAccess ebankDataAccess = new classDataAccess();
            classDataAccess dwDataAccess    = new classDataAccess();

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

            string message     = "";
            int    resultDW    = 0;
            int    resultGW    = 0;
            int    countDW     = 0;
            int    count_errDW = 0;
            int    countGW     = 0;
            int    count_errGW = 0;

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

            foreach (DataRow row in table.Rows)
            {
                resultDW = 0;
                resultGW = 0;
                message  = "";//reset
                //message = CreateSMSMessageS(row.ItemArray[5].ToString(), row.ItemArray[1].ToString(), row.ItemArray[3].ToString(),
                //                                        row.ItemArray[2].ToString(), row.ItemArray[4].ToString());
                message = CreateSMSMessageFailAnnualFee(row.ItemArray[5].ToString(), row.ItemArray[1].ToString(), row.ItemArray[3].ToString(),
                                                        row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[16].ToString(), row.ItemArray[17].ToString());


                if (string.IsNullOrEmpty(message) == false)
                {
                    //string mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[10].ToString(), row.ItemArray[7].ToString());
                    string mobile = row.ItemArray[7].ToString();

                    if (row.ItemArray[10].ToString() == "khong co")
                    {
                        resultDW = dwDataAccess.InsertBlockAndFailAnnualFeeSMSToDW(
                            SMS_TYPE
                            , message
                            , mobile                                //    ,long.Parse(row.ItemArray[10].ToString())
                            , DateTime.Parse(row.ItemArray[0].ToString())
                            //, row.ItemArray[4].ToString()
                            , row.ItemArray[10].ToString()
                            , row.ItemArray[5].ToString()
                            , row.ItemArray[6].ToString()
                            , row.ItemArray[3].ToString()                                //    , long.Parse(row.ItemArray[5].ToString())
                            , row.ItemArray[2].ToString()                                //    , long.Parse(row.ItemArray[6].ToString())
                            , row.ItemArray[4].ToString()                                //    , long.Parse(row.ItemArray[7].ToString())
                            , row.ItemArray[8].ToString()                                //    , int.Parse(row.ItemArray[8].ToString())
                            , "Y"
                            );
                    }
                    else
                    {
                        resultDW = dwDataAccess.InsertBlockAndFailAnnualFeeSMSToDW(
                            SMS_TYPE
                            , message
                            , mobile                                //    ,long.Parse(row.ItemArray[10].ToString())
                            , DateTime.Parse(row.ItemArray[0].ToString())
                            //, row.ItemArray[4].ToString()
                            , row.ItemArray[10].ToString()
                            , row.ItemArray[5].ToString()
                            , row.ItemArray[6].ToString()
                            , row.ItemArray[3].ToString()                                //    , long.Parse(row.ItemArray[5].ToString())
                            , row.ItemArray[2].ToString()                                //    , long.Parse(row.ItemArray[6].ToString())
                            , row.ItemArray[4].ToString()                                //    , long.Parse(row.ItemArray[7].ToString())
                            , row.ItemArray[8].ToString()                                //    , int.Parse(row.ItemArray[8].ToString())
                            , "N"
                            );
                    }
                    if (resultDW == 1)
                    {
                        countDW++;
                        if (row.ItemArray[7].ToString() == "khong co")
                        {
                            resultGW = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                row.ItemArray[9].ToString()
                                , mobile
                                , message
                                , 'Y'                                               //Y se ko gui tin nhan, N se gui tin nhan
                                , SMS_TYPE);
                        }
                        else
                        {
                            resultGW = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                row.ItemArray[9].ToString()
                                , mobile
                                , message
                                , 'N'                                                //Y se ko gui tin nhan, N se gui tin nhan
                                , SMS_TYPE);
                        }
                        if (resultGW == 1)
                        {
                            countGW++;
                        }
                        else
                        {
                            count_errGW++;
                        }
                    }
                    else
                    {
                        count_errDW++;
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classBlockAndFailAnnualFeeLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + countGW);
            classBlockAndFailAnnualFeeLogWriter.WriteLog("Message loi khong Insert vao EbankGW: " + count_errGW);
            classBlockAndFailAnnualFeeLogWriter.WriteLog("Message da duoc Insert vao DW thanh cong: " + countDW);
            classBlockAndFailAnnualFeeLogWriter.WriteLog("Message loi khong Insert vao DW: " + count_errDW);
            return;
        }
Example #5
0
        private static void Insert_SMSMessage(DataTable table, string month)
        {
            classDataAccess ebankDataAccess = new classDataAccess();
            classDataAccess dwDataAccess    = new classDataAccess();

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

            string message   = "";
            int    result    = 0;
            int    count     = 0;
            int    count_err = 0;

            //string expiredDate_P = DateTime.Today.Month.ToString()+"/"+DateTime.Today.Year.ToString();
            foreach (DataRow row in table.Rows)
            {
                result = 0;

                message = CreateSMSMessage(row.ItemArray[4].ToString(), row.ItemArray[0].ToString(), row.ItemArray[1].ToString(), month);

                if (string.IsNullOrEmpty(message) == false)
                {
                    string mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[0].ToString(), row.ItemArray[2].ToString());
                    if (row.ItemArray[2].ToString() == "khong co")
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW_2( //classDataAccess.IDALERT
                            row.ItemArray[7].ToString()
                            , mobile                                          //row.ItemArray[2].ToString() //classDataAccess.MYPHONE
                            , message
                            , 'Y'                                             //Y se ko gui tin nhan, N se gui tin nhan
                            , SMS_TYPE);
                    }
                    else
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW_2( //classDataAccess.IDALERT
                            row.ItemArray[7].ToString()
                            , mobile                                          //row.ItemArray[2].ToString() //classDataAccess.MYPHONE
                            , message
                            , 'N'                                             //Y se ko gui tin nhan, N se gui tin nhan
                            , SMS_TYPE);
                    }
                    if (result == 1)
                    {
                        if (row.ItemArray[2].ToString() == "khong co")
                        {
                            count += dwDataAccess.InsertThuNoFailToDW(SMS_TYPE, message
                                                                      , row.ItemArray[2].ToString() //    ,long.Parse(row.ItemArray[10].ToString())
                                                                      , DateTime.Now
                                                                                                    //, row.ItemArray[0].ToString()
                                                                      , row.ItemArray[8].ToString()
                                                                      , row.ItemArray[4].ToString()
                                                                      , row.ItemArray[3].ToString()
                                                                      , row.ItemArray[1].ToString()
                                                                      , "Y"
                                                                      , row.ItemArray[9].ToString()
                                                                      );
                        }
                        else
                        {
                            count += dwDataAccess.InsertThuNoFailToDW(SMS_TYPE, message
                                                                      , row.ItemArray[2].ToString() //    ,long.Parse(row.ItemArray[10].ToString())
                                                                      , DateTime.Now
                                                                                                    //, row.ItemArray[0].ToString()
                                                                      , row.ItemArray[8].ToString()
                                                                      , row.ItemArray[4].ToString()
                                                                      , row.ItemArray[3].ToString()
                                                                      , row.ItemArray[1].ToString()
                                                                      , "N"
                                                                      , row.ItemArray[9].ToString()
                                                                      );
                        }
                    }
                    else
                    {
                        count_err += dwDataAccess.InsertThuNoFailToDW(SMS_TYPE, message
                                                                      , row.ItemArray[2].ToString() //    ,long.Parse(row.ItemArray[10].ToString())
                                                                      , DateTime.Now
                                                                                                    //, row.ItemArray[0].ToString()
                                                                      , row.ItemArray[8].ToString()
                                                                      , row.ItemArray[4].ToString()
                                                                      , row.ItemArray[3].ToString()
                                                                      , row.ItemArray[1].ToString()
                                                                      , "E"
                                                                      , row.ItemArray[9].ToString()
                                                                      );
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classThuNoFailLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + count);
            classThuNoFailLogWriter.WriteLog("Message loi khong Insert vao EbankGW: " + count_err);
            return;
        }
Example #6
0
        private static void Insert_SMSMessage_Email(DataTable table)
        {
            try
            {
                classDataAccess ebankDataAccess = new classDataAccess();
                classDataAccess dwDataAccess    = new classDataAccess();
                ebankDataAccess.OpenConnection("EBANK_GW");
                dwDataAccess.OpenConnection("CW_DW");

                string message   = "";
                int    result    = 0;
                int    count     = 0;
                int    count2    = 0;
                int    count_err = 0;
                foreach (DataRow row in table.Rows)
                {
                    string   due_date   = row.ItemArray[6].ToString();
                    DateTime dua_date_p = new DateTime(int.Parse(due_date.Substring(0, 4)), int.Parse(due_date.Substring(4, 2)), int.Parse(due_date.Substring(6, 2)));

                    if (System.DateTime.Today == dua_date_p.AddDays(classUtilities.GetIntValueFromConfig("date1_NoQuaHan")) ||
                        System.DateTime.Today == dua_date_p.AddDays(classUtilities.GetIntValueFromConfig("date2_NoQuaHan")) ||
                        System.DateTime.Today == dua_date_p.AddDays(classUtilities.GetIntValueFromConfig("date3_NoQuaHan"))
                        )
                    //if (1 == 1) //hhhh
                    {
                        result = 0;

                        //message = CreateSMSMessage(row.ItemArray[1].ToString(), row.ItemArray[0].ToString(), row.ItemArray[10].ToString(), row.ItemArray[8].ToString(), row.ItemArray[11].ToString(), row.ItemArray[14].ToString(), row.ItemArray[15].ToString());
                        message = CreateSMSMessage_new(row.ItemArray[1].ToString(), row.ItemArray[0].ToString(), DateTime.Parse(row.ItemArray[10].ToString()), row.ItemArray[8].ToString(), row.ItemArray[11].ToString(), row.ItemArray[14].ToString(), row.ItemArray[15].ToString());

                        if (string.IsNullOrEmpty(message) == false)
                        {
                            string mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[0].ToString(), row.ItemArray[3].ToString());
                            if (row.ItemArray[3].ToString() == "khong co")
                            {
                                result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                    row.ItemArray[12].ToString()
                                    , mobile
                                    , message
                                    , 'Y'                                           //Y se ko gui tin nhan, N se gui tin nhan
                                    , SMS_TYPE);
                            }
                            else
                            {
                                //result = 1;
                                result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                    row.ItemArray[12].ToString()
                                    , mobile
                                    , message
                                    , 'N'                                               //Y se ko gui tin nhan, N se gui tin nhan
                                    , SMS_TYPE);
                            }
                            if (result == 1)
                            {
                                int temp = dwDataAccess.Insert_MASTERCARD_EMAIL
                                           (
                                    row.ItemArray[4].ToString()
                                    , row.ItemArray[2].ToString()
                                    , double.Parse(row.ItemArray[5].ToString())
                                    , double.Parse(row.ItemArray[11].ToString())
                                    , double.Parse(row.ItemArray[8].ToString())
                                    , row.ItemArray[1].ToString()
                                           );

                                if (temp == 1)
                                {
                                    int temp2 = 0;
                                    if (row.ItemArray[3].ToString() == "khong co")
                                    {
                                        temp2 = dwDataAccess.InsertNoQuaHanSMSToDW(
                                            SMS_TYPE
                                            , message
                                            , mobile
                                            , DateTime.Parse(row.ItemArray[10].ToString())
                                            //, row.ItemArray[0].ToString()
                                            , row.ItemArray[13].ToString()
                                            , row.ItemArray[1].ToString()
                                            , row.ItemArray[9].ToString()
                                            , "Y"
                                            );
                                    }
                                    else
                                    {
                                        temp2 = dwDataAccess.InsertNoQuaHanSMSToDW(
                                            SMS_TYPE
                                            , message
                                            , mobile
                                            , DateTime.Parse(row.ItemArray[10].ToString())
                                            //, row.ItemArray[0].ToString()
                                            , row.ItemArray[13].ToString()
                                            , row.ItemArray[1].ToString()
                                            , row.ItemArray[9].ToString()
                                            , "N"
                                            );
                                    }

                                    count++;
                                    if (temp2 == 1)
                                    {
                                        count2++;
                                    }
                                }
                            }
                            else
                            {
                                count_err = dwDataAccess.InsertNoQuaHanSMSToDW(
                                    SMS_TYPE
                                    , message
                                    , mobile
                                    , DateTime.Parse(row.ItemArray[10].ToString())
                                    //, row.ItemArray[0].ToString()
                                    , row.ItemArray[13].ToString()
                                    , row.ItemArray[1].ToString()
                                    , row.ItemArray[9].ToString()
                                    , "E"
                                    );
                            }
                        }
                    }
                }
                ebankDataAccess.CloseConnection();
                dwDataAccess.CloseConnection();
                classNoQuaHanLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + count2);
                classNoQuaHanLogWriter.WriteLog("Message loi khong Insert vao EbankGW: " + count_err);
                classNoQuaHanLogWriter.WriteLog("Message da duoc Insert vao XMIS thanh cong: " + count);
            }
            catch (Exception e)
            {
                classNoQuaHanLogWriter.WriteLog("Err Insert_SMSMessage_Email(): " + e.ToString());
            }
        }
        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    count   = 0;

            foreach (DataRow row in table.Rows)
            {
                result  = 0;
                message = CreateSMSMessage(row.ItemArray[4].ToString(), row.ItemArray[2].ToString(), row.ItemArray[5].ToString(),
                                           row.ItemArray[6].ToString(), row.ItemArray[7].ToString(), row.ItemArray[8].ToString(),
                                           row.ItemArray[10].ToString(), row.ItemArray[11].ToString(), row.ItemArray[12].ToString()
                                           , row.ItemArray[13].ToString());
                if (string.IsNullOrEmpty(message) == false)
                {
                    //mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[2].ToString(), row.ItemArray[1].ToString());
                    if (row.ItemArray[1].ToString() == "khong co")
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW_2(classDataAccess.IDALERT
                                                                             , row.ItemArray[1].ToString() // classDataAccess.MYPHONE
                                                                             , message
                                                                             , 'Y'                         //Sent (Y se ko gui tin nhan)
                                                                             , SMS_TYPE);
                    }
                    else
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW_2(classDataAccess.IDALERT
                                                                             , row.ItemArray[1].ToString() // classDataAccess.MYPHONE
                                                                             , message
                                                                             , 'N'                         //hhhh Sent (N se gui tin nhan, Y se ko gui tin nhan)
                                                                             , SMS_TYPE);
                    }
                    if (result == 1)
                    {
                        if (row.ItemArray[1].ToString() == "khong co")
                        {
                            count += dwDataAccess.InsertReminderPayment_2SMSToDW(SMS_TYPE, message
                                                                                 , row.ItemArray[1].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                                 , DateTime.Parse(row.ItemArray[0].ToString())
                                                                                 , row.ItemArray[9].ToString()
                                                                                 , row.ItemArray[4].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())
                                                                                 , row.ItemArray[7].ToString() //    , long.Parse(row.ItemArray[7].ToString())
                                                                                 , row.ItemArray[8].ToString() //    , int.Parse(row.ItemArray[8].ToString())
                                                                                 , "Y"
                                                                                 );
                        }
                        else
                        {
                            count += dwDataAccess.InsertReminderPayment_2SMSToDW(SMS_TYPE, message
                                                                                 , row.ItemArray[1].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                                 , DateTime.Parse(row.ItemArray[0].ToString())
                                                                                 , row.ItemArray[9].ToString()
                                                                                 , row.ItemArray[4].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())
                                                                                 , row.ItemArray[7].ToString() //    , long.Parse(row.ItemArray[7].ToString())
                                                                                 , row.ItemArray[8].ToString() //    , int.Parse(row.ItemArray[8].ToString())
                                                                                 , "N"                         //hhhh (N se gui tin nhan, Y se ko gui tin nhan)
                                                                                 );
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classReminderPayment2LogWriter.WriteLog("So luong message da duoc Insert vao EbankGW thanh cong: " + count);
            return;
        }
Example #8
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;
        }
Example #9
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    count     = 0;
            int    count_err = 0;

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

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

                message = CreateSMSMessage(row.ItemArray[5].ToString(), row.ItemArray[1].ToString(), row.ItemArray[3].ToString(),
                                           row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[11].ToString(), row.ItemArray[12].ToString());
                if (string.IsNullOrEmpty(message) == false)
                {
                    //string mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[10].ToString(), row.ItemArray[7].ToString());
                    string count_act = _dataAccess.Get_First_Activate(row.ItemArray[10].ToString());
                    string count_rep = _dataAccess.Get_Reply_Card(row.ItemArray[10].ToString());
                    if (count_act == "1" && count_rep == "0" && row.ItemArray[13].ToString() == row.ItemArray[3].ToString())//count_rep=0: the chua thay the, count_act=1: active lan dau, ngay active=ngay thu phi
                    {
                        classAnnual_FeeLogWriter.WriteLog("khong gui sms cho lan thu phi dau: card=" + row.ItemArray[10].ToString());
                    }
                    else
                    {
                        if (row.ItemArray[7].ToString() == "khong co")
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                row.ItemArray[9].ToString()
                                //, mobile
                                , row.ItemArray[7].ToString()
                                , message
                                , 'Y'                                               //Y se ko gui tin nhan, N se gui tin nhan
                                , SMS_TYPE);
                        }
                        else
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW_2(//classDataAccess.IDALERT
                                row.ItemArray[9].ToString()
                                //, mobile
                                , row.ItemArray[7].ToString()
                                , message
                                , 'N'                                                //Y se ko gui tin nhan, N se gui tin nhan
                                , SMS_TYPE);
                        }
                        if (result == 1)
                        {
                            if (row.ItemArray[10].ToString() == "khong co")
                            {
                                count += dwDataAccess.InsertAnnualFeeSMSToDW(
                                    SMS_TYPE
                                    , message
                                    //, mobile//    ,long.Parse(row.ItemArray[10].ToString())
                                    , row.ItemArray[7].ToString()
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[10].ToString()
                                    , row.ItemArray[5].ToString()
                                    , row.ItemArray[6].ToString()
                                    , row.ItemArray[3].ToString()                                //    , long.Parse(row.ItemArray[5].ToString())
                                    , row.ItemArray[2].ToString()                                //    , long.Parse(row.ItemArray[6].ToString())
                                    , double.Parse(row.ItemArray[4].ToString())                  //    , long.Parse(row.ItemArray[7].ToString())
                                    , row.ItemArray[8].ToString()                                //    , int.Parse(row.ItemArray[8].ToString())
                                    , "Y"
                                    );
                            }
                            else
                            {
                                count += dwDataAccess.InsertAnnualFeeSMSToDW(
                                    SMS_TYPE
                                    , message
                                    //, mobile//    ,long.Parse(row.ItemArray[10].ToString())
                                    , row.ItemArray[7].ToString()
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[10].ToString()
                                    , row.ItemArray[5].ToString()
                                    , row.ItemArray[6].ToString()
                                    , row.ItemArray[3].ToString()                                //    , long.Parse(row.ItemArray[5].ToString())
                                    , row.ItemArray[2].ToString()                                //    , long.Parse(row.ItemArray[6].ToString())
                                    , double.Parse(row.ItemArray[4].ToString())                  //    , long.Parse(row.ItemArray[7].ToString())
                                    , row.ItemArray[8].ToString()                                //    , int.Parse(row.ItemArray[8].ToString())
                                    , "N"
                                    );
                            }
                        }
                        else
                        {
                            count_err += dwDataAccess.InsertAnnualFeeSMSToDW(
                                SMS_TYPE
                                , message
                                //, mobile//    ,long.Parse(row.ItemArray[10].ToString())
                                , row.ItemArray[7].ToString()
                                , DateTime.Parse(row.ItemArray[0].ToString())
                                //, row.ItemArray[4].ToString()
                                , row.ItemArray[10].ToString()
                                , row.ItemArray[5].ToString()
                                , row.ItemArray[6].ToString()
                                , row.ItemArray[3].ToString()                                    //    , long.Parse(row.ItemArray[5].ToString())
                                , row.ItemArray[2].ToString()                                    //    , long.Parse(row.ItemArray[6].ToString())
                                , double.Parse(row.ItemArray[4].ToString())                      //    , long.Parse(row.ItemArray[7].ToString())
                                , row.ItemArray[8].ToString()                                    //    , int.Parse(row.ItemArray[8].ToString())
                                , "E"
                                );
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classAnnual_FeeLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + count);
            classAnnual_FeeLogWriter.WriteLog("Message loi khong Insert vao EbankGW: " + count_err);
            return;
        }
        private static void Insert_SMSMessage(DataTable table, string crd_brn)
        {
            classDataAccess ebankDataAccess = new classDataAccess();
            classDataAccess dwDataAccess    = new classDataAccess();

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

            string message = "";
            int    result  = 0;
            int    count   = 0;

            foreach (DataRow row in table.Rows)
            {
                result  = 0;
                message = CreateSMSMessage(row.ItemArray[4].ToString(), row.ItemArray[2].ToString(), row.ItemArray[5].ToString(),
                                           row.ItemArray[6].ToString(), row.ItemArray[7].ToString(), row.ItemArray[8].ToString(), row.ItemArray[10].ToString(), crd_brn, row.ItemArray[11].ToString(), row.ItemArray[12].ToString());
                if (string.IsNullOrEmpty(message) == false)
                {
                    //mobile = classUtilities.GetMobileFromCardN oOfSpecialList(row.ItemArray[2].ToString(), row.ItemArray[1].ToString());
                    double ipp = 0;
                    if (row.ItemArray[10].ToString() != "")
                    {
                        ipp = double.Parse(row.ItemArray[10].ToString());
                    }
                    if (double.Parse(row.ItemArray[6].ToString()) >= 0 || double.Parse(row.ItemArray[6].ToString()) <= -100000 || ipp > 0)
                    {
                        if (row.ItemArray[1].ToString() == "khong co")
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW_2(classDataAccess.IDALERT
                                                                                 , row.ItemArray[1].ToString() //classDataAccess.MYPHONE
                                                                                 , message
                                                                                 , 'Y'                         // Y: se ko gui tin nhan, D: ko gui, N: gui, E:Error
                                                                                 , SMS_TYPE);
                        }
                        else
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW_2(classDataAccess.IDALERT
                                                                                 , row.ItemArray[1].ToString() //classDataAccess.MYPHONE
                                                                                 , message
                                                                                 , 'N'                         // hhhh Y: se ko gui tin nhan, D: ko gui, N: gui, E:Error
                                                                                 , SMS_TYPE);
                        }
                    }
                    else // 0 > closing > -100000 and don't have IPP, don't send
                    {
                        count += dwDataAccess.InsertReminderPayment_1SMSToDW(SMS_TYPE, message
                                                                             , row.ItemArray[1].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                             , DateTime.Parse(row.ItemArray[0].ToString())
                                                                             , row.ItemArray[9].ToString()
                                                                             , row.ItemArray[4].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())
                                                                             , "Y"
                                                                             );
                    }
                    if (result == 1)
                    {
                        if (row.ItemArray[1].ToString() == "khong co")
                        {
                            count += dwDataAccess.InsertReminderPayment_1SMSToDW(SMS_TYPE, message
                                                                                 , row.ItemArray[1].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                                 , DateTime.Parse(row.ItemArray[0].ToString())
                                                                                 , row.ItemArray[9].ToString()
                                                                                 , row.ItemArray[4].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())
                                                                                 , "Y"
                                                                                 );
                        }
                        else
                        {
                            count += dwDataAccess.InsertReminderPayment_1SMSToDW(SMS_TYPE, message
                                                                                 , row.ItemArray[1].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                                 , DateTime.Parse(row.ItemArray[0].ToString())
                                                                                 , row.ItemArray[9].ToString()
                                                                                 , row.ItemArray[4].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())
                                                                                 , "N"                                       //hhhh Y: se ko gui tin nhan, D: ko gui, N: gui, E:Error
                                                                                 );
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classReminderPayment1LogWriter.WriteLog("So luong message da duoc Insert vao EbankGW thanh cong: " + count);
            return;
        }