Inheritance: Tools.TOKEN
コード例 #1
0
ファイル: ZhConverter.cs プロジェクト: JaynLeaew/zhconverter
 public static ZhConverter GetInstance(To converterType)
 {
     if (!Converters.ContainsKey(converterType))
     {
         Converters.Add(converterType, new ZhConverter(PropertyFiles[converterType]));
     }
     return Converters[converterType];
 }
コード例 #2
0
        public SmsHelper(string toPhoneNumber, string fromPhoneNumber, string smsText)
        {

            to = new List<To>();

            var toSms = new To { phoneNumber = toPhoneNumber };

            to.Add(toSms);

            var fromSms = new From { phoneNumber = fromPhoneNumber };

            from = fromSms;

            text = smsText;
        }
コード例 #3
0
ファイル: WorkerZayavka.aspx.cs プロジェクト: maziesmith/KOS
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckAccount();
            if (!string.IsNullOrEmpty(Request["lift"]))
            {
                _liftId = HttpUtility.HtmlDecode(Request["lift"]);
            }
            if (!string.IsNullOrEmpty(Request["ReturnUrl"]))
            {
                _url = HttpUtility.HtmlDecode(Request["ReturnUrl"]);
            }

            using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("select ui.Family, ui.IO from UserInfo ui " +
                                                "join Users u on u.UserId=ui.UserId where u.UserName=@userName", conn);
                cmd.Parameters.AddWithValue("userName", User.Identity.Name);
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    fam = dr[0].ToString();
                }
                io = dr[1].ToString();
                dr.Close();
            }

            App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
            _workers = db.GetWorkers();
            if (!IsPostBack)
            {
                List <string> ls = db.GetIdU();
                IdU.DataSource = ls;
                IdU.DataBind();
                if (ls.Count > 0)
                {
                    IdU.SelectedIndex = 0;
                }
                IdU_SelectedIndexChanged(sender, e);

                string[] ss = { "1", "2" };
                Category.DataSource = ss;
                Category.DataBind();
                Category.SelectedIndex = 0;
                db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
                List <string> types = db.GetWZTypes();
                Type.DataSource = types;
                Type.DataBind();
                Type.SelectedIndex = 0;
                PrimLift_TextChanged(this, EventArgs.Empty);
                LiftId_SelectedIndexChanged(this, EventArgs.Empty);

                To.DataSource = _workers;
                To.DataBind();
                To.SelectedIndex = 0;
            }
            List <string> typeakt = new List <string>()
            {
                "Акт дефектовки", "Акт повреждения оборудования"
            };
            List <string> chel = new List <string>()
            {
                "", "Да", "Нет"
            };
            List <string> chas = new List <string>()
            {
                "", "да", "Нет"
            };

            if (!IsPostBack)
            {
                TypeAkt.DataSource = typeakt;
                TypeAkt.DataBind();
                TypeAkt.SelectedIndex = 0;

                Chel.DataSource = chel;
                Chel.DataBind();
                Chel.SelectedIndex = 0;

                Chas.DataSource = chas;
                Chas.DataBind();
                Chas.SelectedIndex = 0;
            }
        }
コード例 #4
0
ファイル: KawazuConverter.cs プロジェクト: tokyokamera/Kawazu
        /// <summary>
        /// Convert the given sentence into chosen form.
        /// </summary>
        /// <param name="str"></param>
        /// <param name="to"></param>
        /// <param name="mode"></param>
        /// <param name="system"></param>
        /// <param name="delimiterStart"></param>
        /// <param name="delimiterEnd"></param>
        /// <returns>Convert result string</returns>
        public async Task <string> Convert(
            string str,
            To to                 = To.Hiragana,
            Mode mode             = Mode.Normal,
            RomajiSystem system   = RomajiSystem.Hepburn,
            string delimiterStart = "(",
            string delimiterEnd   = ")")
        {
            var result = await Task.Run(() =>
            {
                var nodes   = _tagger.Parse(str);  // Parse
                var builder = new StringBuilder(); // StringBuilder for the final output string.
                var text    = nodes.Select(node => new Division(node, Utilities.GetTextType(node.Surface), system))
                              .ToList();
                switch (to)
                {
                case To.Romaji:
                    var isPreviousEndsInTsu = false;
                    switch (mode)
                    {
                    case Mode.Normal:
                        foreach (var division in text)
                        {
                            if (division.IsEndsInTsu)
                            {
                                isPreviousEndsInTsu = true;
                                division.RemoveAt(division.Count - 1);
                                builder.Append(division.RomaReading);
                                continue;
                            }

                            if (isPreviousEndsInTsu)
                            {
                                builder.Append(division.RomaReading.First());
                                isPreviousEndsInTsu = false;
                            }
                            builder.Append(division.RomaReading);
                        }
                        break;

                    case Mode.Spaced:
                        foreach (var division in text)
                        {
                            if (division.IsEndsInTsu)
                            {
                                isPreviousEndsInTsu = true;
                                division.RemoveAt(division.Count - 1);
                                builder.Append(division.RomaReading);
                                continue;
                            }

                            if (isPreviousEndsInTsu)
                            {
                                builder.Append(division.RomaReading.First());
                                isPreviousEndsInTsu = false;
                            }
                            builder.Append(division.RomaReading).Append(" ");
                        }
                        break;

                    case Mode.Okurigana:
                        foreach (var ele in text.SelectMany(division => division))
                        {
                            if (ele.Type == TextType.PureKanji)
                            {
                                builder.Append(ele.Element).Append(delimiterStart).Append(ele.RomaNotation)
                                .Append(delimiterEnd);
                            }
                            else
                            {
                                builder.Append(ele.Element);
                            }
                        }
                        break;

                    case Mode.Furigana:
                        foreach (var ele in text.SelectMany(division => division))
                        {
                            if (ele.Type == TextType.PureKanji)
                            {
                                builder.Append("<ruby>").Append(ele.Element).Append("<rp>")
                                .Append(delimiterStart).Append("</rp>").Append("<rt>")
                                .Append(ele.RomaNotation).Append("</rt>").Append("<rp>")
                                .Append(delimiterEnd).Append("</rp>").Append("</ruby>");
                            }
                            else
                            {
                                if (ele.Element.Last() == 'っ' || ele.Element.Last() == 'ッ')
                                {
                                    builder.Append(ele.Element.Last());
                                    isPreviousEndsInTsu = true;
                                    continue;
                                }

                                if (isPreviousEndsInTsu)
                                {
                                    builder.Append("<ruby>").Append(ele.Element).Append("<rp>")
                                    .Append(delimiterStart).Append("</rp>").Append("<rt>")
                                    .Append(ele.RomaNotation.First())
                                    .Append(ele.RomaNotation).Append("</rt>").Append("<rp>")
                                    .Append(delimiterEnd).Append("</rp>").Append("</ruby>");
                                    isPreviousEndsInTsu = false;
                                    continue;
                                }
                                builder.Append("<ruby>").Append(ele.Element).Append("<rp>")
                                .Append(delimiterStart).Append("</rp>").Append("<rt>")
                                .Append(ele.RomaNotation).Append("</rt>").Append("<rp>")
                                .Append(delimiterEnd).Append("</rp>").Append("</ruby>");
                            }
                        }
                        break;
                    }
                    break;

                case To.Katakana:
                    switch (mode)
                    {
                    case Mode.Normal:
                        foreach (var division in text)
                        {
                            builder.Append(division.KataReading);
                        }
                        break;

                    case Mode.Spaced:
                        foreach (var division in text)
                        {
                            builder.Append(division.KataReading).Append(" ");
                        }
                        break;

                    case Mode.Okurigana:
                        foreach (var ele in text.SelectMany(division => division))
                        {
                            if (ele.Type == TextType.PureKanji)
                            {
                                builder.Append(ele.Element).Append(delimiterStart).Append(ele.KataNotation)
                                .Append(delimiterEnd);
                            }
                            else
                            {
                                builder.Append(ele.Element);
                            }
                        }
                        break;

                    case Mode.Furigana:
                        foreach (var ele in text.SelectMany(division => division))
                        {
                            if (ele.Type == TextType.PureKanji)
                            {
                                builder.Append("<ruby>").Append(ele.Element).Append("<rp>")
                                .Append(delimiterStart).Append("</rp>").Append("<rt>")
                                .Append(ele.KataNotation).Append("</rt>").Append("<rp>")
                                .Append(delimiterEnd).Append("</rp>").Append("</ruby>");
                            }
                            else
                            {
                                builder.Append(ele.Element);
                            }
                        }
                        break;
                    }
                    break;

                case To.Hiragana:
                    switch (mode)
                    {
                    case Mode.Normal:
                        foreach (var division in text)
                        {
                            builder.Append(division.HiraReading);
                        }
                        break;

                    case Mode.Spaced:
                        foreach (var division in text)
                        {
                            builder.Append(division.HiraReading).Append(" ");
                        }
                        break;

                    case Mode.Okurigana:
                        foreach (var ele in text.SelectMany(division => division))
                        {
                            if (ele.Type == TextType.PureKanji)
                            {
                                builder.Append(ele.Element).Append(delimiterStart).Append(ele.HiraNotation)
                                .Append(delimiterEnd);
                            }
                            else
                            {
                                builder.Append(ele.Element);
                            }
                        }
                        break;

                    case Mode.Furigana:
                        foreach (var ele in text.SelectMany(division => division))
                        {
                            if (ele.Type == TextType.PureKanji)
                            {
                                builder.Append("<ruby>").Append(ele.Element).Append("<rp>")
                                .Append(delimiterStart).Append("</rp>").Append("<rt>")
                                .Append(ele.HiraNotation).Append("</rt>").Append("<rp>")
                                .Append(delimiterEnd).Append("</rp>").Append("</ruby>");
                            }
                            else
                            {
                                builder.Append(ele.Element);
                            }
                        }
                        break;
                    }
                    break;
                }

                return(builder.ToString());
            });

            return(result);
        }
