Exemplo n.º 1
0
        private static void Process_Update_Phone(DataTable table)
        {
            classDataAccess dwDataAccess = new classDataAccess();

            dwDataAccess.OpenConnection("CW_DW");

            int    result    = 0;
            int    resu_aud1 = 0;
            int    resu_aud2 = 0;
            int    count     = 0;
            int    count_err = 0;
            string phone_p   = "";


            foreach (DataRow row in table.Rows)
            {
                result = 0;
                if (dwDataAccess.Check_Exist_Card(row.ItemArray[1].ToString()) == "1") //cif co tren cw
                {
                    phone_p = dwDataAccess.Get_Inf_Cus(row.ItemArray[1].ToString());   //phone from CW
                    //if (phone_p != "")
                    {
                        resu_aud1 = dwDataAccess.Insert_UPD_INF_AUD(UPDATE_TYPE, row.ItemArray[1].ToString(), phone_p, row.ItemArray[0].ToString(), 1);
                        resu_aud2 = dwDataAccess.Insert_UPD_INF_AUD(UPDATE_TYPE, row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), row.ItemArray[0].ToString(), 2);
                    }


                    result = dwDataAccess.Update_CIF(row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), row.ItemArray[3].ToString(), row.ItemArray[0].ToString());

                    if (result == 1)                                                                                                             //update cif thanh cong
                    {
                        int flag_in_dw = dwDataAccess.Insert_Update_InfDW(UPDATE_TYPE, row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), //row.ItemArray[3].ToString(),
                                                                          row.ItemArray[0].ToString(), "S");
                        if (flag_in_dw != 0)                                                                                                     //insert DW thanh cong
                        {
                            count++;
                        }
                    }
                    else
                    {
                        classUpdatePhoneLogWriter.WriteLog("cif: " + row.ItemArray[1].ToString() + " can't update from FCC");
                        count_err++;
                    }
                }
                else
                {
                    dwDataAccess.Insert_Update_InfDW(UPDATE_TYPE, row.ItemArray[1].ToString(), row.ItemArray[2].ToString(), //row.ItemArray[3].ToString(),
                                                     row.ItemArray[0].ToString(), "D");                                     //D: cif don't have on CW
                }
            }

            dwDataAccess.CloseConnection();
            classUpdatePhoneLogWriter.WriteLog("so cif da update thanh cong: " + count);
            classUpdatePhoneLogWriter.WriteLog("so cif update loi: " + count_err);
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        private static void SendSMSForGW_EB(string mobile, int err)
        {
            try
            {
                classDataAccess ebankDataAccess = new classDataAccess();
                ebankDataAccess.OpenConnection("EBANK_GW");

                string SMS_TYPE = "SMSME";
                string message  = "pls check connect to Ebanking GW," + err + " SMS can't insert data for ThuNoTatToanIPP.";

                ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                          , mobile //classUtilities.GetRandomMobile()
                                                          , message
                                                          , 'N'    //Y: (se ko gui tin nhan),//N: se gui tin nhan
                                                          , SMS_TYPE);
                ebankDataAccess.CloseConnection();
            }
            catch (Exception ex)
            {
                classThuNoTatToanIPPLogWriter.WriteLog("Error SendSMSForGW_EB():" + ex.Message);
            }
        }
Exemplo n.º 4
0
        private static void SendSMSForDW_FPT(string mobile, int err)
        {
            try
            {
                classDataAccess ebankDataAccess = new classDataAccess();
                ebankDataAccess.OpenConnection("EBANK_GW");

                string SMS_TYPE = "SMSME";
                string message  = "pls check table FPT.smsmastercard, " + err + " SMS can't insert DB DW for MC Debit.";

                ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                          , mobile //classUtilities.GetRandomMobile()
                                                          , message
                                                          , 'N'    //Y: (se ko gui tin nhan),//N: se gui tin nhan
                                                          , SMS_TYPE);
                ebankDataAccess.CloseConnection();
            }
            catch (Exception ex)
            {
                classGDMCDebitLogWriter.WriteLog("Error SendSMSForDW_FPT():" + ex.Message);
            }
        }
Exemplo n.º 5
0
        private static void SendSMSForDueDate(string mobile)
        {
            try
            {
                classDataAccess ebankDataAccess = new classDataAccess();
                ebankDataAccess.OpenConnection("EBANK_GW");

                string SMS_TYPE = "SMSME";
                string message  = "today is due date! pls run instruction file!";

                ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                          , mobile //classUtilities.GetRandomMobile()
                                                          , message
                                                          , 'N'    //Y: (se ko gui tin nhan),//N: se gui tin nhan
                                                          , SMS_TYPE);
                ebankDataAccess.CloseConnection();
            }
            catch (Exception ex)
            {
                classCheckDueDateLogWriter.WriteLog("Error SendSMSForDueDate():" + ex.Message);
            }
        }
