private Panel BuildEditControl(GridControlEditMode mode)
        {
            List <Control> controls = new List <Control>();

            if (this.SelectedItem == null &&
                mode == GridControlEditMode.Edit)
            {
                return(new Panel());
            }

            WebUtilities.Controls.Table table = new WebUtilities.Controls.Table();

            foreach (string field in this.Fields)
            {
                WebUtilities.Controls.TableRow tableRow =
                    new WebUtilities.Controls.TableRow();

                WebUtilities.Controls.TableCell tableCellFieldName =
                    new WebUtilities.Controls.TableCell();
                WebUtilities.Controls.TableCell tableCellFieldValue =
                    new WebUtilities.Controls.TableCell();

                Label lblFieldName = new Label();
                lblFieldName.Name = field;

                //object value = this.SelectedItem.GetValue(field);

                Control control = null;

                control = BuildControl(field, mode == GridControlEditMode.Edit);

                control.ID = this.ID + "_" + field;

                controls.Add(control);

                tableCellFieldName.Controls.Add(lblFieldName);
                tableCellFieldValue.Controls.Add(control);

                tableRow.Cells.Add(tableCellFieldName);
                tableRow.Cells.Add(tableCellFieldValue);

                table.Rows.Add(tableRow);
            }

            // Run through all additional fields.
            foreach (AdditionalField <T> field in this.AdditionalFields)
            {
                if (!field.ShowInEdit)
                {
                    continue;
                }

                if (field.Condition != null && field.Condition(this.SelectedItem) == false)
                {
                    continue;
                }

                WebUtilities.Controls.TableRow tableRow = new WebUtilities.Controls.TableRow();

                WebUtilities.Controls.TableCell tableCellFieldName =
                    new WebUtilities.Controls.TableCell();
                WebUtilities.Controls.TableCell tableCellFieldValue =
                    new WebUtilities.Controls.TableCell();

                Label lblFieldName = new Label();
                lblFieldName.Name = field.Name;

                Control value = field.Render.Invoke(
                    mode == GridControlEditMode.Edit ?
                    this.SelectedItem :
                    null
                    );

                if (value == null)
                {
                    continue;
                }

                controls.Add(value);

                tableCellFieldName.Controls.Add(lblFieldName);
                tableCellFieldValue.Controls.Add(value);

                tableRow.Cells.Add(tableCellFieldName);
                tableRow.Cells.Add(tableCellFieldValue);

                table.Rows.Add(tableRow);
            }

            WebUtilities.Controls.TableRow tableRowButtons =
                new WebUtilities.Controls.TableRow();

            WebUtilities.Controls.TableCell tableCellButtons =
                new WebUtilities.Controls.TableCell();
            tableCellButtons.ColumnSpan      = 2;
            tableCellButtons.HorizontalAlign = HorizontalAlign.Right;

            Button defaultButton = null;

            if (mode == GridControlEditMode.Add)
            {
                Button btnAddConfirm = new Button();
                btnAddConfirm.ID     = this.ID + "BoxAdd";
                btnAddConfirm.Name   = "Add";
                btnAddConfirm.Click += btnAddConfirm_Click;

                defaultButton = btnAddConfirm;

                tableCellButtons.Controls.Add(btnAddConfirm);
            }
            else
            {
                Button btnSave = new Button();
                btnSave.ID     = this.ID + "BoxSave";
                btnSave.Name   = "Save";
                btnSave.Click += btnSave_Click;

                defaultButton = btnSave;

                tableCellButtons.Controls.Add(btnSave);
            }

            Button btnCancel = new Button();

            btnCancel.Name = "Cancel";

            tableCellButtons.Controls.Add(btnCancel);

            tableRowButtons.Cells.Add(tableCellButtons);

            table.Rows.Add(tableRowButtons);

            dragBox       = new Box();
            dragBox.ID    = this.ID + mode.ToString();
            dragBox.Title = mode.ToString() + (this.Items.Count > 0 ? this.Items[0].GetType().Name : "");
            dragBox.TitleLanguageLabel = true;
            dragBox.Dragable           = true;
            dragBox.Visible            = true;

            dragBox.Controls.Add(table);

            Panel panel = new Panel();

            panel.Controls.Add(dragBox);

            foreach (Control control in controls)
            {
                if (control.GetType() == typeof(TextBox))
                {
                    TextBox textBox = (TextBox)control;

                    textBox.Button = defaultButton.ID;
                }
            }

            return(panel);
        }
        private void GenerateUserRoleDetails()
        {
            if (Global.PermissionCore.Sections.Items != null)
            {
                foreach (PermissionCore.Classes.Section sec in Global.PermissionCore.Sections.Items)
                {
                    WebUtilities.Controls.Table tblSection = new WebUtilities.Controls.Table();

                    tblSection.ID          = "tbl" + sec.Name;
                    tblSection.CssClass    = "Userroletable";
                    tblSection.CellPadding = 0;
                    tblSection.CellSpacing = 0;
                    TableHeaderRow hrow = new TableHeaderRow();

                    TableCell hCell1 = new TableCell();
                    hCell1.ID       = "hCell_" + sec.Name;
                    hCell1.Width    = new Unit(150, UnitType.Pixel);
                    hCell1.CssClass = "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor9 TableCellPercentage";
                    hCell1.Text     = PrepareRoleName(Global.LanguageManager.GetText(sec.Name));
                    hrow.Cells.Add(hCell1);


                    int cnt = 0;
                    foreach (PermissionCore.Classes.Permission permission in sec.Permissions)
                    {
                        if (!Global.User.HasPermission(permission.Id) && Global.User.HasPermission(1001) == false)
                        {
                            continue;
                        }
                        if (!(permission.Id == 1001) && !(permission.Id == 1000))
                        {
                            TableCell tc = new TableCell
                            {
                                ID       = "tc" + permission.Name.ToLower(),
                                Text     = PrepareRoleName(Global.LanguageManager.GetText(permission.Name).ToLower()),
                                Width    = new Unit(150, UnitType.Pixel),
                                CssClass =
                                    cnt % 2 == 0
                                        ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5"
                                        : "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor9"
                            };
                            hrow.Cells.Add(tc);
                            cnt++;
                        }
                    }
                    tblSection.Rows.Add(hrow);

                    var roles = Global.Core.Roles.Get().OrderBy(s => s.Name);
                    if (roles != null)
                    {
                        foreach (Role role in roles)
                        {
                            RolePermission rolePermission = Global.Core.RolePermissions.GetSingle("IdRole", role.Id);
                            TableRow       tr             = new WebUtilities.Controls.TableRow();
                            TableCell      td1            = new TableCell
                            {
                                ID    = "td_" + sec.Name + "_" + role.Name,
                                Width = new Unit(150, UnitType.Pixel),
                                Text  = PrepareRoleName(role.Name.ToLower())
                            };
                            td1.Font.Bold = true;
                            td1.CssClass  =
                                "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor8";
                            tr.Cells.Add(td1);

                            int count = 0;
                            foreach (PermissionCore.Classes.Permission detailPermission in sec.Permissions)
                            {
                                if (!Global.User.HasPermission(detailPermission.Id) && Global.User.HasPermission(1001) == false)
                                {
                                    continue;
                                }

                                if (!(detailPermission.Id == 1001) && !(detailPermission.Id == 1000))
                                {
                                    TableCell cell = new TableCell
                                    {
                                        ID       = "td" + detailPermission.Name + role.Id,
                                        Width    = new Unit(150, UnitType.Pixel),
                                        Text     = PrepareRoleName(role.Name.ToLower()),
                                        CssClass = count % 2 == 0
                                            ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor9"
                                            : "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5"
                                    };

                                    WebUtilities.Controls.CheckBox checkBox = new WebUtilities.Controls.CheckBox
                                    {
                                        ID = "chk_" + role.Id + "_" + detailPermission.Id
                                    };

                                    RolePermission dbPermission =
                                        Global.Core.RolePermissions.GetSingle(new string[] { "IdRole", "Permission" },
                                                                              new object[] { role.Id, detailPermission.Id });

                                    checkBox.Checked = dbPermission != null;

                                    cell.Controls.Add(checkBox);
                                    tr.Cells.Add(cell);
                                    count++;
                                }
                            }

                            tblSection.Rows.Add(tr);
                        }
                    }
                    pnlModuleDetails.Controls.Add(tblSection);
                }
            }
        }
        private void GenereateUserGroups(string selectedRole)
        {
            pnlModuleDetails.Controls.Clear();

            if (selectedRole != null)
            {
                if (Global.PermissionCore.Sections.Items != null)
                {
                    var results = Global.Core.Roles.Get().OrderBy(s => s.Name);
                    var roles   = results.Where(x => x.Name == selectedRole);
                    // var results = listData.Where((item, index) => listFilter[index] == 1);
                    if (roles != null)
                    {
                        object idRoleUser = Global.Core.UserRoles.GetValue("IdRole", "IdUser", Global.IdUser.Value);

                        if (idRoleUser == null)
                        {
                            idRoleUser = new Guid();
                        }

                        foreach (Role role in roles)
                        {
                            if (role.Hidden && role.Id != (Guid)idRoleUser)
                            {
                                continue;
                            }

                            WebUtilities.Controls.Table tblSection = new WebUtilities.Controls.Table();

                            tblSection.ID          = "tblRole";//"tbl" + role.Name;
                            tblSection.CssClass    = "Userroletable";
                            tblSection.CellPadding = 0;
                            tblSection.CellSpacing = 0;
                            //TableHeaderRow hrow = new TableHeaderRow();

                            //TableCell hCell1 = new TableCell();
                            //hCell1.ID = "hCell_" + role.Name;
                            //hCell1.Width = new Unit(150, UnitType.Pixel);
                            //hCell1.CssClass = "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor8";
                            //hCell1.Text = PrepareRoleName(role.Name.ToLower());
                            //hrow.Cells.Add(hCell1);
                            //tblSection.Rows.Add(hrow);

                            foreach (PermissionCore.Classes.Section sec in Global.PermissionCore.Sections.Items)
                            {
                                TableRow  trSec    = new WebUtilities.Controls.TableRow();
                                TableCell secEmpty = new TableCell();
                                secEmpty.ID       = "secEmpty_" + role.Name + sec.Name;
                                secEmpty.Width    = new Unit(150, UnitType.Pixel);
                                secEmpty.CssClass = "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor8 TableCellPercentage";
                                secEmpty.Text     = PrepareRoleName(Global.LanguageManager.GetText(sec.Name).ToLower());
                                trSec.Cells.Add(secEmpty);

                                int cnt = 0;
                                foreach (PermissionCore.Classes.Permission permission in sec.Permissions)
                                {
                                    if (!Global.User.HasPermission(permission.Id) && Global.User.HasPermission(1001) == false)
                                    {
                                        continue;
                                    }
                                    if (!(permission.Id == 1001) && !(permission.Id == 1000))
                                    {
                                        TableCell tc = new TableCell
                                        {
                                            ID       = "tc" + permission.Name.ToLower() + "_" + role.Name,
                                            Text     = PrepareRoleName(Global.LanguageManager.GetText(permission.Name).ToLower()),
                                            Width    = new Unit(150, UnitType.Pixel),
                                            CssClass =
                                                cnt % 2 == 0
                                                    ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5"
                                                    : "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor9"
                                        };
                                        trSec.Cells.Add(tc);
                                        cnt++;
                                    }
                                    tblSection.Rows.Add(trSec);
                                }


                                //  var roles = Global.Core.Roles.Get().OrderBy(s => s.Name);


                                //RolePermission rolePermission = Global.Core.RolePermissions.GetSingle("IdRole", role.Id);
                                //TableRow tr = new WebUtilities.Controls.TableRow();
                                //TableCell td1 = new TableCell
                                //{
                                //    ID = "td_" + sec.Name + "_" + role.Name,
                                //    Width = new Unit(150, UnitType.Pixel),
                                //    Text = PrepareRoleName(sec.Name)
                                //};
                                //td1.Font.Bold = true;
                                //td1.CssClass =
                                //    "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor8";
                                //tr.Cells.Add(td1);
                                TableRow  tr    = new WebUtilities.Controls.TableRow();
                                TableCell tdSec = new TableCell();
                                tdSec.ID       = "tdSec_" + sec.Name + role.Name;
                                tdSec.Width    = new Unit(150, UnitType.Pixel);
                                tdSec.CssClass = "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor7 TableCellPercentage";
                                tr.Cells.Add(tdSec);

                                int count = 0;
                                foreach (PermissionCore.Classes.Permission detailPermission in sec.Permissions)
                                {
                                    if (!Global.User.HasPermission(detailPermission.Id) && Global.User.HasPermission(1001) == false)
                                    {
                                        continue;
                                    }

                                    if (!(detailPermission.Id == 1001) && !(detailPermission.Id == 1000))
                                    {
                                        TableCell cell = new TableCell
                                        {
                                            ID       = "td" + detailPermission.Name + role.Id,
                                            Width    = new Unit(150, UnitType.Pixel),
                                            Text     = PrepareRoleName(role.Name.ToLower()),
                                            CssClass = count % 2 == 0
                                                ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor9"
                                                : "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5"
                                        };

                                        WebUtilities.Controls.CheckBox checkBox = new WebUtilities.Controls.CheckBox
                                        {
                                            ID = "chk_" + role.Id + "_" + detailPermission.Id
                                        };

                                        RolePermission dbPermission =
                                            Global.Core.RolePermissions.GetSingle(new string[] { "IdRole", "Permission" },
                                                                                  new object[] { role.Id, detailPermission.Id });

                                        checkBox.Checked = dbPermission != null;

                                        cell.Controls.Add(checkBox);
                                        tr.Cells.Add(cell);
                                        count++;
                                    }
                                }
                                tblSection.Rows.Add(tr);



                                pnlModuleDetails.Controls.Add(tblSection);
                            }
                        }
                    }
                }
            }
        }