コード例 #5
0
        public void JoinablesWithCache()
        {
            string queryCachingDatabaseName = To.GetRuntimeName();

            _queryCachingDatabase = To;

            //make aggregate 2 a joinable
            var joinable2 = new JoinableCohortAggregateConfiguration(CatalogueRepository, cohortIdentificationConfiguration, aggregate2);

            joinable2.AddUser(aggregate1);

            //make aggregate 2 have an additional column (dtCreated)
            var anotherCol = aggregate2.Catalogue.GetAllExtractionInformation(ExtractionCategory.Any).Single(e => e.GetRuntimeName().Equals("dtCreated"));

            aggregate2.AddDimension(anotherCol);

            //create a caching server
            MasterDatabaseScriptExecutor scripter = new MasterDatabaseScriptExecutor(_queryCachingDatabase);

            scripter.CreateAndPatchDatabase(new QueryCachingPatcher(), new AcceptAllCheckNotifier());

            var queryCachingDatabaseServer = new ExternalDatabaseServer(CatalogueRepository, queryCachingDatabaseName, null);

            queryCachingDatabaseServer.SetProperties(_queryCachingDatabase);

            try
            {
                var builderForCaching = new CohortQueryBuilder(aggregate2, null, null);

                var cacheDt = new DataTable();
                using (SqlConnection con = (SqlConnection)Database.Server.GetConnection())
                {
                    con.Open();
                    SqlDataAdapter da = new SqlDataAdapter(new SqlCommand(builderForCaching.SQL, con));
                    da.Fill(cacheDt);
                }

                var cacheManager = new CachedAggregateConfigurationResultsManager(queryCachingDatabaseServer);
                cacheManager.CommitResults(new CacheCommitJoinableInceptionQuery(aggregate2, builderForCaching.SQL, cacheDt, null, 30));

                try
                {
                    var builder = new CohortQueryBuilder(aggregate1, null, null);

                    //make the builder use the query cache we just set SetUp
                    builder.CacheServer = queryCachingDatabaseServer;

                    Console.WriteLine(builder.SQL);

                    using (var con = (SqlConnection)Database.Server.GetConnection())
                    {
                        con.Open();

                        var dbReader = new SqlCommand(builder.SQL, con).ExecuteReader();

                        //can read at least one row
                        Assert.IsTrue(dbReader.Read());
                    }

                    string expectedTableAlias = "ix" + joinable2.ID;

                    //after joinables
                    Assert.AreEqual(
                        CollapseWhitespace(
                            string.Format(
                                @"/*cic_{2}_UnitTestAggregate1*/
SELECT
distinct
[" + TestDatabaseNames.Prefix + @"ScratchArea].[dbo].[BulkData].[chi]
FROM 
[" + TestDatabaseNames.Prefix + @"ScratchArea].[dbo].[BulkData]
LEFT Join (
	/*Cached:cic_{2}_UnitTestAggregate2*/
	select * from [{3}]..[JoinableInceptionQuery_AggregateConfiguration{1}]

){0}
on [" + TestDatabaseNames.Prefix + @"ScratchArea].[dbo].[BulkData].[chi] = {0}.chi",
                                expectedTableAlias,                   //{0}
                                aggregate2.ID,                        //{1}
                                cohortIdentificationConfiguration.ID, //{2}
                                queryCachingDatabaseName)             //{3}
                            ), CollapseWhitespace(builder.SQL));
                }
                finally
                {
                    joinable2.Users[0].DeleteInDatabase();
                    joinable2.DeleteInDatabase();
                }
            }
            finally
            {
                queryCachingDatabaseServer.DeleteInDatabase();
                DiscoveredServerICanCreateRandomDatabasesAndTablesOn.ExpectDatabase(queryCachingDatabaseName).Drop();
            }
        }
