1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL.EC;
using CY.Model;
using CY.BLL.Sys;
 
namespace CY.WebForm.Pages.membermanage
{
    public partial class OnOrUnFreezeOrder : MainPage
    {
        EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL();
        Sys_DictionaryBLL _dictionaryBLL = new Sys_DictionaryBLL();
        public int KeyId
        {
            get
            {
                return Request.Params["KeyId"] == null ? 0 : int.Parse(Request.Params["KeyId"].ToString());
            }
        }
 
        public string UserType
        {
            get
            {
                return Request.Params["UserType"] == null ? string.Empty : Request.Params["UserType"].ToString();
            }
        }
 
        public string PageTitle;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            PageTitle = "冻结订单";
            if (!IsPostBack)
            {
                BindPage();
            }
        }
 
        private void BindPage()
        {
            EC_OrderBasic model = _eC_OrderBasicBLL.SelectModelById(KeyId);
            if (model != null)
            {
                if (UserType == "1")
                {
                    this.lblOrderId.Text = model.SellerOrderId;
                }
                else
                {
                    this.lblOrderId.Text = model.ShowCode;
                }
                this.lblOrderName.Text = model.DocumentName;
                this.lblBuyName.Text = model.BuyerName;
                this.lblSellerName.Text = model.SellerName;
                int orderState = model.OrderState.Value;
 
                string orderStateName = _dictionaryBLL.GetNameByMeanValue(orderState, "EC_订单状态");
                this.lblOrderStateName.Text = orderStateName;
 
                //如果已冻结
                if (orderState == -2)
                {
                    this.PageTitle = "解冻订单";
                    this.btnSave.Text = "确定解冻";
                }
                else
                {
                    this.PageTitle = "冻结订单";
                    this.btnSave.Text = "确定冻结";
                }
            }
        }
 
        
 
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool isSuccess = false;
            EC_OrderOperate orderOperate = null;
            if (this.btnSave.Text == "确定冻结")
            {
                orderOperate = new EC_OrderOperate()
                {
                    OperateType = -2,
                    OrderId = KeyId,
                    Operator = CurrentUser.ShortName,
                    LastUpdateTime=DateTime.Now,
                    Remark = "冻结订单"
                };
                
            }
            else
            {
                EC_OrderOperate operate = _eC_OrderBasicBLL.GetSecondOrderOperateByDEC(KeyId);
                orderOperate = new EC_OrderOperate()
                {
                    OperateType = operate.OperateType.Value,
                    OrderId = KeyId,
                    Operator = CurrentUser.ShortName,
                    LastUpdateTime = DateTime.Now,
                    Remark = "解冻订单"
                };
            }
            isSuccess = _eC_OrderBasicBLL.UpdateOrderState(orderOperate);
            if (isSuccess)
            {
                Response.Write("<script>parent.document.getElementById('_DialogFrame_0').contentWindow.document.getElementById('frmrightChild').contentWindow.ReLoadSelf111();top.Dialog.close();</script>");
            }
            else
            {
                JavaScript.MessageBox("操作失败", this);
            }
        }
    }
}