Exemple #1
0
        /// <summary>
        /// Binds the data grid.
        /// </summary>
        /// <param name="dataBind">if set to <c>true</c> [data bind].</param>
        void BindDataGrid(bool dataBind)
        {
            ControlPropertiesBase properties = ControlProperties.Provider;

            if (properties.GetValue(this.ID, keyShowActive) == null)
            {
                properties.SaveValue(this.ID, keyShowActive, true);
            }

            if (properties.GetValue(this.ID, keyType) == null)
            {
                properties.SaveValue(this.ID, keyType, "365");                  // week
            }
            if ((string)properties.GetValue(this.ID, keyType) == "0" && (properties.GetValue(this.ID, keyFrom) == null || properties.GetValue(this.ID, keyTo) == null))
            {
                properties.SaveValue(this.ID, keyType, "365");                  // week
            }
            DateTime fromDate = DateTime.Now;
            DateTime toDate   = DateTime.Now;

            if ((string)properties.GetValue(this.ID, keyType) != "0")                   // period
            {
                int days = int.Parse((string)properties.GetValue(this.ID, keyType), CultureInfo.InvariantCulture);
                fromDate = fromDate.AddDays(-days);
            }
            else
            {
                fromDate = (DateTime)properties.GetValue(this.ID, keyFrom);
                toDate   = (DateTime)properties.GetValue(this.ID, keyTo);
            }

            DataTable dt = Mediachase.IBN.Business.ToDo.GetListToDoAndTasksAssignedByUserDataTable((bool)properties.GetValue(this.ID, keyShowActive), fromDate, toDate);

            DataView dv = dt.DefaultView;

            ctrlGrid.DataSource = dv;

            divNoObjects.Visible = false;
            if (dv.Count == 0)
            {
                ctrlGrid.Visible  = false;
                lblNoObjects.Text = String.Format("{0} <a href='{1}'>{2}</a>",
                                                  GetGlobalResourceObject("IbnFramework.Global", "NoToDos").ToString(),
                                                  this.Page.ResolveUrl("~/ToDo/ToDoEdit.aspx"),
                                                  GetGlobalResourceObject("IbnFramework.Global", "CreateToDo").ToString());
                divNoObjects.Visible = true;
            }

            BindLegend();
        }
        private void BindValues()
        {
            ControlPropertiesBase properties = ControlProperties.Provider;

            // Active/All
            if (properties.GetValue(this.ID, keyShowActive) == null)
            {
                properties.SaveValue(this.ID, keyShowActive, true);
            }

            if ((bool)properties.GetValue(this.ID, keyShowActive))
            {
                buttonActive.Checked = true;
            }
            else
            {
                buttonAll.Checked = true;
            }

            // Period
            if (properties.GetValue(this.ID, keyType) == null)
            {
                properties.SaveValue(this.ID, keyType, "365");                  // week
            }
            if ((string)properties.GetValue(this.ID, keyType) == "0" && (properties.GetValue(this.ID, keyFrom) == null || properties.GetValue(this.ID, keyTo) == null))
            {
                properties.SaveValue(this.ID, keyType, "365");                  // week
            }
            if ((string)properties.GetValue(this.ID, keyType) != "0")
            {
                rowFrom.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");
                rowTo.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");

                dateFrom.SelectedDate = DateTime.Now.Date.AddDays(-7);
                dateTo.SelectedDate   = DateTime.Now.Date;
            }
            else
            {
                dateFrom.SelectedDate = (DateTime)properties.GetValue(this.ID, keyFrom);
                dateTo.SelectedDate   = (DateTime)properties.GetValue(this.ID, keyTo);
            }

            CommonHelper.SafeSelect(listType, (string)properties.GetValue(this.ID, keyType));
        }
Exemple #3
0
        private void BindValues()
        {
            EntityObject[] reports = BusinessManager.List(ReportEntity.GetAssignedMetaClassName(), new FilterElementCollection().ToArray());
            if (reports != null && reports.Length > 0)
            {
                ReportList.DataSource = reports;
                ReportList.DataBind();

                ControlPropertiesBase properties = ControlProperties.Provider;
                if (properties.GetValue(this.ID, keyReport) != null)
                {
                    CommonHelper.SafeSelect(ReportList, (string)properties.GetValue(this.ID, keyReport));
                }

                ReportsRow.Visible   = true;
                NoReportsRow.Visible = false;
            }
            else
            {
                ReportsRow.Visible   = false;
                NoReportsRow.Visible = true;
            }
        }
Exemple #4
0
        private void BindLegend()
        {
            ControlPropertiesBase properties = ControlProperties.Provider;

            imageFilter.ToolTip       = LocRM.GetString("Filter");
            imageFilter.AlternateText = imageFilter.ToolTip;

            if ((bool)properties.GetValue(this.ID, keyShowActive))
            {
                labelLegend.Text = LocRM.GetString("ShowActive");
            }
            else
            {
                labelLegend.Text = LocRM.GetString("ShowAll");
            }

            labelLegend.Text += ", ";

            if ((string)properties.GetValue(this.ID, keyType) == "7")
            {
                labelLegend.Text += LocRM.GetString("ShowLastWeek");
            }
            else if ((string)properties.GetValue(this.ID, keyType) == "30")
            {
                labelLegend.Text += LocRM.GetString("ShowLastMonth");
            }
            else if ((string)properties.GetValue(this.ID, keyType) == "365")
            {
                labelLegend.Text += LocRM.GetString("ShowLastYear");
            }
            else
            {
                labelLegend.Text += String.Format(CultureInfo.InvariantCulture,
                                                  "{0} {1} {2} {3}",
                                                  LocRM.GetString("ShowFrom"),
                                                  ((DateTime)properties.GetValue(this.ID, keyFrom)).ToShortDateString(),
                                                  LocRM.GetString("ShowTo"),
                                                  ((DateTime)properties.GetValue(this.ID, keyTo)).ToShortDateString());
            }

            labelLegend.ToolTip = LocRM.GetString("Filter");
        }