Exemplo n.º 6
0
        private static void SendSMSForLossMapCard(string mobile, int loss)
        {
            try
            {
                classDataAccess ebankDataAccess = new classDataAccess();
                ebankDataAccess.OpenConnection("EBANK_GW");

                string SMS_TYPE = "SMSME";
                string message  = "pls check table IM.ir_pan_map," + loss + " card loss on this table.";

                ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                          , mobile //classUtilities.GetRandomMobile()
                                                          , message
                                                          , 'N'    //Y: (se ko gui tin nhan),//N: se gui tin nhan
                                                          , SMS_TYPE);
                ebankDataAccess.CloseConnection();
            }
            catch (Exception ex)
            {
                classGDMCDebitLogWriter.WriteLog("Error SendSMSForLossMapCard():" + ex.Message);
            }
        }
Exemplo n.º 7
0
        private static void SendSMSForSpaceDisk(string mobile)
        {
            try
            {
                classDataAccess ebankDataAccess = new classDataAccess();
                ebankDataAccess.OpenConnection("EBANK_GW");

                string SMS_TYPE = "SMSME";


                string message = "tomorrow will backup log switch at: /disk2/CW/CSWT/CWLOG/PREVLOGS. pls check space of disk2 on sever 76.11!";

                ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                          , mobile //classUtilities.GetRandomMobile()
                                                          , message
                                                          , 'N'    //Y: (se ko gui tin nhan),//N: se gui tin nhan
                                                          , SMS_TYPE);
                ebankDataAccess.CloseConnection();
            }
            catch (Exception ex)
            {
                classCheckDueDateLogWriter.WriteLog("Error SendSMSForSpaceDisk():" + ex.Message);
            }
        }
Exemplo n.º 8
0
        private static void Insert_SMSMessage(DataTable table, int flag_send_sms)
        {
            try
            {
                classDataAccess ebankDataAccess = new classDataAccess();
                classDataAccess dwDataAccess    = new classDataAccess();
                ebankDataAccess.OpenConnection("EBANK_GW");
                dwDataAccess.OpenConnection("CW_DW");
                string mobile  = classUtilities.GetStringValueFromConfig("MyPhone1");
                string mobile2 = classUtilities.GetStringValueFromConfig("MyPhone2");
                string mobile3 = classUtilities.GetStringValueFromConfig("MyPhone3");
                //string mobile4 = classUtilities.GetStringValueFromConfig("MyPhone4");
                string mobile7           = classUtilities.GetStringValueFromConfig("MyPhone7");
                int    countSend         = 0;
                int    countReversalSend = 0;
                int    flag_sendSMS      = -1;
                int    flag_sendSMSRe    = -1;
                int    err_DW            = 0;
                int    err_EB            = 0;
                int    err_mapcard       = 0;
                int    tol_err_EB        = 0;
                int    tol_err_DW        = 0;

                foreach (DataRow row in table.Rows)
                {
                    if (string.IsNullOrEmpty(row.ItemArray[13].ToString().Trim()) == false) // la giao dich reversal(status <> "")
                    {
                        if (IsExistedSMSOnDW(                                               //row.ItemArray[4].ToString()
                                row.ItemArray[17].ToString()
                                , row.ItemArray[7].ToString()
                                , row.ItemArray[11].ToString(), row.ItemArray[5].ToString()) == false)            // chua gui tin nhan giao dich thuan
                        {
                            //flag_sendSMS=SendOneSMS(ebankDataAccess, dwDataAccess, row, "Giao dich:", flag_send_sms);
                            SendOneSMS(ebankDataAccess, dwDataAccess, row, "Giao dich:", flag_send_sms, err_DW, err_EB);
                            countSend++;
                        }


                        //flag_sendSMSRe=SendOneSMS(ebankDataAccess, dwDataAccess, row, "Hoan tra:", flag_send_sms);
                        SendOneSMS(ebankDataAccess, dwDataAccess, row, "Hoan tra:", flag_send_sms, err_DW, err_EB);


                        countReversalSend++;
                    }
                    else// la giao dich thuan
                    {
                        //flag_sendSMS=SendOneSMS(ebankDataAccess, dwDataAccess, row, "Giao dich:", flag_send_sms);
                        SendOneSMS(ebankDataAccess, dwDataAccess, row, "Giao dich:", flag_send_sms, err_DW, err_EB);

                        countSend++;
                    }
                    //if (flag_sendSMS == 1 || flag_sendSMSRe == 1)
                    //    err_DW++;
                    //if (flag_sendSMS == 2 || flag_sendSMSRe == 2)
                    //    err_EB++;
                    //if (flag_sendSMS == 4 || flag_sendSMSRe == 4)
                    //    err_mapcard++;
                    tol_err_DW = +err_DW;
                    tol_err_EB = +err_EB;
                }
                if (tol_err_DW > 0)
                {
                    SendSMSForDW_FPT(mobile, err_DW);
                    SendSMSForDW_FPT(mobile2, err_DW);
                    SendSMSForDW_FPT(mobile3, err_DW);
                    //SendSMSForDW_FPT(mobile4, err_DW);
                    SendSMSForDW_FPT(mobile7, err_DW);
                }
                if (tol_err_EB > 0)
                {
                    SendSMSForGW_EB(mobile, err_EB);
                    SendSMSForGW_EB(mobile2, err_EB);
                    SendSMSForGW_EB(mobile3, err_EB);
                    //SendSMSForGW_EB(mobile4, err_EB);
                    SendSMSForGW_EB(mobile7, err_EB);
                }
                //if (err_mapcard > 0)
                //{
                //    SendSMSForLossMapCard(mobile, err_mapcard);
                //    SendSMSForLossMapCard(mobile2, err_mapcard);
                //    SendSMSForLossMapCard(mobile3, err_mapcard);
                //    SendSMSForLossMapCard(mobile4, err_mapcard);
                //    SendSMSForLossMapCard(mobile7, err_mapcard);
                //}
                ebankDataAccess.CloseConnection();
                dwDataAccess.CloseConnection();
                classGDMCDebitLogWriter.WriteLog("Message giao dich thuan da duoc Insert vao EbankGW thanh cong: " + countSend);
                classGDMCDebitLogWriter.WriteLog("Message giao dich reversal da duoc Insert vao EbankGW thanh cong: " + countReversalSend);
                return;
            }
            catch (Exception ex)
            {
                classGDMCDebitLogWriter.WriteLog("Error Insert_SMSMessage() " + ex.Message);
            }
        }
Exemplo n.º 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[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;
        }
Exemplo n.º 10
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;
        }
Exemplo n.º 11
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;
        }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
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;

            //OracleCommand cmd = ebankDataAccess.AddProcedureParameterToEBankGW();

            foreach (DataRow row in table.Rows)
            {
                result  = 0;
                message = CreateSMSMessage(row.ItemArray[5].ToString(), row.ItemArray[0].ToString()
                                           , row.ItemArray[1].ToString(), row.ItemArray[2].ToString());
                if (string.IsNullOrEmpty(message) == false)
                {
                    if (row.ItemArray[3].ToString() == "khong co")
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                                           , row.ItemArray[3].ToString() //classDataAccess.MYPHONE
                                                                           , message
                                                                           , 'Y'                         //Sent (se ko gui tin nhan)
                                                                           , SMS_TYPE);
                    }
                    else
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                                           , row.ItemArray[3].ToString() //classDataAccess.MYPHONE
                                                                           , message
                                                                           , 'N'                         //Sent (se ko gui tin nhan)
                                                                           , SMS_TYPE);
                    }
                    if (result == 1)
                    {
                        if (row.ItemArray[3].ToString() == "khong co")
                        {
                            count += dwDataAccess.InsertRewardPointToDW(SMS_TYPE, message
                                                                        , row.ItemArray[3].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                        , DateTime.Parse(row.ItemArray[6].ToString())
                                                                        , row.ItemArray[0].ToString()
                                                                        , row.ItemArray[5].ToString()
                                                                        , row.ItemArray[4].ToString()
                                                                        , row.ItemArray[2].ToString()//    , long.Parse(row.ItemArray[5].ToString())
                                                                        , row.ItemArray[1].ToString()
                                                                        , "Y"
                                                                        );
                        }
                        else
                        {
                            count += dwDataAccess.InsertRewardPointToDW(SMS_TYPE, message
                                                                        , row.ItemArray[3].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                        , DateTime.Parse(row.ItemArray[6].ToString())
                                                                        , row.ItemArray[0].ToString()
                                                                        , row.ItemArray[5].ToString()
                                                                        , row.ItemArray[4].ToString()
                                                                        , row.ItemArray[2].ToString()//    , long.Parse(row.ItemArray[5].ToString())
                                                                        , row.ItemArray[1].ToString()
                                                                        , "N"
                                                                        );
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classAccumulativeRewardPointLogWriter.WriteLog("So luong message da duoc Insert vao EbankGW thanh cong: " + count);
            return;
        }
        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    count_succ   = 0;
            int    count_err_dw = 0;
            int    count_err_eb = 0;
            string mobile       = classUtilities.GetStringValueFromConfig("MyPhone1");
            string mobile2      = classUtilities.GetStringValueFromConfig("MyPhone2");
            string mobile3      = classUtilities.GetStringValueFromConfig("MyPhone3");
            //string mobile4 = classUtilities.GetStringValueFromConfig("MyPhone4");
            string mobile7 = classUtilities.GetStringValueFromConfig("MyPhone7");

            foreach (DataRow row in table.Rows)
            {
                string available = "";
                if (double.Parse(row.ItemArray[12].ToString()) < double.Parse(row.ItemArray[13].ToString()))
                {
                    available = row.ItemArray[12].ToString();
                }
                else
                {
                    available = row.ItemArray[13].ToString();
                }
                message = CreateSMSMessage(row.ItemArray[4].ToString(), row.ItemArray[2].ToString(), row.ItemArray[5].ToString(),
                                           row.ItemArray[6].ToString(), row.ItemArray[7].ToString(), available, row.ItemArray[15].ToString(), row.ItemArray[16].ToString());
                if (string.IsNullOrEmpty(message) == false)
                {
                    int    flag_fpt = 0;
                    int    flag_eb  = 0;
                    string phone    = "";
                    if (row.ItemArray[17].ToString() != "")      // la the phu(crn the phu khac null)
                    {
                        if (row.ItemArray[18].ToString() == "1") //the phu co gui sms cho the chinh
                        {
                            phone = row.ItemArray[1].ToString(); //gui cho the chinh
                        }
                        else
                        {
                            phone = row.ItemArray[19].ToString();//gui cho the phu
                        }
                    }
                    else
                    {
                        phone = row.ItemArray[1].ToString();
                    }
                    //if (row.ItemArray[1].ToString() == "khong co")
                    if (phone == "khong co" || phone == "")
                    {
                        flag_fpt = dwDataAccess.InsertPaymnetManualSMSToDW(SMS_TYPE, message
                                                                           , row.ItemArray[1].ToString() //    ,long.Parse(row.ItemArray[10].ToString())
                                                                           , DateTime.Parse(row.ItemArray[0].ToString())
                                                                                                         //, row.ItemArray[2].ToString()
                                                                           , row.ItemArray[11].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[21].ToString()              //    , long.Parse(row.ItemArray[7].ToString())
                                                                           , double.Parse(row.ItemArray[7].ToString()) //    , int.Parse(row.ItemArray[8].ToString())
                                                                           , row.ItemArray[9].ToString()
                                                                           , "Y"
                                                                           , row.ItemArray[14].ToString()
                                                                           , row.ItemArray[22].ToString()
                                                                           , row.ItemArray[23].ToString()
                                                                           , row.ItemArray[24].ToString()
                                                                           , row.ItemArray[20].ToString()
                                                                           , row.ItemArray[13].ToString()
                                                                           , row.ItemArray[12].ToString()
                                                                           );
                    }
                    else // so phone hop le
                    {
                        flag_fpt = dwDataAccess.InsertPaymnetManualSMSToDW(SMS_TYPE, message
                                                                           , phone
                                                                           , DateTime.Parse(row.ItemArray[0].ToString())
                                                                           //, row.ItemArray[2].ToString()
                                                                           , row.ItemArray[11].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[21].ToString()              //    , long.Parse(row.ItemArray[7].ToString())
                                                                           , double.Parse(row.ItemArray[7].ToString()) //    , int.Parse(row.ItemArray[8].ToString())
                                                                           , row.ItemArray[9].ToString()
                                                                           , "N"
                                                                           , row.ItemArray[14].ToString()
                                                                           , row.ItemArray[22].ToString()
                                                                           , row.ItemArray[23].ToString()
                                                                           , row.ItemArray[24].ToString()
                                                                           , row.ItemArray[20].ToString()
                                                                           , row.ItemArray[13].ToString()
                                                                           , row.ItemArray[12].ToString()
                                                                           );
                    }
                    if (flag_fpt == 0)
                    {
                        classOutstandingBalancePaymentManualLogWriter.WriteLog("card no " + row.ItemArray[11].ToString() + " can't insert DB DW");
                        count_err_dw++;
                    }
                    else// insert DW thanh cong
                    {
                        //if (row.ItemArray[1].ToString() == "khong co")
                        if (phone == "khong co" || phone == "")
                        {
                            flag_eb = ebankDataAccess.InsertSMSMessateToEBankGW(//classDataAccess.IDALERT
                                row.ItemArray[10].ToString()
                                , phone
                                , message
                                , 'Y'                                //Y: se ko gui tin nhan),//N: se gui tin nhan
                                , SMS_TYPE);
                        }
                        else
                        {
                            flag_eb = ebankDataAccess.InsertSMSMessateToEBankGW(//classDataAccess.IDALERT
                                row.ItemArray[10].ToString()
                                , phone
                                , message
                                , 'N'                              //hhhh Y: se ko gui tin nhan),//N: se gui tin nhan
                                , SMS_TYPE);
                        }

                        if (flag_eb == 0)
                        {
                            classOutstandingBalancePaymentManualLogWriter.WriteLog("mobile no " + row.ItemArray[1].ToString() + " can't insert DB EB");
                            dwDataAccess.Update_Status_SMS(//update status sms ve loi ko gui qua EW
                                row.ItemArray[11].ToString(),
                                row.ItemArray[5].ToString(),
                                row.ItemArray[14].ToString(),
                                "E"
                                );
                            count_err_eb++;
                        }
                        else
                        {
                            count_succ++;
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            if (count_err_dw > 0)
            {
                SendSMSForDW_FPT(mobile, count_err_dw);
                SendSMSForDW_FPT(mobile2, count_err_dw);
                SendSMSForDW_FPT(mobile3, count_err_dw);
                //SendSMSForDW_FPT(mobile4, count_err_dw);
                SendSMSForDW_FPT(mobile7, count_err_dw);
            }
            if (count_err_eb > 0)
            {
                SendSMSForGW_EB(mobile, count_err_eb);
                SendSMSForGW_EB(mobile2, count_err_eb);
                SendSMSForGW_EB(mobile3, count_err_eb);
                //SendSMSForGW_EB(mobile4, count_err_eb);
                SendSMSForGW_EB(mobile7, count_err_eb);
            }

            classOutstandingBalancePaymentManualLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + count_succ);
            classOutstandingBalancePaymentManualLogWriter.WriteLog("Message loi khong duoc Insert vao EbankGW: " + count_err_eb);
            classOutstandingBalancePaymentManualLogWriter.WriteLog("Message loi khong duoc Insert vao DW: " + count_err_dw);
            return;
        }
Exemplo n.º 15
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());
            }
        }