Exemple #4
0
        private void GenerateUserRoleDetails(Guid roleId)
        {
            if (Global.PermissionCore.Sections.Items != null)
            {
                foreach (PermissionCore.Classes.Section sec in Global.PermissionCore.Sections.Items)
                {
                    WebUtilities.Controls.Table tblSection = new WebUtilities.Controls.Table
                    {
                        ID          = "tbl" + sec.Name,
                        CssClass    = "Userroletable",
                        CellPadding = 0,
                        CellSpacing = 0
                    };

                    TableHeaderRow hrow = new TableHeaderRow();

                    TableCell hCell1 = new TableCell();
                    hCell1.ID       = "hCellgroupassigned";
                    hCell1.Width    = new Unit(150, UnitType.Pixel);
                    hCell1.CssClass = "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor1";
                    hrow.Cells.Add(hCell1);


                    int cnt = 0;
                    foreach (PermissionCore.Classes.Permission permission in sec.Permissions)
                    {
                        TableCell tc = new TableCell
                        {
                            ID       = "tc" + permission.Name.ToLower(),
                            Text     = permission.Name.ToLower(),
                            Width    = new Unit(150, UnitType.Pixel),
                            CssClass =
                                cnt % 2 == 0
                                    ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5"
                                    : "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor1"
                        };
                        hrow.Cells.Add(tc);
                        cnt++;
                    }
                    tblSection.Rows.Add(hrow);

                    var role = Global.Core.Roles.GetSingle(roleId);
                    if (role != null)
                    {
                        TableRow  tr  = new WebUtilities.Controls.TableRow();
                        TableCell td1 = new TableCell
                        {
                            ID    = "td_" + role.Name,
                            Width = new Unit(150, UnitType.Pixel),
                            Text  = role.Name.ToLower()
                        };
                        td1.Font.Bold = true;
                        td1.CssClass  =
                            "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5";
                        tr.Cells.Add(td1);

                        int count = 0;
                        foreach (PermissionCore.Classes.Permission detailPermission in sec.Permissions)
                        {
                            TableCell cell = new TableCell
                            {
                                ID       = "td" + detailPermission.Name,
                                Width    = new Unit(150, UnitType.Pixel),
                                Text     = role.Name.ToLower(),
                                CssClass = count % 2 == 0
                                    ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor1"
                                    : "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5"
                            };

                            WebUtilities.Controls.CheckBox checkBox = new WebUtilities.Controls.CheckBox
                            {
                                ID = "chk_" + role.Id + "_" + detailPermission.Id
                            };

                            RolePermission dbPermission =
                                Global.Core.RolePermissions.GetSingle(new string[] { "IdRole", "Permission" },
                                                                      new object[] { role.Id, detailPermission.Id });

                            checkBox.Checked = dbPermission != null;

                            cell.Controls.Add(checkBox);
                            tr.Cells.Add(cell);
                            count++;
                        }
                        tblSection.Rows.Add(tr);
                    }
                    pnlModuleDetails.Controls.Add(tblSection);
                }
            }
        }
