コード例 #1
0
        public override bool Equals(object obj)
        {
            PriceListDetail another = obj as PriceListDetail;

            if (another == null)
            {
                return(false);
            }
            else
            {
                return(this.Id == another.Id);
            }
        }
コード例 #2
0
        public ActionResult _PriceListDetailEdit(PriceListDetail priceListDetail)
        {
            if (priceListDetail.PriceListCode != null)
            {
                PriceListMaster priceListMaster = this.genericMgr.FindById<PriceListMaster>(priceListDetail.PriceListCode);
                priceListDetail.PriceList = priceListMaster;
                ModelState.Remove("PriceList");
            }

            if (ModelState.IsValid)
            {
                bool isError = false;
                if (priceListDetail.EndDate != null)
                {
                    if (System.DateTime.Compare((System.DateTime)priceListDetail.EndDate, (System.DateTime)priceListDetail.StartDate) < 1)
                    {
                        SaveErrorMessage(Resources.MD.WorkingCalendar.Errors_StartDateGreaterThanEndDate);
                        isError = true;
                    }
                }
                if (!isError)
                {
                    this.genericMgr.UpdateWithTrim(priceListDetail);
                    SaveSuccessMessage(Resources.BIL.PriceListDetail.PriceListDetail_Updated);
                }
            }

            return PartialView(priceListDetail);
        }
コード例 #3
0
        public ActionResult _PriceListDetailNew(PriceListDetail priceListDetail, string priceListCode)
        {
            if (!string.IsNullOrEmpty(priceListCode))
            {
                ViewBag.PriceListCode = priceListCode;
                PriceListMaster priceListMaster = this.genericMgr.FindById<PriceListMaster>(priceListCode);
                priceListDetail.PriceList = priceListMaster;
                ModelState.Remove("PriceList");
            }
            if (ModelState.IsValid)
            {
                if (this.genericMgr.FindAll<long>(priceListDetailDuiplicateVerifyStatement, new object[] { priceListDetail.Id })[0] > 0)
                {
                    SaveErrorMessage(Resources.SYS.ErrorMessage.Errors_Existing_Code, priceListDetail.Id.ToString());
                }
                else
                {
                    bool isError = false;
                    if (this.genericMgr.FindAll<Item>("from Item where Code=?", priceListDetail.Item).Count < 1)
                    {
                        SaveErrorMessage(Resources.BIL.PriceListDetail.Errors_NotExisting_Item);
                        isError = true;
                    }
                    else if (priceListDetail.EndDate != null)
                    {
                        if (System.DateTime.Compare((System.DateTime)priceListDetail.EndDate, (System.DateTime)priceListDetail.StartDate) < 1)
                        {
                            SaveErrorMessage(Resources.MD.WorkingCalendar.Errors_StartDateGreaterThanEndDate);
                            isError = true;
                        }
                    }

                    if (!isError)
                    {
                        this.genericMgr.CreateWithTrim(priceListDetail);
                        SaveSuccessMessage(Resources.BIL.PriceListDetail.PriceListDetail_Added);
                        return new RedirectToRouteResult(new RouteValueDictionary  
                                                   { 
                                                       { "action", "_PriceListDetailList" }, 
                                                       { "controller", "DistributionPriceList" },
                                                       { "PriceListCode", priceListCode }
                                                   });
                    }
                }
            }

            return PartialView(priceListDetail);
        }