コード例 #6
0
 public bool Equals([AllowNull] Move other)
 {
     return(From.Equals(other.From) && To.Equals(other.To));
 }
 public override string ToString()
 {
     return
         ($"{nameof(Enabled)}: {Enabled}, {nameof(To)}: {string.Join("; ", To.Select(email => email.Address))}, {nameof(From)}: {From}, {nameof(IsValid)}: {IsValid}");
 }
コード例 #8
0
ファイル: ZhConverter.cs プロジェクト: JaynLeaew/zhconverter
 public static string Convert(string text, To converterType)
 {
     var instance = GetInstance(converterType);
     return instance.Convert(text);
 }
コード例 #9
0
 public override string ToString() => $"{From?.ToString() ?? "null"} + '{Token}' = {To?.ToString() ?? "null"}";
コード例 #10
0
        public void ActOnInMessage(IConMessage comMsg)
        {
            HubMessage message = (HubMessage)comMsg;

            if (message is MainChat)
            {
                MainChat    main = (MainChat)message;
                MainMessage msg  = new MainMessage(main.From, main.Content);
                Update(hub, new FmdcEventArgs(Actions.MainMessage, msg));
            }
            else if (message is To)
            {
                To             to = (To)message;
                PrivateMessage pm = new PrivateMessage(to.To, to.From, to.Content);
                Update(hub, new FmdcEventArgs(Actions.PrivateMessage, pm));
            }
            else if (message is SR)
            {
                SR searchResult         = (SR)message;
                SearchResultInfo srinfo = new SearchResultInfo(searchResult.Info, searchResult.From);
                Update(hub, new FmdcEventArgs(Actions.SearchResult, srinfo));
            }
            else if (message is Search)
            {
                Search search = (Search)message;
                if (hub.Share == null)
                {
                    return;
                }
                int  maxReturns = 5;
                bool active     = false;
                if (search.Address != null)
                {
                    maxReturns = 10;
                    active     = true;
                }
                System.Collections.Generic.List <ContentInfo> ret = new System.Collections.Generic.List <ContentInfo>(maxReturns);
                // TODO : This lookup can be done nicer
                lock (hub.Share)
                {
                    foreach (System.Collections.Generic.KeyValuePair <string, Containers.ContentInfo> var in hub.Share)
                    {
                        if (var.Value == null)
                        {
                            continue;
                        }
                        bool   foundEnough = false;
                        string ext         = search.Info.Get(SearchInfo.EXTENTION);
                        string sch         = search.Info.Get(SearchInfo.SEARCH);
                        if (ext != null && sch != null)
                        {
                            ContentInfo contentInfo = new ContentInfo();
                            if (search.Info.ContainsKey(SearchInfo.TYPE))
                            {
                                switch (search.Info.Get(SearchInfo.TYPE))
                                {
                                case "2":

                                    contentInfo.Set(ContentInfo.TTH, search.Info.Get(SearchInfo.SEARCH));
                                    if (hub.Share.ContainsContent(ref contentInfo))
                                    {
                                        ret.Add(contentInfo);
                                    }
                                    // We are looking through whole share here.
                                    // If no TTH matching. Ignore.
                                    foundEnough = true;
                                    break;

                                case "1":
                                default:
                                    if (var.Value.ContainsKey(ContentInfo.VIRTUAL) && (System.IO.Path.GetDirectoryName(var.Value.Get(ContentInfo.VIRTUAL)).IndexOf(sch, System.StringComparison.OrdinalIgnoreCase) != -1))
                                    {
                                        ret.Add(var.Value);
                                    }
                                    break;
                                }
                            }

                            if (!foundEnough)
                            {
                                string infoExt = System.IO.Path.GetExtension(var.Value.Get(ContentInfo.VIRTUAL)).TrimStart('.');
                                if (
                                    var.Value.ContainsKey(ContentInfo.VIRTUAL) &&
                                    (var.Value.Get(ContentInfo.VIRTUAL).IndexOf(sch, System.StringComparison.OrdinalIgnoreCase) != -1) &&
                                    (ext.Length == 0 || ext.Contains(infoExt))
                                    )
                                {
                                    ret.Add(var.Value);
                                }
                            }
                        }
                        if (foundEnough || ret.Count >= maxReturns)
                        {
                            break;
                        }
                    }
                }
                // Test against size restrictions
                for (int i = 0; i < ret.Count; i++)
                {
                    bool send = true;
                    long size = -1;
                    try
                    {
                        size = long.Parse(search.Info.Get(SearchInfo.SIZE));
                    }
                    catch { }
                    if (search.Info.ContainsKey(SearchInfo.SIZETYPE) && size != -1)
                    {
                        switch (search.Info.Get(SearchInfo.SIZETYPE))
                        {
                        case "1":           // Min Size
                            send = (size <= ret[i].Size);
                            break;

                        case "2":           // Max Size
                            send = (size >= ret[i].Size);
                            break;

                        case "3":           // Equal Size
                            send = (size == ret[i].Size);
                            break;
                        }
                    }
                    // Should this be sent?
                    if (send)
                    {
                        SR sr = new SR(hub, ret[i], (search.Info.ContainsKey(SearchInfo.EXTENTION) ? search.Info.Get(SearchInfo.EXTENTION).Equals("$0") : false), search.From);
                        if (active)
                        {
                            // Send with UDP
                            UdpConnection.Send(sr, search.Address);
                        }
                        else
                        {
                            // Send through hub
                            hub.Send(sr);
                        }
                    }
                }
            }
            else if (message is Lock)
            {
                hub.Send(new Supports(hub));
                hub.Send(new Key(hub, ((Lock)message).Key));
                hub.Send(new ValidateNick(hub));
            }
            else if (message is HubNmdc.HubName)
            {
                HubNmdc.HubName    hubname = (HubNmdc.HubName)message;
                Containers.HubName name    = null;
                if (hubname.Topic != null)
                {
                    name = new Containers.HubName(hubname.Name, hubname.Topic);
                }
                else
                {
                    name = new Containers.HubName(hubname.Content);
                }
                Update(hub, new FmdcEventArgs(Actions.Name, name));
            }
            else if (message is NickList)
            {
                NickList nicks = (NickList)message;
                foreach (string userid in nicks.List)
                {
                    UserInfo userInfo = new UserInfo();
                    userInfo.DisplayName = userid;
                    userInfo.Set(UserInfo.STOREID, hub.StoreId + userid);
                    if (hub.GetUserById(userid) == null)
                    {
                        Update(hub, new FmdcEventArgs(Actions.UserOnline, userInfo));
                    }
                }
            }
            else if (message is OpList)
            {
                OpList ops = (OpList)message;
                foreach (string userid in ops.List)
                {
                    UserInfo userInfo = new UserInfo();
                    userInfo.DisplayName = userid;
                    userInfo.Set(UserInfo.STOREID, hub.StoreId + userid);
                    userInfo.IsOperator = true;
                    User usr = null;
                    if ((usr = hub.GetUserById(userid)) == null)
                    {
                        Update(hub, new FmdcEventArgs(Actions.UserOnline, userInfo));
                    }
                    else
                    {
                        usr.UserInfo = userInfo;
                        Update(hub, new FmdcEventArgs(Actions.UserInfoChange, usr.UserInfo));
                    }
                }
            }
            else if (message is Quit)
            {
                Quit quit = (Quit)message;
                User usr  = null;
                if ((usr = hub.GetUserById(quit.From)) != null)
                {
                    Update(hub, new FmdcEventArgs(Actions.UserOffline, usr.UserInfo));
                }
            }
            else if (message is LogedIn)
            {
                hub.RegMode = 2;
            }
            else if (message is ValidateDenide)
            {
                Update(hub, new FmdcEventArgs(Actions.StatusChange, new HubStatus(HubStatus.Codes.Disconnected)));
            }
            else if (message is GetPass)
            {
                hub.RegMode = 1;
                if (hub.HubSetting.Password.Length == 0)
                {
                    Update(hub, new FmdcEventArgs(Actions.Password, null));
                }
                else
                {
                    hub.Send(new MyPass(hub));
                }
            }
            else if (message is MyINFO)
            {
                MyINFO myinfo = (MyINFO)message;
                User   usr    = null;
                if ((usr = hub.GetUserById(message.From)) == null)
                {
                    Update(hub, new FmdcEventArgs(Actions.UserOnline, myinfo.UserInfo));
                }
                else
                {
                    bool op = usr.IsOperator;
                    usr.UserInfo            = myinfo.UserInfo;
                    usr.UserInfo.IsOperator = op;
                    Update(hub, new FmdcEventArgs(Actions.UserInfoChange, usr.UserInfo));
                }

                if (hub.RegMode >= 0 && string.Equals(myinfo.From, hub.Me.ID))
                {
                    IsReady = true;
                }
            }
            else if (message is Hello)
            {
                if (hub.HubSetting.DisplayName.Equals(message.From))
                {
                    hub.Send(new Version(hub));
                    hub.Send(new GetNickList(hub));
                    if (hub.RegMode < 0)
                    {
                        hub.RegMode = 0;
                    }
                    UpdateMyInfo();
                }
            }
            else if (message is ConnectToMe)
            {
                ConnectToMe conToMe = (ConnectToMe)message;
                Transfer    trans   = new Transfer(conToMe.Address, conToMe.Port);
                trans.Share  = this.hub.Share;
                trans.Me     = hub.Me;
                trans.Source = new Source(hub.StoreId, null);
                // Protocol has to be set last.
                trans.Protocol = new TransferNmdcProtocol(trans);
#if !COMPACT_FRAMEWORK
                if (conToMe.TLS && hub.Me.ContainsKey(UserInfo.SECURE))
                {
                    trans.SecureProtocol = SecureProtocols.TLS;
                }
#endif
                Update(hub, new FmdcEventArgs(Actions.TransferStarted, trans));
            }
            else if (message is RevConnectToMe)
            {
                RevConnectToMe revConToMe = (RevConnectToMe)message;
                User           usr        = null;
                usr = hub.GetUserById(revConToMe.From);
                if (hub.Me.Mode == FlowLib.Enums.ConnectionTypes.Passive)
                {
                    if (usr != null)
                    {
                        // If user are not set as passive. Set it as it and respond with a revconnect.
                        if (usr.UserInfo.Mode != FlowLib.Enums.ConnectionTypes.Passive)
                        {
                            usr.UserInfo.Mode = FlowLib.Enums.ConnectionTypes.Passive;
                            hub.Send(new RevConnectToMe(revConToMe.From, hub));
                        }
                    }
                }
                else
                {
                    if (usr != null)
                    {
                        Update(hub, new FmdcEventArgs(Actions.TransferRequest, new TransferRequest(usr.ID, hub, usr.UserInfo)));
#if !COMPACT_FRAMEWORK
                        // Security, Windows Mobile doesnt support SSLStream so we disable this feature for it.
                        if (
                            usr.UserInfo.ContainsKey(UserInfo.SECURE) &&
                            hub.Me.ContainsKey(UserInfo.SECURE) &&
                            !string.IsNullOrEmpty(hub.Me.Get(UserInfo.SECURE))
                            )
                        {
                            hub.Send(new ConnectToMe(usr.ID, hub.Share.Port, hub, SecureProtocols.TLS));
                        }
                        else
#endif
                        hub.Send(new ConnectToMe(usr.ID, hub.Share.Port, hub));
                    }
                }
            }
            else if (message is ForceMove)
            {
                ForceMove forceMove = (ForceMove)message;
                hub.Disconnect();
                Update(hub, new FmdcEventArgs(Actions.Redirect, new RedirectInfo(forceMove.Address)));
            }
        }
コード例 #11
0
        protected HubMessage ParseMessage(string raw)
        {
            raw = raw.Replace(this.Seperator, "");
            HubMessage msg = new HubMessage(hub, raw);

            if (!string.IsNullOrEmpty(raw))
            {
                switch (raw[0])
                {
                case '$':
                    int    pos;
                    string cmd = null;
                    if ((pos = raw.IndexOf(' ')) != -1)
                    {
                        cmd = raw.Substring(0, pos).ToLower();
                    }
                    else
                    {
                        if (raw.Length >= 10)
                        {
                            break;
                        }
                        cmd = raw.ToLower();
                    }
                    if (cmd == null || cmd.Equals(string.Empty))
                    {
                        break;
                    }
                    switch (cmd)
                    {
                    case "$lock":
                        msg = new Lock(hub, raw); break;

                    case "$supports":
                        msg = new Supports(hub, raw); break;

                    case "$hubname":
                        msg = new HubNmdc.HubName(hub, raw); break;

                    case "$hello":
                        msg = new Hello(hub, raw); break;

                    case "$myinfo":
                        msg = new MyINFO(hub, raw); break;

                    case "$nicklist":
                        msg = new NickList(hub, raw); break;

                    case "$oplist":
                        msg = new OpList(hub, raw); break;

                    case "$to:":
                        msg = new To(hub, raw); break;

                    case "$quit":
                        msg = new Quit(hub, raw); break;

                    case "$getpass":
                        msg = new GetPass(hub, raw); break;

                    case "$logedin":
                        msg = new LogedIn(hub, raw); break;

                    case "$validatedenide":
                        msg = new ValidateDenide(hub, raw); break;

                    case "$forcemove":
                        msg = new ForceMove(hub, raw); break;

                    case "$connecttome":
                        msg = new ConnectToMe(hub, raw); break;

                    case "$revconnecttome":
                        msg = new RevConnectToMe(hub, raw); break;

                    case "$search":
                        msg = new Search(hub, raw); break;

                    case "$sr":
                        msg = new SR(hub, raw); break;
                    }
                    break;

                default:
                    // No command. Assume MainChat.
                    msg = new MainChat(hub, raw);
                    break;
                }
            }
            return(msg);
        }
