private void GenerateTabs()
        {
            string ProgramId = null;

            //if (Request.QueryString["ProjectId"] != null)
            //    NavigatedProjectId = Request.QueryString["ProjectId"];

            if (Request.QueryString["ProgramId"] != null)
            {
                ProgramId = Request.QueryString["ProgramId"];
            }

            //Active Tab
            HtmlGenericControl li = new HtmlGenericControl("li");

            li.Attributes.Add("class", "RoundedCornerTop");
            Tabs.Controls.Add(li);

            HtmlGenericControl anchor = new HtmlGenericControl("a");

            anchor.Attributes.Add("href", "ProjectMaintenance.aspx?ProjectId=" + hfProjectId.Value);
            anchor.InnerText = "Project Maintenance";
            anchor.Attributes.Add("class", "RoundedCornerTop");

            li.Controls.Add(anchor);

            DataTable dtTabs = TabsData.GetProgramTabs(DataUtils.GetInt(ProgramId));

            foreach (DataRow dr in dtTabs.Rows)
            {
                HtmlGenericControl li1 = new HtmlGenericControl("li");
                if (dr["URL"].ToString() == "ConservationSourcesUses.aspx")
                {
                    li1.Attributes.Add("class", "RoundedCornerTop selected");
                }
                else
                {
                    li1.Attributes.Add("class", "RoundedCornerTop");
                }

                Tabs.Controls.Add(li1);
                HtmlGenericControl anchor1 = new HtmlGenericControl("a");
                anchor1.Attributes.Add("href", dr["URL"].ToString() + "?ProjectId=" + hfProjectId.Value + "&ProgramId=" + ProgramId);
                anchor1.InnerText = dr["TabName"].ToString();
                anchor1.Attributes.Add("class", "RoundedCornerTop");
                li1.Controls.Add(anchor1);
            }
        }
Exemple #2
0
        public TabsData SaveTabs(Tabs m, long roleId, long userId, DateTime currentDate)
        {
            var result = new TabsData();

            try
            {
                var sqlParameters = new SqlParameter[12];
                sqlParameters[0]  = new SqlParameter("pId", m.TabId);
                sqlParameters[1]  = new SqlParameter("pTabName", m.TabName);
                sqlParameters[2]  = new SqlParameter("pController", !string.IsNullOrEmpty(m.Controller) ? m.Controller : string.Empty);
                sqlParameters[3]  = new SqlParameter("pAction", !string.IsNullOrEmpty(m.Action) ? m.Action : string.Empty);
                sqlParameters[4]  = new SqlParameter("pRouteValues", !string.IsNullOrEmpty(m.RouteValues) ? m.RouteValues : string.Empty);
                sqlParameters[5]  = new SqlParameter("pTabOrder", m.TabOrder.GetValueOrDefault());
                sqlParameters[6]  = new SqlParameter("pTabImageUrl", !string.IsNullOrEmpty(m.TabImageUrl) ? m.TabImageUrl : string.Empty);
                sqlParameters[7]  = new SqlParameter("pParentTabId", m.ParentTabId);
                sqlParameters[8]  = new SqlParameter("pIsActive", m.IsActive);
                sqlParameters[9]  = new SqlParameter("pUserId", userId);
                sqlParameters[10] = new SqlParameter("pCurrentDate", currentDate);
                sqlParameters[11] = new SqlParameter("pRoleId", roleId);

                using (var r = _context.MultiResultSetSqlQuery(StoredProcedures.SprocSaveTab.ToString(), parameters: sqlParameters, isCompiled: false))
                {
                    result.ExecutionStatus = r.SingleResultSetFor <int>();
                    if (result.ExecutionStatus > 0)
                    {
                        result.AllTabs    = r.GetResultWithJson <TabsCustomModel>(JsonResultsArray.Tabs.ToString());
                        result.TabsByRole = r.GetResultWithJson <Tabs>(JsonResultsArray.Tabs.ToString());
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }