/// <summary> /// 设置参数 /// </summary> /// <param name="left"></param> private string InitQueryTicketParam(leftTicketDTO left) { string url = "https://kyfw.12306.cn/otn/leftTicket/query?leftTicketDTO.train_date={train_date}&leftTicketDTO.from_station={from_station}&leftTicketDTO.to_station={to_station}&purpose_codes={purpose_codes}"; string[] param = left.GetEntityProperties(); foreach (string item in param) { url= url.Replace("{" + item+"}", left.GetPropertyValue(item)); } return url; }
void GetPapeParam() { ticketParam = new leftTicketDTO(); DateTime goTime = dtpGoTime.Value; ticketParam.from_station= GetComboBoxSelectItemKey(cmbBeginStation); ticketParam.to_station = GetComboBoxSelectItemKey(cmbToStation); ticketParam.train_date = goTime.ToString(CommonFormat.DateFormat); if (string.IsNullOrEmpty(ticketParam.purpose_codes)) { ticketParam.purpose_codes = "ADULT"; } }