Exemplo n.º 1
0
        private static void SendOneSMS(classDataAccess ebankDataAccess, classDataAccess dwDataAccess, DataRow row, string creditOrDebit, int flag_send_sms, int err_dw, int err_eb)
        {
            try
            {
                err_dw = 0;
                err_eb = 0;
                int    flag_return_p = -1;
                int    flag_return   = -1;
                string card_tmp      = "";
                if (row.ItemArray[4].ToString() == "")//the bi thieu bang map card (ir_pan_map)
                {
                    card_tmp = _dataAccess.GetCardNo(row.ItemArray[17].ToString());
                    classGDMCDebitLogWriter.WriteLog("card no " + row.ItemArray[17].ToString() + " is loss on ir_pan_map");
                    flag_return = 4;//thieu bang map card
                }
                else
                {
                    card_tmp = row.ItemArray[4].ToString();
                }
                string message = null;

                if (creditOrDebit == "Giao dich:")
                {
                    message = CreateSMSCreditMessage(row.ItemArray[2].ToString(), card_tmp,//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[19].ToString(), row.ItemArray[20].ToString());
                }
                else
                {
                    message = CreateSMSDebitMessage(row.ItemArray[2].ToString(), card_tmp,//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[19].ToString(), row.ItemArray[20].ToString());
                }
                if (row.ItemArray[14].ToString().Trim() == "")//giao dich cua the chinh(gia tri truong CRN the phu khong co)
                {
                    //if (flag_send_sms==0)//tat chuc nang kiem tra the co dk send sms hay khong
                    //    flag_return=SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[10].ToString(), "Y");//truyen tham so mac dinh co gui sms
                    //else
                    //    flag_return=SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[10].ToString(), row.ItemArray[18].ToString());
                    flag_return_p = SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[10].ToString(), "Y");//truyen tham so mac dinh co gui sms
                }
                else//giao dich cua the phu
                {
                    //if (flag_send_sms == 0)//tat chuc nang kiem tra the co dk send sms hay khong
                    //    flag_return=SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[15].ToString(), "Y");//truyen tham so mac dinh co gui sms
                    //else
                    //    flag_return=SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[15].ToString(), row.ItemArray[18].ToString());
                    if (row.ItemArray[21].ToString().Trim() == "1")//la the quan ly
                    {
                        //if(row.ItemArray[22].ToString()!=row.ItemArray[10].ToString())
                        flag_return_p = SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[22].ToString(), "Y");    //gui sms cho the quan ly
                        //else
                        //flag_return_p = SendSMSForPhone_K(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[22].ToString(), "K");//khong gui sms cho the quan ly vi trung so dt
                    }
                    else // the phu khong phai la the quan ly
                    {
                        if (row.ItemArray[22].ToString().Trim() != "E")//the phu co the quan ly (man_phone <> E)
                        {
                            flag_return = SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[15].ToString(), "Y");       //gui sms cho the phu
                            if (row.ItemArray[23].ToString().Trim() == "1")                                                                                     //1:gui sms cho the chinh or the quan ly
                            {
                                flag_return_p = SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[22].ToString(), "Y"); //gui sms cho the quan ly
                            }
                        }
                        else //the phu co the chinh
                        {
                            flag_return = SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[15].ToString(), "Y");//gui sms cho the phu
                            if (row.ItemArray[23].ToString().Trim() == "1")                                                                                     //1:gui sms cho the chinh or the quan ly
                            {
                                flag_return_p = SendSMSForPhone(ebankDataAccess, dwDataAccess, row, creditOrDebit, message, row.ItemArray[10].ToString(), "Y"); //gui sms cho the chinh
                            }
                        }
                    }
                }
                if (flag_return == 1)
                {
                    err_dw++;
                }
                else
                if (flag_return == 2)
                {
                    err_eb++;
                }

                if (flag_return_p == 1)
                {
                    err_dw++;
                }
                else
                if (flag_return_p == 2)
                {
                    err_eb++;
                }
            }
            catch (Exception ex)
            {
                classGDMCDebitLogWriter.WriteLog("Error SendOneSMS():" + ex.Message);
            }
        }