Exemplo n.º 1
0
 public void Insert(User user) {
     user.CreatedDate = DateTime.Now;
     user.LastUpdatedDate = DateTime.Now;
     user.Version = 0;
     this.Context.Users.Add(user);
     this.Context.SaveChanges();
 }
Exemplo n.º 2
0
 private void grdPatient_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     this.SelectedUser = (User) this.bdgUser.List[e.RowIndex];
     if (this.SelectedUser == null) return;
     this.DialogResult = DialogResult.Yes;
     this.Close();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChangePassword"/> class.
 /// </summary>
 public ChangePassword(User user)
 {
     InitializeComponent();
     this.User = user;
     this.bdsUser.DataSource = User;
     this.txtUser.Text = User.UserName;
     this._userRepository = new UserRepository();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientRegister"/> class.
        /// </summary>
        public UserRegister(User patient)
        {
            InitializeComponent();
          

            this.User = patient;
            this.bdsUser.DataSource = User;
            this._isAddNew = false;
            this._userRepository = new UserRepository();
        }
Exemplo n.º 5
0
 public void Update(User user) {
     var oldUsr = this.Context.Users.FirstOrDefault(x => x.Id == user.Id);
     if (oldUsr == null) return;
     oldUsr.Name = user.Name;
     oldUsr.UserName = user.UserName;
     oldUsr.Password = user.Password;
     oldUsr.Active = user.Active;
     oldUsr.Role = user.Role;
     oldUsr.ClinicId = user.ClinicId;
     oldUsr.LastUpdatedDate = DateTime.Now;
     oldUsr.Version++;
     this.Context.SaveChanges();
 }
Exemplo n.º 6
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         User user = new User();
         user.Name = this.TxtName.Text;
         user.UserName = this.TxtUserName.Text;
         user.Password = this.TxtPassword.Text;
         user.Active = CboActive.Checked;
         userRepository.Insert(user);
         MessageBox.Show("Inserted");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientRegister"/> class.
        /// </summary>
        public UserRegister(User patient)
        {
            InitializeComponent();
            var roles = new List<Item>()
                            {
                                new Item(Role.Administrator, "System admin"),
                                new Item(Role.Doctor, "Doctor"),
                                new Item(Role.Manager, "Supervisor"),
                                new Item(Role.Pharmacist, "Pharmacist")
                            };
            bdsRole.DataSource = roles;

            this.User = patient;
            this.bdsUser.DataSource = User;
            this._isAddNew = false;
            this._userRepository = new UserRepository();

            this.txtCode.ReadOnly = true;
            this.txtPhone.ReadOnly = true;
        }