Esempio n. 1
0
        public override bool Equals(object obj)
        {
            ItemDiscontinue another = obj as ItemDiscontinue;

            if (another == null)
            {
                return(false);
            }
            else
            {
                return(this.Id == another.Id);
            }
        }
 public ActionResult _UpdateSave(ItemDiscontinue itemDiscon) {
     if (ModelState.IsValid)
     {
         if (itemDiscon.EndDate != null && System.DateTime.Compare(System.DateTime.Parse(itemDiscon.EndDate.ToString()), System.DateTime.Parse(itemDiscon.StartDate.ToString())) < 1)
         {
             SaveErrorMessage(Resources.MD.ItemDiscontinue.Errors_StartDateGreaterThanEndDate);
         }
         else
         {
             this.genericMgr.UpdateWithTrim(itemDiscon);
             SaveSuccessMessage(Resources.MD.ItemDiscontinue.ItemDiscontinue_Updated);
             return RedirectToAction("List");
         }
     }
     return RedirectToAction("Edit/" + itemDiscon.Id);
     
 }
 public ActionResult New(ItemDiscontinue itemdiscon)
 {
     if (ModelState.IsValid)
     {
         if (this.genericMgr.FindAll<long>(duiplicateVerifyStatement, new object[] {itemdiscon.Item,itemdiscon.DiscontinueItem,itemdiscon.UnitQty,itemdiscon.Priority,itemdiscon.StartDate })[0] > 0)
         {
             SaveErrorMessage(Resources.EXT.ControllerLan.Con_AlreadyExists);
         }
         else if (itemdiscon.EndDate!=null && System.DateTime.Compare(System.DateTime.Parse(itemdiscon.EndDate.ToString()), System.DateTime.Parse(itemdiscon.StartDate.ToString())) < 1)
         {
             SaveErrorMessage(Resources.MD.ItemDiscontinue.Errors_StartDateGreaterThanEndDate);
         }
         else if(itemdiscon.Item==null || itemdiscon.DiscontinueItem==null)
         {
             SaveErrorMessage(Resources.MD.ItemDiscontinue.Error_ItemDiscontinueNotBeEmpty);
         }
         else if (itemdiscon.Item.ToString() == itemdiscon.DiscontinueItem.ToString() )
         {
             SaveErrorMessage(Resources.MD.ItemDiscontinue.Error_ItemCannotEqualDiscontinueItem);
         }
         else
         {
             genericMgr.CreateWithTrim(itemdiscon);
             SaveSuccessMessage(Resources.MD.ItemDiscontinue.ItemDiscontinue_Added);
             return RedirectToAction("Edit/" + itemdiscon.Id);
         }    
     }
     TempData["ItemDiscontinue"] = itemdiscon;
     return View(itemdiscon);
 }