Пример #1
0
        public static int Insert_SMS_Nhac_No_Due_Date(ObjInsertSMSDueDate obj)
        {
            OracleConnection conn = new OracleConnection();

            try
            {
                conn = OracleDBConnection.OpenConnectionDB("CW_DW");
                string        str = "Insert into SMS_NHAC_NO VALUES " + "('" + obj.getId() + "','" + obj.getSmsType() + "','" + obj.getSmsDetail() + "','" + obj.getDesMobile() + "'," + obj.getDateTime() + "," + obj.getInsertTransDateTime() + ",'" + obj.getPan() + "','" + obj.getCardBrn() + "','" + obj.getCardType() + "'," + obj.getSmsMonth() + "," + obj.getClosingBalance() + "," + obj.getDueDate() + "," + obj.getMinimumPayment() + ",'" + obj.getActionType() + "'," + obj.getTotalBalIpp() + ",'" + obj.getVip() + "','" + obj.getCifVip() + "','" + obj.getCardNo() + "'," + obj.getLoc() + ",'" + obj.getIdStatement() + "'" + ")";
                OracleCommand cmd = new OracleCommand(str, conn);
                cmd.CommandType = CommandType.Text;
                int rowsUpdated = cmd.ExecuteNonQuery();
                if (rowsUpdated == 0)
                {
                    _logSMSNhacNoSaoKe.WriteLog("Insert record table SMS_NHAC_NO failed because " + rowsUpdated);
                }
                else
                {
                    _logSMSNhacNoSaoKe.WriteLog("Insert record table SMS_NHAC_NO");
                }

                conn.Close();
                return(rowsUpdated);
            }
            catch (Exception ex)
            {
                _logSMSNhacNoSaoKe.WriteLog("Insert record DB SMS_NHAC_NO failed because " + ex.Message);
                if (conn != null)
                {
                    conn.Close();
                }
                return(-1);
            }
        }
Пример #2
0
        private void btnSendSMS_Click(object sender, EventArgs e)
        {
            string p_settl_month = txbStatementMonth.Text;
            string p_due_date    = txbDueDate.Text;

            DataTable table = new DataTable();

            try
            {
                _log.WriteLog("----------------Begin Process-----------------");
                table.Rows.Clear();
                table = GetSmsDataDueDate(p_settl_month, p_due_date);
                if (table.Rows.Count > 0)
                {
                    DialogResult dialogResult = MessageBox.Show("So luong gui tin nhan SMS la " + table.Rows.Count, "Info", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        List <ObjInsertSMSDueDate> listObjs = new List <ObjInsertSMSDueDate>();
                        foreach (DataRow row in table.Rows)
                        {
                            string id              = row.ItemArray[0].ToString();
                            string smsType         = row.ItemArray[1].ToString();
                            string smsDetail       = row.ItemArray[2].ToString(); //empty
                            string desMobile       = row.ItemArray[3].ToString();
                            string dateTime        = row.ItemArray[4].ToString();
                            string insertTransDate = row.ItemArray[5].ToString(); //empty
                            string pan             = row.ItemArray[6].ToString();
                            string cardBrnData     = row.ItemArray[7].ToString();
                            string cardType        = row.ItemArray[8].ToString();
                            string smsMonth        = row.ItemArray[9].ToString(); //YYYYMM
                            string closingBal      = row.ItemArray[10].ToString();
                            string dueDate         = row.ItemArray[11].ToString();
                            string minimumPayment  = row.ItemArray[12].ToString();
                            string actType         = row.ItemArray[13].ToString();//N: tao moi, Y: da gui qua eb, F: gui qua eb failed, D: ko gui
                            string totBalIpp       = row.ItemArray[14].ToString();
                            string vip             = row.ItemArray[15].ToString();
                            string cifVip          = row.ItemArray[16].ToString();
                            string cardNo          = row.ItemArray[17].ToString();
                            string loc             = row.ItemArray[18].ToString();
                            string idStatement     = row.ItemArray[19].ToString();

                            ObjInsertSMSDueDate obj = new ObjInsertSMSDueDate(id, smsType, smsDetail, desMobile
                                                                              , dateTime, insertTransDate, pan, cardBrnData, cardType, smsMonth, closingBal, dueDate
                                                                              , minimumPayment, actType, totBalIpp, vip, cifVip, cardNo, loc, idStatement);

                            listObjs.Add(obj);
                        }
                        Insert_SMSMessage(listObjs);
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        _log.WriteLog("User press button No ==> exit");
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("Data is empty", "Error");
                    _log.WriteLog("Data is empty");
                }
            }
            catch (Exception ex)
            {
                _log.WriteLog("Error RunService(), " + ex.Message);
            }
        }