Ejemplo n.º 1
0
        public JsonResult FindDonViTinhByMaSP(string maSP)
        {
            var ctx = new SmsContext();
            ObjectResult <SP_GET_DON_VI_TINH_Result> resultDonViTinh = ctx.SP_GET_DON_VI_TINH(int.Parse(maSP));
            var result = Json(resultDonViTinh.Take(100).ToList());

            ctx.Dispose();
            return(result);
        }
Ejemplo n.º 2
0
        public JsonResult FindFactorOfProduct(string maSP, string unitNo)
        {
            var ctx = new SmsContext();
            ObjectResult <SP_GET_DON_VI_TINH_Result> resultDonViTinh = ctx.SP_GET_DON_VI_TINH(int.Parse(maSP));

            foreach (SP_GET_DON_VI_TINH_Result dvt in resultDonViTinh)
            {
                if (int.Parse(unitNo) == dvt.MA_DON_VI)
                {
                    var result = Json(new { heso = dvt.HE_SO });
                    ctx.Dispose();
                    return(result);
                }
            }
            ctx.Dispose();
            return(null);
        }