Пример #1
0
 private bool ValidateBienBanGiaoCa(BienBanGiaoCa BienBanGiaoCaToValidate)
 {
     //if (BienBanGiaoCaToValidate.FirstName.Trim().Length == 0)
     //    _validationDictionary.AddError("FirstName", "First name is required.");
     //if (BienBanGiaoCaToValidate.LastName.Trim().Length == 0)
     //    _validationDictionary.AddError("LastName", "Last name is required.");
     ////if (bienBanGiaoCaToValidate.Phone.Length > 0 && !Regex.IsMatch(bienBanGiaoCaToValidate.Phone, @"((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"))
     ////    _validationDictionary.AddError("Phone", "Invalid phone number.");
     //if (BienBanGiaoCaToValidate.Email.Length > 0 && !Regex.IsMatch(bienBanGiaoCaToValidate.Email, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$"))
     //    _validationDictionary.AddError("Email", "Invalid email address.");
     return _validationDictionary.IsValid;
 }
Пример #2
0
 public bool DeleteBienBanGiaoCa(BienBanGiaoCa bienBanGiaoCaToDelete)
 {
     try
     {
         _repository.DeleteBienBanGiaoCa(bienBanGiaoCaToDelete);
     }
     catch
     {
         return false;
     }
     return true;
 }
Пример #3
0
        public bool EditBienBanGiaoCa(BienBanGiaoCa bienBanGiaoCaToEdit)
        {
            // Validation logic
            if (!ValidateBienBanGiaoCa(bienBanGiaoCaToEdit))
                return false;

            // Database logic
            try
            {
                _repository.EditBienBanGiaoCa(bienBanGiaoCaToEdit);
            }
            catch
            {
                return false;
            }
            return true;
        }
Пример #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the BienBanGiaoCas EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBienBanGiaoCas(BienBanGiaoCa bienBanGiaoCa)
 {
     base.AddObject("BienBanGiaoCas", bienBanGiaoCa);
 }
Пример #5
0
 /// <summary>
 /// Create a new BienBanGiaoCa object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static BienBanGiaoCa CreateBienBanGiaoCa(global::System.Int32 id)
 {
     BienBanGiaoCa bienBanGiaoCa = new BienBanGiaoCa();
     bienBanGiaoCa.Id = id;
     return bienBanGiaoCa;
 }
Пример #6
0
 public ActionResult Edit(BienBanGiaoCa bienBanGiaoCaToEdit)
 {
     try
     {
         // TODO: Add update logic here
         if (_service.EditBienBanGiaoCa(bienBanGiaoCaToEdit))
         {
             return RedirectToAction("Index");
         }
         return View("Edit");
     }
     catch
     {
         return View();
     }
 }