Ejemplo n.º 1
0
        private static void Insert_SMSMessage(DataTable table)
        {
            classDataAccess ebankDataAccess = new classDataAccess();
            classDataAccess dwDataAccess    = new classDataAccess();

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

            string message = "";
            int    result  = 0;
            int    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;
        }