示例#1
0
        public ApiMessage GetBuyPriceFullInfo()
        {
            ApiMessage message = new ApiMessage() { Status = "ok" };
            HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request = context.Request;
            string user_id = User.Identity.Name;
            UserManager userMgr = new UserManager(int.Parse(user_id), null);
            BUser user = userMgr.CurrentUser;
            BuyManager buyManager = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            BBuyPrice buyPrice = null;
            int priceId = 0;
            try
            {
                int.TryParse(request["buy_price_id"], out priceId);
                if (priceId <= 0)
                {
                    message.Status = "failed";
                    message.Message = "没有输入询价单编号";
                    return message;
                }

                buyPrice = buyManager.GetBuyPriceFullInfo(priceId);

                if (buyPrice == null)
                {
                    message.Status = "failed";
                    message.Message = "询价单编号错误";
                    return message;
                }

                message.Item = buyPrice;
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException dbex)
            {
                message.Status = "failed";
                message.Message = dbex.Message;
            }
            catch (KM.JXC.Common.KMException.KMJXCException kex)
            {
                message.Status = "failed";
                message.Message = kex.Message;
            }
            catch (Exception ex)
            {
                message.Status = "failed";
                message.Message = ex.Message;
            }
            finally
            {

            }

            return message;
        }
示例#2
0
        public ActionResult PriceDetail(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("请输入正确的询价单编号"));
            }

            int oId = 0;
            int.TryParse(id, out oId);
            string uid = HttpContext.User.Identity.Name;
            if (oId <= 0)
            {
                return Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("请输入正确的询价单编号"));
            }
            BBuyPrice buyPrice = null;
            try
            {
                UserManager userMgr = new UserManager(int.Parse(uid), null);
                BUser user = userMgr.CurrentUser;
                BuyManager buyManager = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
                buyPrice = buyManager.GetBuyPriceFullInfo(oId);
            }
            catch (KMJXCException kex)
            {
                return Redirect("/Home/Error?message=" + HttpUtility.UrlEncode(kex.Message));
            }
            catch
            {
                return Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("未知错误"));
            }
            return View(buyPrice);
        }