Example #1
0
        private void addBtn_Click(object sender, EventArgs e)
        {
            // NHibernateRepository repo = new NHibernateRepository();
            if (tabControl.SelectedTab == tabControl.TabPages[0])
            {
                View.ItemView itemView = new View.ItemView(true, null);
                itemView.ShowDialog();
                showAllItems(repo);
            }
            else
            {
                View.StaffView staffView = new View.StaffView(true, null);
                staffView.ShowDialog();

                /*var staffs = repo.Query<Staff>();
                 * var showedStaffs = from staff in staffs
                 *                 let showedStaff = new
                 *                 {
                 *                     lastname = staff.lastName,
                 *                     firstname = staff.firstName,
                 *                     groupcode = staff.groupCode,
                 *                     email = staff.email,
                 *                     phone = staff.phone,
                 *                     location = staff.location
                 *
                 *                 }
                 *                 select showedStaff;
                 * staffDataGridView.DataSource = showedStaffs.ToList();*/
                showAllStaffs(repo);
            }
        }
Example #2
0
 private void editBtn_Click(object sender, EventArgs e)
 {
     if (tabControl.SelectedTab == tabControl.TabPages[0])
     {
         // NHibernateRepository repo = new NHibernateRepository();
         ICriterion[] expressions = new ICriterion[2];
         expressions[0] = Expression.Eq("asset", itemsDataGridView.Rows[rowindex].Cells["Asset"].Value);
         expressions[1] = Expression.Eq("isDelete", false);
         IList <Item>  items    = repo.Query <Item>(expressions);
         View.ItemView itemView = new View.ItemView(false, items[0]);
         itemView.ShowDialog();
         editBtn.Enabled = false;
         showAllItems(repo);
     }
     else
     {
         ICriterion     criterion = Expression.Eq("groupCode", staffDataGridView.Rows[rowindex].Cells["groupCode"].Value);
         IList <Staff>  staffs    = repo.Query <Staff>(criterion);
         View.StaffView staffView = new View.StaffView(false, staffs[0]);
         staffView.ShowDialog();
         editBtn.Enabled = false;
         showAllStaffs(repo);
     }
 }