Beispiel #1
0
		public AsynchronousSocketListener(Schemas.CRCL.Status.CRCLStatusType status,
			HandleNewCommandDelegate handleNewCommand,
			int port) {
			this.status = status;
			this.handleNewCommand = handleNewCommand;
			this.port = port;
		}
Beispiel #2
0
 public Serializer(Action<Events.Base> emit, Schemas.Base schema = null)
 {
     this.emit = emit;
     if (schema == null)
         schema = new Schemas.Full();
     this.Schema = schema;
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>Funtion to build a full MultipartMessageType, from simple fields.</summary>
        /// <param name="destinations">An array of phoneNumber destinations.</param>
        /// <param name="subject">The subject of the MMS.</param>
        /// <param name="originAddress">The sender address.</param>
        /// <param name="senderName">Optional: A sender name.</param>
        /// <param name="message">Optional: A text message that will be sent as a text attachment.</param>
        /// <param name="attachments">Optional: List of attachments to be sent.</param>
        /// <param name="endpoint">Optional: String which contains the endpoint where status notifications will be sent.</param>
        /// <param name="correlator">Optional, Mandatory if Notifications: The correlator for the status notifications.</param>
        /// <returns>A MultipartMessageType, ready to be serialized and sent.</returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public static Schemas.MultipartMessageType CreateMultipartMessageType(string[] destinations, string subject
            , MMS.Schemas.UserIdType originAddress
            , string senderName = null, string message = null, Schemas.Attachment[] attachments = null
            , string endpoint = null, string correlator = null)
        {

            Schemas.MultipartMessageType multipartMessage = new Schemas.MultipartMessageType();
            Schemas.MessageType messageType = new Schemas.MessageType();

            messageType.address = new Schemas.UserIdType[destinations.Length];
            for (int i = 0; i < destinations.Length; i++)
            {
                Core.Tools.Extension.checkIsNumber(destinations[i], "destination");
                messageType.address[i] = new Schemas.UserIdType() { Item = destinations[i]
                    , ItemElementName = Schemas.ItemChoiceType1.phoneNumber 
                };
            }

            messageType.originAddress =  originAddress;

            messageType.subject = subject;

            messageType.senderName = senderName;

            if (!string.IsNullOrEmpty(endpoint) && !string.IsNullOrEmpty(correlator))//Both endpoint and correlator arent null nor empty
            {
                messageType.receiptRequest = new Schemas.SimpleReferenceType() { endpoint = endpoint, correlator = correlator };
            }

            multipartMessage.message = message;

            //Translating attachments to attachmentInfos
            Schemas.AttachmentInfo[] attachmentInfos = null;
            if (attachments == null)
            {
                attachmentInfos = new Schemas.AttachmentInfo[0];
            }
            else
            {
                attachmentInfos = new Schemas.AttachmentInfo[attachments.Length];
                for (var i = 0; i < attachments.Length; i++)
                {
                    if (attachments[i] != null)
                    {
                        attachmentInfos[i] = new Schemas.AttachmentInfo(
                            attachments[i].fileName, Tools.MMSTools.extractMIMEText(attachments[i].mimeType)
                            );
                    }
                }
            }
            multipartMessage.attachments = attachmentInfos;

            multipartMessage.messageType = messageType;

            return multipartMessage;
        }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>Allows to send and MMS to the Bluevia endpoint. And offers to check the delivery status,
 /// following a notification strategy.</summary>
 /// <param name="destination">Array of address of the recipients of the message.</param>
 /// <param name="subject">The subject of the mms to send.</param>
 /// <param name="message">Optional: A text message that will be sent as a text attachment.</param>
 /// <param name="attachments">Optional: List of attachments to be sent.</param>
 /// <param name="endpoint"> Optional: String which contains the endpoint where status notifications will be sent.</param>
 /// <param name="correlator">Optional, Mandatory if Notifications: The correlator for the status notifications.</param>
 /// <returns>It returns a String containing the mmsId of the MMS sent. To poll for delivery status.</returns>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public string Send(string[] destination, string subject
     , string message = null, Schemas.Attachment[] attachments = null
     , string endpoint = null, string correlator = null)
 {
     return base.SendProcess(destination, subject
         , new MMS.Schemas.UserIdType()
     { Item = connector.GetToken(), ItemElementName = MMS.Schemas.ItemChoiceType1.alias }
         , null, null
         , message, attachments
         , endpoint, correlator);
 }
