private void SaveStatus()
 {
     try
     {
         int result = 0;
         objStatusLookUp = new StatusLookupDal();
         LookupBDto objStatus = new LookupBDto();
         objLookUpBDto = new LookupBDto();
         objLookUpBDto.LookupName =txtStatusName.Text;
         objLookUpBDto.UserProfile = objAuthorizationBDto.UserProfile;
         result = objStatusLookUp.InsertStatus(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; }
     }
 }
 /// <summary>
 /// Bind StatusLookUp grid
 /// </summary>
 private void BindGrid()
 {
    objStatusLookUp = new StatusLookupDal();
    DataSet dsStatus = objStatusLookUp.GetStatusName("");
    radgrdStatus.DataSource = dsStatus;
    radgrdStatus.DataBind();
    ViewState[vsStatus] = dsStatus;
 }
        /// <summary>
        /// Action bar's save button event which saves grid data by xml.
        /// </summary>
        /// <param name="sender">The object which raised the event</param>
        /// <param name="e">The event listener object</param>
        protected void acbStatus_SaveClick(object sender, EventArgs e)
        {
            
            try
            {
                int result = 0;
                objStatusLookUp = new StatusLookupDal();
                switch (acbStatus.SaveButton.CommandName)
                {
                    case "Save":
                        SaveStatus();
                        pnlAddNewMode.Visible = false;
                        acbStatus.EditableMode = false;
                        BindGrid();

                        break;
                    case "Update":
                        String xmlData = GenerateXmlString(radgrdStatus);
                        result = objStatusLookUp.UpdateStatus(xmlData);
                        if (result == 1)
                        {
                            acbStatus.DefaultMode = true;
                            Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Update].ToString());
                            Master.MessageCssClass = "successMessage";

                            if (ViewState[PageConstants.vsItemIndexes] != null)
                                htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];
                            for (int i = 0; i < htItemIndex.Count; i++)
                                radgrdStatus.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;
                }

                Reset();
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
        protected void acbStatus_SearchClick(object sender, EventArgs e)
        {
            try
            {
                objStatusLookUp = new StatusLookupDal();
                DataSet dsStatus = objStatusLookUp.GetStatusName(acbStatus.SearchTextBox.Text);
                radgrdStatus.DataSource = dsStatus;
                radgrdStatus.DataBind();
                ViewState[vsStatus] = dsStatus;
                Reset();
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }

        }
        /// <summary>
        /// Action bar's delete button event which delete records physically from database.
        /// </summary>
        /// <param name="sender">The object which raised the event</param>
        /// <param name="e">The event listener object</param>
        protected void acbStatus_DeleteClick(object sender, EventArgs e)
        {
            try
            {
                StringBuilder statusId = 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 lblStatusId = (Label)radgrdStatus.Items[i].FindControl("lblGrdStatusIdItem");
                        if (lblStatusId != null)
                        {
                            statusId.Append(lblStatusId.Text + ",");
                        }
                    }
                }
                objStatusLookUp = new StatusLookupDal();
                String statusNameId = statusId.ToString().TrimEnd(',');
                result = objStatusLookUp.DeleteStatus(statusNameId);

                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; }
            }
        }