Exemple #5
0
        private void GenerateModules()
        {
            if (Global.PermissionCore.Sections.Items != null)
            {
                foreach (PermissionCore.Classes.Section sec in Global.PermissionCore.Sections.Items)
                {
                    WebUtilities.Controls.Table tblSection = new WebUtilities.Controls.Table();

                    tblSection.ID          = "tbl" + sec.Name;
                    tblSection.CssClass    = "Userroletable";
                    tblSection.CellPadding = 0;
                    tblSection.CellSpacing = 0;
                    tblSection.Width       = new Unit(100, UnitType.Percentage);

                    TableHeaderRow hrow = new TableHeaderRow();

                    TableCell hCell1 = new TableCell();
                    hCell1.ID       = "hCell" + sec.Name;
                    hCell1.Width    = new Unit(100, UnitType.Pixel);
                    hCell1.CssClass = "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor8 TableCellPercentage";
                    hCell1.Text     = Global.LanguageManager.GetText(sec.Name).ToLower();
                    hrow.Cells.Add(hCell1);


                    int cnt = 0;
                    foreach (PermissionCore.Classes.Permission permission in sec.Permissions)
                    {
                        if (!Global.User.HasPermission(permission.Id) && Global.User.HasPermission(1001) == false)
                        {
                            continue;
                        }

                        if (!(permission.Id == 1001) && !(permission.Id == 1000))
                        {
                            TableCell tc = new TableCell();
                            tc.ID       = "tc" + permission.Name.ToLower();
                            tc.Text     = PrepareRoleName(Global.LanguageManager.GetText(permission.Name).ToLower());
                            tc.Width    = new Unit(150, UnitType.Pixel);
                            tc.CssClass = cnt % 2 == 0 ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor5" : "TableCellHeadline TableCellHeadlineCategory BorderColor9 BackgroundColor9";
                            hrow.Cells.Add(tc);
                            cnt++;
                        }
                    }
                    tblSection.Rows.Add(hrow);

                    TableRow  tr  = new WebUtilities.Controls.TableRow();
                    TableCell td1 = new TableCell
                    {
                        ID    = "td_" + sec.Name,
                        Width = new Unit(150, UnitType.Pixel)
                    };
                    td1.CssClass =
                        "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor7";
                    tr.Cells.Add(td1);

                    int count = 0;
                    foreach (PermissionCore.Classes.Permission detailPermission in sec.Permissions)
                    {
                        if (!Global.User.HasPermission(detailPermission.Id) && Global.User.HasPermission(1001) == false)
                        {
                            continue;
                        }
                        if (!(detailPermission.Id == 1001) && !(detailPermission.Id == 1000))
                        {
                            TableCell cell = new TableCell();
                            cell.ID       = "td" + detailPermission.Name;
                            cell.Width    = new Unit(150, UnitType.Pixel);
                            cell.CssClass = count % 2 == 0 ? "TableCellHeadline TableCellHeadlineCategory BorderColor7 BackgroundColor9" : "TableCellHeadline TableCellHeadlineCategory BorderColor9 BackgroundColor5";
                            WebUtilities.Controls.CheckBox checkBox = new WebUtilities.Controls.CheckBox();
                            checkBox.ID = "chk_" + detailPermission.Id;

                            cell.Controls.Add(checkBox);
                            tr.Cells.Add(cell);
                            count++;
                        }
                    }

                    tblSection.Rows.Add(tr);

                    pnlModuleDetails.Controls.Add(tblSection);
                }
            }
        }
        /// <summary>
        /// Render Saved Reports
        /// </summary>

        private Panel RenderSavedReports()
        {
            // Build the full path to the current users's saved reports directory.
            string directory = Path.Combine(
                HttpContext.Current.Request.PhysicalApplicationPath,
                "Fileadmin",
                "SavedReports",
                Global.Core.ClientName,
                Global.User.Id.ToString()
                );

            var tblReport = new WebUtilities.Controls.Table
            {
                ID          = "tblReport",
                CssClass    = "newsText Color1",
                CellPadding = 0,
                CellSpacing = 0
            };

            if (Directory.Exists(directory))
            {
                if (Directory.GetFiles(directory).Any())
                {
                    var row = new TableRow();
                    var cnt = 1;
                    // foreach (var file in Directory.GetFiles(directory).OrderByDescending(file => file).Take(2))
                    foreach (var file in Directory.GetFiles(directory).OrderByDescending(file => new FileInfo(file).LastWriteTime).Take(3))
                    {
                        var fInfo = new FileInfo(file);
                        // Check if the file is a saved report.
                        if (fInfo.Extension == ".lor")
                        {
                            var reportCell = new TableCell
                            {
                                ID       = "reportCell" + cnt,
                                CssClass = "rptCell"
                            };

                            reportCell.Attributes.Add("Style", "margin-left:20px;");

                            var imgFile = new ImageButton
                            {
                                ID       = "imgFile" + fInfo.Name.Split('.')[0],
                                CssClass = "BackgroundColor1",
                                //Width = 50,
                                //Height = 50
                            };
                            imgFile.Attributes.Add("Source", file);

                            string imgFileName = Path.Combine(
                                HttpContext.Current.Request.PhysicalApplicationPath,
                                "Images",
                                "Icons",
                                "Cloud",
                                fInfo.Extension + ".png"
                                );

                            string imageName = fInfo.Extension + ".png";

                            //imgFile.ImageUrl = cnt % 2 == 0 ? "/Images/Icons/Home/report1.png" : "/Images/Icons/Home/report2.png";
                            imgFile.ImageUrl = "/Images/Icons/Cloud/.lor.png";
                            imgFile.Attributes.Add(
                                "onmouseover",
                                "this.src = '/Images/Icons/Cloud/Run.png'"
                                );
                            imgFile.Attributes.Add(
                                "onmouseout",
                                "this.src = '/Images/Icons/Cloud/" + imageName + "';document.forms[0].action = document.forms[0].action.split('?')[0];"
                                );

                            imgFile.Attributes.Add(
                                "onclick",
                                "return savedReportsClick(this);"
                                );


                            //LinkOnline.Pages.LandingPage page = new LinkOnline.Pages.LandingPage();

                            //imgFile.Click += page.SavedReport_Click;

                            reportCell.Controls.Add(imgFile);
                            row.Controls.Add(reportCell);

                            //var reportText = new Label
                            //{
                            //    ID = "lbl" + fInfo.Name.Split('.')[0],
                            //    CssClass = "reportText Color1",
                            //    Text = fInfo.Name.Split('.')[0].Trim()
                            //};
                            //reportCell.Controls.Add(reportText);


                            var reportCellText = new TableCell
                            {
                                ID       = "reportCellText" + cnt,
                                CssClass = "reportText Color1",
                                Text     = fInfo.Name.Split('.')[0],
                            };

                            row.Controls.Add(reportCellText);

                            tblReport.Rows.Add(row);
                        }
                        else
                        {
                            var cellReport = new TableCell
                            {
                                ID         = "cellReport",
                                CssClass   = "noMsg Color2",
                                ColumnSpan = 4,
                                Text       = "no reports are saved"
                            };
                            row.Controls.Add(cellReport);
                            cellReport.Font.Size = 14;
                            tblReport.Rows.Add(row);
                        }
                        cnt++;
                    }
                }
                else
                {
                    var row        = new TableRow();
                    var cellReport = new TableCell
                    {
                        ID         = "cellReport",
                        CssClass   = "noMsg Color2",
                        ColumnSpan = 4,
                        Text       = "no reports are saved"
                    };

                    cellReport.Font.Size = 14;
                    row.Controls.Add(cellReport);
                    tblReport.Rows.Add(row);
                }
            }
            else
            {
                var row        = new TableRow();
                var cellReport = new TableCell
                {
                    ID         = "cellReport",
                    CssClass   = "noMsg Color2",
                    ColumnSpan = 4,
                    Text       = "no reports are saved"
                };

                cellReport.Font.Size = 14;
                row.Controls.Add(cellReport);
                tblReport.Rows.Add(row);
            }

            Panel mypanel = new Panel();

            mypanel.Controls.Add(tblReport);

            //pnlReportDetails.Controls.Add(tblReport);

            return(mypanel);
        }
        private Table GetNews()
        {
            var newsManager = new NewsManager();

            var xmlNewsListBase = newsManager.GetNewsAll(Global.Core.ClientName);

            var innerTbl = new WebUtilities.Controls.Table
            {
                ID          = "NewsFromXML",
                CellPadding = 2,
                CellSpacing = 2,
                CssClass    = "tblNews"
                              //BackColor = System.Drawing.ColorTranslator.FromHtml("#E2EFF9")
            };

            //innerTbl.Attributes.Add(
            //        "onmouseover",
            //        "this.bgColor='#E2EFF9'"
            //    );

            //innerTbl.Attributes.Add(
            //      "onmouseout",
            //      "this.bgColor='#FFFFFF'"
            //  );
            if (xmlNewsListBase != null)
            {
                /*The below code using for sort the XML based on an attribute*/
                var xmlNewsList = new List <XmlNode>(xmlNewsListBase.Cast <XmlNode>().OrderByDescending(p => p.Attributes["CreatedDate"].Value));
                if (xmlNewsList.Count != 0)
                {
                    int i = 1;
                    foreach (XmlNode xn in xmlNewsList)
                    {
                        var xmlElement = xn;
                        if (xmlElement != null)
                        {
                            var innerRow  = new TableRow();
                            var innerCell = new TableCell
                            {
                                ID       = "NewsXMLHeading" + i,
                                Text     = xmlElement.Attributes["Heading"].Value,
                                CssClass = "newsText Color1"
                            };
                            innerCell.Font.Bold = true;
                            innerRow.Cells.Add(innerCell);
                            innerTbl.Controls.Add(innerRow);

                            var    innerRow1 = new TableRow();
                            string datePart  = null;
                            if (!string.IsNullOrEmpty(xmlElement.Attributes["CreatedDate"].Value))
                            {
                                datePart = xmlElement.Attributes["CreatedDate"].Value;
                            }
                            var innerCell1 = new TableCell
                            {
                                ID       = "NewsXMLDesc" + i,
                                Text     = xmlElement.Attributes["Description"].Value,
                                CssClass = "newsText Color1"
                            };
                            //innerCell1.Font.Bold = true;
                            //innerCell1.CssClass = "newsSubText Color2";
                            innerRow1.Cells.Add(innerCell1);
                            innerTbl.Controls.Add(innerRow1);

                            var innerRow2 = new TableRow();

                            string userName = "";
                            if (xmlElement.Attributes["UserId"] != null)
                            {
                                User user = null;
                                user = Global.Core.Users.GetSingle(Guid.Parse(xmlElement.Attributes["UserId"].Value.Trim()));
                                if (user != null)
                                {
                                    userName = user.FirstName + "&nbsp;" + user.LastName;
                                }
                            }
                            var innerCell2 = new TableCell
                            {
                                ID       = "NewsCreatedUser" + i,
                                Text     = Convert.ToDateTime(datePart).ToString("MMMM dd, yyyy") + " | &nbsp;" + userName,
                                CssClass = "newsSubText Color2"
                            };
                            innerCell2.Font.Bold = true;
                            innerRow2.Cells.Add(innerCell2);
                            innerTbl.Controls.Add(innerRow2);
                        }
                        i++;
                    }
                }
                else
                {
                    innerTbl = null;
                }
            }
            else
            {
                innerTbl = null;
            }

            return(innerTbl);
        }
        private Panel GenerateNewsFromWebSite()
        {
            Panel myPanel = new Panel();

            if (HttpContext.Current.Session["NewsDetails"] != null)
            {
                var tblNews = new WebUtilities.Controls.Table
                {
                    ID          = "tblNews",
                    CssClass    = "newsTable",
                    CellPadding = 0,
                    CellSpacing = 0
                };

                var newsXmlRow   = new TableRow();
                var tdClientNews = new TableCell
                {
                    ID = "tdClientNewsFromXML"
                };
                if (GetNews() != null)
                {
                    tdClientNews.Controls.Add(GetNews());
                }
                else
                {
                    tdClientNews.CssClass = "noMsg Color2";
                    tdClientNews.Text     = "no news available";
                }
                newsXmlRow.Cells.Add(tdClientNews);
                tblNews.Rows.Add(newsXmlRow);
                var emptyRow  = new TableRow();
                var emptyCell = new TableCell
                {
                    ID       = "emptyCell",
                    CssClass = "emptCell"
                };
                emptyRow.Cells.Add(emptyCell);
                tblNews.Rows.Add(emptyRow);

                var globalHeadingRow = new TableRow();
                var tdglobalHeading  = new TableCell
                {
                    ID       = "tdglobalHeading",
                    CssClass = "widgetTitle Color1",
                    Text     = "news @ blueocean"
                };
                globalHeadingRow.Cells.Add(tdglobalHeading);
                tblNews.Rows.Add(globalHeadingRow);

                var emptyRow1  = new TableRow();
                var emptyCell1 = new TableCell
                {
                    ID       = "emptyCell1",
                    CssClass = "emptCell"
                };
                emptyRow1.Cells.Add(emptyCell1);
                tblNews.Rows.Add(emptyRow1);

                var gloablNews   = new TableRow();
                var tdgloablNews = new TableCell
                {
                    ID       = "tdgloablNews",
                    CssClass = "globalNews"
                };

                tdgloablNews.Controls.Add(HttpContext.Current.Session["NewsDetails"] as Table);
                gloablNews.Cells.Add(tdgloablNews);
                tblNews.Rows.Add(gloablNews);

                //pnlRssFeeds.Controls.Add(tblNews);
                myPanel.Controls.Add(tblNews);
                return(myPanel);
            }
            else
            {
                return(myPanel);
            }
        }