/// <summary>
        /// Bind Designation grid
        /// </summary>

        private void BindGrid()
        {
            objDesignationLookup = new DesignationLookupDal();
            DataSet dsDesignation = objDesignationLookup.GetDesignation("");
            radgrdDesignation.DataSource = dsDesignation;
            radgrdDesignation.DataBind();
            ViewState[vsDesignation] = dsDesignation;

        }
        protected void acbDesignation_SearchClick(object sender, EventArgs e)
        {
            try
            {
                
                objDesignationLookup = new DesignationLookupDal();
                DataSet dsDesignation = objDesignationLookup.GetDesignation(acbDesignation.SearchTextBox.Text);
                radgrdDesignation.DataSource = dsDesignation;
                radgrdDesignation.DataBind();
                ViewState[vsDesignation] = dsDesignation;
                Reset();

            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
        protected void acbDesignation_SaveClick(object sender, EventArgs e)
        {

            try
            {
                int result = 0;
                objDesignationLookup = new DesignationLookupDal();
                switch (acbDesignation.SaveButton.CommandName)
                {
                    case "Save":
                        Save();
                        pnlAddNewMode.Visible = false;
                        acbDesignation.EditableMode = false;

                        break;

                    case "Update":
                        String xmlData = GenerateXmlString(radgrdDesignation);
                        result = objDesignationLookup.UpdateDesignation(xmlData);
                        if (result == 1)
                        {
                            acbDesignation.DefaultMode = true;
                            Master.DisplayMessage(ConfigurationSettings.AppSettings["UpdateRecord"].ToString());
                            Master.MessageCssClass = "successMessage";

                            if (ViewState[PageConstants.vsItemIndexes] != null)
                                htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];
                            for (int i = 0; i < htItemIndex.Count; i++)
                                radgrdDesignation.Items[Convert.ToInt32(htItemIndex[i])].Edit = false;
                            bisEdit = false;
                            ViewState[PageConstants.vsItemIndexes] = null;
                            BindGrid();
                        }
                        else
                        {
                            Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Update].ToString());
                            Master.MessageCssClass = "errorMessage";
                        }
                        break;
                }
                objDesignationLookup = new DesignationLookupDal();

            }


            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
        protected void acbDesignation_DeleteClick(object sender, EventArgs e)
        {
            try
            {
                StringBuilder DesignationId = new StringBuilder();
                int result = 0;
                if (ViewState[PageConstants.vsItemIndexes] != null)
                    htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];

                if (htItemIndex != null)
                {
                    foreach (int i in htItemIndex.Values)
                    {

                        Label lblDesignationId = (Label)radgrdDesignation.Items[i].FindControl("lblgrdDesignationIdItem");
                        if (lblDesignationId != null)
                        {
                            DesignationId.Append(lblDesignationId.Text + ",");
                        }
                    }
                }

                objDesignationLookup = new DesignationLookupDal();
                String DesigId = DesignationId.ToString().TrimEnd(',');
                result = objDesignationLookup.DeleteDesignation(DesigId);


                if (result == 1)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Delete].ToString());
                    Master.MessageCssClass = "successMessage";
                    ViewState[PageConstants.vsItemIndexes] = null;
                    BindGrid();
                }
                else if (result == 547)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Delete].ToString());
                    Master.MessageCssClass = "errorMessage";
                }
            }

            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
 private void Save()
 {
     try
     {
         int result = 0;
         objDesignationLookup = new DesignationLookupDal();
         objLookupBDto = new LookupBDto();
         objLookupBDto.LookupName = txtDesignationDesc.Text;
         objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile;
         result = objDesignationLookup.InsertDesignation(objLookupBDto);
         if (result >= 1)
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
             Master.MessageCssClass = "successMessage";
         }
         else
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
             Master.MessageCssClass = "errorMessage";
         }
         BindGrid();
         Reset();
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         { throw ex; }
     }
 }