コード例 #1
0
        public void ResponseSmsInfoRequested(sms_msg msg)
        {
            sms_msg sendSmsMsg = GetSmsMessage(USRSTRUCTS.SMS_INFO_RES, string.Empty, msg.from_ext, msg.receiverphones, msg.to_ext, string.Empty);

            byte[] bytes = util.GetBytes(sendSmsMsg);
            client.Send(bytes, bytes.Length);
        }
コード例 #2
0
        // Receive Sms
        public void ResponseSmsReceivedRequested(sms_msg msg)
        {
            sms_msg sendSmsMsg = GetSmsMessage(USRSTRUCTS.SMS_RECV_RES, string.Empty, msg.to_ext, msg.senderphone, msg.senderphone, string.Empty);

            byte[] bytes = util.GetBytes(sendSmsMsg);
            client.Send(bytes, bytes.Length);
        }
コード例 #3
0
        // Send Sms
        public void SendSms(Customer customer, string smsmsg, string sender)
        {
            try
            {
                sms_msg msg   = this.GetSmsMessage(USRSTRUCTS.SMS_SEND_REQ, smsmsg, sender, customer.Cellular, string.Empty, string.Empty);
                byte[]  bytes = util.GetBytes(msg);

                client.Send(bytes, bytes.Length);
            }
            catch (SocketException ex)
            {
                util.WriteLog(ex.ErrorCode, ex.Message.ToString());
            }

            // Thread.Sleep(100);
        }
コード例 #4
0
        public sms_msg GetSmsMessage(byte st, string strmsg, string sender, string receiver, string toext, string reservtime)
        {
            sms_msg msg = new sms_msg();

            switch (st)
            {
            case USRSTRUCTS.SMS_SEND_REQ:
                msg.cmd            = st;
                msg.direct         = USRSTRUCTS.DIRECT_OUTGOING;
                msg.type           = USRSTRUCTS.TYPE_COUPLEPHONE;
                msg.from_ext       = CoupleModeInfo.userid;
                msg.message        = strmsg;
                msg.senderphone    = sender;
                msg.receiverphones = receiver;
                msg.reservetime    = reservtime;
                break;

            case USRSTRUCTS.SMS_INFO_RES:
                msg.cmd            = st;
                msg.direct         = USRSTRUCTS.DIRECT_OUTGOING;
                msg.type           = USRSTRUCTS.TYPE_COUPLEPHONE;
                msg.from_ext       = sender;
                msg.receiverphones = receiver;
                msg.to_ext         = toext;
                break;

            case USRSTRUCTS.SMS_RECV_RES:
                msg.cmd            = st;
                msg.direct         = USRSTRUCTS.DIRECT_INCOMING;
                msg.type           = USRSTRUCTS.TYPE_COUPLEPHONE;
                msg.status         = USRSTRUCTS.STATUS_SMS_SUCCESS;
                msg.from_ext       = sender;
                msg.senderphone    = sender;
                msg.receiverphones = receiver;
                msg.to_ext         = receiver;
                msg.userid         = receiver;
                break;
            }

            return(msg);
        }
コード例 #5
0
        private void DoItForSMS(byte[] buffer)
        {
            sms_msg msg = util.GetObject <sms_msg>(buffer);

            switch (msg.cmd)
            {
            case USRSTRUCTS.SMS_SEND_RES:
                if (SmsSentCompletedEvent != null)
                {
                    SmsSentCompletedEvent(this, msg);
                }
                break;

            case USRSTRUCTS.SMS_INFO_REQ:
                if (SmsSentInfoRequestedEvent != null)
                {
                    SmsSentInfoRequestedEvent(this, msg);
                }
                break;

            case USRSTRUCTS.SMS_RECV_REQ:
                if (SmsRecievedRequestedEvent != null)
                {
                    SmsRecievedRequestedEvent(this, msg);
                }
                break;

            default:
                break;
            }

            // sendmsg = GetSmsMessage(USRSTRUCTS.SMS_INFO_RES, string.Empty, msg.from_ext, msg.receiverphones, msg.to_ext, string.Empty);

            // byte[] bytes = util.GetBytes(sendmsg);
            // client.Send(bytes, bytes.Length);

            // util.WriteLog(string.Format("cmd : {0}, status : {1}, receiverphones : {2}, toext : {3}, fromext : {4}", msg.cmd, msg.status, msg.receiverphones, msg.to_ext, msg.from_ext));
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: step4u/MiniCRM
        private void Client_SmsSentInfoRequestedEvent(object obj, sms_msg msg)
        {
            client.ResponseSmsInfoRequested(msg);

            //Smses smslists = new Smses();
            //Sms item = new Sms() {
            //    Cust_Tel = msg.receiverphones,
            //    Memo = msg.message
            //};

            //smslists.add(item);

            //if (pb.calls != null)
            //{
            //    pb.smslist.add();
            //}
        }
コード例 #7
0
ファイル: MainWindow.xaml.cs プロジェクト: step4u/MiniCRM
        private void Client_SmsSentCompletedEvent(object obj, sms_msg msg)
        {
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                SearchCondition1 con = new SearchCondition1();
                con.StartDate = pb.sdate.Value;
                con.EndDate = pb.edate.Value;
                // Smses smslists = new Smses();
                if (pb.smslist == null)
                    pb.smslist = new Smses(con);

                Customer itm = smscustomers.FirstOrDefault(x => x.Cellular.Equals(msg.receiverphones));

                if (itm != null)
                {
                    Sms item = new Sms()
                    {
                        Cust_Name = itm.Name,
                        Cust_Tel = msg.receiverphones,
                        Memo = msg.message,
                        Regdate = DateTime.Now,
                        Result = msg.status
                    };

                    pb.smslist.add(item);
                    pb.dgSmsList.ItemsSource = pb.smslist;

                    smscustomers.Remove(itm);
                    this.SendSms(null, smsmsg, smssender);
                }
                
            }));
        }
