Ejemplo n.º 1
0
 public static string AddUnit(ShowableUnit unit)
 {
     try
     {
         using (var db = new BarProjectEntities())
         {
             var q = db.UnitTypes.FirstOrDefault(x => x.type_name == unit.Type);
             if (q != null)
             {
                 db.addUnit(unit.Name, unit.Factor, q.id);
             }
             else
             {
                 throw new ArgumentException("Problem with type name!");
             }
         }
     }
     catch (Exception ex)
     {
         var message = ex.Message;
         if (ex.InnerException != null)
         {
             message += "\nInner:" + ex.InnerException.Message;
         }
         return(message);
     }
     return("");
 }
Ejemplo n.º 2
0
 private bool IsUnitEmpty(ShowableUnit unit)
 {
     return(unit.Name == null && unit.Type == null);
 }