Ejemplo n.º 1
0
    protected void SetupMultiHeader(DataTable dt)
    {
        iti_Tools_Sharp.DynamicHeader dynamicHeader = new iti_Tools_Sharp.DynamicHeader();
        //If you want to start with the original header
        //copy the Columns of the dt into the dynamic header
        //else you can just create the rows you want to add
        iti_Tools_Sharp.DynamicHeaderRow firstHeaderRow = new iti_Tools_Sharp.DynamicHeaderRow();
        dynamicHeader.Rows.Add(firstHeaderRow);
        firstHeaderRow.CssClass = "metricsHeader";

        iti_Tools_Sharp.DynamicHeaderRow secondHeaderRow = new iti_Tools_Sharp.DynamicHeaderRow();
        dynamicHeader.Rows.Add(secondHeaderRow);
        secondHeaderRow.CssClass = "metricsHeader"; //"metricsSubHeader";

        for (int i = 0; i < dt.Columns.Count; i++)
        {
            iti_Tools_Sharp.DynamicHeaderCell cell = new iti_Tools_Sharp.DynamicHeaderCell();
            cell.Text = dt.Columns[i].ColumnName;
            firstHeaderRow.Cells.Add(cell);
            cell.CssClass = "metricsHeader";

            cell      = new iti_Tools_Sharp.DynamicHeaderCell();
            cell.Text = dt.Columns[i].ColumnName;
            secondHeaderRow.Cells.Add(cell);
            cell.CssClass            = "metricsHeader"; //"metricsSubHeader";
            cell.Style["border-top"] = "1px solid grey";
        }

        grdMD.DynamicHeader = dynamicHeader;
    }
    private void loadGridData()
    {
        _dtUser = UserManagement.LoadUserList(organizationId: 0, excludeDeveloper: false, loadArchived: false, userNameSearch: "");
        Page.ClientScript.RegisterArrayDeclaration("_userList", JsonConvert.SerializeObject(_dtUser, Newtonsoft.Json.Formatting.None));
        _dtAllocation_Unused = MasterData.Allocation_Get_All_Unused();
        Page.ClientScript.RegisterArrayDeclaration("_Allocation_Unused", JsonConvert.SerializeObject(_dtAllocation_Unused, Newtonsoft.Json.Formatting.None));
        DataTable dt = null;

        if (_refreshData || Session["AllocationGroup_Assignment"] == null)
        {
            dt = MasterData.AllocationGroup_Assignment_Get(this._qfWorkAreaID);
            HttpContext.Current.Session["AllocationGroup_Assignment"] = dt;
        }
        else
        {
            dt = (DataTable)HttpContext.Current.Session["AllocationGroup_Assignment"];
        }

        if (dt != null)
        {
            this.DCC = dt.Columns;
            Page.ClientScript.RegisterArrayDeclaration("_dcc", JsonConvert.SerializeObject(DCC, Newtonsoft.Json.Formatting.None));
            spanRowCount.InnerText = dt.Rows.Count.ToString();


            InitializeColumnData(ref dt);
            dt.AcceptChanges();
            iti_Tools_Sharp.DynamicHeader head = WTSUtility.CreateGridMultiHeader(dt);
            if (head != null)
            {
                grdMD.DynamicHeader = head;
            }

            int count = dt.Rows.Count;
            count = count > 0 ? count - 1 : count;
            spanRowCount.InnerText = count.ToString();
        }

        grdMD.DataSource = dt;
        grdMD.DataBind();
    }
