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; }