예제 #1
0
       public void sendInvitesToAll()
       {
          
          
           ClsCalender objCal = new ClsCalender();

           DataRow drConf = ClsCalender.getConferenceDetails(confID).Tables[0].Rows[0];

           for (int i = 0; i < lstInvitedUserList.Items.Count; i++)
           {
               ListBoxItem lstItem = new ListBoxItem();
               lstItem = (ListBoxItem)lstInvitedUserList.Items.GetItemAt(i);
               string guestname = lstItem.Content.ToString();
               string[] tagSplit = lstItem.Tag.ToString().Split(':');
               Int64 guestID = Int64.Parse(tagSplit[1]);
               string email = tagSplit[0];
               objCal.ConferenceID = confID;

               objCal.Email = email;
               objCal.CreatedBy = userID;
               objCal.ModifiedBy = userID;

               if (guestID == -99)
               {
                   try
                   {
                       Int64 uid = CreateNewUser(guestname, email);
                       DataRow drUinfo = ClsCalender.getUserInfoForMail(uid).Tables[0].Rows[0];
                       string newuserid = drUinfo["DisplayName"].ToString();
                       string pwd = drUinfo["Password"].ToString();
                       objCal.GuestName = newuserid;

                       string[] stotaltimeSplit = drConf["StartDateTime"].ToString().Split(' ');
                       string sdate1 = stotaltimeSplit[0];
                       string stime1 = stotaltimeSplit[1] + " " + stotaltimeSplit[2];

                       string[] etotaltimeSplit = drConf["EndDateTime"].ToString().Split(' ');
                       string edate1 = etotaltimeSplit[0];
                       string etime1 = etotaltimeSplit[1] + " " + etotaltimeSplit[2];
                       string strUri = VMuktiAPI.VMuktiInfo.ZipFileDownloadLink.ToString();
                       if (dtpStartDate.Text.Equals(dtpendate.Text))
                           SendEmailTo(email, "VMukti Meeting/Conference Invitation: " + drConf["ConfTitle"].ToString(), "<br/><br/>You are invited for the following Conference/Meeting. <br/><br/><br/><b>Title:</b> " + drConf["ConfTitle"].ToString() + "<br/><br/>" + "<b>Description:</b> " + drConf["ConferenceDetail"].ToString() + "<br/><br/><b>Location:</b> " + drConf["ConferenceLocation"].ToString() + "<br/><br/><b>Meeting/Conference Type:</b> " + drConf["ConferenceType"].ToString() + "<br/><br/><br/><br/><b>Date:</b> " + sdate1 + "<br/><br/><b>Start Time:</b> " + stime1 + "<br/><br/><b>End Time:</b> " + etime1 +   " <br/><br/><b>Default TimeZone:</b> " + drConf["Timezone"] + "<br/><br/><b>Your Login Information is as follows:</b><br/><b>Username:</b> " + newuserid + "<br><b>Password:</b> " + pwd + "<br><br><b>URI:</b> "+strUri+"<br><br><br>");
                       else
                           SendEmailTo(email, "VMukti Meeting/Conference Invitation: " + drConf["ConfTitle"].ToString(), "<br/><br/>You are invited for the following Conference/Meeting. <br/><br/><br/><b>Title:</b> " + drConf["ConfTitle"].ToString() + "<br/><br/>" + "<b>Description:</b> " + drConf["ConferenceDetail"].ToString() + "<br/><br/><b>Location:</b> " + drConf["ConferenceLocation"].ToString() + "<br/><br/><b>Meeting/Conference Type:</b> " + drConf["ConferenceType"].ToString() + "<br/><br/><br/><br/><b>Start Date:</b> " + sdate1 + "<br/><br/><b>Start Time:</b> " + stime1 + "<br/><br/><br/><b>End Date:</b> " + edate1 + "<br/><br/><b>End Time:</b> " + etime1 + " <br/><br/><b>Default TimeZone:</b> " + drConf["Timezone"] + "<br/><br/><b>Your Login Information is as follows:</b><br/><b>Username:</b> " + newuserid + "<br><b>Password:</b> " + pwd + "<br><br><b>URI:</b> " + strUri + "<br><br><br>");

                       ClsCalender.setEmailStatusOfConferenceGuest(newuserid, email, "Sent");
                       //      if (guestID != -99)
                       ClsCalender.addConferenceUsers(confID, uid);
                       objCal.SaveGuest(confID);
                   }
                   catch (Exception exp)
                   {
                       VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "sendInvitesToAll()--if--", "ctlAddEvent.xaml.cs");
                   }
               }
               else
               {
                   objCal.GuestName = guestname;
                   objCal.SaveGuest(confID);

                   DataRow drConfGuest = ClsCalender.getConferenceGuest(guestname, email).Tables[0].Rows[0];

                   string emailStatus = drConfGuest["EmailStatus"].ToString();


                   try
                   {
                       objCal.GuestName = guestname;
                       string[] stotaltimeSplit = drConf["StartDateTime"].ToString().Split(' ');
                       string sdate1 = stotaltimeSplit[0];
                       string stime1 = stotaltimeSplit[1] + " " + stotaltimeSplit[2];

                       string[] etotaltimeSplit = drConf["EndDateTime"].ToString().Split(' ');
                       string edate1 = etotaltimeSplit[0];
                       string etime1 = etotaltimeSplit[1] + " " + etotaltimeSplit[2];
                       string strUri = VMuktiAPI.VMuktiInfo.ZipFileDownloadLink.ToString();
                       if (dtpStartDate.Text.Equals(dtpendate.Text))
                           //Email sended to invited users(email, ConfTitle)
                           SendEmailTo(email, "VMukti Meeting/Conference Invitation: " + drConf["ConfTitle"].ToString(), "<br/><br/>You are invited for the following Conference/Meeting. <br/><br/><br/><b>Title:</b> " + drConf["ConfTitle"].ToString() + "<br/><br/>" + "<b>Description:</b> " + drConf["ConferenceDetail"].ToString() + "<br/><br/><b>Location:</b> " + drConf["ConferenceLocation"].ToString() + "<br/><br/><b>Meeting/Conference Type:</b> " + drConf["ConferenceType"].ToString() + "<br/><br/><br/><br/><b>Date:</b> " + sdate1 + "<br/><br/><b>Start Time:</b> " + stime1 + "<br/><br/><b>End Time:</b> " + etime1 + "<br/><br/><b>Default TimeZone:</b> " + drConf["Timezone"] + "<br><br><b>URI:</b> " + strUri + "<br/><br/><br/>");
                       else
                           SendEmailTo(email, "VMukti Meeting/Conference Invitation: " + drConf["ConfTitle"].ToString(), "<br/><br/>You are invited for the following Conference/Meeting. <br/><br/><br/><b>Title:</b> " + drConf["ConfTitle"].ToString() + "<br/><br/>" + "<b>Description:</b> " + drConf["ConferenceDetail"].ToString() + "<br/><br/><b>Location:</b> " + drConf["ConferenceLocation"].ToString() + "<br/><br/><b>Meeting/Conference Type:</b> " + drConf["ConferenceType"].ToString() + "<br/><br/><br/><br/><b>Start Date:</b> " + sdate1 + "<br/><br/><b>Start Time:</b> " + stime1 + "<br/><br/><br/><b>End Date:</b> " + edate1 + "<br/><br/><b>End Time:</b> " + etime1 + "<br/><br/><b>Default TimeZone:</b> " + drConf["Timezone"] + "<br><br><b>URI:</b> " + strUri + "<br/><br/><br/>");

                       ClsCalender.setEmailStatusOfConferenceGuest(guestname, email, "Sent");
                       //      if (guestID != -99)
                       ClsCalender.addConferenceUsers(confID, guestID);
                       objCal.SaveGuest(confID);
                   }
                   catch (Exception exp)
                   {
                       VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "sendInvitesToAll()--else--", "ctlAddEvent.xaml.cs");
                   }
               }
               
           }
           for (int j = 0; j < lstExistingUserList.Items.Count; j++)
           {
               ListBoxItem lstItem1 = new ListBoxItem();
               lstItem1 = (ListBoxItem)lstExistingUserList.Items.GetItemAt(j);
               string guestname1 = lstItem1.Content.ToString();
               string[] tagSplit1 = lstItem1.Tag.ToString().Split(':');
               Int64 guestID1 = Int64.Parse(tagSplit1[1]);
               string email1 = tagSplit1[0];

               ClsCalender.deleteUnInvitedConferenceGuest(guestname1, email1);
               //       if (guestID != -99)
               //       {
               ClsCalender.deleteConferenceUsers(confID, guestID1);
               //       }
           }

           MessageBox.Show("Mail has been sent to all the invited users");

       }
        //public static StringBuilder CreateTressInfo()
        //{
        //    StringBuilder sb = new StringBuilder();
        //    sb.Append("User Is : " + VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
        //    sb.AppendLine();
        //    sb.Append("Peer Type is : " + VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType.ToString());
        //    sb.AppendLine();
        //    sb.Append("User's SuperNode is : " + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP);
        //    sb.AppendLine();
        //    sb.Append("User's Machine Ip Address : " + VMuktiAPI.GetIPAddress.ClsGetIP4Address.GetIP4Address());
        //    sb.AppendLine();
        //    sb.AppendLine("----------------------------------------------------------------------------------------");
        //    return sb;
        //}

        public ctlEditEventReadOnly()
        {
            InitializeComponent();


            System.Data.DataSet dsUserInfo = ClsCalender.getConferenceDetails(GlobalVariables.ConferenceID);
            confID = GlobalVariables.ConferenceID;
            DataTable table = dsUserInfo.Tables[0];
            DataRow   dr    = table.Rows[0];

            txtWhat.Content      = dr["ConfTitle"].ToString();
            txtStartDate.Content = dr["StartDateTime"].ToString();
            txtEndDate.Content   = dr["EndDateTime"].ToString();
            txtAllDay.Content    = dr["IsAllDay"].ToString();

            txtCreatedBy.Content  = ClsCalender.getUserInfo(Int64.Parse((dr["CreatedBy"].ToString())));
            txtTimezone.Content   = dr["Timezone"].ToString();
            txtRepeatType.Content = dr["RepeatType"].ToString();
            txtwhere.Content      = dr["ConferenceLocation"].ToString();

            txtdescription.AppendText(dr["ConferenceDetail"].ToString());
            txtdescription.IsReadOnly = true;
            //           txtReminderType.Content = dr["ReminderType"].ToString();


            System.Data.DataSet dsConferenceReminder = ClsCalender.getConferenceReminder(GlobalVariables.ConferenceID);

            DataRow drConferenceReminder = dsConferenceReminder.Tables[0].Rows[0];
            //            txtReminderTime.Content = drConferenceReminder["TimeBeforeConf"].ToString();

            string conferenceType = dr["ConferenceType"].ToString();

            if (conferenceType.Equals("Default"))
            {
                txtPrivacy.Content = "Default";
            }
            else if (conferenceType.Equals("Public"))
            {
                txtPrivacy.Content = "Public";
            }
            else if (conferenceType.Equals("Private"))
            {
                txtPrivacy.Content = "Private";
            }

            DataSet dsUsers = ClsCalender.getConferenceUsers(GlobalVariables.ConferenceID);
            int     countUsersAttendingConference = 0;

            foreach (DataRow drUsers in dsUsers.Tables[0].Rows)
            {
                try
                {
                    string response = drUsers["Attendence"].ToString().Trim();
                    if (response.Equals("Yes"))
                    {
                        countUsersAttendingConference++;
                    }
                    else if (response.Equals("MayBe"))
                    {
                        countUsersAttendingConference++;
                    }
                }
                catch (Exception ex)
                {
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "ctlEditEventReadOnly()", "ctlEditEventReadOnly.xaml.cs");
                }
            }

            txtGuestsNo.Content = countUsersAttendingConference.ToString();
        }