void LoadPostingType() { try { List <ATTPostingType> lstPostingTypes = BLLPostingType.GetPostingType(null, null); Session["PostingType"] = lstPostingTypes; this.lstPostingType.DataSource = lstPostingTypes; this.lstPostingType.DataTextField = "POSTINGTYPENAME"; this.lstPostingType.DataValueField = "POSTINGTYPEID"; this.lstPostingType.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
void LoadPostingType() { try { List <ATTPostingType> PostingTypeList = BLLPostingType.GetPostingType(null, "Y"); PostingTypeList.Insert(0, new ATTPostingType(0, "--- छान्नुहोस ---", "")); this.ddlPostingType_rqd.DataSource = PostingTypeList; this.ddlPostingType_rqd.DataTextField = "POSTINGTYPENAME"; this.ddlPostingType_rqd.DataValueField = "POSTINGTYPEID"; this.ddlPostingType_rqd.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
void LoadPostingType() { try { List <ATTPostingType> lst = BLLPostingType.GetPostingType(null, "Y"); if (lst.Count > 0) { lst.Insert(0, new ATTPostingType(0, "--- Select Type ---", "Y")); } this.ddlPostingType.DataSource = lst; this.ddlPostingType.DataTextField = "PostingTypeName"; this.ddlPostingType.DataValueField = "PostingTypeID"; this.ddlPostingType.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
protected void btnSave_Click(object sender, EventArgs e) { List <ATTPostingType> lstPostingTypes = (List <ATTPostingType>)Session["PostingType"]; int intPostingTypeID = 0; string strActive; if (this.lstPostingType.SelectedIndex > -1) { intPostingTypeID = lstPostingTypes[this.lstPostingType.SelectedIndex].PostingTypeID; } strActive = "Y"; ATTPostingType objPostingType; try { objPostingType = new ATTPostingType(intPostingTypeID, this.txtPostingType_Rqd.Text.Trim(), strActive); ObjectValidation OV = BLLPostingType.Validate(objPostingType); if (!OV.IsValid) { this.lblStatusMessage.Text = OV.ErrorMessage; this.programmaticModalPopup.Show(); return; } for (int i = 0; i < lstPostingType.Items.Count; i++) { if (lstPostingType.SelectedIndex != i) { if (lstPostingTypes[i].PostingTypeName.ToLower() == txtPostingType_Rqd.Text.Trim().ToLower()) { this.lblStatusMessage.Text = "Posting Type Already Exists"; this.programmaticModalPopup.Show(); return; } } } BLLPostingType.SavePostingType(objPostingType); if (this.lstPostingType.SelectedIndex == -1) { lstPostingTypes.Add(objPostingType); } else { lstPostingTypes[this.lstPostingType.SelectedIndex].PostingTypeName = this.txtPostingType_Rqd.Text.Trim(); lstPostingTypes[this.lstPostingType.SelectedIndex].Active = strActive; } this.lstPostingType.DataSource = lstPostingTypes; this.lstPostingType.DataBind(); this.txtPostingType_Rqd.Text = ""; this.lstPostingType.SelectedIndex = -1; this.lblStatusMessage.Text = "Posting Type Successfully Saved."; this.programmaticModalPopup.Show(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }