Пример #1
0
        /// <summary>
        /// Bind Qualification grid
        /// </summary>
        private void BindGrid()
        {

            objDepartmentLookup = new DepartmentLookupDal();
            DataSet dsDepartment = objDepartmentLookup.GetDepartment("");
            radgrdDepartment.DataSource = dsDepartment;
            radgrdDepartment.DataBind();
            ViewState[vsDepartment] = dsDepartment;

        }
Пример #2
0
        protected void acbDepartment_SearchClick(object sender, EventArgs e)
        {
            try
            {

                objDepartmentLookup = new DepartmentLookupDal();
                DataSet dsDepartment = objDepartmentLookup.GetDepartment(acbDepartment.SearchTextBox.Text);
                radgrdDepartment.DataSource = dsDepartment;
                radgrdDepartment.DataBind();
                ViewState[vsDepartment] = dsDepartment;
                Reset();
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }

        }
Пример #3
0
        protected void acbDepartment_SaveClick(object sender, EventArgs e)
        {
            try
            {
                int result = 0;
                objDepartmentLookup = new DepartmentLookupDal();
                switch (acbDepartment.SaveButton.CommandName)
                {
                    case "Save":
                        Save();
                        pnlAddNewMode.Visible = false;
                        acbDepartment.EditableMode = false;

                        break;

                    case "Update":
                        String xmlData = GenerateXmlString(radgrdDepartment);
                        result = objDepartmentLookup.UpdateDepartment(xmlData);
                        if (result == 1)
                        {
                            acbDepartment.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++)
                                radgrdDepartment.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;
                }
                objDepartmentLookup = new DepartmentLookupDal();

            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
Пример #4
0
        protected void acbDepartment_DeleteClick(object sender, EventArgs e)
        {
            try
            {
                StringBuilder DepartmentId = 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 lblDepartmentId = (Label)radgrdDepartment.Items[i].FindControl("lblgrdDepartmentIdItem");

                        if (lblDepartmentId != null)
                        {
                            DepartmentId.Append(lblDepartmentId.Text + ",");
                        }
                    }
                }

                objDepartmentLookup = new DepartmentLookupDal();
                String DeptId = DepartmentId.ToString().TrimEnd(',');
                result = objDepartmentLookup.DeleteDepartment(DeptId);


                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; }
            }
        }
Пример #5
0
 private void Save()
 {
     try
     {
         int result = 0;
         objDepartmentLookup = new DepartmentLookupDal();
         objLookupBDto = new LookupBDto();
         objLookupBDto.LookupName = txtDepartmentName.Text;
         objLookupBDto.Description = txtDepartmentDesc.Text;
         objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile;
         result = objDepartmentLookup.InsertDepartment(objLookupBDto);
         if (result >= 1)
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
             Master.MessageCssClass = "successMessage";
             bisEdit = false;
         }
         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; }
     }
 }