Ejemplo n.º 1
0
        public AppointmentRow AddAppointmentRow(string Title, string URL, string ID, System.DateTime BeginDate, System.DateTime EndDate, string Location, string Description, string Subject, string Source, bool Recurrent, bool SLKEvent, bool AllDayEvent)
        {
            AppointmentRow rowAppointmentRow = ((AppointmentRow)(this.NewRow()));

            rowAppointmentRow.ItemArray = new object[] {
                Title,
                URL,
                ID,
                BeginDate,
                EndDate,
                Location,
                Description,
                Subject,
                Source,
                Recurrent,
                SLKEvent,
                AllDayEvent
            };
            this.Rows.Add(rowAppointmentRow);
            return(rowAppointmentRow);
        }
Ejemplo n.º 2
0
 public void RemoveAppointmentRow(AppointmentRow row)
 {
     this.Rows.Remove(row);
 }
Ejemplo n.º 3
0
 public AppointmentRowChangeEvent(AppointmentRow row, System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
Ejemplo n.º 4
0
 public void AddAppointmentRow(AppointmentRow row)
 {
     this.Rows.Add(row);
 }
Ejemplo n.º 5
0
        private void GenerateEventList(string URL, string ListTitle)
        {
            string WSURL       = "";
            string ListURLPart = "";

            URL = URL.ToLower();

            // Some entries will already have "allitems.aspx", and some won't. Remove it to give us a consistent URL to work with
            URL = URL.Replace("allitems.aspx", "");
            URL = URL.Replace("calendar.aspx", "");

            // Trim the trailing slash if there
            if (URL.EndsWith("/"))
            {
                URL = URL.TrimEnd('/');
            }

            string[] ListURLBits = URL.Split('/');

            //If the list title is not specified then try and determine form URL
            ListURLPart = ListURLBits[ListURLBits.Length - 1].ToString();
            if (ListTitle == "")
            {
                ListTitle = ListURLPart;
            }

            WSURL = URL.Replace("lists/" + ListURLPart, "_vti_bin/lists.asmx");

            //Use the list search class to query for list items via web services
            ListSearch.ListPlannerData listdata = new ListPlannerData();
            if (this.cont.User.Identity.AuthenticationType.ToUpper() == "BASIC")
            {
                listdata.UserName = this.cont.User.Identity.Name;
                listdata.Password = this.cont.Request.ServerVariables["AUTH_PASSWORD"];
            }
            listdata.RowLimit = 20;
            listdata.URL      = WSURL.ToLower();
            listdata.ListName = ListTitle.Replace("%20", " ");
            listdata.DNSName  = this.DNSName;
//			listdata.Conditions.Add("<Leq><FieldRef Name=\"EventDate\"/><Value Type=\"DateTime\">{0}Z</Value></Leq>");
//			listdata.Conditions.Add("<Geq><FieldRef Name=\"EventDate\"/><Value Type=\"DateTime\">{0}Z</Value></Geq>");
//			//listdata.Conditions.Add("<Geq><FieldRef Name=\"EndDate\"/><Value Type=\"DateTime\">{0}Z</Value></Geq>");
            listdata.Values.Add(EndDate.ToString("s"));
            listdata.Values.Add(StartDate.ToString("s"));

            listdata.SelectFields.Add("Title");
            listdata.SelectFieldTypes.Add("System.String");
            listdata.SelectFields.Add("ID");
            listdata.SelectFieldTypes.Add("System.Double");
            listdata.SelectFields.Add("EventDate");
            listdata.SelectFieldTypes.Add("System.DateTime");
            listdata.SelectFields.Add("EndDate");
            listdata.SelectFieldTypes.Add("System.DateTime");
            listdata.SelectFields.Add("RecurrenceData");
            listdata.SelectFieldTypes.Add("System.String");

            listdata.OrderBy = "<OrderBy><FieldRef Name=\"Modified\" Ascending=\"FALSE\"/></OrderBy>";

            listdata.Debug = false;
            listdata.GetData();

            if (listdata.HasError)
            {
                this.HasError  = true;
                this.ErrorDesc = listdata.ErrorMessage;
            }
            string TargetURL;

            foreach (DataRow item in listdata.Tables[0].Rows)
            {
                try
                {
                    AppointmentRow dr = this.Appointment.NewAppointmentRow();

                    dr["Title"] = item["Title"];

                    TargetURL = URL.Replace("lists/" + ListURLPart, "_layouts/") + System.Threading.Thread.CurrentThread.CurrentUICulture.LCID.ToString() + "/LgUtilities/showevent.aspx?URL=" + URL + "&ID=" + item["ID"].ToString() + "&DNSName=" + this.DNSName;
                    dr.URL    = TargetURL;

                    dr.ID = item["ID"].ToString();

                    if (item["EventDate"] != null)
                    {
                        dr.BeginDate = ((DateTime)item["EventDate"]).ToUniversalTime();
                        //dr.BeginDate = dr.BeginDate.ToUniversalTime();
                    }

                    try
                    {
                        if (item["EndDate"] != null)
                        {
                            //dr["EndDate"] = item["EndDate"];
                            //						dr.EndDate = dr.EndDate.ToUniversalTime();
                            dr.EndDate = ((DateTime)item["EndDate"]).ToUniversalTime();
                        }
                    }
                    catch
                    {
                        dr["EndDate"] = item["EndDate"];
                    }

                    /////////////////////////////////////////////////////////////////////////////////////
                    string recurrence_data = "";

                    if (item["RecurrenceData"] != null)
                    {
                        recurrence_data = item["RecurrenceData"].ToString();
                        recurrence_data = System.Web.HttpUtility.HtmlDecode(recurrence_data);
                        if (recurrence_data != "")
                        {
                            dr.Recurrent = true;
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////

                    dr.Source = "SPSEvents";

                    this.Appointment.AddAppointmentRow(dr);
                }
                catch (System.Data.ConstraintException)
                {
                    // Ignore this exception. Just means a row was added twice.
                }
            }
            listdata.Dispose();
        }