示例#1
0
        private void reSendMess(DataGridView tbl, string clmName, string clmConTentMess, string clmNbPhone, string loaihopthu)
        {
            DataGridViewSelectedRowCollection selectedRows = tbl.SelectedRows;

            if (selectedRows.Count == 1)
            {
                DataGridViewRow row = selectedRows[0];
                // danh dau tinh trang
                int    j      = 0;
                string hopthu = "";
                try
                {
                    SmsSubmitPdu pdu = new SmsSubmitPdu(row.Cells[clmConTentMess].Value.ToString(), row.Cells[clmNbPhone].Value.ToString(), "");
                    j      = 1;
                    hopthu = loaihopthu;
                    common.Constants.comm.SendMessage(pdu);
                }
                catch (Exception)
                {
                    j      = 0;
                    hopthu = "";
                    MessageBox.Show("Send Message Failed");
                }

                bool result = HopThuDiDAO.updateStatusReSentMess(j, hopthu, row.Cells[clmName].Value.ToString());
            }
            else if (selectedRows.Count > 1)
            {
                MessageBox.Show("Ban chi duoc chon 1 tin nhan de gui lai .");
            }
            else
            {
                MessageBox.Show("Ban phai chon tin nhan de gui lai");
            }
        }
示例#2
0
        private void deleteMessSent(DataGridView tbl, string clmName)
        {
            DataGridViewSelectedRowCollection selectedRows = tbl.SelectedRows;

            if (selectedRows.Count > 0)
            {
                if (MessageBox.Show("Ban co chac chan xoa nhung tin nhan nay ?", "Xac Nhan Xoa .", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in selectedRows)
                    {
                        bool result = HopThuDiDAO.deleteMessSent(row.Cells[clmName].Value.ToString());
                    }
                }
            }
            else
            {
                MessageBox.Show("Ban chua chon tin nhan.");
            }
        }
示例#3
0
        private void showSearchNormalMessDeletedSentByNoiDungTinNhan(string noiDungMess)
        {
            DataTable tbl = HopThuDiDAO.getNormalMessDeletedSentByNoiDungTinNhan(noiDungMess);

            tblNormalMessDeletedSent.DataSource = tbl;
        }
示例#4
0
        private void showSearchNormalMessDeletedSentBySoDienThoai(string nbPhone)
        {
            DataTable tbl = HopThuDiDAO.getNormalMessDeletedSentByNbPhone(nbPhone);

            tblNormalMessDeletedSent.DataSource = tbl;
        }
示例#5
0
        private void showSearchSytaxMessDeletedSentByCuPhap(string cuPhap)
        {
            DataTable tbl = HopThuDiDAO.getSyntaxMessDeletedSentByCuPhap(cuPhap);

            tblSyntaxMessDeletedSent.DataSource = tbl;
        }
示例#6
0
        public void showAllNormalMessDeletedSent()
        {
            DataTable tableNormalMessDeletedSent = HopThuDiDAO.getAllNormalMessDeletedSent();

            tblNormalMessDeletedSent.DataSource = tableNormalMessDeletedSent;
        }
示例#7
0
        private void showSearchSytaxMessErrorSentByNoiDungTinNhan(string noiDungMess)
        {
            DataTable tbl = HopThuDiDAO.getSyntaxMessErrorSentByNoiDungTinNhan(noiDungMess);

            tblSyntaxMessErrorSent.DataSource = tbl;
        }
示例#8
0
        private void showSearchSytaxMessErrorSentBySoDienThoai(string nbPhone)
        {
            DataTable tbl = HopThuDiDAO.getSyntaxMessErrorSentByNbPhone(nbPhone);

            tblSyntaxMessErrorSent.DataSource = tbl;
        }
示例#9
0
        public void showAllSyntaxMessDeletedSent()
        {
            DataTable tableSyntaxMessDeletedSent = HopThuDiDAO.getAllSyntaxMessDeletedSent();

            tblSyntaxMessDeletedSent.DataSource = tableSyntaxMessDeletedSent;
        }
示例#10
0
        //private delegate void SetTextCallback(string text);

        private void but_Send_Click(object sender, EventArgs e)
        {
            SmsSubmitPdu[] desPhones;
            ArrayList      listPdu = new ArrayList();
            SmsSubmitPdu   pdu;

            string[] phones = (txtPhoneNumber.Text).Split(';');
            string   mess   = txtMessage.Text;

            bool unicode = chkUnicode.Checked;

            if (!txtPhoneNumber.Text.Equals("") && !mess.Equals(""))
            {
                Cursor.Current = Cursors.WaitCursor;

                if (phones.Length == 1)
                {
                    model = new HopThuDiMODEL();
                    int testTV = 0;
                    if (!unicode)
                    {
                        pdu = new SmsSubmitPdu();
                        try
                        {
                            pdu.UserDataText       = mess;
                            pdu.DestinationAddress = phones[0];
                            pdu.SmscAddress        = "";
                            testTV = 1;
                        }
                        catch (Exception)
                        {
                            txtLog.AppendText("Ban phai check vao Tieng Viet de gui tin nhan co dau .\n");
                            testTV = 0;
                        }
                    }
                    else
                    {
                        byte dcs = DataCodingScheme.NoClass_16Bit;
                        pdu    = new SmsSubmitPdu(txtMessage.Text, phones[0], "", dcs);
                        testTV = 1;
                    }

                    model.So_Dien_Thoai     = phones[0];
                    model.Noi_Dung_Tin_Nhan = mess;
                    model.Loai_Hop_Thu      = "6";
                    model.User11            = "";
                    model.User21            = "";
                    model.User31            = "";
                    model.User41            = "";
                    model.User51            = "";
                    if (testTV == 1)
                    {
                        try
                        {
                            common.Constants.comm.SendMessage(pdu);
                            model.Tinh_Trang = "1";
                            txtLog.AppendText("Gui 1 tin nhan thanh cong .\n");
                        }
                        catch (Exception k)
                        {
                            model.Tinh_Trang = "0";
                            MessageBox.Show("Gui tin nhan that bai . " + k.Message + "\n");
                        }
                    }

                    bool result = HopThuDiDAO.insertHopThuDi(model);
                }
                else if (phones.Length > 1)
                {
                    int testTV = 0;
                    if (!unicode)
                    {
                        foreach (string phone in phones)
                        {
                            try
                            {
                                pdu    = new SmsSubmitPdu(mess, phone, "");
                                testTV = 1;
                            }
                            catch (Exception)
                            {
                                txtLog.AppendText("Ban phai check vao Tieng Viet de gui tin nhan co dau .\n");
                                testTV = 0;
                                break;
                            }
                            listPdu.Add(pdu);

                            model = new HopThuDiMODEL();

                            model.So_Dien_Thoai     = phone;
                            model.Noi_Dung_Tin_Nhan = mess;
                            model.Tinh_Trang        = "1";
                            model.Loai_Hop_Thu      = "6";
                            model.User11            = "";
                            model.User21            = "";
                            model.User31            = "";
                            model.User41            = "";
                            model.User51            = "";

                            bool result = HopThuDiDAO.insertHopThuDi(model);
                        }

                        desPhones = (SmsSubmitPdu[])listPdu.ToArray(typeof(SmsSubmitPdu));
                        if (testTV == 1)
                        {
                            try
                            {
                                common.Constants.comm.SendMessages(desPhones);
                                txtLog.AppendText("Gui " + desPhones.Length.ToString() + " tin nhan thanh cong .\n");
                            }
                            catch (Exception i)
                            {
                                txtLog.AppendText(i.Message + "\n");
                            }
                        }
                    }
                    else
                    {
                        byte dcs = DataCodingScheme.NoClass_16Bit;

                        foreach (string phone in phones)
                        {
                            pdu = new SmsSubmitPdu(mess, phone, "", dcs);
                            listPdu.Add(pdu);

                            model = new HopThuDiMODEL();

                            model.So_Dien_Thoai     = phone;
                            model.Noi_Dung_Tin_Nhan = mess;
                            model.Tinh_Trang        = "1";
                            model.Loai_Hop_Thu      = "6";
                            model.User11            = "";
                            model.User21            = "";
                            model.User31            = "";
                            model.User41            = "";
                            model.User51            = "";

                            bool result = HopThuDiDAO.insertHopThuDi(model);
                        }

                        desPhones = (SmsSubmitPdu[])listPdu.ToArray(typeof(SmsSubmitPdu));
                        try
                        {
                            common.Constants.comm.SendMessages(desPhones);
                            txtLog.AppendText("Gui " + desPhones.Length.ToString() + " tin nhan thanh cong .\n");
                        }
                        catch (Exception j)
                        {
                            txtLog.AppendText(j.Message + "\n");
                        }
                    }
                    Cursor.Current = Cursors.Default;
                }
            }
            else
            {
                MessageBox.Show("Số Điện Thoại hoặc Nội Dung Tin Nhắn trống .");
            }
        }