Exemplo n.º 1
0
    protected void _grdScheme_ItemBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
        {
            string _status = e.Item.Cells[1].Text;
            DataSet _ds = new DataSet();
            if (_status == "True")
            {
                ((CheckBox)e.Item.FindControl("_chkDefault")).Checked = true;
            }

            ProcessScheme _procSchm = new ProcessScheme();
            try
            {

                _procSchm.ID = int.Parse(((Label)e.Item.FindControl("lblSchemeID")).Text);
                _procSchm.selectSchemeUsers();
                _ds = _procSchm.Ds;

                ((Label)e.Item.FindControl("_lblUserCount")).Text = _ds.Tables[0].Rows[0]["UserCount"].ToString();

                _procSchm.selectSchemeUnits();
                _ds = _procSchm.Ds;

                ((Label)e.Item.FindControl("_lblUnitCount")).Text = _ds.Tables[0].Rows[0]["unitCount"].ToString();
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }

            finally
            {
                _procSchm = null;
                _ds = null;

            }

        }

        foreach (GridCommandItem cmdItm in _grdScheme.MasterTableView.GetItems(GridItemType.CommandItem))
           	{
            LinkButton Addbtn = (LinkButton)cmdItm.FindControl("InitInsertButton");
            if (!_isInsert)
            {
              	Addbtn.Visible = false;
              	Button btn = (Button)cmdItm.FindControl("AddNewRecordButton");
              	btn.Visible = false;
            }
            else
            {
                Addbtn.Text = " Add new scheme";
            }
          	}

        foreach (GridColumn col in _grdScheme.MasterTableView.RenderColumns)
        {
            if (col.UniqueName == "EditCommandColumn")
            {
                    if (_isEdit)
                     	col.Visible = true;
                    else
                       	col.Visible = false;
            }

            if (col.UniqueName == "Delete")
            {
                    if (_isDelete)
                     	col.Visible = true;
                    else
                       	col.Visible = false;
            }
        }
        _lblMsg.Text = _message;
    }
Exemplo n.º 2
0
    private void loadScheme()
    {
        try
        {
            ProcessScheme _porcsScheme = new ProcessScheme(AlarmasABC.BLL.InvokeOperations.operations.SELECT);
            _porcsScheme.ComID = 1;
            _porcsScheme.invoke();
            DataSet _ds = new DataSet();
            _ds = _porcsScheme.Ds;

            _grdScheme.DataSource = _ds;
            _grdScheme.DataBind();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message.ToString());
        }
        finally
        {

        }
    }