コード例 #12
0
 public void Turn(To to)
 {
     character.Turn((Direction)to);
 }
 /// <summary>
 /// Create a new <see cref="PushEffect"/>.
 /// </summary>
 /// <param name="target">
 /// The <see cref="Target"/> this effect component acts on. This
 /// cannot be null.
 /// </param>
 /// <param name="to">
 /// Who combat advantage is granted to.
 /// </param>
 /// <param name="until">
 /// When the effect will end.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// No argument can be null.
 /// </exception>        
 public GrantCombatAdvantageEffect(Target target, To to, Until until)
     : base(target)
 {
     this.To = to;
     this.Until = until;
 }
コード例 #14
0
ファイル: ToString_Smart.cs プロジェクト: Minatron/Minatron
 public DateTimeToString_SmartConvertor(From from, To to)
     : base(from,to)
 {
 }
コード例 #15
0
 /// <summary>
 /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
 /// </returns>
 public override string ToString()
 {
     return("(" + From.ToString() + "," + To.ToString() + ")");
 }
コード例 #16
0
 public override string ToString()
 {
     return(string.Format("{0},{1}", From.ToString(), To.ToString()));
 }
コード例 #17
0
        public void ActOnOutMessage(FmdcEventArgs e)
        {
            if (e.Action.Equals(Actions.MainMessage))
            {
                Containers.MainMessage main = (Containers.MainMessage)e.Data;
                hub.Send(new MainChat(hub, hub.Me.ID, main.Content));
            }
            else if (e.Action.Equals(Actions.PrivateMessage))
            {
                Containers.PrivateMessage pm = (Containers.PrivateMessage)e.Data;
                To to = null;
                hub.Send(to = new To(hub, pm.To, pm.Content));
                this.ParseRaw(to.Raw);
            }
            else if (e.Action.Equals(Actions.Password))
            {
                hub.Send(new MyPass(hub, e.Data.ToString()));
            }
            else if (e.Action.Equals(Actions.Search))
            {
                hub.Send(new Search(hub, (SearchInfo)e.Data));
            }
            else if (e.Action.Equals(Actions.StartTransfer))
            {
                UserInfo usrInfo;
                User     usr = e.Data as User;
                if (usr == null)
                {
                    usrInfo = e.Data as UserInfo;
                    if (usrInfo == null)
                    {
                        return;
                    }
                }
                else
                {
                    usrInfo = usr.UserInfo;
                }

                switch (hub.Me.Mode)
                {
                case ConnectionTypes.Direct:
                case ConnectionTypes.UPnP:
                case ConnectionTypes.Forward:
                    Update(hub, new FmdcEventArgs(Actions.TransferRequest, new TransferRequest(usrInfo.ID, hub, usrInfo)));
#if !COMPACT_FRAMEWORK
// Security, Windows Mobile doesnt support SSLStream so we disable this feature for it.
                    if (
                        usrInfo.ContainsKey(UserInfo.SECURE) &&
                        hub.Me.ContainsKey(UserInfo.SECURE) &&
                        !string.IsNullOrEmpty(hub.Me.Get(UserInfo.SECURE))
                        )
                    {
                        hub.Send(new ConnectToMe(usrInfo.ID, hub.Share.Port, hub, SecureProtocols.TLS));
                    }
                    else
#endif
                    hub.Send(new ConnectToMe(usrInfo.ID, hub.Share.Port, hub));
                    break;

                case ConnectionTypes.Passive:
                case ConnectionTypes.Socket5:
                case ConnectionTypes.Unknown:
                default:
                    if (usrInfo.Mode == ConnectionTypes.Passive)
                    {
                        break;
                    }
                    hub.Send(new RevConnectToMe(usrInfo.ID, hub));
                    break;
                }
            }
        }
コード例 #18
0
ファイル: Syncronize.cs プロジェクト: nafetz/SE
 public static void SyncUpwardWishes(To who)
 {
     switch (who)
     {
         case To.UI:
             {
                 _ui.UpwardRequired = _elevator.UpwardRequired;
             } break;
         case To.Elevator:
             {
                 _elevator.UpwardRequired = _ui.UpwardRequired;
             } break;
     }
 }
コード例 #19
0
 protected override void Write(M3UFileInfo fileInfo, string value, LineReader reader)
 {
     fileInfo.Version = To.Value <int>(value);
 }
コード例 #20
0
        protected override void Execute(CodeActivityContext context)
        {
            MailMessage forwardMail = MailMessage.Get(context);

            if (forwardMail != null)
            {
                string html = ExportMailToHtml(forwardMail);

                string strHeader = "<p>";

                string fMessage = ForwardMessage.Get(context);
                if (!string.IsNullOrEmpty(fMessage))
                {
                    fMessage  = TextToHtml(fMessage);
                    strHeader = fMessage + "<br>";
                }

                if (ShowOriginalMessage)
                {
                    strHeader  = strHeader + "<br><br>" + "-----Original Message-----" + "<br>";
                    strHeader += "From: " + forwardMail.From.DisplayName + "<br>";
                    strHeader += "Sent: " + forwardMail.Headers["Date"] + "<br>";
                    strHeader += "To: " + forwardMail.To + "<br>";
                    strHeader += "Subject: " + forwardMail.Subject + "<br><br>";
                }

                forwardMail.Subject    = "FW: " + forwardMail.Subject;
                forwardMail.IsBodyHtml = true;
                forwardMail.Body       = strHeader + GetTrimmedBodyText(html) + "</p>";

                string to = To.Get(context);
                if (!string.IsNullOrEmpty(to))
                {
                    to = to.Replace(",", ";");
                    var toSplits = to.Split(';');
                    foreach (var t in toSplits)
                    {
                        forwardMail.To.Add(new MailAddress(t));
                    }
                }

                string cc = CC.Get(context);
                if (!string.IsNullOrEmpty(cc))
                {
                    cc = cc.Replace(",", ";");
                    var ccSplits = cc.Split(';');
                    foreach (var cs in ccSplits)
                    {
                        forwardMail.CC.Add(new MailAddress(cs));
                    }
                }

                string bcc = BCC.Get(context);
                if (!string.IsNullOrEmpty(bcc))
                {
                    bcc = bcc.Replace(",", ";");
                    var bccSplits = bcc.Split(';');
                    foreach (var b in bccSplits)
                    {
                        forwardMail.Bcc.Add(new MailAddress(b));
                    }
                }

                this.ForwardMail.Set(context, forwardMail);
            }
            else
            {
                Console.WriteLine("No Mail Message Found");
            }
        }
コード例 #21
0
ファイル: ServerItemSwap.cs プロジェクト: zeaf/NexusForever
 public void Write(GamePacketWriter writer)
 {
     To.Write(writer);
     From.Write(writer);
 }
コード例 #22
0
 /// <inheritdoc />
 public bool Equals(OrthogonalLine other)
 {
     return(From.Equals(other.From) && To.Equals(other.To));
 }
