Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I ve employee role supervisor in employee master page in O&M Cluster when i select a circle and then supervisor should display only those employee ids whose role is supervisor under tat particular circle. for supervisor binding i ve used view in mysql for fetching data. here s the code for binding can anyone help me with this?
C#
private void _bindClusterSupervisor()
{
    try
    {
        int _errorCode = (int)ErrorCodes.NoError;
        string _tblNM = DBStructure.VIEW_GET_ACTIVE_EMPLOYEES;
        FieldNames[] _selFlds = new FieldNames[2];
        _selFlds[0].FieldName = DBStructure.EMPLOYEE_MASTER_ID;
        _selFlds[1].FieldName = DBStructure.EMPLOYEE_MASTER_CODE;

        cndCheck[] _whClause = new cndCheck[2];
        _whClause[0].FieldName = DBStructure.EMPLOYEE_MASTER_ACCOUNT_ID;
        _whClause[0].FieldType = Fieldtypes.Integer;
        _whClause[0].FirstFieldValue = UserGroupID.ToString();
        _whClause[0].ArithmeticOp = ArithmeticOperator.EQUALS;
        _whClause[0].LogicOp = LogicalOperator.AND;

        _whClause[1].FieldName = DBStructure.EMPLOYEE_MASTER_ROLE_ID;
        _whClause[1].FieldType = Fieldtypes.Integer;
        _whClause[1].FirstFieldValue =((int)BasicEmployeeRoles.Supervisor).ToString();
        _whClause[1].ArithmeticOp = ArithmeticOperator.EQUALS;

        sortColumn[] _sortClause = new sortColumn[1];
        _sortClause[0].FieldName = DBStructure.EMPLOYEE_MASTER_CODE;
        _sortClause[0].SortOrder = ColSortOrder.ASCENDING;

            DataSet _dsCircle = _dalAccess.Select(false, _tblNM, true, _selFlds, _whClause, _sortClause, out _errorCode);
            if (_errorCode == (int)ErrorCodes.NoError)
            {
                DataTable _dtUpdated = AddSelectRow(_dsCircle.Tables[0], DBStructure.EMPLOYEE_MASTER_ID, DBStructure.EMPLOYEE_MASTER_CODE);

                this.cmbClusterSupervisor.DataSource = _dtUpdated;
                this.cmbClusterSupervisor.DataTextField = _dtUpdated.Columns[DBStructure.EMPLOYEE_MASTER_CODE].ColumnName.ToString();
                this.cmbClusterSupervisor.DataValueField = _dtUpdated.Columns[DBStructure.EMPLOYEE_MASTER_ID].ColumnName.ToString();
                this.cmbClusterSupervisor.DataBind();

            }
         }
    catch (Exception ex)
    {
        _errorLogger.PrintUnknownError(ex.Message.ToString() + ex.StackTrace, GetModuleName(), GetPageName(), "_bindClusterSupervisor");
    }
}
Posted
Updated 13-May-14 21:51pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900