/// <summary> /// 初始化系统信息实体 /// </summary> /// <returns></returns> private TicketSystemModel InitSysModel() { TicketSystemModel sysModel = new TicketSystemModel(); sysModel.TicketInterfaceUrl = ConfigClass.GetConfigString("Ticket", "TicketInterfaceUrl"); sysModel.Sign = ConfigClass.GetConfigString("Ticket", "Sign"); sysModel.CompanyCode = ConfigClass.GetConfigString("Ticket", "CompanyCode"); sysModel.cpcode = ConfigClass.GetConfigString("Ticket", "cpcode"); sysModel.sysPath = ConfigClass.GetConfigString("Ticket", "sysPath"); return(sysModel); }
/// <summary> /// 构造要跳转的URL /// </summary> /// <param name="model"></param> /// <param name="sysModel"></param> /// <returns></returns> private Adpost.Ticket.Model.TicketQueryResult QueryURL(Adpost.Ticket.Model.TicketModel model, TicketSystemModel sysModel) { Adpost.Ticket.Model.TicketQueryResult result = new Adpost.Ticket.Model.TicketQueryResult(); result.IsSuccess = true; result.TicketGotoUrl = ""; #region 表单验证 if (String.IsNullOrEmpty(sysModel.TicketInterfaceUrl)) { result.ErrorInfo.Append("请填写机票接口网址。\n"); result.IsSuccess = false; } if (!result.IsSuccess) { return(result); } #endregion #region 构造URL StringBuilder str = new StringBuilder(); Hashtable parameters = new Hashtable(); if (FXUser.ContainsKey(model.User.UserName)) { sysModel.cpcode = FXUser[model.User.UserName].ToString(); } str.AppendFormat("&CompanyCode={0}", sysModel.CompanyCode); str.AppendFormat("&cpcode={0}", sysModel.cpcode); str.AppendFormat("&sysPath={0}", sysModel.sysPath); str.AppendFormat("&sign={0}", sysModel.Sign); if (!String.IsNullOrEmpty(model.User.UserName)) { str.AppendFormat("&UserAccount={0}", HttpUtility.UrlEncodeUnicode(model.User.UserName)); str.AppendFormat("&UserID={0}", HttpUtility.UrlEncodeUnicode(sysModel.cpcode + "." + model.User.UserName)); str.AppendFormat("&UserName={0}", HttpUtility.UrlEncodeUnicode(model.User.UserName)); } str.AppendFormat("&MobilePhone={0}", "15356126700"); str.AppendFormat("&CompanyName={0}", HttpUtility.UrlEncodeUnicode(model.User.CorpName)); str.AppendFormat("&Email={0}", "*****@*****.**"); str.AppendFormat("&LinkMan={0}", HttpUtility.UrlEncodeUnicode("徐晟")); //parameters.Add("DoubleTrip", Convert.ToInt32(model.Flight.VoyageSet).ToString()); model.Flight.FromCity = "HGH"; model.Flight.ToCity = "PEK"; model.Flight.TakeOffDate = DateTime.Now; //if (!String.IsNullOrEmpty(model.Flight.FromCity)) //{ // parameters.Add("FromCityCode", model.Flight.FromCity); //} //if (!String.IsNullOrEmpty(model.Flight.ToCity)) //{ // parameters.Add("DestCityCode", model.Flight.ToCity); //} //if (model.Flight.TakeOffDate.HasValue) //{ // parameters.Add("LeaveDate", model.Flight.TakeOffDate.Value.ToString("yyyy-MM-dd")); //} //if (model.Flight.ReturnDate.HasValue) //{ // parameters.Add("ReturnDate", model.Flight.ReturnDate.Value.ToString("yyyy-MM-dd")); //} //else //{ // parameters.Add("ReturnDate", string.Empty); //} if (string.IsNullOrEmpty(Request.QueryString["url"])) { str.AppendFormat("&action={0}", HttpUtility.UrlEncode(ConfigClass.GetConfigString("Ticket", "QueryURL") + "?" + Sign(parameters) + "")); } else { str.AppendFormat("&action={0}", HttpUtility.UrlEncode(Request.QueryString["url"] + "?" + Sign(parameters) + "")); } string strURL = str.ToString(); if (strURL.StartsWith("&")) { strURL = strURL.Substring(1); } #endregion result.IsSuccess = true; result.TicketGotoUrl = sysModel.TicketInterfaceUrl + "?" + strURL; return(result); }
/// <summary> /// 构造要跳转的URL /// </summary> /// <param name="model"></param> /// <param name="sysModel"></param> /// <returns></returns> private Adpost.Ticket.Model.TicketQueryResult QueryURL(Adpost.Ticket.Model.TicketModel model, TicketSystemModel sysModel) { Adpost.Ticket.Model.TicketQueryResult result = new Adpost.Ticket.Model.TicketQueryResult(); result.IsSuccess = true; result.TicketGotoUrl = ""; #region 表单验证 if (String.IsNullOrEmpty(sysModel.TicketInterfaceUrl)) { result.ErrorInfo.Append("请填写机票接口网址。\n"); result.IsSuccess = false; } if (!result.IsSuccess) { return(result); } #endregion #region 构造URL StringBuilder str = new StringBuilder(); Hashtable parameters = new Hashtable(); if (FXUser.ContainsKey(model.User.UserName)) { sysModel.cpcode = FXUser[model.User.UserName].ToString(); } str.AppendFormat("&CompanyCode={0}", sysModel.CompanyCode); str.AppendFormat("&cpcode={0}", sysModel.cpcode); str.AppendFormat("&sysPath={0}", sysModel.sysPath); str.AppendFormat("&sign={0}", sysModel.Sign); if (!String.IsNullOrEmpty(model.User.UserName)) { str.AppendFormat("&UserAccount={0}", HttpUtility.UrlEncodeUnicode(model.User.UserName)); str.AppendFormat("&UserID={0}", HttpUtility.UrlEncodeUnicode(sysModel.cpcode + "." + model.User.UserName)); str.AppendFormat("&UserName={0}", HttpUtility.UrlEncodeUnicode(model.User.UserName)); } str.AppendFormat("&MobilePhone={0}", "15356126700"); str.AppendFormat("&CompanyName={0}", HttpUtility.UrlEncodeUnicode(model.User.CorpName)); str.AppendFormat("&Email={0}", "*****@*****.**"); str.AppendFormat("&LinkMan={0}", HttpUtility.UrlEncodeUnicode("徐晟")); parameters.Add("DoubleTrip", Convert.ToInt32(model.Flight.VoyageSet).ToString()); if (!String.IsNullOrEmpty(model.Flight.FromCity)) { parameters.Add("FromCityCode", model.Flight.FromCity); } if (!String.IsNullOrEmpty(model.Flight.ToCity)) { parameters.Add("DestCityCode", model.Flight.ToCity); } if (model.Flight.TakeOffDate.HasValue) { parameters.Add("LeaveDate", model.Flight.TakeOffDate.Value.ToString("yyyy-MM-dd")); } if (model.Flight.ReturnDate.HasValue) { parameters.Add("ReturnDate", model.Flight.ReturnDate.Value.ToString("yyyy-MM-dd")); } else { parameters.Add("ReturnDate", string.Empty); } str.AppendFormat("&action={0}", HttpUtility.UrlEncode("/sales/selectair_1.asp" + "?" + Sign(parameters) + "seattype=012&isback=0&LimitSupplier=&airline=")); string strURL = str.ToString(); if (strURL.StartsWith("&")) { strURL = strURL.Substring(1); } #endregion result.IsSuccess = true; result.TicketGotoUrl = sysModel.TicketInterfaceUrl + "?" + strURL; return(result); }