Ejemplo n.º 3
0
    private void loadGridData(bool bind = true)
	{
        _dtResources = MasterData.WTS_Resource_Get(includeArchive: false);


		_dtUser = UserManagement.LoadUserList(organizationId: 0, excludeDeveloper: false, loadArchived: false, userNameSearch: "");
		Page.ClientScript.RegisterArrayDeclaration("_userList", JsonConvert.SerializeObject(_dtUser, Newtonsoft.Json.Formatting.None));
        DataTable dt = null, dtTemp = null;
        DataSet ds = null;
        if (_refreshData || Session["dtMD_AllocationDS"] == null)
        {
            ds = MasterData.AllocationList_Get(includeArchive: true);
            if (ds != null && ds.Tables.Count > 0)
            {
                if (ds.Tables.Contains("Allocation"))
                {
                    dt = ds.Tables["Allocation"];
                    HttpContext.Current.Session["dtMD_AllocationDS"] = ds;
                }
            }

        }
        else
        {
            ds = (DataSet) HttpContext.Current.Session["dtMD_AllocationDS"];
            if (ds.Tables.Contains("Allocation"))
            {
                dt = ds.Tables["Allocation"];
            }
        }

        if (dt != null)
		{
            // 12902 - 3:
            dtTemp = dt.DefaultView.ToTable(true, new string[] { "AllocationGroupID", "AllocationGroup", "AllocationCategoryID", "AllocationCategory" });
            dtTemp.DefaultView.RowFilter = "AllocationGroupID IS NOT NULL";

            //dtTemp = dt.DefaultView.ToTable(true, new string[] { "AllocationCategoryID", "AllocationCategory" });
            //dtTemp.DefaultView.RowFilter = "AllocationCategoryID IS NOT NULL";
            dtTemp = dtTemp.DefaultView.ToTable();

			this.DCC = dt.Columns;
			Page.ClientScript.RegisterArrayDeclaration("_dcc", JsonConvert.SerializeObject(DCC, Newtonsoft.Json.Formatting.None));

			if (ds.Tables.Contains("Category"))
			{
				_dtCat = ds.Tables["Category"];
				Page.ClientScript.RegisterArrayDeclaration("_AllocationCategoryList", JsonConvert.SerializeObject(_dtCat, Newtonsoft.Json.Formatting.None));
			}
            //12092 - 3:
            if (ds.Tables.Contains("Group"))
            {
                _dtGroup = ds.Tables["Group"];
                Page.ClientScript.RegisterArrayDeclaration("_AllocationGroupList", JsonConvert.SerializeObject(_dtGroup, Newtonsoft.Json.Formatting.None));
            }

            ListItem item = null;
			foreach (DataRow row in dtTemp.Rows)
			{
				item = ddlQF.Items.FindByValue(row["AllocationCategoryID"].ToString());
				if (item == null)
				{
					ddlQF.Items.Add(new ListItem(row["AllocationCategory"].ToString(), row["AllocationCategoryID"].ToString()));
				}

                // 12902 - 3:
                item = ddlQFGroup.Items.FindByValue(row["AllocationGroupID"].ToString());
                if (item == null)
                {
                    ddlQFGroup.Items.Add(new ListItem(row["AllocationGroup"].ToString(), row["AllocationGroupID"].ToString()));
                }

            }

            // 12092 - 3 - Remarked out:
   //         item = ddlQF.Items.FindByValue(_qfAllocationCategoryID.ToString());
			//if (item != null)
			//{
			//	item.Selected = true;
			//}

            // 12092 - 3:
            item = ddlQFGroup.Items.FindByValue(_qfAllocationGroupID.ToString());
            if (item != null)
            {
                item.Selected = true;
            }

            InitializeColumnData(ref dt);
			dt.AcceptChanges();

            iti_Tools_Sharp.DynamicHeader head = WTSUtility.CreateGridMultiHeader(dt);
			if (head != null)
			{
				grdMD.DynamicHeader = head;
			}
		}

        // 12902 - 3:
		if (_qfAllocationGroupID != 0 && dt != null && dt.Rows.Count > 0)
		{
			dt.DefaultView.RowFilter = string.Format(" AllocationGroupID =  {0}", _qfAllocationGroupID.ToString());
			dt = dt.DefaultView.ToTable();
		}
        //if (_qfAllocationCategoryID != 0 && dt != null && dt.Rows.Count > 0)
        //{
        //    dt.DefaultView.RowFilter = string.Format(" AllocationCategoryID =  {0}", _qfAllocationCategoryID.ToString());
        //    dt = dt.DefaultView.ToTable();
        //}

        int count = dt.Rows.Count;
		count = count > 0 ? count - 1 : count; //need to subtract the empty row
		spanRowCount.InnerText = count.ToString();

        if (_export)
        {
            exportExcel(dt);
        }

        grdMD.DataSource = dt;
		if (bind) grdMD.DataBind();
	}