コード例 #8
0
ファイル: MainWindow.xaml.cs プロジェクト: step4u/MiniCRM
        private void Client_SmsRecievedRequestedEvent(object obj, sms_msg msg)
        {
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                if (pb.smslist != null)
                {
                    Sms item = new Sms()
                    {
                        Cust_Tel = msg.receiverphones,
                        Memo = msg.message
                    };

                    pb.smslist.add(item);
                    pb.tabs.SelectedIndex = 2;
                }
            }));
        }
コード例 #9
0
ファイル: UdpCoupleMode.cs プロジェクト: step4u/MiniCRM
        public sms_msg GetSmsMessage(byte st, string strmsg, string sender, string receiver, string toext, string reservtime)
        {
            sms_msg msg = new sms_msg();

            switch (st)
            {
                case USRSTRUCTS.SMS_SEND_REQ:
                    msg.cmd = st;
                    msg.direct = USRSTRUCTS.DIRECT_OUTGOING;
                    msg.type = USRSTRUCTS.TYPE_COUPLEPHONE;
                    msg.from_ext = CoupleModeInfo.userid;
                    msg.message = strmsg;
                    msg.senderphone = sender;
                    msg.receiverphones = receiver;
                    msg.reservetime = reservtime;
                    break;
                case USRSTRUCTS.SMS_INFO_RES:
                    msg.cmd = st;
                    msg.direct = USRSTRUCTS.DIRECT_OUTGOING;
                    msg.type = USRSTRUCTS.TYPE_COUPLEPHONE;
                    msg.from_ext = sender;
                    msg.receiverphones = receiver;
                    msg.to_ext = toext;
                    break;
                case USRSTRUCTS.SMS_RECV_RES:
                    msg.cmd = st;
                    msg.direct = USRSTRUCTS.DIRECT_INCOMING;
                    msg.type = USRSTRUCTS.TYPE_COUPLEPHONE;
                    msg.status = USRSTRUCTS.STATUS_SMS_SUCCESS;
                    msg.from_ext = sender;
                    msg.senderphone = sender;
                    msg.receiverphones = receiver;
                    msg.to_ext = receiver;
                    msg.userid = receiver;
                    break;
            }

            return msg;
        }
コード例 #10
0
ファイル: UdpCoupleMode.cs プロジェクト: step4u/MiniCRM
 public void ResponseSmsInfoRequested(sms_msg msg)
 {
     sms_msg sendSmsMsg = GetSmsMessage(USRSTRUCTS.SMS_INFO_RES, string.Empty, msg.from_ext, msg.receiverphones, msg.to_ext, string.Empty);
     byte[] bytes = util.GetBytes(sendSmsMsg);
     client.Send(bytes, bytes.Length);
 }
コード例 #11
0
ファイル: UdpCoupleMode.cs プロジェクト: step4u/MiniCRM
 // Receive Sms
 public void ResponseSmsReceivedRequested(sms_msg msg)
 {
     sms_msg sendSmsMsg = GetSmsMessage(USRSTRUCTS.SMS_RECV_RES, string.Empty, msg.to_ext, msg.senderphone, msg.senderphone, string.Empty);
     byte[] bytes = util.GetBytes(sendSmsMsg);
     client.Send(bytes, bytes.Length);
 }