void LoadCurrency() { List <ATTCurrency> lstCurrency = BLLCurrency.GetCurrencyList(null); Session["Currency"] = lstCurrency; ddlCurrency.DataSource = lstCurrency; ddlCurrency.DataTextField = "CurrencyName"; ddlCurrency.DataValueField = "CurrencyID"; ddlCurrency.DataBind(); }
void LoadCurrency() { try { Session["Currency_CurrencyList"] = BLLCurrency.GetCurrencyList(null); this.lstCurrency.DataSource = (List <ATTCurrency>)Session["Currency_CurrencyList"]; this.lstCurrency.DataTextField = "CurrencyName"; this.lstCurrency.DataValueField = "CurrencyID"; this.lstCurrency.DataBind(); } catch (Exception ex) { this.lblStatus.Text = ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { ATTCurrency currencyObj = new ATTCurrency ( 0, this.txtCurrencyName_Rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, DateTime.Now ); ObjectValidation OV = BLLCurrency.Validate(currencyObj); if (OV.IsValid == false) { this.lblStatus.Text = OV.ErrorMessage; return; } List <ATTCurrency> lstCurr = (List <ATTCurrency>)Session["Currency_CurrencyList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (this.lstCurrency.SelectedIndex < 0) { if (user.MenuList["4,6,1"] == null || user.MenuList["4,6,1"].PAdd == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " add Currency."; return; } Previlege pobj = new Previlege(user.UserName, "4,6,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); BLLCurrency.AddCurrency(currencyObj, pobj); lstCurr.Add(currencyObj); } else { if (user.MenuList["4,6,1"] == null || user.MenuList["4,6,1"].PEdit == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " update Currency."; return; } Previlege pobj = new Previlege(user.UserName, "4,6,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT); currencyObj.CurrencyID = int.Parse(this.lstCurrency.SelectedValue); BLLCurrency.EditCurrency(currencyObj, pobj); lstCurr[this.lstCurrency.SelectedIndex] = currencyObj; } this.lstCurrency.DataSource = lstCurr; this.lstCurrency.DataTextField = "CurrencyName"; this.lstCurrency.DataValueField = "CurrencyID"; this.lstCurrency.DataBind(); this.ClearCurrencyControl(); } catch (Exception ex) { this.lblStatus.Text = ex.Message; } }