Пример #1
0
        //private static void SelfFbUsers()
        //{
        //    var listPoe = common.GetAllPoEs().Where(a => a.PoeFlag == 2).ToList();
        //    var content = string.Empty;
        //    var subject = string.Empty;
        //    foreach (var user in listPoe.Select(poe => common.GetSelfbUser(11)).SelectMany(userlist => userlist))
        //    {
        //        var messagecount = 1;
        //        if (user.UpdatedOn != null)
        //        {
        //            var emailDays = int.Parse(ConfigurationManager.AppSettings["Emailingdays"]);
        //            var diffResult = (currentdate - (DateTime)user.UpdatedOn).TotalDays;
        //            if (diffResult > emailDays)
        //            {
        //                if (user.LastEmail != null)
        //                {
        //                    messagecount = messagecount + (int)user.EmailCount;
        //                    CheckLastMail((DateTime)user.LastEmail, messagecount, user.MappingId, user.emailid, content, subject);
        //                }
        //                else
        //                {
        //                    //send mail
        //                    SendMailForResource(user.emailid, content, subject);
        //                    //Update Table

        //                    UpdateLastMail(user.MappingId, messagecount);
        //                }
        //            }
        //        }
        //        else
        //        {
        //            if (user.LastEmail != null)
        //            {
        //                messagecount = messagecount + (int)user.EmailCount;
        //                CheckLastMail((DateTime)user.LastEmail, messagecount, user.MappingId, user.emailid, content, subject);
        //            }
        //            else
        //            {
        //                //send mail
        //                SendMailForResource(user.emailid, content, subject);
        //                //Update Table
        //                UpdateLastMail(user.MappingId, messagecount);
        //            }
        //        }
        //    }
        //}

        //public static void CheckLastMail(DateTime Lastmail, int messagecount, int mappingid, string mailid, string content, string subject)
        //{
        //    var lastmail = (currentdate - (DateTime)Lastmail).TotalDays;
        //    if (lastmail > 7)
        //    {
        //        //send mail
        //        SendMailForResource(mailid, content, subject);
        //        //Update record

        //        UpdateLastMail(mappingid, messagecount);
        //    }
        //}

        //public static void SendMailForResource(string toaddress, string content, string subject)
        //{
        //    var emailServer = ConfigurationManager.AppSettings["mailServer"];
        //    var userId = ConfigurationManager.AppSettings["emailUserId"];
        //    var pwd = ConfigurationManager.AppSettings["emailPassword"];
        //    var bcc = ConfigurationManager.AppSettings["bccEmail"];
        //    var to = ConfigurationManager.AppSettings["mailTo"];
        //    var from = ConfigurationManager.AppSettings["fromEmail"];

        //    if (to.Trim() == string.Empty)
        //    {
        //        to = toaddress;
        //    }
        //    var objEmail = new MailMessage(from, to, subject, content);

        //    objEmail.Bcc.Add(bcc);

        //    objEmail.IsBodyHtml = true;

        //    var emailClient = new SmtpClient(emailServer);
        //    var basicAuthenticationInfo = new System.Net.NetworkCredential(userId,
        //        pwd);

        //    emailClient.Host = emailServer;
        //    emailClient.UseDefaultCredentials = false;
        //    emailClient.Credentials = basicAuthenticationInfo;
        //    emailClient.Send(objEmail);
        //}

        //public static void UpdateLastMail(int mappingId, int messageCount)
        //{
        //    common.UpdateLastMail(mappingId, messageCount);
        //}

        //public static void GetYammerContent()
        //{
        //    var common = new CommonClient();

        //}
        public static void GetYammerContent()
        {
            bExcellent.Service.BusinessLogic.Common.Common common = new bExcellent.Service.BusinessLogic.Common.Common();

            var getyammer = common.GetYammerTopContent();

            foreach (var yammerContent in getyammer)
            {
                if (yammerContent.Groupid != null)
                {
                    SendYammerGroup(yammerContent.ToMailid, yammerContent.Subject, yammerContent.Description,
                                    yammerContent.ImageUrl, yammerContent.YammerToken, yammerContent.Groupid);
                    UpdateYammerContent(yammerContent.ID);
                }
                else
                {
                    SendYammerUser(yammerContent.ToMailid, yammerContent.Subject, yammerContent.Description,
                                   yammerContent.ImageUrl, yammerContent.YammerToken);
                    UpdateYammerContent(yammerContent.ID);
                }
            }
        }
Пример #2
0
 public static void UpdateYammerContent(int id)
 {
     Log("UpdateYammerContent:");
     bExcellent.Service.BusinessLogic.Common.Common common = new bExcellent.Service.BusinessLogic.Common.Common();
     common.UpdateYammercontent(id);
 }
