private void InitializeQuery() { List <DropItem> listQueryAccountType = new List <DropItem>(); List <DropItem> listBank = new List <DropItem>(); List <DropItem> listUser = new List <DropItem>(); UserCollection userColl = new UserCollection(); DropItem dr = new DropItem { ValueField = "", DisplayField = " " }; listQueryAccountType.Add(dr); listQueryAccountType.AddRange(StaticRescourse.GetAccountType()); this.dropCardQueryAccountType.DataSource = listQueryAccountType; Helper.SetDropDownList(this.dropCardQueryAccountType); this.dropCardQueryAccountType.SelectedValue = string.Empty; listBank.Add(dr); listBank.AddRange(StaticRescourse.GetBank()); this.dropCardQueryBank.DataSource = listBank; Helper.SetDropDownList(this.dropCardQueryBank); this.dropCardQueryBank.SelectedValue = string.Empty; userColl = UserMethods.GetUser(new List <QueryElement>()); if (userColl != null && userColl.Count > 0) { listUser.Add(dr); foreach (var userInfo in userColl) { listUser.Add(new DropItem { ValueField = userInfo.Id.ToString(), DisplayField = userInfo.Name }); } this.dropCardQueryUser.DataSource = listUser; } this.dropCardQueryUser.DataSource = listUser; Helper.SetDropDownList(this.dropCardQueryUser); this.dropCardQueryUser.SelectedValue = string.Empty; this.txtCardQueryCardNumber.Text = string.Empty; this.txtCardQueryBankName.Text = string.Empty; this.txtCardQueryBOpenDate.Text = string.Empty; this.txtCardQueryEOpenDate.Text = string.Empty; }
private void InitializeEdit(CardInfo info) { List <DropItem> listOwner = new List <DropItem>(); List <DropItem> listuser = new List <DropItem>(); listuser.Add(new DropItem { ValueField = "", DisplayField = " " }); this.dropAddBank.DataSource = StaticRescourse.GetBank(); Helper.SetDropDownList(this.dropAddBank); this.dropAddBank.SelectedValue = info.BankId.ToString(); UserCollection userColl = new UserCollection(); //userColl = UserMethods.GetUser(null, null); if (userColl != null && userColl.Count > 0) { foreach (var userInfo in userColl) { listOwner.Add(new DropItem { ValueField = userInfo.Id.ToString(), DisplayField = userInfo.Name }); listuser.Add(new DropItem { ValueField = userInfo.Id.ToString(), DisplayField = userInfo.Name }); } } this.dropAddCardOwner.DataSource = listOwner; Helper.SetDropDownList(this.dropAddCardOwner); this.dropAddCardOwner.SelectedValue = info.OwnerId.ToString(); this.dropAddCardUser.DataSource = listuser; Helper.SetDropDownList(this.dropAddCardUser); this.dropAddCardUser.SelectedValue = info.UserId > 0?info.UserId.ToString():string.Empty; this.txtAddCardOpenDate.Text = !string.IsNullOrEmpty(info.OpenDate.ToString("yyyy-MM-dd")) ? info.OpenDate.ToString("yyyy-MM-dd") : string.Empty; this.dropCardAddAccountType.DataSource = StaticRescourse.GetAccountType(); Helper.SetDropDownList(this.dropCardAddAccountType); this.dropCardAddAccountType.SelectedValue = info.AccountType.ToString(); this.txtAddCardNumber.Text = info.CardNumber; this.txtAddBankName.Text = !string.IsNullOrEmpty(info.BankName) ? info.BankName : string.Empty; this.txtCardAddContent.Text = !string.IsNullOrEmpty(info.Content) ? info.Content : string.Empty; }
private void Initialize() { List <DropItem> listOwner = new List <DropItem>(); List <DropItem> listuser = new List <DropItem>(); listuser.Add(new DropItem { ValueField = "", DisplayField = " " }); this.dropAddBank.DataSource = StaticRescourse.GetBank(); Helper.SetDropDownList(this.dropAddBank); this.dropAddBank.SelectedIndex = 0; UserCollection userColl = new UserCollection(); //userColl = UserMethods.GetUser(null, null); if (userColl != null && userColl.Count > 0) { foreach (var userInfo in userColl) { listOwner.Add(new DropItem { ValueField = userInfo.Id.ToString(), DisplayField = userInfo.Name }); listuser.Add(new DropItem { ValueField = userInfo.Id.ToString(), DisplayField = userInfo.Name }); } } this.dropAddCardOwner.DataSource = listOwner; Helper.SetDropDownList(this.dropAddCardOwner); this.dropAddCardOwner.SelectedIndex = 0; this.dropAddCardUser.DataSource = listuser; Helper.SetDropDownList(this.dropAddCardUser); this.dropAddCardUser.SelectedIndex = 0; this.txtAddCardOpenDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.dropCardAddAccountType.DataSource = StaticRescourse.GetAccountType(); Helper.SetDropDownList(this.dropCardAddAccountType); this.dropCardAddAccountType.SelectedIndex = 0; }
private void Initialize(CardInfo info) { List <DropItem> listUser = new List <DropItem>(); UserCollection userColl = new UserCollection(); UserInfo loginInfo = new UserInfo(); if (Session["UserCode"] != null) { loginInfo = UserMethods.GetUserByCode(Session["UserCode"].ToString()); } userColl = UserMethods.GetUser(new List <QueryElement>()); if (userColl != null && userColl.Count > 0) { foreach (var userInfo in userColl) { listUser.Add(new DropItem { ValueField = userInfo.Id.ToString(), DisplayField = userInfo.Name }); } } this.dropAddBank.DataSource = StaticRescourse.GetBank(); Helper.SetDropDownList(this.dropAddBank); this.dropAddCardOwner.DataSource = listUser; Helper.SetDropDownList(this.dropAddCardOwner); this.dropAddCardUser.DataSource = listUser; Helper.SetDropDownList(this.dropAddCardUser); this.dropCardAddAccountType.DataSource = StaticRescourse.GetAccountType(); Helper.SetDropDownList(this.dropCardAddAccountType); if (info.Id > 0) { string str = info.OpenDate.ToString("yyyy-MM-dd"); int date = Convert.ToInt32(str.Substring(0, 4) + str.Substring(5, 2) + str.Substring(8, 2)); this.dropAddBank.SelectedValue = info.BankId.ToString(); this.dropAddCardOwner.SelectedValue = info.OwnerId.ToString(); this.dropAddCardUser.SelectedValue = info.UserId.ToString(); this.dropCardAddAccountType.SelectedValue = info.AccountType.ToString(); this.txtAddCardNumber.Text = info.CardNumber; this.txtCardAddContent.Text = !string.IsNullOrEmpty(info.Content) ? info.Content : string.Empty; this.txtAddBankName.Text = !string.IsNullOrEmpty(info.BankName) ? info.BankName : string.Empty; this.txtAddCardOpenDate.Text = date > 20000101 ? info.OpenDate.ToString("yyyy-MM-dd") : string.Empty; this.txtAddCardNumber.Enabled = false; this.dropAddBank.Enabled = false; this.dropCardAddAccountType.Enabled = false; } else { this.txtAddCardNumber.Enabled = true; this.dropAddBank.Enabled = true; this.dropCardAddAccountType.Enabled = true; this.dropAddBank.SelectedIndex = 0; this.dropCardAddAccountType.SelectedIndex = 0; //this.dropAddCardOwner.SelectedValue = loginInfo.Id.ToString(); //this.dropAddCardUser.SelectedValue = loginInfo.Id.ToString(); this.txtAddCardOpenDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); } }