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;
|
}
|
}
|
}
|