username@email.com
2025-05-14 99ddfbcecf0fa2881eb3a91028257eef87dab6de
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
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.BLL.Inquiry;
using CY.Model;
using CY.Infrastructure.Common;
using CY.Model.Inquiry;
using CY.BLL.EC;
using CY.WebForm.Pages.common;
 
namespace CY.WebForm.Pages.front
{
    public partial class ConfirmInquiry : FrontBasePage
    {
        EC_MemberBasicBLL _eC_MemberBasicBLL = new EC_MemberBasicBLL();
        PaperSizeDetailBLL _paperSizeDetailBLL = new PaperSizeDetailBLL();
        PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
        BrandInfoBLL _brandInfoBLL = new BrandInfoBLL();
        InquiryBLL _inquiryBLL = new InquiryBLL();
 
        public int PrintTypeId
        {
            get
            {
                object obj = ViewState["PrintTypeId"];
                return obj == null ? 0 : int.Parse(obj.ToString());
            }
            set
            {
                ViewState["PrintTypeId"] = value;
            }
        }
 
        /// <summary>
        /// 卖家编号
        /// </summary>
        public Guid firmId
        {
            get
            {
                if (Request["fid"] != null)
                {
                    return Guid.Parse(Request["fid"].ToString().Trim(',').Split(',')[0]);
                }
                return Guid.Empty;
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (CurrentUser == null)
            {
                Response.Redirect("/login.html?backurlCS=" + "/order/confirm/" + Request["fid"] + ".html");
            }
 
            if (!IsPostBack)
            {
                string firmId = string.Empty;
                if (Request["fid"] != null)
                {
                    firmId = Request["fid"].ToString();
                    EC_MemberBasic memberModel = _eC_MemberBasicBLL.GetMemberByMemberId(Guid.Parse(firmId));
                    this.lblFirmName.Text = memberModel.Name;
                    this.lblPhone.Text = memberModel.EC_MemberExtendMode.PhoneNum;
                    this.lblQQ.Text = memberModel.EC_MemberExtendMode.QQ;
                    try
                    {
                        InquiryCommonModel model = InquiryBLL.GetInquiryCommonModel();
                        if (model != null)
                        {
                            PrintTypeId = model.PrintTypeId;
                            hidPrintTypeId.Value = model.PrintTypeId.ToString();
                            this.lblPrintTypeName.Text = model.PrintTypeName;
                            this.lblPrintMode.Text = model.PrintModeName;
                            this.lblPrintCount.Text = model.PrintCountName;
                            this.lblPrintDemand.Text = model.PrintDemand;
                            this.lblAfterWorksDemand.Text = model.AfterWorksDemand;
                            this.lblDeliveryMode.Text = model.DeliveryModeName;
                            this.lblBillMode.Text = model.BillModeName;
                            this.lblRemarks.Text = model.Remarks;
                            hidDeliveryMode.Value = model.DeliveryMode.ToString();
                            hidBillMode.Value = model.BillMode.ToString();
                            Guid memberId = Guid.Empty;
                            if (CurrentUser != null)
                            {
                                memberId = CurrentUser.MemberId;
                            }
                            CY.Model.InquiryDetail detail = _inquiryBLL.GetInquiryDetailByConfirm(model, Guid.Parse(firmId), memberId);
                            ViewState["detail"] = detail;
                            this.lblPaperPrice.Text = detail.PaperPriceStr;
                            this.lblImpressPrice.Text = detail.ImpressPriceStr;
                            this.lblVersionCost.Text = detail.VersionCost.ToString("0.00");
                            this.lblAfterWorkPrice.Text = detail.AfterWorkPriceStr;
                            this.lblCargagePrice.Text = detail.CargagePrice.ToString("0.00");
                            this.lblTaxationPrice.Text = detail.TaxationPrice.ToString("0.00");
                            this.lblTotalPrice.Text = detail.TotalPrice.ToString("0");
                        }
                    }
                    catch
                    {
                        Response.Redirect("/Inquiry/index.html");
                    }
                }
            }
        }
 
        /// <summary>
        /// 确认下单事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnConfirmInquiry_Click(object sender, EventArgs e)
        {
            InquiryCommonModel model = InquiryBLL.GetInquiryCommonModel();
            if (ViewState["detail"] != null)
            {
                CY.Model.InquiryDetail detail = ViewState["detail"] as CY.Model.InquiryDetail;
                model.InquiryDetailObj = detail;
            }
            decimal totalPrice=lblTotalPrice.Text.ToDecimal2().Value;
            EC_MemberBasicBLL _memberBasicBLL = new EC_MemberBasicBLL();
            EC_MemberBasic member = _memberBasicBLL.GetMemberByMemberId(firmId);
            EC_OrderBasic orderBasic=null;
            try
            {
                Request.RequestContext.RouteData.DataTokens.Add("CurrentMemberId",CurrentUser.MemberId);
                orderBasic = PayAbout.NewOrder(CurrentUser.MemberId, "",CurrentUser.Name, firmId, member.Name, CurrentUser.ShortName, totalPrice, model, 0, PayAbout.FillModel);
            }
            catch(Exception ex)
            {
 
            }
            if (orderBasic==null)
            {
                JavaScript.MessageBox("操作失败", this);
            }
            else
            {
                DelDemandByCurrentMember(model.PrintDemand);
                string orderId = orderBasic.Keyid.ToString();
                string url = "/order/success/" + orderId+".html";
                Response.Redirect(url);
                //this.panInquiry.Visible = false;
                //this.panSuccess.Visible = true;
                //this.hidOrderId.Value = orderBasic.Keyid.ToString();
                //this.lblOrderCode.Text = orderBasic.SellerOrderId;
                //this.lblOrderPrice.Text = orderBasic.SumPrice.Value.ToString("0.00");
                //Utils.WriteCookie("InquiryRecord", string.Empty, -1);
            }
        }
 
        /// <summary>
        /// 当下单成功时删除当前用户的当天发布的相同印刷要求的需求(发布状态)
        /// </summary>
        public void DelDemandByCurrentMember(string demandStr)
        {
            try
            {
                EC_QuoteDemandBLL _eC_QuoteDemandBLL = new EC_QuoteDemandBLL();
                EC_QuoteDemand demandModel = _eC_QuoteDemandBLL.GetModelByCanDel(CurrentUser.MemberId, demandStr);
                if (demandModel != null)
                {
                    _eC_QuoteDemandBLL.DelModel(demandModel.Keyid.Value);
                }
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
            }
        }
 
        /// <summary>
        /// 找到字符串中某个字符第二次出现的位置
        /// </summary>
        /// <param name="str"></param>
        /// <param name="?"></param>
        /// <returns></returns>
        public int GetIndex(string str, char c)
        {
            int index=-1;
            int num = 0;
            char[] arry = str.ToArray<char>();
            foreach (char a in arry)
            {
                index++;
                if (a == c)
                {
                    num++;
                }
                if (num == 1)
                {
                    break;
                }
            }
            return index;
        }
    }
}