protected void btnAssign_Click(object sender, EventArgs e)
        {
            if (DgvRepSearchDetails.Behaviors.Selection.SelectedRows.Count > 0)
            {
                DataTable dt = Util.GetCurrentRepresentative();
                if (dt != null && dt.Rows.Count > 0)
                {
                    lblStatusMessage.Text = "Please remove current representative first.";
                    return;
                }
                //DataRow[] dr = dt.Select(" RepresentativeName = '" + DgvRepSearchDetails.Behaviors.Selection.SelectedRows[0].Items[1].ToString() + "'");
                //if (dr.Length > 0)
                //{
                //    lblStatusMessage.Text = "Selected employee is already a representative";
                //    return;
                //}

                foreach (GridRecord select in DgvRepSearchDetails.Behaviors.Selection.SelectedRows)
                {
                    assign_employeeID = select.Items.GetValue(0).ToString();
                }
                adrCtrl = new AssignDepartmentRepresentativeControl();
                adrCtrl.SelectAssign(Convert.ToInt16(assign_employeeID));
                DgvRepSearchDetails.ClearDataSource();
                FillRepresentativeList();
                drdRepEmployeeList.ClearSelection();
            }
            else
            {
                lblStatusMessage.Text = "Please select the employee to assign.";
            }
        }
        //protected void DgvCurrentDeptRepresentative_RowSelectionChanged(object sender,
        //    Infragistics.Web.UI.GridControls.SelectedRowEventArgs e)
        //{
        //    remove_employeeID = e.CurrentSelectedRows[0].Attributes["EmployeeID"].ToString();
        //}

        //protected void DgvRepSearchDetails_RowSelectionChanged(object sender,
        //  Infragistics.Web.UI.GridControls.SelectedRowEventArgs e)
        //{
        //    assign_employeeID = e.CurrentSelectedRows[0].Attributes["EmployeeID"].ToString();
        //}

        private AssignDepartmentRepresentativeControl GetControl()
        {
            if (adrCtrl == null)
            {
                adrCtrl = new AssignDepartmentRepresentativeControl();
            }
            return(adrCtrl);
        }
 /// <summary>
 /// Loads the AssignDeptRespresentative form
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         FillEmployee();
         StationeryStoreInventorySystemController.Util.PutSession(sessionKey, adrCtrl);
     }
     else
     {
         adrCtrl = (AssignDepartmentRepresentativeControl)StationeryStoreInventorySystemController.Util.GetSession(sessionKey);
     }
     FillRepresentativeList();
 }
 /// <summary>
 /// Fills selected changed employee to datagrid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void drdRepEmployeeList_SelectionChanged(object sender,
                                                    Infragistics.Web.UI.ListControls.DropDownSelectionChangedEventArgs e)
 {
     try
     {
         String selectedEmployee = drdRepEmployeeList.SelectedItem.Text;
         adrCtrl = new AssignDepartmentRepresentativeControl();
         DataTable dtEmployees = adrCtrl.SelectEmployeeName(selectedEmployee);
         DgvRepSearchDetails.DataSource = dtEmployees;
         DgvRepSearchDetails.DataBind();
     }
     catch (Exception ex)
     {
         Logger.WriteErrorLog(ex);
     }
 }
 protected void btnRemove_Click(object sender, EventArgs e)
 {
     if (DgvCurrentDeptRepresentative.Behaviors.Selection.SelectedRows.Count > 0)
     {
         foreach (GridRecord selectedRow in DgvCurrentDeptRepresentative.Behaviors.Selection.SelectedRows)
         {
             remove_employeeID = selectedRow.Items.GetValue(0).ToString();
         }
         adrCtrl = GetControl();
         adrCtrl.SelectRemove(Convert.ToInt16(remove_employeeID));
         FillRepresentativeList();
     }
     else
     {
         lblStatusMessage.Text = "Please select employee to remove.";
     }
 }