/// <summary> /// Bind Cust Code grid /// </summary> private void BindGrid() { objCustomerCodeLookup = new CustomerCodeLookupDal(); DataSet dsCustCode = objCustomerCodeLookup.GetCustomerCode(""); radgrdcode.DataSource = dsCustCode; radgrdcode.DataBind(); ViewState[vsCustCode] = dsCustCode; }
protected void acbCustCode_SearchClick(object sender, EventArgs e) { try { acbCustCode.SearchTextBox.Focus(); objCustomerCodeLookup = new CustomerCodeLookupDal(); DataSet dsCode = objCustomerCodeLookup.GetCustomerCode(acbCustCode.SearchTextBox.Text); radgrdcode.DataSource = dsCode; radgrdcode.DataBind(); ViewState[vsCustCode] = dsCode; Reset(); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }
protected void acbCustCode_SaveClick(object sender, EventArgs e) { try { int result = 0; objCustomerCodeLookup = new CustomerCodeLookupDal(); switch (acbCustCode.SaveButton.CommandName) { case "Save": Save(); pnlAddNewMode.Visible = false; acbCustCode.EditableMode = false; break; case "Update": String xmlData = GenerateXmlString(radgrdcode); result = objCustomerCodeLookup.UpdateCustomerCode(xmlData); if (result == 1) { acbCustCode.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++) radgrdcode.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; } objCustomerCodeLookup = new CustomerCodeLookupDal(); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }
protected void acbCustCode_DeleteClick(object sender, EventArgs e) { try { StringBuilder CodeId = 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 lblCodeId = (Label)radgrdcode.Items[i].FindControl("lblgrdCodeIdItem"); if (lblCodeId != null) { CodeId.Append(lblCodeId.Text + ","); } } } objCustomerCodeLookup = new CustomerCodeLookupDal(); String CustCodeId = CodeId.ToString().TrimEnd(','); result = objCustomerCodeLookup.DeleteCustomerCode(CustCodeId); 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; objCustomerCodeLookup = new CustomerCodeLookupDal(); objLookupBDto = new LookupBDto(); objLookupBDto.LookupName = txtCodeName.Text; objLookupBDto.Description = txtCodeDesc.Text; objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile; result = objCustomerCodeLookup.InsertCustomerCode(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; } } }