/// <summary>
    /// Fill up client drop down list
    /// </summary>
    private void FillClientDropmDownList()
    {
        try
        {
            //ClientGateway ClientGatewayObject = new ClientGateway();
            //clientNameDropDownList.DataSource = ClientGatewayObject.GetAllClient();

            ClientGateway ClientGatewayObject = new ClientGateway();
            clientNameDropDownList.DataSource     = ClientGatewayObject.GetClientTable();
            clientNameDropDownList.DataTextField  = "client_CompanyName";
            clientNameDropDownList.DataValueField = "client_ID";
            clientNameDropDownList.DataBind();

            //if (ClientGatewayObject.GetAllClient().Count == 0)
            if (ClientGatewayObject.GetClientTable().Rows.Count == 0)
            {
                errorLabel.Text = "No client is created.";
            }
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
    }
    /// <summary>
    /// Fills client droupdownlist
    /// </summary>
    private void FillClientIdDropDownList()
    {
        try
        {
            ClientGateway ClientGatewayObject = new ClientGateway();
            clientIdDropDownList.DataSource     = ClientGatewayObject.GetClientTable();
            clientIdDropDownList.DataTextField  = "client_ID";
            clientIdDropDownList.DataValueField = "client_CompanyName";
            clientIdDropDownList.DataBind();

            if (ClientGatewayObject.GetClientTable().Rows.Count == 0)
            {
                errorLabel.Text = "No client is created yet. Can't edit client information";
            }
        }
        catch (SqlException sqlExceptionObj)
        {
            errorLabel.Text = sqlExceptionObj.Message;
        }
        catch (Exception exceptionObj)
        {
            errorLabel.Text = exceptionObj.Message;
        }
    }
예제 #3
0
 /// <summary>
 /// Loads all clients information in dataGridView
 /// </summary>
 private void LoadClientData()
 {
     try
     {
         ClientGateway ClientGatewayObject = new ClientGateway();
         clientGridView.DataSource = ClientGatewayObject.GetClientTable();
         clientGridView.DataBind();
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }
 /// <summary>
 /// Fills up clientNameDropDownList DDL
 /// </summary>
 private void FillClientDropmDownList()
 {
     try
     {
         ClientGateway ClientGatewayObject = new ClientGateway();
         clientNameDropDownList.DataSource     = ClientGatewayObject.GetClientTable();
         clientNameDropDownList.DataTextField  = "client_CompanyName";
         clientNameDropDownList.DataValueField = "client_ID";
         clientNameDropDownList.DataBind();
     }
     catch (SqlException sqlExceptionObj)
     {
         errorLabel.Text = sqlExceptionObj.Message;
     }
     catch (Exception exceptionObj)
     {
         errorLabel.Text = exceptionObj.Message;
     }
 }