public void Delete(LaundryChecklistDataEntity p_checklist)
 {
     using(var session = NHibernateHelper.OpenSession())
     {
         using(var transaction = session.BeginTransaction())
         {
             try
             {
                 session.Delete(p_checklist);
                 transaction.Commit();
             }
             catch(Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }
Exemplo n.º 2
0
        public List<LaundryChecklistDataEntity> ProcessCheckList()
        {
            List<LaundryChecklistDataEntity> checklist = new List<LaundryChecklistDataEntity>();
            foreach(DataGridViewRow row in dgvCheckList.Rows){
                if(row.Cells[1].Value != null){
                    string name = row.Cells[1].Value.ToString().Trim();
                    LaundryChecklistDataEntity entity = null;
                    if(row.Cells[3].Value != null){
                        entity = m_presenter.GetById(int.Parse(row.Cells[3].Value.ToString()));
                    }

                    if(entity == null){
                        entity = new LaundryChecklistDataEntity();
                        entity.Name = name;
                        checklist.Add(entity);
                    }else if(!entity.Name.Equals(name)){
                        entity.Name = name;
                        checklist.Add(entity);
                    }
                }
            }
            return checklist;
        }