Example #1
0
        public void addGuestRequest(GuestRequest r)
        {
            var v = from item in dal.GetGuestRequestList()
                    where item.ID == r.ID && (item.PrivateName != r.PrivateName || item.FamilyName != r.FamilyName)
                    select item;

            foreach (GuestRequest item in v)
            {
            }
            if (v != null)
            {
                if (r.EntryDate.Date >= r.ReleaseDate.Date)
                {
                    throw new Exception("entry date must be smaller than the release day at least one day");
                }
                else
                {
                    try
                    {
                        if (r.MailAddress.EndsWith("@gmail.com"))
                        {
                            r.RegistrationDate = DateTime.Now;
                            dal.addGuestRequest(r);
                        }
                        else
                        {
                            throw new Exception("bl:addGuestRequest:the mail address is not correct");
                        }
                    }
                    catch (Exception x)
                    {
                        throw new Exception(x.Message);
                    }
                }
            }
            else
            {
                throw new Exception("bl:addGuestRequest:the id  is not taken allready");
            }
        }