示例#1
0
        protected override GoodsArrival SaveThis(TDto dto)
        {
            GoodsArrival goodsArrival = base.SaveThis(dto);

            if (goodsArrival.Approved)
            {
                List <BarcodeBase> barcodeBases = this.goodsArrivalRepository.GetBarcodeBases(goodsArrival.GoodsArrivalID);
                foreach (BarcodeBase barcodeBase in barcodeBases)
                {
                    string symbologies = this.goodsArrivalRepository.GetMatrixSymbologies(barcodeBase.Code);
                    this.goodsArrivalRepository.SetBarcodeSymbologies(barcodeBase.BarcodeID, symbologies);
                }
            }

            return(goodsArrival);
        }
示例#2
0
        /// <summary>
        /// 填充到货提醒信息
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        private List <GoodsArrival> SetGoodsArrivalInfo(DataTable dt)
        {
            List <GoodsArrival> list = new List <GoodsArrival>();
            GoodsArrival        g;

            foreach (DataRow dr in dt.Rows)
            {
                g               = new GoodsArrival();
                g.Id            = int.Parse(dr["Id"].ToString().Trim());
                g.AddTime       = dr["AddTime"].ToString().Trim();
                g.ArrivalStatus = int.Parse(dr["ArrivalStatus"].ToString().Trim());
                g.EntId         = dr["EntId"].ToString().Trim();
                g.NewTime       = dr["NewTime"].ToString().Trim();
                g.ProductId     = dr["ProductId"].ToString().Trim();
                g.ReadStatus    = int.Parse(dr["ReadStatus"].ToString().Trim());
                g.Status        = int.Parse(dr["Status"].ToString().Trim());
                g.UserId        = dr["UserId"].ToString().Trim();
                g.Remak         = dr["Remak"].ToString().Trim();
                list.Add(g);
            }
            return(list);
        }
示例#3
0
        public virtual ActionResult ChangeExpiryDateConfirmed(ExpiryDateViewModel expiryDateViewModel)
        {
            try
            {
                if (expiryDateViewModel.ExpiryDate == null || expiryDateViewModel.Remarks == null || expiryDateViewModel.Remarks.Trim() == "")
                {
                    throw new System.ArgumentException("Lỗi gia hạn sử dụng", "Vui lòng nhập ngày và số hồ sơ gia hạn.");
                }

                GoodsArrival entity = this.GetEntityAndCheckAccessLevel(expiryDateViewModel.GoodsArrivalID, GlobalEnums.AccessLevel.Readable);
                if (entity == null)
                {
                    throw new System.ArgumentException("Lỗi gia hạn sử dụng", "BadRequest.");
                }

                if (this.goodsArrivalService.ChangeExpiryDate(expiryDateViewModel.GoodsArrivalID, expiryDateViewModel.GoodsArrivalDetailID, expiryDateViewModel.ExpiryDate, expiryDateViewModel.Remarks))
                {
                    ModelState.Clear(); ////https://weblog.west-wind.com/posts/2012/apr/20/aspnet-mvc-postbacks-and-htmlhelper-controls-ignoring-model-changes
                    //IMPORTANT NOTES: ASP.NET MVC Postbacks and HtmlHelper Controls ignoring Model Changes
                    //HtmlHelpers controls (like .TextBoxFor() etc.) don't bind to model values on Postback, but rather get their value directly out of the POST buffer from ModelState. Effectively it looks like you can't change the display value of a control via model value updates on a Postback operation.
                    //When MVC binds controls like @Html.TextBoxFor() or @Html.TextBox(), it always binds values on a GET operation. On a POST operation however, it'll always used the AttemptedValue to display the control. MVC binds using the ModelState on a POST operation, not the model's value
                    //So, if you want the behavior that I was expecting originally you can actually get it by clearing the ModelState in the controller code: ModelState.Clear();
                    //voidDetailViewModel.Remarks = voidDetailViewModel.Remarks;
                    return(View("ChangeExpiryDateSuccess", expiryDateViewModel));
                }
                else
                {
                    throw new System.ArgumentException("Lỗi gia hạn sử dụng", "Lỗi gia hạn sử dụng.");
                }
            }
            catch (Exception exception)
            {
                ModelState.AddValidationErrors(exception);
                return(RedirectToAction("ChangeExpiryDate", new { @id = expiryDateViewModel.GoodsArrivalID, @detailId = expiryDateViewModel.GoodsArrivalDetailID }));
            }
        }