Ejemplo n.º 1
0
 /// <summary>
 /// Create an SmtpEmailer.
 /// </summary>
 public SmtpEmailer()
 {
     to = new ArrayList();
       files = new ArrayList();
       receipients = new ToList(to);
       attachments = new AttachmentList(files);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create an SmtpEmailer.
 /// </summary>
 public SmtpEmailer()
 {
     to          = new ArrayList();
     files       = new ArrayList();
     receipients = new ToList(to);
     attachments = new AttachmentList(files);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles find users button click event.
        /// </summary>
        protected void FindUsers_Click(object sender, EventArgs e)
        {
            if (To.Text.Length < 2)
            {
                // need at least 2 latters of user's name
                PageContext.AddLoadMessage(GetText("NEED_MORE_LETTERS"));
                return;
            }

            // try to find users by user name
            using (DataTable dt = DB.user_find(PageContext.PageBoardID, true, To.Text, null))
            {
                if (dt.Rows.Count > 0)
                {
                    // we found a user(s)
                    ToList.DataSource     = dt;
                    ToList.DataValueField = "UserID";
                    ToList.DataTextField  = "Name";
                    ToList.DataBind();
                    //ToList.SelectedIndex = 0;
                    // hide To text box and show To drop down
                    ToList.Visible = true;
                    To.Visible     = false;
                    // find is no more needed
                    FindUsers.Visible = false;
                    // we need clear button displayed now
                    Clear.Visible = true;
                }

                // re-bind data to the controls
                DataBind();
            }
        }
Ejemplo n.º 4
0
        public override void ExecuteCommand()
        {
            System.Threading.Thread.Sleep(30 * 1000);
            //Construct the SMTP host.
            SmtpClient        sc = new SmtpClient("smtphost");
            NetworkCredential nc = new NetworkCredential(UserAccount, Password);

            sc.UseDefaultCredentials = false;
            sc.Credentials           = nc;
            sc.Host      = EmailHost;
            sc.EnableSsl = true;
            sc.Port      = 25;
            sc.EnableSsl = true;
            ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };
            System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();

            //Set the from and to mail addressess.
            message.From = new MailAddress(UserAccount, "NuGet Gallery Support");

            string[] replyTo = ReplyToList.Split(new char[] { ',' });
            foreach (string replyToAddress in replyTo)
            {
                message.ReplyToList.Add(new MailAddress(replyToAddress, replyToAddress));
            }

            string[] to = ToList.Split(new char[] { ',' });
            foreach (string toAddress in to)
            {
                message.To.Add(new MailAddress(toAddress, toAddress));
            }

            //Get the list of packages if present and add the owner email Ids to Bcc.
            List <string> PackagesList = GetPackageIds();

            if (PackagesList != null && PackagesList.Count > 0)
            {
                message.Bcc.AddRange(GetOwnerMailAddressess(this.ConnectionString.ToString(), PackagesList));
            }

            message.Subject    = string.Format(MailSubject);
            message.IsBodyHtml = true;
            message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(@"<html><body></br></br>" + GetMailContent() + "</body></html>", new ContentType("text/html")));

            try
            {
                sc.Send(message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error in sending mail : {0}", ex.Message);
            }
        }
Ejemplo n.º 5
0
        private void AddButton_Click(object sender, EventArgs e)

        {
            int row = (int)this.FromList.SelectedIndex;

            if (row >= 0)

            {
                string selectedItem = this.FromList.SelectedValue.ToString();

                if ((currentItems != null && currentItems.Contains(selectedItem)) || (parentItems != null && parentItems.Contains(selectedItem)))

                {
                    UIErrorHelper.ShowMessage(VMDirConstants.WRN_SEL_ITEM_PRESENT);
                }

                else if (SelectedItemsList.Contains(selectedItem))

                {
                    UIErrorHelper.ShowMessage(VMDirConstants.WRN_ITEM_ALRDY_SLCTD);
                }

                else

                {
                    SelectedItemsList.Add(selectedItem);

                    //The datasource has to be explicitly set to null before we refresh the list. it doesnt seem to work by reference.

                    this.ToList.DataSource = null;

                    this.ToList.DataSource = SelectedItemsList;

                    ToList.Refresh();
                }
            }
        }
Ejemplo n.º 6
0
 public X Uncons <X>(Func <X> nil, Func <A, DiffList <A>, X> headTail)
 {
     return(ToList.Uncons(nil, (a, l) => headTail(a, l.ToDiffList)));
 }
Ejemplo n.º 7
0
 public B FoldLeft <B>(Func <B, A, B> f, B b)
 {
     return(ToList.FoldLeft(f, b));
 }
Ejemplo n.º 8
0
 public B FoldRight <B>(Func <A, B, B> f, B b)
 {
     return(ToList.FoldRight(f, b));
 }
Ejemplo n.º 9
0
 public DiffList <A> Where(Func <A, bool> f)
 {
     return(ToList.Where(f).ToDiffList);
 }
Ejemplo n.º 10
0
        public void ShowExample_Click(object sender, EventArgs e)
        {
            Form form = null;

            switch (((Button)sender).Name)
            {
            // LINQ Dynamic | Restriction Operators
            case "uiROWhere":
                form = new Where();
                break;

            // LINQ Dynamic | Projection Operators
            case "uiPOSelect":
                form = new Select();
                break;

            case "uiPOSelectMany":
                form = new SelectMany();
                break;

            // LINQ Dynamic | Aggregate Operators
            case "uiAOMin":
                form = new Min();
                break;

            case "uiAOMax":
                form = new Max();
                break;

            case "uiAOSum":
                form = new Sum();
                break;

            case "uiAOCount":
                form = new Count();
                break;

            case "uiAOAverage":
                form = new Average();
                break;

            case "uiAOAggregate":
                form = new Aggregate();
                break;

            // LINQ Dynamic | Query Execution
            case "uiQEDeferredExecution":
                form = new DeferredExecution();
                break;

            case "uiQEQueryReuse":
                form = new QueryReuse();
                break;

            case "uiQEImmediateExecution":
                form = new ImmediateExecution();
                break;


            // LINQ Dynamic |  Join Operators
            case "uiJOCrossJoin":
                form = new CrossJoin();
                break;

            case "uiJOGroupJoin":
                form = new GroupJoin();
                break;

            case "uiJOCrossWithGroupJoin":
                form = new CrossJoinwithGroupJoin();
                break;

            case "uiJOLeftOuterJoin":
                form = new LeftOuterJoin();
                break;

            // LINQ Dynamic |    Set Operators
            case "uiSODistinct":
                form = new Distinct();
                break;

            case "uiSOExcept":
                form = new Except();
                break;

            case "uiSOIntersect":
                form = new Intersect();
                break;

            case "uiSOUnion":
                form = new Union();
                break;

            // LINQ Dynamic |    Element Operators
            case "uiEOElementAt":
                form = new ElementAt();
                break;

            case "uiEOFirst":
                form = new First();
                break;

            case "uiEOFirstDefault":
                form = new FirstOrDefault();
                break;

            // LINQ Dynamic |    Custom Sequence Operators
            case "uiCSOCombine":
                form = new Combine();
                break;

            // LINQ Dynamic |    Quantifiers
            case "uiQuantifiersAll":
                form = new All();
                break;

            case "uiQuantifiersAny":
                form = new Any();
                break;

            // LINQ Dynamic |    Grouping Operators
            case "uiGOGroupBy":
                form = new GroupBy();
                break;

            // LINQ Dynamic |    Miscellaneous Operators
            case "uiMOConcat":
                form = new Concat();
                break;

            case "uiMOEqualAll":
                form = new EqualAll();
                break;


            // LINQ Dynamic |    Generation Operators
            case "uiGORepeat":
                form = new Repeat();
                break;

            case "uiGORange":
                form = new Range();
                break;


            // LINQ Dynamic |    Ordering Operators
            case "uiOOOrderBy":
                form = new OrderBy();
                break;

            case "uiOOThenBy":
                form = new ThenBy();
                break;

            case "uiOOThenByDescending":
                form = new ThenByDescending();
                break;

            case "uiOOOrderByDescending":
                form = new OrderByDescending();
                break;

            case "uiOOReverse":
                form = new Reverse();
                break;

            // LINQ Dynamic |    Conversion Operators
            case "uiCOOfType":
                form = new OfType();
                break;

            case "uiCOToArray":
                form = new ToArray();
                break;

            case "uiCOToDictionary":
                form = new ToDictionary();
                break;

            case "uiCOToList":
                form = new ToList();
                break;


            // LINQ Dynamic |    Partitioning Operators
            case "uiPOTake":
                form = new Take();
                break;

            case "uiPOTakeWhile":
                form = new TakeWhile();
                break;

            case "uiPOSkip":
                form = new Skip();
                break;

            case "uiPOSkipWhile":
                form = new SkipWhile();
                break;
            }

            form.StartPosition = FormStartPosition.CenterParent;
            form.ShowDialog();
        }
Ejemplo n.º 11
0
        public IEnumerable <TheList> GetPlayersForTheList()
        {
            'Dim t2 As New Stopwatch
            't2.Start()

            var players = new List <Player>();

            If TeamID < > 0 Or LoweredSearchName <> "" Or PositionID < > 0 Then

               players = Helpers.GetAllActivePlayers()

                         If TeamID = -2 Then
                                     Dim mu As MembershipUser = Membership.GetUser
                                                                Dim userPlayerIDs As List(Of Integer)                     = Helpers.GetUserPlayersByUserTeam(Helpers.GetUserTeamByUserId(mu.ProviderUserKey))
                                                                                                                  players = players.Where(Function(o) userPlayerIDs.Contains(o.PlayerID)).ToList
                                                                                                                            End If

                                                                                                                            If TeamID > 0 And LoweredSearchName = "" And PositionID = 0 Then
                                                                                                                                                                                      players = players.Where(Function(o) o.TeamID.Equals(TeamID)).ToList
                                                                                                                                                                                                End If
                                                                                                                                                                                                If TeamID < 1 Then
                                                                                                                                                                                                players = players.Where(Function(o) o.Surname.ToLower.Contains(LoweredSearchName)).ToList
                                                                                                                                                                                                          End If
                                                                                                                                                                                                          If TeamID > 0 And LoweredSearchName <> "" And PositionID                     = 0 Then
                                                                                                                                                                                                                                                                               players = players.Where(Function(o) o.Surname.ToLower.Contains(LoweredSearchName) And o.TeamID.Equals(TeamID)).ToList
                                                                                                                                                                                                                                                                                         End If
                                                                                                                                                                                                                                                                                         'position
                If PositionID > 0 Then
                    If TeamID <= 0 And LoweredSearchName = "" Then
                        players = players.Where(Function(o) o.PositionID.Equals(PositionID)).ToList
                    End If
                    If TeamID > 0 Then
                        players = players.Where(Function(o) o.PositionID.Equals(PositionID) AndAlso o.TeamID.Equals(TeamID)).ToList
                    End If
                    If LoweredSearchName <> "" Then
                        players = players.Where(Function(o) o.PositionID.Equals(PositionID) AndAlso o.Surname.ToLower.Contains(LoweredSearchName)).ToList
                    End If
                    If TeamID > 0 And LoweredSearchName <> "" Then
                        players = players.Where(Function(o) o.PositionID.Equals(PositionID) AndAlso o.TeamID.Equals(TeamID) _
                                                            AndAlso o.Surname.ToLower.Contains(LoweredSearchName)).ToList
                    End If
                End If
            End If

            't2.Stop()

                                                                                                                                                                                                                                                                                         'Debug.WriteLine("** Filtering took " & t2.ElapsedMilliseconds & "ms")

            'Dim t1 As New Stopwatch
                                                                                                                                                                                                                                                                                         't1.Start()

            Dim theListData As New List(Of TheList)

            'Dim competitionWeeks As List(Of Integer) = Helpers.GetCompetitionWeekIdsForCompetitionID(competitionId)

                                                        Dim LastWeek As Week = (From o As Week In db.Weeks Where o.CompetitionID.Equals(CompetitionId) AndAlso o.WeekNo.Equals(CurrentWeek.WeekNo - 1)).FirstOrDefault

                                                                               Dim thisWeeksListData As New List(Of TheList)

                                                                               If LastWeek IsNot Nothing Then

                                                                               Dim playerIDs As List(Of Integer) = (From o In players Select o.PlayerID).ToList

                                                                                                                   If playerIDs.Count > 0 Then
                                                                                                                   thisWeeksListData = (From o As TheList In db.TheLists Where o.WeekID.Equals(LastWeek.WeekID) AndAlso playerIDs.Contains(o.PlayerID)).ToList
                                                                                                                                       Else
                                                                                                                                       thisWeeksListData = (From o As TheList In db.TheLists Where o.WeekID.Equals(LastWeek.WeekID)).ToList
                                                                                                                                                           End If

                                                                                                                                                           End If

                                                                                                                                                           theListData.AddRange(thisWeeksListData)

                                                                                                                                                           theListData = (From o As TheList In theListData Order By o.TotalPoints Descending).ToList

                                                                                                                                                                         TotalActivePlayers = theListData.Count()

                                                                                                                                                                                              theListData = theListData.Skip((PageIndex - 1) * iPageSize).Take(iPageSize).ToList

                                                                                                                                                                                                            't1.Stop()

            'Debug.WriteLine("** Get data took " & t1.ElapsedMilliseconds & "ms")

                                                                                                                                                                                                            Return theListData

                                                                                                                                                                                                            End Function
        }