Ejemplo n.º 1
0
        private void toolStripButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();

                tblHouse house = new tblHouse();
                house.RegionID  = int.Parse(cboRegion.SelectedValue.ToString());
                house.SubCityID = int.Parse(cboSubCity.SelectedValue.ToString());
                house.WoredaID  = int.Parse(cboWoreda.SelectedValue.ToString());

                house.BlockNumber = txtBlockNumber.Text;
                house.FloorNumber = int.Parse(txtFloorNumber.Text);
                house.HouseNumber = txtHouseNumber.Text;

                house.GovernmentTransferedDate = dtpGovernmentTrasferedDate.Value;
                house.SiteName = txtSiteName.Text;

                entity.tblHouses.Add(house);
                entity.SaveChanges();

                MessageBox.Show("Saved");
            }
            catch (Exception)
            {
                MessageBox.Show("Save Failed");
            }
        }
Ejemplo n.º 2
0
        private void toolStripButtonUpdate_Click(object sender, EventArgs e)
        {
            CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();
            int      houseId  = int.Parse(listViewHouse.Items[listViewHouse.SelectedIndices[0]].SubItems[0].Text);
            tblHouse oldHouse = entity.tblHouses.Where(x => x.ID == houseId).FirstOrDefault();

            tblHouse newHouse = new tblHouse();

            newHouse.ID        = houseId;
            newHouse.RegionID  = int.Parse(cboRegion.SelectedValue.ToString());
            newHouse.SubCityID = int.Parse(cboSubCity.SelectedValue.ToString());
            newHouse.WoredaID  = int.Parse(cboWoreda.SelectedValue.ToString());

            newHouse.BlockNumber = txtBlockNumber.Text;
            newHouse.FloorNumber = int.Parse(txtFloorNumber.Text);
            newHouse.HouseNumber = txtHouseNumber.Text;

            newHouse.GovernmentTransferedDate = dtpGovernmentTrasferedDate.Value;
            newHouse.SiteName = txtSiteName.Text;

            entity.Entry(oldHouse).CurrentValues.SetValues(newHouse);
            entity.SaveChanges();

            MessageBox.Show("Updated");
        }
Ejemplo n.º 3
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();
            int      houseId  = int.Parse(listViewHouse.Items[listViewHouse.SelectedIndices[0]].SubItems[0].Text);
            tblHouse oldHouse = entity.tblHouses.Where(x => x.ID == houseId).FirstOrDefault();

            entity.tblHouses.Remove(oldHouse);
            entity.SaveChanges();

            MessageBox.Show("Deleted");
        }
Ejemplo n.º 4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();
            int userID = int.Parse(listViewUser.Items[listViewUser.SelectedIndices[0]].SubItems[0].Text);

            tblUser oldUser = entity.tblUsers.Where(x => x.ID == userID).FirstOrDefault();

            entity.tblUsers.Remove(oldUser);
            entity.SaveChanges();

            MessageBox.Show("User Deleted");
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();
            tblRole role = new Condominium_Management_System.tblRole();

            role.Title = txtTitle.Text;

            entity.tblRoles.Add(role);
            entity.SaveChanges();

            MessageBox.Show("Role Saved");
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();
            tblUserRole userRole = new Condominium_Management_System.tblUserRole();

            userRole.UserID = int.Parse(cboUser.SelectedValue.ToString());
            userRole.RoleID = int.Parse(cboRole.SelectedValue.ToString());

            entity.tblUserRoles.Add(userRole);
            entity.SaveChanges();

            MessageBox.Show("User Role Saved");
        }
Ejemplo n.º 7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();
            tblUser user = new Condominium_Management_System.tblUser();

            user.Fullname = txtFullname.Text;
            user.Username = txtUsername.Text;
            user.Password = txtPassword.Text;

            entity.tblUsers.Add(user);
            entity.SaveChanges();

            MessageBox.Show("User Saved");
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();
            int roleID = int.Parse(listViewRole.Items[listViewRole.SelectedIndices[0]].SubItems[0].Text);

            tblRole oldRole = entity.tblRoles.Where(x => x.ID == roleID).FirstOrDefault();

            tblRole newRole = new Condominium_Management_System.tblRole();

            newRole.ID    = roleID;
            newRole.Title = txtTitle.Text;

            entity.Entry(oldRole).CurrentValues.SetValues(newRole);
            entity.SaveChanges();

            MessageBox.Show("Role Updated");
        }
Ejemplo n.º 9
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CondominiumManagementSystemDBEntities entity = new Condominium_Management_System.CondominiumManagementSystemDBEntities();
            int userID = int.Parse(listViewUser.Items[listViewUser.SelectedIndices[0]].SubItems[0].Text);

            tblUser oldUser = entity.tblUsers.Where(x => x.ID == userID).FirstOrDefault();

            tblUser newUser = new Condominium_Management_System.tblUser();

            newUser.ID       = userID;
            newUser.Fullname = txtFullname.Text;
            newUser.Username = txtUsername.Text;
            newUser.Password = txtPassword.Text;

            entity.Entry(oldUser).CurrentValues.SetValues(newUser);
            entity.SaveChanges();

            MessageBox.Show("User Updated");
        }