/// <summary> /// 查询订单 /// </summary> /// <param name="writer"></param> /// <param name="parames"></param> public override void Query(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames) { var pager = parames["pager"].Split(';'); int pageSize = int.Parse(pager[0]); int currPage = int.Parse(pager[1]); string con = SelWhere(parames); string orderby = " CreateTime desc"; int totalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager", outParams, new object[] { totalCount, pageSize, currPage, "*,dbo.GetCpyName(CPCpyNo) NewCpCpyName ", con, orderby }) as List <Tb_Ticket_Order>; totalCount = outParams.GetValue <int>("1"); writer.Write(new { TotalCount = totalCount, PageSize = pageSize, List = list }); }
/// <summary> /// 获取时间(处理时间) /// </summary> /// <param name="Order"></param> /// <returns></returns> private string[] GetTime(Tb_Ticket_Order Order) { string[] time = new string[2]; time[0] = ""; time[1] = ""; try { if (Order.PolicySource > 2) { //接口 if (!string.IsNullOrEmpty(Order.PolicyCancelTime)) { time[0] = Order.PolicyCancelTime; time[1] = Order.PolicyCancelTime; } } if (string.IsNullOrEmpty(time[0])) { string sqlWhere = "UninCode='" + Order.CPCpyNo + "'"; //出票方工作时间 PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <User_Company> User_CompanyList = baseDataManage.CallMethod("User_Company", "GetList", null, new Object[] { sqlWhere }) as List <User_Company>; if (User_CompanyList != null && User_CompanyList.Count > 0) { time[0] = User_CompanyList[0].WorkTime; time[1] = User_CompanyList[0].BusinessTime; } } } catch (Exception) { } return(time); }
//查询实时政策 http://ip/api/policy?orderId=... public override void Query(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames) { UserLoginInfo user = AuthLogin.GetUserInfo(Username); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); string orderId = parames["orderId"]; List <Tb_Ticket_Order> reList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { string.Format("orderID='{0}'", orderId) }) as List <Tb_Ticket_Order>; if (reList == null && reList.Count == 0) { writer.WriteEx(541, "Can't Found Order by OrderID", "通过OrderID找不到订单信息"); } else { Tb_Ticket_Order order = reList[0]; PolicyMatch pm = new PolicyMatch(); Regex reg = new Regex(@"(\w{3})-(\w{3})(/\2-(\w{3}))?"); if (reg.IsMatch(order.TravelCode)) { var ma = reg.Match(order.TravelCode); var fcity = ma.Groups[1].Value; var mcity = ma.Groups[3].Success ? ma.Groups[2].Value : ""; var tcity = ma.Groups[3].Success ? ma.Groups[4].Value : ma.Groups[2].Value; OrderInputParam InputParam = new OrderInputParam(); string ErrMsg = ""; Tb_Ticket_OrderBLL orderBLL = new Tb_Ticket_OrderBLL(); InputParam = orderBLL.GetOrder(orderId, InputParam, out ErrMsg); PbProject.Logic.Buy.AirQurey airqurey = new PbProject.Logic.Buy.AirQurey(user.BaseParametersList, user.User, user.Company); var catchID = airqurey.SkyListSaveCache(InputParam, "0");//PNR导入不能确定舱位是否是特价舱位,暂时默认写死为普通 YYY 2013-05-22 var swList = baseDataManage.CallMethod("Tb_Ticket_SkyWay", "GetList", null, new Object[] { string.Format("orderID='{0}'", orderId) }) as List <Tb_Ticket_SkyWay>; if (swList == null && swList.Count == 0) { writer.WriteEx(541, "Can't Found Ticket_SkyWay by OrderID", "通过OrderID找不到航程信息"); } swList = swList.OrderBy(p => p.FromDate).ToList(); var policy = pm.getMatchingPolicy(user.Company.UninCode, fcity, mcity, tcity, swList[0].FromDate.ToString(), swList.Count > 1 ? swList[1].FromDate.ToString() : swList[0].ToDate.ToString(), order.TravelType.ToString(), catchID, false, user.Company.GroupId, orderId, user.User, order.IsChdFlag, order.HaveBabyFlag, false); var lst = dataSetToList(policy, true); writer.Write(lst); } else { writer.WriteEx(541, "Error:TravelCode's format have error", "航班Code格式错误"); } } }