public void AddOrder(Order o) { List <Branch> branchH = (dal.GetListBranch().Where(i => i.BranchCode == o.Branch)).ToList <Branch>(); if (branchH.Count() != 0) { if (branchH[0].HechsherBranch > o.OrderHechsher) { throw new Exception("the order hechsher is not appropriate to the branch"); } } if (o.CreditCard.Length != 8 && o.CreditCard.Length != 16) { throw new Exception("the digits number is wrong! "); } dal.AddOrder(o); }