Beispiel #1
0
        public bool SendEmail(string toEmail, string subject, string body, String display_name = "", bool IsHtml = true)
        {
            MailMessage mail = new MailMessage();

            mail.From = new MailAddress(GetValue("SmtpEmail"), display_name);

            mail.To.Add(toEmail);
            mail.Subject = subject;

            mail.IsBodyHtml = IsHtml;
            mail.Body       = body;


            SmtpClient smtp = new SmtpClient(GetValue("Smtp"), Numerics.GetInt(GetValue("Port")));


            smtp.Credentials = new NetworkCredential(GetValue("SmtpEmail"), GetValue("SmtpPassword"));

            smtp.EnableSsl = Convert.ToBoolean(GetValue("EnableSsl"));

            try
            {
                smtp.Send(mail);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #2
0
        public bool SendEmail(string from, string port, string host, string password, string toEmail, string subject, string body, String to_name_of_user, String display_name = "", bool IsHtml = true, bool IsSSL = false)
        {
            MailMessage mail = new MailMessage();

            mail.From = new MailAddress(from, display_name);

            mail.To.Add(toEmail);
            mail.Subject = subject;

            mail.IsBodyHtml = IsHtml;
            mail.Body       = body;


            SmtpClient smtp = new SmtpClient(host, Numerics.GetInt(port));


            smtp.Credentials = new NetworkCredential(from, password);

            smtp.EnableSsl = IsSSL;

            try
            {
                smtp.Send(mail);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #3
0
        public List <PageNumber> GetPageination(string key, decimal listCount, int pageNo, int take = 10)
        {
            List <PageNumber> lp = new List <PageNumber>();

            decimal val        = listCount / take;
            int     totalCount = Numerics.GetInt(Math.Ceiling(val));

            int limit = pageNo + 4;


            if (limit > totalCount)
            {
                limit = totalCount;
            }

            if (limit <= 1)
            {
                limit  = 5;
                pageNo = 1;
            }

            if (pageNo < 1)
            {
                pageNo = 1;
            }

            ///////////////////////////////////////
            if (totalCount < 5 && totalCount >= 0)
            {
                limit = totalCount;
            }

            for (int i = pageNo; i <= limit; i++)
            {
                PageNumber pn = new PageNumber();
                pn.Key    = key + "";
                pn.PageNo = i + "";

                if (pageNo == i)
                {
                    pn.SelectedClass = "active";
                }

                if (i != pageNo || i == 1)
                {
                    pn.Overflow = "grid-overflow";
                }
                else
                {
                    int prevPageNo = i - 5;

                    if (prevPageNo < 1)
                    {
                        prevPageNo = 1;
                    }

                    pn.PageNoPrev = prevPageNo + "";
                    pn.Overflow   = "";
                }

                if (i < limit || i == totalCount)
                {
                    pn.OverflowForward = "grid-overflow";
                }


                else
                {
                    int forwdPageNo = limit + 1;
                    if (forwdPageNo > totalCount)
                    {
                        forwdPageNo = totalCount;
                    }

                    pn.PageNoFw = forwdPageNo + "";
                }



                lp.Add(pn);
            }

            return(lp);
        }