传递参数ID是总是空的

来源:互联网 发布:沙宣发型设计软件 编辑:程序博客网 时间:2024/04/30 14:23

 public partial class RefuseOrdersEdit : BaseAdmin
    {
        protected SmartShop.Entity.RefuseOrders obj_refuseorder = new SmartShop.Entity.RefuseOrders();
        protected SmartShop.Entity.Orders obj_order = new SmartShop.Entity.Orders();

        protected new int ID;
        protected int OrdersTypeID;
        protected string url;
        protected DataTable dt_backorderdetail = new DataTable();
        protected DataTable dt_refusedetail;
        protected string endscript;
        protected decimal payableprice;   //已付金额
        protected StringBuilder Str_endscript_orderdetail, Str_endscript_stock, Str_endscript_finance;
        protected int productmodifing;//是否在修改产品 1 是 0否

 

protected void Page_Load(object sender, EventArgs e)
        {
            ID = GetQueryForInt("ID", 0);
            OrdersTypeID = GetQueryForInt("OrdersTypeID", 0);
            productmodifing = GetQueryForInt("productmodifing", 0);
            url = "RefuseOrdersEdit.aspx?ID=" + ID + "&OrdersTypeID" + OrdersTypeID;
            url = Server.UrlEncode(url);

            if (!IsPostBack)
            {
                if (ID == 0)
                {
                    Response.Redirect("message.aspx?msg='参数id不能为空!'&url=RefuseOrdersDetail.aspx?OrdersTypeID=" + OrdersTypeID);
                }
                else
                {
                    obj_refuseorder = SmartShop.BusLogic.RefuseOrdersLogic.GetEntity(ID);
                    obj_order = SmartShop.BusLogic.OrdersLogic.GetEntity(obj_refuseorder.OrderID);
                    dt_backorderdetail = SmartShop.BusLogic.RefuseOrdersDetailLogic.GetDataTableByRefuseOrdersID(ID);

                }
                obj_order = SmartShop.BusLogic.OrdersLogic.GetEntity(obj_refuseorder.OrderID);  

}

RefuseOrdersDetail.aspx添加功能部分代码:

     int backorderid = SmartShop.BusLogic.RefuseOrdersLogic.Add(obj_backorder);

     bool result = SmartShop.BusLogic.RefuseOrdersDetailLogic.Add(backorderid, ShoppingCookiesStr);

   if (result)
            {
                // 修改订单状态
                SmartShop.BusLogic.OrdersLogic.PiliangStatusTo(OrderID.ToString(), 12);     
                SmartShop.ClassLibrary.JCookie.RemoveCookie("ShoppingCookiesStr");
                Response.Redirect("message.aspx?msg='添加成功!'&url=RefuseOrdersEdit.aspx?=ID " + backorderid);
            }
            else
            {
                Response.Redirect("message.aspx?msg='添加失败!'&url=RefuseOrdersDetail.aspx");
            }

 

 /// <summary>
        /// 获取int类型的Url传值
        /// </summary>
        /// <param name="param">参数名称</param>
        /// <param name="defaultValue">默认值,当但没有得到传值时的默认返回值</param>    
        protected int GetQueryForInt(string param, int defaultValue)
        {
            try
            {
                if (Request.QueryString[param] != null && Request.QueryString[param] != "")
                    return int.Parse(Request.QueryString[param].ToString());
                else
                    return defaultValue;
            }
            catch
            {
                return 0;
            }
        }

问题是:当添加成功时,提示添加成功,然后跳转到RefuseOrdersEdit .aspx页面,跳转是总是提示id为空。、

原创粉丝点击