Пример #1
0
 public bool insertSubsribe(SubscribeDTO s)
 {
     try
     {
         SUBSCRIBE temp = new SUBSCRIBE();
         temp.CUSTOMER_ID = s._customer_id;
         temp.MEDICINE_ID = s._medicine_id;
         Db.Insertable <SUBSCRIBE>(temp).ExecuteCommand();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Пример #2
0
        public static Command CreateCommand(byte fixedHeader)
        {
            Header header = new Header(fixedHeader);

            Command result = null;

            switch (header.Type)
            {
            case 1:
                result = new CONNECT(header);
                break;

            case 2:
                result = new CONNACK(header);
                break;

            case 3:
                result = new PUBLISH(header);
                break;

            case 4:
                result = new PUBACK(header);
                break;

            case 5:
                result = new PUBREC(header);
                break;

            case 6:
                result = new PUBREL(header);
                break;

            case 7:
                result = new PUBCOMP(header);
                break;

            case 8:
                result = new SUBSCRIBE(header);
                break;

            case 9:
                result = new SUBACK(header);
                break;

            case 10:
                result = new UNSUBSCRIBE(header);
                break;

            case 11:
                result = new UNSUBACK(header);
                break;

            case 12:
                result = new PINGREQ(header);
                break;

            case 13:
                result = new PINGRESP(header);
                break;

            case 14:
                result = new DISCONNECT(header);
                break;

            default:
                throw new NMSException("Unknown Command received");
            }

            return(result);
        }