username@email.com
2025-01-21 85c82e61104884a052893b2a642e732d1182707f
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL;
using CY.Infrastructure.Common;
using CY.Model;
using CY.BLL.EC;
using CY.Infrastructure.Query;
using System.Transactions;
 
namespace CY.WebForm.Pages.business
{
    //吴辉
    //外协订单列表
    public partial class AgOutsourcSingleAllList : BasePage
    {
        EC_OrderBasicBLL bll_EC_OrderBasicBLL = null;
        OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
 
        //初始化
        public AgOutsourcSingleAllList()
        {
            bll_EC_OrderBasicBLL = new EC_OrderBasicBLL();
            bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["delete"]))
            {
                EC_OrderBasic _eC_OrderBasic = bll_EC_OrderBasicBLL.SelectModelById(Request["delete"].ToInt32().Value);
                if (_eC_OrderBasic.BuyerId == CurrentUser.MemberId)
                {
                    if (bll_EC_OrderBasicBLL.DeleteOutOrder(Request["delete"].ToInt32().Value))
                        JavaScript.MessageBox("删除成功", this, "window.location='/Pages/business/AgOutsourcSingleAllList.aspx'"); 
                    else
                        JavaScript.MessageBox("删除失败", this);
                }
                else
                    JavaScript.MessageBox("删除失败", this);
            }
 
            if (!string.IsNullOrEmpty(Request["chexiao"]))
            {
                EC_OrderBasic _eC_OrderBasic = bll_EC_OrderBasicBLL.SelectModelById(Request["chexiao"].ToInt32().Value);
                if(_eC_OrderBasic.SellerName != "其他")
                {
                    JavaScript.MessageBox("已经确认供应商不能撤单!", this);
                }
                if (_eC_OrderBasic.BuyerId == CurrentUser.MemberId)
                {
                    var res = false;
                    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
  new TransactionOptions
  {
      IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted,
      Timeout = TransactionManager.MaximumTimeout
  }
  )
           )
                    {
                        try
                        {
                            res = bll_EC_OrderBasicBLL.UpdateOldOrderSurplusPrintNum(Request["chexiao"].ToInt32().Value);
                            res = bll_EC_OrderBasicBLL.DeleteOutOrder(Request["chexiao"].ToInt32().Value);
                            scope.Complete();
                        }
                        catch (Exception ex)
                        {
                            PAGEHandleException(ex);
                            JavaScript.MessageBox("撤单成功", this);
                        }
                        finally
                        {
                            // 释放资源
                            scope.Dispose();
                        }
                    }
 
                    
                    if (res)
                    {
                        JavaScript.MessageBox("撤单成功", this, "window.location='/Pages/business/AgOutsourcSingleAllList.aspx'");
                        
                    }
                    else
                    {
                        JavaScript.MessageBox("撤单失败", this);
                       
                    }
                       
                }
                else
                    JavaScript.MessageBox("撤单失败", this);
            }
 
            UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
            if (!IsPostBack)
            {
                BindOutFirm();
                BindList();
            }
        }
 
        //绑定外协厂商
        public void BindOutFirm()
        {
            Pagination pa = new Pagination();
            pa.PageSize = 500;
            pa.PageIndex = 1;
            this.selOutFirm.DataSource = bll_OA_CorporateClientsBLL.SelectModelPage(pa, CurrentUser.MemberId, "");
            this.selOutFirm.DataTextField = "OutVendorName";
            this.selOutFirm.DataValueField = "FirmId";
            this.selOutFirm.DataBind();
            this.selOutFirm.Items.Insert(0, new ListItem("全部", ""));
        }
 
        //绑定数据
        private void BindList()
        {
            Pagination pa = new Pagination();
            pa.PageSize = UCPager1.AspNetPager.PageSize;
            pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
            this.RepClientList.DataSource = bll_EC_OrderBasicBLL.SelectAferOfOutOrder(pa, CurrentUser.MemberId, this.txtStartCreatTime.Value.ToDateTime2(), this.txtEndCreatTime.Value.ToDateTime2(), this.txtStartReturnTime.Value.ToDateTime2(), this.txtEndReturnTime.Value.ToDateTime2(), this.txtCreater.Value, this.selOutFirm.Value, this.selWorkStates.Value, this.txtOutOrderId.Value, 4);
            this.RepClientList.DataBind();
            UCPager1.AspNetPager.RecordCount = pa.RecordCount;
        }
 
        //分页事件
        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            BindList();
        }
 
        //查询事件
        protected void btn_Search_Click(object sender, EventArgs e)
        {
            BindList();
        }
 
        /// <summary>
        /// 是否已经操作
        /// </summary>
        /// <param name="keyid"></param>
        /// <param name="orderState"></param>
        /// <param name="opType"></param>
        /// <returns></returns>
        public bool IsOpearted(object keyidObj, object orderStateObj, object opTypeObj)
        {
            int keyid = (int)keyidObj;
            int orderState = (int)orderStateObj;
            string opType = (string)opTypeObj;
            return bll_EC_OrderBasicBLL.IsOpearted(keyid, orderState, opType);
        }
    }
}