Exemplo n.º 16
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;

            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;
        }
        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());
                if (string.IsNullOrEmpty(message) == false)
                {
                    if (row.ItemArray[1].ToString() == "khong co")
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                                           , row.ItemArray[1].ToString() //classDataAccess.MYPHONE
                                                                           , message
                                                                           , 'Y'                         //Sent (se ko gui tin nhan)
                                                                           , SMS_TYPE);
                    }
                    else
                    {
                        result = ebankDataAccess.InsertSMSMessateToEBankGW(classDataAccess.IDALERT
                                                                           , row.ItemArray[1].ToString() //classDataAccess.MYPHONE
                                                                           , message
                                                                           , 'N'                         //Sent (se ko gui tin nhan)
                                                                           , SMS_TYPE);
                    }
                    if (result == 1)
                    {
                        if (row.ItemArray[1].ToString() == "khong co")
                        {
                            count += dwDataAccess.InsertPaymnetAutoSMSToDW(SMS_TYPE, message
                                                                           , row.ItemArray[1].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                           , DateTime.Parse(row.ItemArray[0].ToString())
                                                                           , row.ItemArray[2].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[8].ToString()               //    , long.Parse(row.ItemArray[7].ToString())
                                                                           , double.Parse(row.ItemArray[7].ToString()) //    , int.Parse(row.ItemArray[8].ToString())
                                                                           , row.ItemArray[9].ToString()
                                                                           , "Y"
                                                                           );
                        }
                        else
                        {
                            count += dwDataAccess.InsertPaymnetAutoSMSToDW(SMS_TYPE, message
                                                                           , row.ItemArray[1].ToString()//    ,long.Parse(row.ItemArray[10].ToString())
                                                                           , DateTime.Parse(row.ItemArray[0].ToString())
                                                                           , row.ItemArray[2].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[8].ToString()               //    , long.Parse(row.ItemArray[7].ToString())
                                                                           , double.Parse(row.ItemArray[7].ToString()) //    , int.Parse(row.ItemArray[8].ToString())
                                                                           , row.ItemArray[9].ToString()
                                                                           , "N"
                                                                           );
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classOutstandingBalancePaymentAutoLogWriter.WriteLog("So luong message da duoc Insert vao EbankGW thanh cong: " + count);
            return;
        }
Exemplo n.º 18
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    count_succ   = 0;
            int    count_err_dw = 0;
            int    count_err_eb = 0;
            string mobile       = classUtilities.GetStringValueFromConfig("MyPhone1");
            string mobile2      = classUtilities.GetStringValueFromConfig("MyPhone2");
            string mobile3      = classUtilities.GetStringValueFromConfig("MyPhone3");
            string mobile4      = classUtilities.GetStringValueFromConfig("MyPhone4");
            string mobile7      = classUtilities.GetStringValueFromConfig("MyPhone7");

            foreach (DataRow row in table.Rows)
            {
                string available = "";
                if (double.Parse(row.ItemArray[12].ToString()) < double.Parse(row.ItemArray[13].ToString()))
                {
                    available = row.ItemArray[12].ToString();
                }
                else
                {
                    available = row.ItemArray[13].ToString();
                }

                if (row.ItemArray[15].ToString() == "ThanhToan")//hhhh
                //message = CreateSMSMessageThuNo(row.ItemArray[4].ToString(), row.ItemArray[2].ToString(), row.ItemArray[5].ToString(),
                //                                row.ItemArray[6].ToString(), row.ItemArray[7].ToString(), available, row.ItemArray[17].ToString(), row.ItemArray[14].ToString(), row.ItemArray[19].ToString());
                {
                    message = CreateSMSMessageThuNo_160(row.ItemArray[4].ToString(), row.ItemArray[2].ToString(), row.ItemArray[5].ToString(),
                                                        row.ItemArray[6].ToString(), row.ItemArray[7].ToString(), available, row.ItemArray[17].ToString(), row.ItemArray[14].ToString(), row.ItemArray[19].ToString());
                }
                else
                {
                    message = CreateSMSMessageTatToan(row.ItemArray[4].ToString(), row.ItemArray[2].ToString(), row.ItemArray[5].ToString(),
                                                      row.ItemArray[6].ToString(), row.ItemArray[18].ToString(), available, row.ItemArray[17].ToString(), row.ItemArray[14].ToString(), row.ItemArray[19].ToString());
                }
                if (string.IsNullOrEmpty(message) == false)
                {
                    int flag_fpt = 0;
                    int flag_eb  = 0;
                    if (row.ItemArray[1].ToString() == "khong co")
                    {
                        flag_fpt = dwDataAccess.InsertThuNoTatToanIPPSMSToDW(SMS_TYPE, message
                                                                             , row.ItemArray[1].ToString() //    ,long.Parse(row.ItemArray[10].ToString())
                                                                             , DateTime.Parse(row.ItemArray[0].ToString())
                                                                                                           //, row.ItemArray[2].ToString()
                                                                             , row.ItemArray[11].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[8].ToString()               //    , long.Parse(row.ItemArray[7].ToString())
                                                                             , double.Parse(row.ItemArray[7].ToString()) //    , int.Parse(row.ItemArray[8].ToString())
                                                                             , row.ItemArray[9].ToString()
                                                                             , "Y"
                                                                             , row.ItemArray[16].ToString()
                                                                             );
                    }
                    else
                    {
                        flag_fpt = dwDataAccess.InsertThuNoTatToanIPPSMSToDW(SMS_TYPE, message
                                                                             , row.ItemArray[1].ToString() //    ,long.Parse(row.ItemArray[10].ToString())
                                                                             , DateTime.Parse(row.ItemArray[0].ToString())
                                                                                                           //, row.ItemArray[2].ToString()
                                                                             , row.ItemArray[11].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[8].ToString()               //    , long.Parse(row.ItemArray[7].ToString())
                                                                             , double.Parse(row.ItemArray[7].ToString()) //    , int.Parse(row.ItemArray[8].ToString())
                                                                             , row.ItemArray[9].ToString()
                                                                             , "N"
                                                                             , row.ItemArray[16].ToString()
                                                                             );
                    }
                    if (flag_fpt == 0)
                    {
                        classThuNoTatToanIPPLogWriter.WriteLog("card no " + row.ItemArray[11].ToString() + " can't insert DB DW");
                        count_err_dw++;
                    }
                    else
                    {
                        //mobile = classUtilities.GetMobileFromCardNoOfSpecialList(row.ItemArray[2].ToString(), row.ItemArray[1].ToString());
                        if (row.ItemArray[1].ToString() == "khong co")
                        {
                            flag_eb = ebankDataAccess.InsertSMSMessateToEBankGW( //classDataAccess.IDALERT
                                row.ItemArray[10].ToString()
                                , row.ItemArray[1].ToString()                    //classUtilities.GetRandomMobile()
                                , message
                                , 'Y'                                            //Y: se ko gui tin nhan),//N: se gui tin nhan
                                , SMS_TYPE);
                        }
                        else
                        {
                            string mobile_spe = classUtilities.GetMobileFromCardNoOfSpecialList2(row.ItemArray[11].ToString());
                            if (mobile_spe == "000")                                 // the phu khong thuoc ds dac biet
                            {
                                flag_eb = ebankDataAccess.InsertSMSMessateToEBankGW( //classDataAccess.IDALERT
                                    row.ItemArray[10].ToString()
                                    , row.ItemArray[1].ToString()                    //classUtilities.GetRandomMobile()
                                    , message
                                    , 'N'                                            //Y: se ko gui tin nhan),//N: se gui tin nhan
                                    , SMS_TYPE);
                            }
                            else //the phu thuoc ds dac biet
                            {
                                flag_eb = ebankDataAccess.InsertSMSMessateToEBankGW(//classDataAccess.IDALERT
                                    row.ItemArray[10].ToString()
                                    , mobile_spe
                                    , message
                                    , 'N'                          //Y: se ko gui tin nhan),//N: se gui tin nhan
                                    , SMS_TYPE);
                            }
                        }

                        if (flag_eb == 0)
                        {
                            classThuNoTatToanIPPLogWriter.WriteLog("mobi no " + row.ItemArray[1].ToString() + " can't insert DB EB");
                            classThuNoTatToanIPPLogWriter.WriteLog("card no " + row.ItemArray[11].ToString() + " can't insert DB EB");
                            dwDataAccess.Update_Status_SMS(//update status sms ve loi ko gui qua EW
                                row.ItemArray[11].ToString(),
                                row.ItemArray[5].ToString(),
                                row.ItemArray[16].ToString(),
                                "E"
                                );
                            count_err_eb++;
                        }
                        else
                        {
                            count_succ++;
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            if (count_err_dw > 0)
            {
                SendSMSForDW_FPT(mobile, count_err_dw);
                SendSMSForDW_FPT(mobile2, count_err_dw);
                SendSMSForDW_FPT(mobile3, count_err_dw);
                SendSMSForDW_FPT(mobile4, count_err_dw);
                SendSMSForDW_FPT(mobile7, count_err_dw);
            }
            if (count_err_eb > 0)
            {
                SendSMSForGW_EB(mobile, count_err_eb);
                SendSMSForGW_EB(mobile2, count_err_eb);
                SendSMSForGW_EB(mobile3, count_err_eb);
                SendSMSForGW_EB(mobile4, count_err_eb);
                SendSMSForGW_EB(mobile7, count_err_eb);
            }

            classThuNoTatToanIPPLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + count_succ);
            classThuNoTatToanIPPLogWriter.WriteLog("Message loi khong duoc Insert vao EbankGW: " + count_err_eb);
            classThuNoTatToanIPPLogWriter.WriteLog("Message loi khong duoc Insert vao DW: " + count_err_dw);
            return;
        }
Exemplo n.º 19
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;
        }
Exemplo n.º 20
0
        private static void Insert_SMSMessage(DataTable table)
        {
            classDataAccess ebankDataAccess = new classDataAccess();
            classDataAccess dwDataAccess    = new classDataAccess();
            classDataAccess IMDataAccess    = new classDataAccess();

            ebankDataAccess.OpenConnection("EBANK_GW");
            dwDataAccess.OpenConnection("CW_DW");
            IMDataAccess.OpenConnection("CW_IM");
            string link_km        = classUtilities.GetStringValueFromConfig("SCB_KM");
            string link_HDSD      = classUtilities.GetStringValueFromConfig("SCB_HDSD");
            string message        = "";
            string message_encode = "";
            int    result         = 0;
            int    count          = 0;
            int    count_err      = 0;

            foreach (DataRow row in table.Rows)
            {
                string card_no = classUtilities.GetCardFromSMS_Pin_List(row.ItemArray[9].ToString());
                if (card_no == "")//nhan pin giay
                {
                    string count_act = IMDataAccess.Get_First_Activate(row.ItemArray[9].ToString());
                    if (count_act == "1")//1: active lan dau
                    {
                        string count_rep = IMDataAccess.Get_Reply_Card(row.ItemArray[9].ToString());
                        if (count_rep == "0")//0: the chua thay the
                        {
                            message = CreateSMSMessage_act_first(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km, link_HDSD);
                        }
                        else
                        {
                            message = CreateSMSMessage(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km);
                        }
                    }
                    else
                    {
                        message = CreateSMSMessage(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km);
                    }

                    //message = CreateSMSMessage(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km);
                    if (string.IsNullOrEmpty(message) == false)
                    {
                        string mobile = row.ItemArray[7].ToString();
                        if (row.ItemArray[7].ToString() == "khong co")
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW(//classDataAccess.IDALERT
                                row.ItemArray[8].ToString()
                                , mobile
                                , message
                                , 'Y'                                               //Y se ko gui tin nhan, N se gui tin nhan
                                , SMS_TYPE);
                        }
                        else
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW(//classDataAccess.IDALERT
                                row.ItemArray[8].ToString()
                                , mobile
                                , message
                                , 'N'                                               //Y se ko gui tin nhan, N se gui tin nhan
                                , SMS_TYPE);
                        }
                        if (result == 1)
                        {
                            if (row.ItemArray[7].ToString() == "khong co")
                            {
                                count += dwDataAccess.InsertKichHoatTheSMSToDW(
                                    SMS_TYPE
                                    , message
                                    , mobile
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()
                                    , row.ItemArray[6].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "Y"
                                    );
                            }
                            else
                            {
                                count += dwDataAccess.InsertKichHoatTheSMSToDW(
                                    SMS_TYPE
                                    , message
                                    , mobile
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()
                                    , row.ItemArray[6].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "N"
                                    );
                            }
                        }
                        else
                        {
                            count_err += dwDataAccess.InsertKichHoatTheSMSToDW(
                                SMS_TYPE
                                , message
                                , mobile
                                , DateTime.Parse(row.ItemArray[0].ToString())
                                //, row.ItemArray[4].ToString()
                                , row.ItemArray[9].ToString()
                                , row.ItemArray[2].ToString()
                                , row.ItemArray[3].ToString()
                                , row.ItemArray[5].ToString()
                                , row.ItemArray[6].ToString()
                                , row.ItemArray[1].ToString()
                                , "E"
                                );
                        }
                    }
                    else //gen mess loi
                    {
                        classKichHoatTheLogWriter.WriteLog("err when create mess: " + row.ItemArray[9].ToString());
                    }
                }
                else //nhan pin sms
                {
                    result = 0;
                    string loc_pan = row.ItemArray[10].ToString() + row.ItemArray[4].ToString().Substring(12, 4);

                    //if (row.ItemArray[11].ToString() == "P")//P: the chinh
                    //{
                    //    string count_act = IMDataAccess.Get_First_Activate(row.ItemArray[9].ToString());
                    //    if (row.ItemArray[14].ToString() == "")//the ko thuoc CBNV
                    //    {
                    //        if (count_act == "1")//1: active lan dau
                    //        {
                    //            string count_rep = IMDataAccess.Get_Reply_Card(row.ItemArray[9].ToString());
                    //            if (count_rep == "0")//0: the chua thay the
                    //            {
                    //                message = CreateSMSMessage_phi(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), row.ItemArray[7].ToString(), loc_pan);
                    //            }
                    //            else
                    //                message = CreateSMSMessage_QC(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km, row.ItemArray[7].ToString(), loc_pan);
                    //        }
                    //        else
                    //        {
                    //            message = CreateSMSMessage_QC(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km, row.ItemArray[7].ToString(), loc_pan);
                    //        }
                    //    }
                    //    else
                    //        message = CreateSMSMessage_QC(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km, row.ItemArray[7].ToString(), loc_pan);
                    //}
                    //else//the phu
                    //{
                    //    //message = CreateSMSMessage(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(),row.ItemArray[13].ToString());
                    //    message = CreateSMSMessage_QC(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km, row.ItemArray[7].ToString(), loc_pan);
                    //}
                    string pin = Gen_PIN(row.ItemArray[7].ToString(), loc_pan);
                    if (pin != null)
                    {
                        message        = CreateSMSMessage_QC(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km, row.ItemArray[7].ToString(), loc_pan, pin);
                        message_encode = CreateSMSMessage_EC(row.ItemArray[2].ToString(), row.ItemArray[4].ToString(), row.ItemArray[5].ToString(), row.ItemArray[6].ToString(), row.ItemArray[12].ToString(), row.ItemArray[13].ToString(), link_km, row.ItemArray[7].ToString(), loc_pan, pin);
                    }
                    else //gen PIN Loi
                    {
                        classKichHoatTheLogWriter.WriteLog("gen PIN loi for LOC: " + row.ItemArray[10].ToString());
                    }
                    if (string.IsNullOrEmpty(message) == false)
                    {
                        string mobile = row.ItemArray[7].ToString();
                        if (row.ItemArray[7].ToString() == "khong co")
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW(//classDataAccess.IDALERT
                                row.ItemArray[8].ToString()
                                , mobile
                                , message
                                , 'Y'                                               //Y se ko gui tin nhan, N se gui tin nhan
                                , SMS_TYPE);
                        }
                        else
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW(//classDataAccess.IDALERT
                                row.ItemArray[8].ToString()
                                , mobile
                                , message
                                , 'N'                                               //Y se ko gui tin nhan, N se gui tin nhan
                                , SMS_TYPE);
                        }
                        if (result == 1)
                        {
                            if (row.ItemArray[7].ToString() == "khong co")
                            {
                                count += dwDataAccess.InsertKichHoatTheSMSToDW(
                                    SMS_TYPE
                                    , message_encode
                                    , mobile
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()
                                    , row.ItemArray[6].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "Y"
                                    );
                            }
                            else
                            {
                                count += dwDataAccess.InsertKichHoatTheSMSToDW(
                                    SMS_TYPE
                                    , message_encode
                                    , mobile
                                    , DateTime.Parse(row.ItemArray[0].ToString())
                                    //, row.ItemArray[4].ToString()
                                    , row.ItemArray[9].ToString()
                                    , row.ItemArray[2].ToString()
                                    , row.ItemArray[3].ToString()
                                    , row.ItemArray[5].ToString()
                                    , row.ItemArray[6].ToString()
                                    , row.ItemArray[1].ToString()
                                    , "N"
                                    );
                            }
                        }
                        else
                        {
                            count_err += dwDataAccess.InsertKichHoatTheSMSToDW(
                                SMS_TYPE
                                , message_encode
                                , mobile
                                , DateTime.Parse(row.ItemArray[0].ToString())
                                //, row.ItemArray[4].ToString()
                                , row.ItemArray[9].ToString()
                                , row.ItemArray[2].ToString()
                                , row.ItemArray[3].ToString()
                                , row.ItemArray[5].ToString()
                                , row.ItemArray[6].ToString()
                                , row.ItemArray[1].ToString()
                                , "E"
                                );
                        }
                    }
                }
            }
            ebankDataAccess.CloseConnection();
            dwDataAccess.CloseConnection();
            classKichHoatTheLogWriter.WriteLog("Message da duoc Insert vao EbankGW thanh cong: " + count);
            classKichHoatTheLogWriter.WriteLog("Message loi khong Insert vao EbankGW: " + count_err);
        }
Exemplo n.º 21
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;
        }
Exemplo n.º 22
0
        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;
        }