protected void acbOutputCheckList_SaveClick(object sender, EventArgs e) { try { int result = 0; objAddressTypeLookup = new AddressTypeLookupDal(); switch (acbOutputCheckList.SaveButton.CommandName) { case "Save": Save(); pnlAddNewMode.Visible = false; acbOutputCheckList.EditableMode = false; break; case "Update": try { objAddressTypeLookup = new AddressTypeLookupDal(); objLookupBDto = new LookupBDto(); if (ViewState[PageConstants.vsItemIndexes] != null) { htItemIndex = (Hashtable)(ViewState[PageConstants.vsItemIndexes]); } int OutputCheckListId = 0; for (int i = 0; i < htItemIndex.Count; i++) { objAuthorizationBDto = new AuthorizationBDto(); objLookupBDto = new LookupBDto(); Label lblgrdOutputCheckList = (Label)radgrdOutputCheckList.Items[Convert.ToInt32(htItemIndex[i])].FindControl("lblgrdOutputCheckListEdit"); TextBox txtgrdOutputCheckList = (TextBox)radgrdOutputCheckList.Items[Convert.ToInt32(htItemIndex[i])].FindControl("txtgrdOutputCheckList"); OutputCheckListId = int.Parse(lblgrdOutputCheckList.Text); objAddressTypeLookup = new AddressTypeLookupDal(); objLookupBDto = new LookupBDto(); objLookupBDto.LookupName = txtgrdOutputCheckList.Text; objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile; objLookupBDto.LookupId = OutputCheckListId; result = objAddressTypeLookup.UpdateOutputCheckList(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) { } result = objAddressTypeLookup.UpdateOutputCheckList(objLookupBDto); if (result == 1) { acbOutputCheckList.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++) radgrdOutputCheckList.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; } objAddressTypeLookup = new AddressTypeLookupDal(); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }
private void Update() { try { int result = 0; objAddressTypeLookup = new AddressTypeLookupDal(); objLookupBDto = new LookupBDto(); objLookupBDto.LookupName = txtOutputCheckListName.Text; objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile; objLookupBDto.LookupId = 0; string CityName = txtOutputCheckListName.Text; Int32 modifyBy = Convert.ToInt32(objAuthorizationBDto.UserProfile); result = objAddressTypeLookup.UpdateOutputCheckList(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; } } }