Esempio n. 1
0
    /// <summary>
    /// 绑定数据
    /// </summary>
    public void Bind()
    {
        string type = Request.QueryString["type"] + "";

        if (KeyID != 0)
        {
            if (!Common.PageCompOperable("ReturnOrder", KeyID, CompID))
            {
                Response.Redirect("../../NoOperable.aspx");
                return;
            }

            Hi.Model.DIS_OrderReturn OrderReturnModel = OrderReturnBll.GetModel(KeyID);

            if (OrderReturnModel != null)
            {
                this.lblDisName.InnerText = Common.GetDis(OrderReturnModel.DisID, "DisName");
                this.hidDisId.Value       = OrderReturnModel.DisID.ToString();
                DisId   = OrderReturnModel.DisID;
                OrderId = OrderReturnModel.OrderID;

                Hi.Model.DIS_Order OrderModel = new Hi.BLL.DIS_Order().GetModel(OrderId);

                this.lblReceiptNo.InnerText = OrderReturnModel.ReceiptNo;

                this.lblReturnDate.InnerText = OrderReturnModel.ReturnDate == DateTime.MinValue ? "" : OrderReturnModel.ReturnDate.ToString("yyyy-MM-dd");

                this.lblReturnUserID.InnerText = Common.GetUserName(OrderReturnModel.ReturnUserID.ToString().ToInt(0));
                this.lblReturnState.InnerText  = OrderInfoType.ReturnState(OrderReturnModel.ReturnState);
                //this.lblExpress.InnerText = OrderReturnModel.Express;
                //this.lblExpressNo.InnerText = OrderReturnModel.ExpressNo;
                this.lblReturnContent.InnerText = OrderReturnModel.ReturnContent;

                ProID    = OrderInfoType.getOrderExt(OrderReturnModel.OrderID, "ProID");
                ProPrice = OrderInfoType.getOrderExt(OrderReturnModel.OrderID, "ProAmount");
                ProIDD   = OrderInfoType.getOrderExt(OrderReturnModel.OrderID, "ProDID");
                ProType  = OrderInfoType.getOrderExt(OrderReturnModel.OrderID, "Protype");

                //订单信息
                this.lblOState.InnerText   = OrderInfoType.OState(OrderModel.ID);
                this.lblPayState.InnerHtml = OrderInfoType.PayState(OrderModel.PayState);
                if (OrderModel.PayState == (int)Enums.PayState.未支付)
                {
                    this.lblPayState.Attributes.Add("style", "Color:Red");
                }
                else
                {
                    this.lblPayState.Attributes.Add("style", "Color:green");
                }

                this.lblAddType.InnerText = OrderInfoType.AddType(OrderModel.AddType);
                this.lblOtype.InnerText   = OrderInfoType.OType(OrderModel.Otype);
                //订单总价
                this.lblTotalPrice.InnerText = OrderInfoType.getOrder(OrderReturnModel.OrderID, "AuditAmount");


                if (OrderReturnModel.AuditUserID == 0)
                {
                    this.trAuditUser.Attributes.Add("style", "display:none;");
                    this.trAuditRemark.Attributes.Add("style", "display:none;");
                }
                else
                {
                    this.trAuditUser.Attributes.Add("style", "");
                    this.trAuditRemark.Attributes.Add("style", "");
                }
                this.lblAuditUser.InnerText   = Common.GetUserName(OrderReturnModel.AuditUserID);
                this.lblAuditDate.InnerText   = OrderReturnModel.AuditDate == DateTime.MinValue ? "" : OrderReturnModel.AuditDate.ToString("yyyy-MM-dd");
                this.lblAuditRemark.InnerText = OrderReturnModel.AuditRemark;

                if (this.Erptype != 0)
                {
                    //U8、U9等用户  不能对订单进行操作
                    this.Audit.Visible       = false;
                    this.ReturnMoney.Visible = false;
                }
                else
                {
                    //非U8、U9等用户  可以对订单进行操作
                    #region
                    if (OrderReturnModel.ReturnState < (int)Enums.AuditState.提交)
                    {
                        //this.Audit.Attributes.Add("style", "display:none;");
                        //this.ReturnMoney.Attributes.Add("style", "display:none;");

                        this.Audit.Visible       = false;
                        this.ReturnMoney.Visible = false;
                    }
                    else if (OrderReturnModel.ReturnState == (int)Enums.AuditState.提交)
                    {
                        this.Audit.Visible       = true;
                        this.ReturnMoney.Visible = false;

                        //this.Audit.Attributes.Add("style", "display:inline-block;");
                        //this.ReturnMoney.Attributes.Add("style", "display:none;");
                    }
                    else if (OrderReturnModel.ReturnState == (int)Enums.AuditState.已审)
                    {
                        this.Audit.Visible = false;
                        //this.Audit.Attributes.Add("style", "display:none;");
                        if (OrderModel != null)
                        {
                            if (OrderModel.Otype != (int)Enums.OType.赊销订单)
                            {
                                if (type == "")
                                {
                                    this.ReturnMoney.Visible = false;
                                    //this.ReturnMoney.Attributes.Add("style", "display:none;");
                                }
                                else
                                {
                                    this.ReturnMoney.Visible = true;
                                    //this.ReturnMoney.Attributes.Add("style", "display:inline-block;");
                                }
                            }
                            else
                            {
                                if (OrderModel.PayState == (int)Enums.PayState.已支付)
                                {
                                    if (type == "")
                                    {
                                        this.ReturnMoney.Visible = false;
                                        //this.ReturnMoney.Attributes.Add("style", "display:none;");
                                    }
                                    else
                                    {
                                        this.ReturnMoney.Visible = true;
                                        //this.ReturnMoney.Attributes.Add("style", "display:inline-block;");
                                    }
                                }
                                else
                                {
                                    this.ReturnMoney.Visible = false;
                                    //this.ReturnMoney.Attributes.Add("style", "display:none;");
                                }
                            }
                        }
                    }
                    else if (OrderReturnModel.ReturnState == (int)Enums.AuditState.已完结)
                    {
                        this.Audit.Visible       = false;
                        this.ReturnMoney.Visible = false;
                        //this.Audit.Attributes.Add("style", "display:none;");
                        //this.ReturnMoney.Attributes.Add("style", "display:none;");
                    }
                    #endregion
                }
                BindOrderDetail(OrderReturnModel.OrderID, OrderReturnModel.DisID);
            }
        }
        else
        {
            Response.Write("数据错误!");
            Response.End();
        }
    }