예제 #1
0
    private void loadGridData()
    {
        DataTable dt = null;

        if (_refreshData || Session["AllocationGroup"] == null)
        {
            dt = MasterData.AllocationGroup_Get();
            HttpContext.Current.Session["AllocationGroup"] = dt;
        }
        else
        {
            dt = (DataTable)HttpContext.Current.Session["AllocationGroup"];
        }

        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();

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

        if (_export && dt != null && CanView)
        {
            exportExcel(dt);
        }


        grdMD.DataSource = dt;
        grdMD.DataBind();
    }
예제 #2
0
    private void loadGridDataAA()
    {
        _dtSystem = MasterData.SystemList_Get(includeArchive: false, cv: cvValue);
        if (_dtSystem != null && _qfSystemID != 0)
        {
            _dtSystem.DefaultView.RowFilter = string.Format(" WTS_SYSTEMID IN (0, {0}) ", _qfSystemID.ToString());
            _dtSystem = _dtSystem.DefaultView.ToTable();
        }

        _dtALLOCATION = MasterData.WorkAreaList_Get(includeArchive: false, cv: cvValue);
        if (_dtALLOCATION != null && _qfWorkAreaID != 0)
        {
            _dtALLOCATION.DefaultView.RowFilter = string.Format(" ALLOCATIONID = {0} ", _qfALLOCATIONID.ToString());
            _dtALLOCATION = _dtALLOCATION.DefaultView.ToTable();
        }

        _dtAllocationGroup = MasterData.AllocationGroup_Get();

        DataTable dt = MasterData.WorkArea_SystemList_Get(workAreaID: this._qfALLOCATIONID, systemID: this._qfSystemID, cv: cvValue);

        if (dt != null)
        {
            //if (_qfSystemID > 0)
            //{
            //    dt.Columns["WTS_SYSTEM"].SetOrdinal(dt.Columns["ALLOCATIONID"].Ordinal);
            //    dt.Columns["WTS_SYSTEMID"].SetOrdinal(dt.Columns["WTS_SYSTEM"].Ordinal);
            //    dt.AcceptChanges();
            //}

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

            ListItem item = null;
            foreach (DataRow row in _dtALLOCATION.Rows)
            {
                item = ddlQF.Items.FindByValue(row["ALLOCATIONID"].ToString());
                if (item == null)
                {
                    ddlQF.Items.Add(new ListItem(row["ALLOCATION"].ToString(), row["ALLOCATIONID"].ToString()));
                }
            }
            item = ddlQF.Items.FindByValue(_qfWorkAreaID.ToString());
            if (item != null)
            {
                item.Selected = true;
            }

            foreach (DataRow row in _dtSystem.Rows)
            {
                item = ddlQF_System.Items.FindByValue(row["WTS_SYSTEMID"].ToString());
                if (item == null)
                {
                    ddlQF_System.Items.Add(new ListItem(row["WTS_SYSTEM"].ToString(), row["WTS_SYSTEMID"].ToString()));
                }
            }
            item = ddlQF_System.Items.FindByValue(_qfSystemID.ToString());
            if (item != null)
            {
                item.Selected = true;
            }

            InitializeColumnDataAA(ref dt);
            dt.AcceptChanges();
        }

        if (_qfWorkAreaID != 0 && dt != null && dt.Rows.Count > 0)
        {
            dt.DefaultView.RowFilter = string.Format(" ALLOCATIONID =  {0} OR (ALLOCATIONID = 0 AND WTS_SYSTEMID = 0) ", _qfWorkAreaID.ToString());
            dt = dt.DefaultView.ToTable();
        }
        if (_qfSystemID != 0 && dt != null && dt.Rows.Count > 0)
        {
            dt.DefaultView.RowFilter = string.Format(" WTS_SYSTEMID =  {0} OR (WTS_SYSTEMID = 0 AND ALLOCATIONID = 0) OR WTS_SYSTEMID IS NULL ", _qfSystemID.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();

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