Пример #1
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);
            }
        }
Пример #2
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);
            }
        }
Пример #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);
            }
        }
Пример #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);
            }
        }
Пример #5
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);
            }
        }
Пример #6
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;
        }
Пример #7
0
        private static int SendSMSForPhone(classDataAccess ebankDataAccess, classDataAccess dwDataAccess, DataRow row, string creditOrDebit, string mess, string phone, string flag_send)
        {
            try
            {
                int result = 0;
                if (string.IsNullOrEmpty(mess.Trim()) == false)
                {
                    string status = (creditOrDebit == "Giao dich:" ? " " : "C");//neu la giao dich reversal thi status = "C"
                    //if (flag_send == "Y")
                    //{
                    if (phone == "khong co")
                    {
                        int flag_fpt = dwDataAccess.InsertOutBalChangeMDSMSToDW(SMS_TYPE, mess
                                                                                , phone
                                                                                , DateTime.Parse(row.ItemArray[0].ToString())
                                                                                //, row.ItemArray[4].ToString()
                                                                                , row.ItemArray[17].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()
                                                                                , status
                                                                                , row.ItemArray[1].ToString()
                                                                                , "Y"//khong co so dt, tin nhan ko duoc gui di
                                                                                );
                        if (flag_fpt == 0)
                        {
                            classGDMCDebitLogWriter.WriteLog("card no " + row.ItemArray[17].ToString() + " can not insert DB DW");
                            return(1); //intert DW khong thanh cong
                        }
                        else           //inster DW thanh cong
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW(
                                //classDataAccess.IDALERT
                                row.ItemArray[16].ToString()
                                , phone
                                , mess
                                , 'Y'                                   //Y: (se ko gui tin nhan),//N: se gui tin nhan
                                , SMS_TYPE);
                            if (result == 0)
                            {
                                classGDMCDebitLogWriter.WriteLog("card no " + row.ItemArray[17].ToString() + " can not insert Ebanking GW");
                                return(2);    //2: inster EB khong thanh cong
                            }
                            else
                            {
                                return(0);   //thanh cong
                            }
                        }
                    }
                    else    //so phone hop le
                    {
                        int flag_fpt = dwDataAccess.InsertOutBalChangeMDSMSToDW(
                            SMS_TYPE
                            , mess
                            , phone
                            , DateTime.Parse(row.ItemArray[0].ToString())
                            , row.ItemArray[17].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()
                            , status
                            , row.ItemArray[1].ToString()
                            , "N"//normal: insert DW thanh cong
                            );
                        if (flag_fpt == 0)
                        {
                            classGDMCDebitLogWriter.WriteLog("card no " + row.ItemArray[17].ToString() + " can't insert DB DW");
                            return(1); //intert DW khong thanh cong
                        }
                        else           //inster DW thanh cong
                        {
                            result = ebankDataAccess.InsertSMSMessateToEBankGW(
                                //classDataAccess.IDALERT
                                row.ItemArray[16].ToString()
                                , phone
                                , mess
                                , 'N'                                   //Y: (se ko gui tin nhan),//N: se gui tin nhan
                                , SMS_TYPE);
                            if (result == 0)
                            {
                                int flag = dwDataAccess.Update_Status_SMS(    //update status sms ve loi ko gui qua EW
                                    row.ItemArray[17].ToString(),
                                    row.ItemArray[5].ToString(),
                                    row.ItemArray[11].ToString(),
                                    "E"
                                    );
                                classGDMCDebitLogWriter.WriteLog("card no " + row.ItemArray[17].ToString() + " can not insert Ebanking GW");
                                return(2);    //2: inster EB khong thanh cong
                            }
                            else
                            {
                                return(0);    //thanh cong
                            }
                        }
                    }
                    //}
                    //else// flag = N, khong nhan sms
                    //{
                    //    int flag_fpt = dwDataAccess.InsertOutBalChangeMDSMSToDW(SMS_TYPE, mess
                    //       , phone
                    //       , DateTime.Parse(row.ItemArray[0].ToString())
                    //        //, row.ItemArray[4].ToString()
                    //       , row.ItemArray[17].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()
                    //       , status
                    //       , row.ItemArray[1].ToString()
                    //       , "K"//the ko dk nhan sms

                    //       );
                    //    if (flag_fpt == 0)
                    //    {
                    //        dwDataAccess.InsertOutBalChangeMDSMSToDW(SMS_TYPE, mess
                    //        , phone
                    //        , DateTime.Parse(row.ItemArray[0].ToString())
                    //            //, row.ItemArray[4].ToString()
                    //        , row.ItemArray[17].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()
                    //        , status
                    //        , row.ItemArray[1].ToString()
                    //        , "K"//insert lan 2: loi do ko insert duoc DW lan 1

                    //        );
                    //        classGDMCDebitLogWriter.WriteLog("card no " + row.ItemArray[17].ToString() + " can't insert DB DW");
                    //        return 1;
                    //    }

                    //}
                }
                return(3);//ko gui sms
            }
            catch (Exception ex)
            {
                classGDMCDebitLogWriter.WriteLog("Error SendSMSForPhone():" + ex.Message);
                return(3);//3: loi
            }
        }
Пример #8
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;
        }
        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;
        }
Пример #11
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);
        }