Example #1
0
 public FrmUserDetail()
 {
     reciever = new UserReciever();
     helper   = new DataHelper();
     InitializeComponent();
     Configuration();
 }
Example #2
0
        private void FrmAddEditUser_Load(object sender, EventArgs e)
        {
            reciever = new UserReciever();
            // Fill Combo box
            Helpers.DataHelper helper = new Helpers.DataHelper();
            var dataList = GetGroup().Select(x => new DropDown()
            {
                Name = x.GroupName, Value = x.GroupId.ToString()
            }).ToList();

            dataList.Insert(0, new DropDown()
            {
                Name = "-- Select --", Value = (0).ToString()
            });
            helper.FillCombo(cmbGroupType, dataList);
            if (_model != null)
            {
                cmbGroupType.SelectedIndex = dataList.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.GroupId.ToString()).Select(x => x.index).FirstOrDefault();
                txtUserName.Text           = _model.UserName;
                txtPassword.Text           = _model.Password;
                txtConfirmPassword.Text    = _model.Password;
            }
            else
            {
                _model = new UserModel();
                cmbGroupType.SelectedIndex = 0;
            }
        }