コード例 #23
0
        public void Send(bool isHtml)
        {
            string[] sAddr = To.Split(';');
            var      oMsg  = new MailMessage();

            for (var i = 0; i < sAddr.Length; i++)
            {
                if (sAddr[i].Trim() != "")
                {
                    oMsg.To.Add(sAddr[i]);
                }
            }

            oMsg.From    = new MailAddress(From);
            oMsg.Subject = m_Subject;
            oMsg.Body    = m_MessageBody;

            if (m_InternalOnly)
            {
                oMsg.Subject += " [INTERNAL USE ONLY]";
            }

            //body
            if (isHtml)
            {
                m_MessageBody += string.Format("<br><br><br>Sent from {0}", Environment.MachineName);
            }
            else
            {
                m_MessageBody += string.Format("\r\n\r\n\r\nSent from {0}", Environment.MachineName);
            }
            oMsg.IsBodyHtml = isHtml;
            oMsg.Body       = m_MessageBody;
            // attachment
            if (m_Attachments != null)
            {
                foreach (EmailAttachment attach in m_Attachments)
                {
                    if (attach != null)
                    {
                        oMsg.Attachments.Add(attach.ToAttachment());
                    }
                }
            }

            // add cc if any exist
            if (!string.IsNullOrEmpty(m_Cc))
            {
                foreach (string oneCC in m_Cc.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                {
                    MailAddress cc = new MailAddress(oneCC);
                    oMsg.CC.Add(cc);
                }
            }

            if (string.IsNullOrEmpty(m_MailServer))
            {
                m_MailServer = sm_DefaultSMTPServerName;
                if (string.IsNullOrEmpty(m_MailServer))
                {
                    if (m_MailServer == null)
                    {
                        m_MailServer = "localhost";
                    }
                }
            }
            var smtpClient = new SmtpClient(m_MailServer);

            smtpClient.Credentials = new System.Net.NetworkCredential("contact", "PassW0rd");
            try
            {
                smtpClient.Send(oMsg);
            }
            //TODO: figure email problems and remove try/catch here or throw exception back
            catch (Exception ex)
            {
                logger.Error("Sending email failed.", ex);
                //throw;
            }
        }
コード例 #24
0
ファイル: EMailMessage.cs プロジェクト: diev/Mailer
        public EmailMessage(string recipients, string subject, string body, string[] files)
        {
            From = new MailAddress(Parameters.FROM, App.Name, Encoding.UTF8);

            To.Add(recipients.Replace(';', ','));
            // this.CC
            // this.Bcc
            // this.ReplyToList;

            // this.IsBodyHtml = true;
            // this.Priority = MailPriority.High;

            string mode = Parameters.MODE;

            if (subject.Length > 0)
            {
                int m = mode.IndexOf(subject[0]);
                if (m > -1)
                {
                    Subject = SubjBuilder(m, subject);
                }
                else
                {
                    Subject = subject;
                }
            }

            if (body.Length > 0)
            {
                if (mode.IndexOf(body[0]) > -1)
                {
                    string   list     = Parameters.LIST;
                    string[] bodyList = body.Split(list.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    foreach (string item in bodyList)
                    {
                        int m = mode.IndexOf(item[0]);
                        if (m > -1)
                        {
                            Body += BodyBuilder(m, item);
                        }
                    }
                }
                else
                {
                    Body = body;
                }
            }

            foreach (string file in files)
            {
                FileInfo fi = new FileInfo(file.Trim());
                if (fi.Exists)
                {
                    Attachment         attachment  = new Attachment(fi.FullName);
                    ContentDisposition disposition = attachment.ContentDisposition;

                    disposition.CreationDate     = fi.CreationTime;
                    disposition.ModificationDate = fi.LastWriteTime;
                    disposition.ReadDate         = fi.LastAccessTime;

                    Attachments.Add(attachment);
                }
                else
                {
                    Trace.TraceWarning("Attachment file " + fi.FullName + " not found!");
                }
            }
        }
コード例 #25
0
ファイル: EmailClient.cs プロジェクト: rickiz/BR.EzTravel
        public void SendEmail(string[] fileNames)
        {
            MailMessage mail = new MailMessage();

            //multiple recipient

            string[] emailAdds = To.Split(';');
            foreach (string emailAdd in emailAdds)
            {
                if (!string.IsNullOrEmpty(emailAdd))
                {
                    mail.To.Add(emailAdd);
                }
            }
            emailAdds = Cc.Split(';');
            foreach (string emailAdd in emailAdds)
            {
                if (!string.IsNullOrEmpty(emailAdd))
                {
                    mail.CC.Add(emailAdd);
                }
            }
            emailAdds = Bcc.Split(';');
            foreach (string emailAdd in emailAdds)
            {
                if (!string.IsNullOrEmpty(emailAdd))
                {
                    mail.Bcc.Add(emailAdd);
                }
            }

            //attach excel file
            if (fileNames != null)
            {
                foreach (string fileName in fileNames)
                {
                    if (!string.IsNullOrEmpty(fileName))
                    {
                        Attachment attachFile = new Attachment(fileName);
                        mail.Attachments.Add(attachFile);
                    }
                }
            }

            mail.From       = new MailAddress(_From);
            mail.Subject    = Subject;
            mail.Body       = Body;
            mail.IsBodyHtml = true;

            SmtpClient SmtpMail = new SmtpClient();

            SmtpMail.Host = _Host;
            SmtpMail.Port = _Port;
            //SmtpMail.DeliveryMethod = SmtpDeliveryMethod.Network;
            SmtpMail.EnableSsl = _IsEnableSsl;

            if (_UseDefaultCredentials)
            {
                SmtpMail.UseDefaultCredentials = true;
            }
            else
            {
                SmtpMail.Credentials = new System.Net.NetworkCredential(_UserID, _Password);
            }

            SmtpMail.Send(mail);
        }
コード例 #26
0
ファイル: SizeAnimation.cs プロジェクト: togeljoss/toolkit
 /// <inheritdoc/>
 protected override (Vector2?, Vector2?) GetParsedValues()
 {
     return(To?.ToVector2(), From?.ToVector2());
 }
コード例 #27
0
 public bool IsValid()
 {
     return(To.IsNotNullOrEmpty() && From.IsNotNullOrEmpty() && Text.IsNotNullOrEmpty() &&
            Provider.IsNotNullOrEmpty() && Settings != null);
 }
コード例 #28
0
        public virtual void Save(System.IO.TextWriter txt)
        {
            txt.WriteLine("Date: {0}", (Date == DateTime.MinValue ? DateTime.Now : Date).GetRFC2060Date());
            txt.WriteLine("To: {0}", string.Join("; ", To.Select(x => x.ToString())));
            txt.WriteLine("Cc: {0}", string.Join("; ", Cc.Select(x => x.ToString())));
            txt.WriteLine("Reply-To: {0}", string.Join("; ", ReplyTo.Select(x => x.ToString())));
            txt.WriteLine("Bcc: {0}", string.Join("; ", Bcc.Select(x => x.ToString())));
            if (Sender != null)
            {
                txt.WriteLine("Sender: {0}", Sender);
            }
            if (From != null)
            {
                txt.WriteLine("From: {0}", From);
            }
            if (!string.IsNullOrEmpty(MessageID))
            {
                txt.WriteLine("Message-ID: {0}", MessageID);
            }

            var otherHeaders = Headers.Where(x => !SpecialHeaders.Contains(x.Key, StringComparer.InvariantCultureIgnoreCase));

            foreach (var header in otherHeaders)
            {
                txt.WriteLine("{0}: {1}", header.Key, header.Value);
            }
            if (Importance != MailPriority.Normal)
            {
                txt.WriteLine("Importance: {0}", (int)Importance);
            }
            txt.WriteLine("Subject: {0}", Subject);

            string boundary = null;

            if (Attachments.Any() || AlternateViews.Any())
            {
                boundary = string.Format("--boundary_{0}", Guid.NewGuid());
                txt.WriteLine("Content-Type: multipart/mixed; boundary={0}", boundary);
            }

            // signal end of headers
            txt.WriteLine();

            if (boundary != null)
            {
                txt.WriteLine("--" + boundary);
                txt.WriteLine();
            }

            txt.WriteLine(Body);

            AlternateViews.Union(Attachments).ToList().ForEach(att => {
                txt.WriteLine("--" + boundary);
                txt.WriteLine(string.Join("\n", att.Headers.Select(h => string.Format("{0}: {1}", h.Key, h.Value))));
                txt.WriteLine();
                txt.WriteLine(att.Body);
            });

            if (boundary != null)
            {
                txt.WriteLine("--" + boundary + "--");
            }
        }
コード例 #29
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (MessagingServiceSid != null)
            {
                p.Add(new KeyValuePair <string, string>("MessagingServiceSid", MessagingServiceSid.ToString()));
            }

            if (Body != null)
            {
                p.Add(new KeyValuePair <string, string>("Body", Body));
            }

            if (MediaUrl != null)
            {
                p.AddRange(MediaUrl.Select(prop => new KeyValuePair <string, string>("MediaUrl", Serializers.Url(prop))));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", Serializers.Url(StatusCallback)));
            }

            if (ApplicationSid != null)
            {
                p.Add(new KeyValuePair <string, string>("ApplicationSid", ApplicationSid.ToString()));
            }

            if (MaxPrice != null)
            {
                p.Add(new KeyValuePair <string, string>("MaxPrice", MaxPrice.Value.ToString()));
            }

            if (ProvideFeedback != null)
            {
                p.Add(new KeyValuePair <string, string>("ProvideFeedback", ProvideFeedback.Value.ToString().ToLower()));
            }

            if (ValidityPeriod != null)
            {
                p.Add(new KeyValuePair <string, string>("ValidityPeriod", ValidityPeriod.ToString()));
            }

            if (ForceDelivery != null)
            {
                p.Add(new KeyValuePair <string, string>("ForceDelivery", ForceDelivery.Value.ToString().ToLower()));
            }

            if (SmartEncoded != null)
            {
                p.Add(new KeyValuePair <string, string>("SmartEncoded", SmartEncoded.Value.ToString().ToLower()));
            }

            if (PersistentAction != null)
            {
                p.AddRange(PersistentAction.Select(prop => new KeyValuePair <string, string>("PersistentAction", prop)));
            }

            return(p);
        }
コード例 #30
0
 public override int GetHashCode()
 {
     return(Unit.GetHashCode() ^ Length.GetHashCode() ^
            From.GetHashCode() ^ To.GetHashCode() ^
            unit.ToLowerInvariant().GetHashCode());
 }
コード例 #31
0
ファイル: AngleBounds.cs プロジェクト: num0005/Mutation
 public override string ToString()
 {
     return("AngleBounds: " + Name + ", To: " + To.ToString() + ", From: " + From.ToString());
 }
コード例 #32
0
 public override int GetHashCode()
 {
     return(From.GetHashCode() ^ To.GetHashCode());
 }
コード例 #33
0
        private static void VerifyDataForFullParams(Dictionary <string, object> request, PrivateApiResponse <Dictionary <string, object> > response, QueryLogic queryLogic, From from, To to, Cc cc, Bcc bcc, Subject subject, Body body, Date date, Box box, Attachment attachment)
        {
            ExceptedCases(response, FieldQueryParameters.From.ToString(), from.ToString());
            ExceptedCases(response, FieldQueryParameters.To.ToString(), to.ToString());
            ExceptedCases(response, FieldQueryParameters.Cc.ToString(), cc.ToString());
            ExceptedCases(response, FieldQueryParameters.Bcc.ToString(), bcc.ToString());
            ExceptedCases(response, FieldQueryParameters.Subject.ToString(), subject.ToString());
            ExceptedCases(response, FieldQueryParameters.Body.ToString(), body.ToString());
            ExceptedCases(response, FieldQueryParameters.Date.ToString(), date.ToString());
            ExceptedCases(response, FieldQueryParameters.Box.ToString(), box.ToString());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));

            var hits = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(response.Result["hits"].ToString());

            if (box == Box.Two)
            {
                PrAssert.That(hits.Count, PrIs.EqualTo(0), "Still able to get box 2.");
            }
            else
            {
                PrAssert.That(response.Result["totalHits"], PrIs.GreaterThan(0), "The response is empty.");

                if (queryLogic == QueryLogic.And)
                {
                    foreach (var result in hits)
                    {
                        PrAssert.That(
                            CompareValues[from.ToString()](result[FieldQueryParameters.From.GetEnumStringValue()], FromMail) &&
                            CompareValues[to.ToString()](result[FieldQueryParameters.To.GetEnumStringValue()], ToMails.First()) &&
                            CompareValues[subject.ToString()](result[FieldQueryParameters.Subject.GetEnumStringValue()], SubjectMail) &&
                            CompareValues[body.ToString()](result["preview"].ToString(), BodyMail) &&
                            CompareValues[date.ToString()](result[FieldQueryParameters.Date.GetEnumStringValue()], DateListMultipleMail.ElementAt(NumberOfMail / 2)) &&
                            CompareValues[box != Box.Missing ? Operations.Eq.ToString() : box.ToString()](result[FieldQueryParameters.Box.GetEnumStringValue()], box == Box.One ? 1 : 2) &&
                            CompareValues[attachment != Attachment.Missing ? Operations.Eq.ToString() : attachment.ToString()](result[FieldQueryParameters.HasAttachment.GetEnumStringValue()], attachment == Attachment.Zero ? 0 : 1)
                            );
                    }
                }
                else
                {
                    foreach (var result in hits)
                    {
                        PrAssert.That(
                            CompareValues[from.ToString()](result[FieldQueryParameters.From.GetEnumStringValue()], FromMail) ||
                            CompareValues[to.ToString()](result[FieldQueryParameters.To.GetEnumStringValue()], ToMails.First()) ||
                            CompareValues[subject.ToString()](result[FieldQueryParameters.Subject.GetEnumStringValue()], SubjectMail) ||
                            CompareValues[body.ToString()](result["preview"].ToString(), BodyMail) ||
                            CompareValues[date.ToString()](result[FieldQueryParameters.Date.GetEnumStringValue()], DateListMultipleMail.ElementAt(NumberOfMail / 2)) ||
                            CompareValues[box != Box.Missing ? Operations.Eq.ToString() : box.ToString()](result[FieldQueryParameters.Box.GetEnumStringValue()], box == Box.One ? 1 : 2) ||
                            CompareValues[attachment != Attachment.Missing ? Operations.Eq.ToString() : attachment.ToString()](result[FieldQueryParameters.HasAttachment.GetEnumStringValue()], attachment == Attachment.Zero ? 0 : 1)
                            );
                    }
                }
            }
        }