Пример #3
0
        private static void Main(string[] args)
        {
            DateTime date             = DateTime.Today;
            int      daysInYear       = DateTime.IsLeapYear(date.Year) ? 366 : 365;
            int      daysLeftInYear   = daysInYear - date.DayOfYear;
            double   percentageOfYear = ((double)date.DayOfYear / daysInYear) * 100;

            bExcellent.Service.BusinessLogic.Common.Common common = new bExcellent.Service.BusinessLogic.Common.Common();

            var Goal   = common.GetGoalDates().GroupBy(a => a.ManagerId);
            var counts = 1;


            var common1 = new bExcellent.Service.BusinessLogic.Common.CommonDataAccess();
            var Goal1   = common1.GetOverallReportsCalculated();
            var t       = 1;

            //foreach (var date in Goal)
            //{
            //    var goalDate = Convert.ToDateTime(date.goalDate);
            //    var currentDate = DateTime.Now;
            //    var days = (goalDate - currentDate).TotalDays;
            //    if (days > 7 && days < 8)
            //    {
            //        //Send Mail
            //    }
            //}

            //var common = new bExcellent.Service.BusinessLogic.Common.CommonDataAccess();
            try
            {
                //Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
                //MailSettingsSectionGroup settings = (MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");

                SmtpClient sc = new SmtpClient("smtp.gmail.com");

                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();

                msg.From = new MailAddress("*****@*****.**");
                msg.To.Add(new MailAddress("*****@*****.**"));
                msg.Subject = "r";
                msg.Body    = "r";
                StringBuilder str = new StringBuilder();
                str.AppendLine("BEGIN:VCALENDAR");
                str.AppendLine("PRODID:-//" + "*****@*****.**");
                str.AppendLine("VERSION:2.0");
                str.AppendLine("METHOD:REQUEST");
                str.AppendLine("BEGIN:VEVENT");

                str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", DateTime.Now.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z")));
                str.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", (Convert.ToDateTime("20/05/2017") - DateTime.Now).Minutes.ToString()));
                str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", Convert.ToDateTime("20/05/2017").ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z")));
                //str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", objApptEmail.StartDate.ToString()));
                //str.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", DateTime.UtcNow));
                //str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", objApptEmail.EndDate.ToString()));
                // str.AppendLine("LOCATION:" + objApptEmail.Location);
                str.AppendLine(string.Format("DESCRIPTION:{0}", ""));
                str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", "bdy"));
                str.AppendLine(string.Format("SUMMARY:{0}", "call"));
                str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", "*****@*****.**"));
                str.AppendLine(string.Format("ATTENDEE;CN=\"{0}\";RSVP=TRUE:mailto:{1}", msg.To[0].DisplayName, msg.To[0].Address));
                str.AppendLine("BEGIN:VALARM");
                str.AppendLine("TRIGGER:-PT15M");
                str.AppendLine("ACTION:DISPLAY");
                str.AppendLine("DESCRIPTION:Reminder");
                str.AppendLine("END:VALARM");
                str.AppendLine("END:VEVENT");
                str.AppendLine("END:VCALENDAR");
                System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
                ct.Parameters.Add("method", "REQUEST");
                AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct);
                msg.AlternateViews.Add(avCal);
                NetworkCredential nc = new NetworkCredential("*****@*****.**", "pipe9@123");
                sc.Port        = 587;
                sc.EnableSsl   = true;
                sc.Credentials = nc;
                sc.Send(msg);
            }
            catch { }
            //   var t = common.GetPSMReports(101);
            var c = 9;
            //double k = (double)12.0/11.0;
            //var ki = k;
            //List<DIYQuestions> questions=new List<DIYQuestions>();
            //var question1 = new DIYQuestions();
            //question1.Importance = 1;
            //question1.Question = "sdsd";
            //var question2 = new DIYQuestions();
            //question2.Importance = 2;
            //question2.Question = "ss";

            //var question3 = new DIYQuestions();
            //question3.Importance = 4;
            //question3.Question = "ss";
            //var question4 = new DIYQuestions();
            //question4.Importance = 4;
            //question4.Question = "sss";
            //var question5 = new DIYQuestions();
            //question5.Importance = 3;
            //question5.Question = "sss";
            //questions.Add(question1);
            //questions.Add(question2);
            //questions.Add(question3);
            //questions.Add(question4);
            //questions.Add(question5);
            //var totalQuestions = questions.Count();
            //var sumOfallWeightage = questions.Sum(a => a.Importance);
            //var precentageForSurvey = 100;
            //foreach (var question in questions)
            //{
            //  question.WeightagePerQuestion = ((double)question.Importance / sumOfallWeightage) * precentageForSurvey;
            //}

            //SurveyAnswers color = (SurveyAnswers)System.Enum.Parse(typeof(SurveyAnswers), "Trivial");
            //int animalNumber = (int)Enum.Parse(typeof(SurveyAnswers), "Trivial");
            //string x = ((SurveyAnswers)4).ToString();
            //int t = 0;
            //string _from = ConfigurationManager.AppSettings["fromEmail"];
            //string emailServer = ConfigurationManager.AppSettings["mailServer"];
            //string _userId = ConfigurationManager.AppSettings["emailUserId"];
            //string _pwd = ConfigurationManager.AppSettings["emailPassword"];
            //string _bcc = ConfigurationManager.AppSettings["bccEmail"];
            //var content ="hi";
            ////content.Replace("{0}", toemail).Replace("{1}", password);
            ////content.Replace("{0}", toemail);
            //MailMessage mail = new MailMessage();
            //mail.To.Add("*****@*****.**");
            //mail.From = new MailAddress("*****@*****.**");
            //mail.Subject = "test";
            //string Body = "content";
            //mail.Body = Body;
            //mail.IsBodyHtml = true;
            //SmtpClient smtp = new SmtpClient();
            //smtp.Host = "smtp.gmail.com";
            //smtp.Port = 587;
            //smtp.UseDefaultCredentials = false;
            //smtp.Credentials = new System.Net.NetworkCredential
            //("*****@*****.**", "timepass@123");// Enter seders User name and password
            //smtp.EnableSsl = true;
            //smtp.Send(mail);
            //MailMessage objEmail = new MailMessage(_from, "*****@*****.**", "test", content);

            //objEmail.Bcc.Add(_bcc);

            //objEmail.IsBodyHtml = true;

            //SmtpClient emailClient = new SmtpClient(emailServer);
            //System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(_userId, _pwd);

            //emailClient.Host = emailServer;
            //emailClient.UseDefaultCredentials = false;
            //emailClient.Credentials = basicAuthenticationInfo;
            //emailClient.Send(objEmail);
            //    MailMessage mail = new MailMessage();
            //    SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

            //    mail.From = new MailAddress("*****@*****.**");
            //    mail.To.Add("*****@*****.**");
            //    mail.Subject = "Test Mail";
            //    mail.Body = "This is for testing SMTP mail from GMAIL";

            //    SmtpServer.Port = 587;
            //    SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "prtillid@123");
            //    SmtpServer.EnableSsl = true;

            //    SmtpServer.Send(mail);
            // MessageBox.Show("mail Send");
            //var devpriorityList = new List<DevlopmentPriority>();
            //var devpriority = new DevlopmentPriority();
            //devpriority.FeedbackFor = 1;
            //devpriority.FeedbackFrom = 1;
            //devpriority.Questionid = 1;
            //devpriority.CurrentFeedbackId = 1;
            //devpriority.PriorityOrder = 1;
            //devpriority.ManagerResult = 1;
            //devpriority.UpdatedOn = DateTime.Now;
            //devpriority.Active = true;

            //var devpriority1 = new DevlopmentPriority();
            //devpriority.FeedbackFor = 2;
            //devpriority.FeedbackFrom = 2;
            //devpriority.Questionid = 2;
            //devpriority.CurrentFeedbackId = 2;
            //devpriority.PriorityOrder = 2;
            //devpriority.ManagerResult = 2;
            //devpriority.UpdatedOn = DateTime.Now;
            //devpriority.Active = true;
            //devpriorityList.Add(devpriority);
            //devpriorityList.Add(devpriority1);
            //var devlopmentPriorities = new XElement("DevlopmentPriorities");
            //foreach (XElement ele in devpriorityList.Select(t => new XElement("DevlopmentPriority", new XElement("FeedbackFrom", t.FeedbackFrom),
            //                                                                  new XElement("FeedbackFor", t.FeedbackFor),
            //                                                                  new XElement("Questionid", t.Questionid),
            //                                                                  new XElement("PriorityOrder", t.PriorityOrder),
            //                                                                  new XElement("ManagerResult", t.ManagerResult),
            //                                                                  new XElement("CurrentFeedbackId", t.CurrentFeedbackId),
            //                                                                  new XElement("Active", t.Active),
            //                                                                  new XElement("UpdatedOn", t.UpdatedOn))))
            //{
            //    devlopmentPriorities.Add(ele);
            //}
            //var dev = devlopmentPriorities;
            //var common = new bExcellent.Service.BusinessLogic.Standing.StandingDataAccess();
            // var common = new bExcellent.Service.BusinessLogic.Goal.GoalDataAccess();
            // var c = common.GetManagerDevProgress(415, 13, 742);

            //var value = "+955562425";
            //v//ar k = HttpUtility.HtmlEncode(value);
            //SelfFbUsers();
            // GetYammerContent();
            //var common = new bExcellent.Service.BusinessLogic.Standing.StandingDataAccess();
            //var common = new bExcellent.Service.BusinessLogic.Goal.GoalDataAccess();
            //var devPriorities = common.GetTeamGoalDate(42, 11, 91);
            //88 99
            //var selffb = common.GetGoalsShared(45, 11);


            //common.GetSherbasFbidString(12, "1", 1, "*****@*****.**");
        }