Beispiel #5
0
        protected Schemas GetSchemas()
        {
            Schemas ListSchema = new Schemas();
            using (Connection)
            {
                Connection.Open();
                #region reader

                using (SqlDataReader _reader = Command.ExecuteReader())
                {
                    while (_reader.Read())
                    {
                        Schema schema = new Schema();

                        #region reflection 寫法 不要用.
                        PropertyInfo[] props = schema.GetType().GetProperties();
                        foreach (PropertyInfo prop in props)
                        {
                            try
                            {
                                int idx = _reader.GetOrdinal(prop.Name);
                                if (idx != -1)
                                {

                                    if (prop.PropertyType.Name.ToLower() == "string")
                                    {
                                        string value = _reader.GetString(idx);
                                        prop.SetValue(schema, value, null);
                                    }
                                    else if (prop.PropertyType.Name.ToLower() == "int32")
                                    {
                                        int value = (_reader.IsDBNull(idx))? 0:_reader.GetInt32(idx);
                                        prop.SetValue(schema, value, null);
                                    }

                                }
                            }
                            catch { }
                        }
                        #endregion

                        ListSchema.Add(schema);
                    }
                }

                #endregion

                Connection.Close();
            }

            return ListSchema;
        }
Beispiel #6
0
		private static void updateStatus(Schemas.CRCL.Status.CRCLStatusType newStatus) {
			status = newStatus;
			showStatus ();
		}
 public VsixWithVsixManifest(string file, Schemas.Vsix manifest) : base(file)
 {
     mManifest = manifest;
 }
Beispiel #8
0
		private static void handleNewCommand(Schemas.CRCL.CommandInstance.CRCLCommandInstanceType newCmdInstance) {
			cmdInstance.CRCLCommand = newCmdInstance.CRCLCommand;
		}
Beispiel #9
0
        public override SQLScriptList ToSqlDiff(List <ISchemaBase> schemas)
        {
            var isAzure10 = this.Info.Version == DatabaseInfo.VersionTypeEnum.SQLServerAzure10;

            var listDiff = new SQLScriptList();

            listDiff.Add(new SQLScript(String.Format(@"/*

    Open DBDiff {0}
    http://opendbiff.codeplex.com/

    Script created by {1}\{2} on {3} at {4}.

    Created on:  {5}
    Source:      {6} on {7}
    Destination: {8} on {9}

*/

",
                                                     System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                                     Environment.UserDomainName,
                                                     Environment.UserName,
                                                     DateTime.Now.ToShortDateString(),
                                                     DateTime.Now.ToLongTimeString(),
                                                     Environment.MachineName,
                                                     SourceInfo != null ? SourceInfo.Database : "Uknown",
                                                     SourceInfo != null ? SourceInfo.Server : "Uknown",
                                                     Info != null ? Info.Database : "Uknown",
                                                     Info != null ? Info.Server : "Uknown",
                                                     0), 0, Enums.ScripActionType.None));
            if (!isAzure10)
            {
                listDiff.Add("USE [" + Name + "]\r\nGO\r\n\r\n", 0, Enums.ScripActionType.UseDatabase);
                listDiff.AddRange(Assemblies.ToSqlDiff(schemas));
                listDiff.AddRange(UserTypes.ToSqlDiff(schemas));
            }
            listDiff.AddRange(TablesTypes.ToSqlDiff(schemas));
            listDiff.AddRange(Tables.ToSqlDiff(schemas));
            listDiff.AddRange(Rules.ToSqlDiff(schemas));
            listDiff.AddRange(Schemas.ToSqlDiff(schemas));
            listDiff.AddRange(XmlSchemas.ToSqlDiff(schemas));
            listDiff.AddRange(Procedures.ToSqlDiff(schemas));
            if (!isAzure10)
            {
                listDiff.AddRange(CLRProcedures.ToSqlDiff(schemas));
                listDiff.AddRange(CLRFunctions.ToSqlDiff(schemas));
                listDiff.AddRange(FileGroups.ToSqlDiff(schemas));
            }
            listDiff.AddRange(DDLTriggers.ToSqlDiff(schemas));
            listDiff.AddRange(Synonyms.ToSqlDiff(schemas));
            listDiff.AddRange(Views.ToSqlDiff(schemas));
            listDiff.AddRange(Users.ToSqlDiff(schemas));
            listDiff.AddRange(Functions.ToSqlDiff(schemas));
            listDiff.AddRange(Roles.ToSqlDiff(schemas));
            listDiff.AddRange(PartitionFunctions.ToSqlDiff(schemas));
            listDiff.AddRange(PartitionSchemes.ToSqlDiff(schemas));
            if (!isAzure10)
            {
                listDiff.AddRange(FullText.ToSqlDiff(schemas));
            }
            return(listDiff);
        }