Exemple #1
0
        public override bool Equals(object obj)
        {
            UomConversion another = obj as UomConversion;

            if (another == null)
            {
                return(false);
            }
            else
            {
                return(this.Id == another.Id);
            }
        }
Exemple #2
0
        public ActionResult _UomConvertEdit(UomConversion uomConv)
        {
            if (uomConv.ItemCode != null)
            {
                Item item = base.genericMgr.FindById<Item>(uomConv.ItemCode);
                uomConv.Item = item;
            }
            else
            {
                uomConv.Item = null;
            }


            ModelState.Remove("Item.Code");
            ModelState.Remove("Item.Description");
            if (ModelState.IsValid)
            {
                base.genericMgr.Update(uomConv);
                SaveSuccessMessage(Resources.MD.UomConvert.UomConvert_Updated);
            }
            ////return new RedirectToRouteResult(new RouteValueDictionary  
            ////                                       { 
            ////                                           { "action", "_UomConvertEdit" }, 
            ////                                           { "controller", "Uom" },
            ////                                           { "id", uomConv.Id }
            ////                                       });

            return PartialView(uomConv);
        }
Exemple #3
0
        public ActionResult _UomConvertNew(UomConversion uomConversion)
        {
            if (ModelState.IsValid)
            {
                if (base.genericMgr.FindAll<long>(uomConvertDuiplicateVerifyStatement, new object[] { uomConversion.Id })[0] > 0)
                {
                    SaveErrorMessage(Resources.ErrorMessage.Errors_Existing_Code);
                }
                else if (uomConversion.BaseUom == uomConversion.AlterUom)
                {
                    SaveErrorMessage(Resources.MD.UomConvert.Errors_Existing_Uom);
                }
                else if (uomConversion.ItemCode == null)
                {
                    if (base.genericMgr.FindAll<long>(uomConvertIsExistAndItemIsNull, new object[] { uomConversion.BaseUom, uomConversion.AlterUom })[0] > 0)
                    {
                        SaveErrorMessage(Resources.MD.UomConvert.Errors_Existing_UomConv);
                    }
                    else
                    {
                        base.genericMgr.Create(uomConversion);
                        SaveSuccessMessage(Resources.MD.UomConvert.UomConvert_Added);
                        return RedirectToAction("_UomConvertEdit/" + uomConversion.Id);
                    }
                }
                else
                {
                    if (base.genericMgr.FindAll<Item>("from Item where Code=?", uomConversion.ItemCode).Count < 1)
                    {
                        SaveErrorMessage(Resources.MD.UomConvert.Errors_NotExisting_Item);
                    }
                    else
                    {
                        if (base.genericMgr.FindAll<long>(uomConvertIsExist, new object[] { uomConversion.ItemCode, uomConversion.BaseUom, uomConversion.AlterUom })[0] > 0)
                        {
                            SaveErrorMessage(Resources.MD.UomConvert.Errors_Existing_UomConv);
                        }
                        else
                        {
                            Item item = base.genericMgr.FindById<Item>(uomConversion.ItemCode);
                            uomConversion.Item = item;
                            base.genericMgr.Create(uomConversion);
                            SaveSuccessMessage(Resources.MD.UomConvert.UomConvert_Added);
                            return RedirectToAction("_UomConvertEdit/" + uomConversion.Id);
                        }
                    }
                }
            }

            return PartialView(uomConversion);
        }