コード例 #34
0
        //load pharm pur Due payument company
        public List <InvenCentralPurchasePaymentDTO> CentralPurchase_Due_Payment(int purid, int orderid, int Compid, string SalesManName, string FromDate, string ToDate)
        {
            DateTime From, To;

            using (var Container = new InventoryContainer())
            {
                var query = from payinfo in Container.InvenCentralPurchcasePayments
                            join purinfo in Container.InvenCentralPurchaseInfoes on payinfo.PurId equals purinfo.PurId
                            //from purinfo in Container.PharmPurchaseInfoes
                            //  join Comp in Container.PharmDurgCompanyInfoes on purinfo.DurgCompId equals Comp.CompId
                            select new { payinfo, purinfo };

                if (!String.IsNullOrEmpty(FromDate.ToString()) && !String.IsNullOrEmpty(ToDate.ToString()))
                {
                    To    = Convert.ToDateTime(ToDate);
                    To    = To.AddDays(1);
                    From  = Convert.ToDateTime(FromDate);
                    query = query.Where(c => c.purinfo.CreateDate >= From && c.purinfo.CreateDate <= To);
                }
                else if (String.IsNullOrEmpty(FromDate.ToString()) && !String.IsNullOrEmpty(ToDate.ToString()))
                {
                    To    = Convert.ToDateTime(ToDate);
                    query = query.Where(c => c.purinfo.CreateDate == To);
                }
                else if (!String.IsNullOrEmpty(FromDate.ToString()) && String.IsNullOrEmpty(ToDate.ToString()))
                {
                    From  = Convert.ToDateTime(FromDate);
                    query = query.Where(c => c.purinfo.CreateDate == From);
                }
                if (purid != 0)
                {
                    query = query.Where(c => c.purinfo.PurId.Equals(purid));
                }

                //if (Compid != 0)
                //    query = query.Where(c => c.Comp.CompId.Equals(Compid));
                if (orderid != 0)
                {
                    query = query.Where(c => c.purinfo.PurOrderNo.Equals(orderid));
                }

                if (!string.IsNullOrEmpty(SalesManName))
                {
                    query = query.Where(c => c.purinfo.SalesManName.Contains(SalesManName));
                }


                var result = from o in query
                             orderby o.purinfo.PurId ascending
                             where o.payinfo.DueAmount != 0
                             select new InvenCentralPurchasePaymentDTO
                {
                    //  CompId = o.Comp.CompId,
                    //CompName = o.Comp.CompName,

                    SalesManName = o.purinfo.SalesManName,
                    PurId        = o.purinfo.PurId,
                    PurOrderNo   = o.purinfo.PurOrderNo,

                    TotalPrice   = o.payinfo.TotalPrice,
                    PurPaymentId = o.payinfo.PurPaymentId,
                    PaidAmount   = o.payinfo.PaidAmount,
                    //   PaymentDate = o.payinfo.PaymentDate,
                    DueAmount = o.payinfo.DueAmount,
                };
                return(result.ToList <InvenCentralPurchasePaymentDTO>());
            }
        }
コード例 #35
0
ファイル: ReplyMailItem.cs プロジェクト: zhengdeding/openrpa
        protected override void Execute(CodeActivityContext context)
        {
            Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application();
            // Microsoft.Office.Interop.Outlook.MailItem email = (Microsoft.Office.Interop.Outlook.MailItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
            var fromemail = Email.Get(context);


            var    to       = To.Get(context);
            var    cc       = CC.Get(context);
            var    bcc      = BCC.Get(context);
            var    subject  = Subject.Get(context);
            string body     = (Body != null ?Body.Get(context) : null);
            string htmlbody = (HTMLBody != null ? HTMLBody.Get(context) : null);

            if (!string.IsNullOrEmpty(htmlbody))
            {
                body = htmlbody;
            }
            var attachments = Attachments.Get(context);
            var uiaction    = UIAction.Get(context);
            var replyaction = ReplyAction.Get(context);

            Microsoft.Office.Interop.Outlook.MailItem email;
            if (replyaction == "forward")
            {
                email = fromemail.mailItem.Forward();
            }
            else if (replyaction == "reply")
            {
                email = fromemail.mailItem.Reply();
            }
            else
            {
                email = fromemail.mailItem.ReplyAll();
            }
            email.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatRichText;
            if (!string.IsNullOrEmpty(to))
            {
                email.To = to;
            }
            if (!string.IsNullOrEmpty(subject))
            {
                email.Subject = subject;
            }
            email.HTMLBody = body + Environment.NewLine + email.HTMLBody;
            if (!string.IsNullOrEmpty(cc))
            {
                email.CC = cc;
            }
            if (!string.IsNullOrEmpty(bcc))
            {
                email.BCC = bcc;
            }

            if (attachments != null && attachments.Count() > 0)
            {
                foreach (var attachment in attachments)
                {
                    if (!string.IsNullOrEmpty(attachment))
                    {
                        email.Attachments.Add(attachment, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, 100000, Type.Missing);
                    }
                }
            }
            if (uiaction == "Show")
            {
                email.Display(true);
            }
            //else if(uiaction == "SendVisable")
            //{
            //    email.Display(true);
            //    email.Send();
            //}
            else
            {
                email.Send();
            }
            if (EMail != null)
            {
                EMail.Set(context, new email(email));
            }
        }
コード例 #36
0
ファイル: Syncronize.cs プロジェクト: nafetz/SE
        public static void SyncInnerWishes(To who)
        {
            switch (who)
            {
                case To.UI:
                    {
                        _ui.InternRequired = _elevator.InternRequired;

                    } break;
                case To.Elevator:
                    {
                        _elevator.InternRequired = _ui.InternRequired;
                    } break;
            }
        }
コード例 #37
0
 public static ApiResponse <TData> ToResponse <TError, TData>(this TError error, int?statusCode, To <TData> _)
     where TError : Error
 {
     return(new ApiResponse <TData>(error)
            .WithStatusCode(statusCode));
 }
コード例 #38
0
 public static ApiResponse <TData> ToResponse <TError, TData>(this TError error, To <TData> _)
     where TError : Error
 {
     return(new(error));
 }
コード例 #39
0
ファイル: ToString.cs プロジェクト: Minatron/Minatron
 public DateTimeToStringConvertor(To to)
     : base(to)
 {
 }