/// <summary> /// 初始化编辑 /// </summary> /// <param name="data">乘客信息</param> private void InitEditPassengerInfo(PassengersAllData data) { modifyAction.PostData = "org.apache.struts.taglib.html.TOKEN=" + TokenInit + "&name=" + translation.UtfEncode(data.passenger_name) + "&card_type=" + data.card_type + "&card_no=" + data.card_no + "&passenger_type=" + data.passenger_type; modifyAction.InitModifyPassenger((str) => { if (str.IndexOf("保存") > -1) { TokenEdit = System.Text.RegularExpressions.Regex.Match(str, "[0-9abcdefABCDEF]{32}").ToString(); UpdatePassengerInfo(data); } else { MessageBox.Show("提示", "更新失败", MessageBoxButtons.OK, MessageBoxIcon.Information); } }, _cookieContainer); }
/// <summary> /// 更新变更 /// </summary> /// <param name="data">乘客信息</param> private void UpdatePassengerInfo(PassengersAllData data) { modifyAction.PostData = string.Format("org.apache.struts.taglib.html.TOKEN={0}&name={1}&old_name={2}&gender={3}&sex_code={4}&born_date={5}&country_code={6}&card_type={7}&old_card_type={8}&card_no={9}&old_card_no={10}&psgTypeCode={11}&passenger_type={12}&mobile_no={13}&phone_no={14}&email={15}&address={16}&postalcode={17}&studentInfo.province_code={18}&studentInfo.school_code{19}&studentInfo.school_name={20}&studentInfo.department={21}&studentInfo.school_class={22}&studentInfo.student_no={23}&schoolSystemDefault={24}&studentInfo.school_system={25}&enterYearCode={26}&studentInfo.enter_year={27}&studentInfo.preference_card_no={28}&studentInfo.preference_from_station_name={29}&studentInfo.preference_from_station_code={30}&studentInfo.preference_to_station_name={31}&studentInfo.preference_to_station_code={32}", TokenEdit, translation.UtfEncode(data.passenger_name), translation.UtfEncode(data.old_name), data.gender, data.sex_code, data.born_date, data.country_code, data.card_type, data.old_card_type, data.card_no, data.old_card_no, data.psgTypeCode, data.passenger_type, data.mobile_no, data.phone_no, data.email, data.address, data.postalcode, data.studentInfo_province_code, data.studentInfo_school_code, data.studentInfo_school_name, data.studentInfo_department, data.studentInfo_school_class, data.studentInfo_student_no, data.schoolSystemDefault, data.studentInfo_school_system, data.enterYearCode, data.studentInfo_enter_year, data.studentInfo_preference_card_no, data.studentInfo_preference_from_station_name, data.studentInfo_preference_from_station_code, data.studentInfo_preference_to_station_name, data.studentInfo_preference_to_station_code); modifyAction.ModifyPassenger((str) => { if (str != "") { if (str.IndexOf("修改常用联系人成功") > -1) { MessageBox.Show("修改常用联系人成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); GetAllPassenger(); } else { string message = System.Text.RegularExpressions.Regex.Match(str, "(?<=var message = \")[\\u4E00-\\u9FFF]+").ToString(); MessageBox.Show(string.Format("修改联系人失败:{0}", message), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }, _cookieContainer); }
public void TranslationHtml(string html, Action <List <PassengersAllData> > callback) { List <PassengersAllData> passengers = new List <PassengersAllData>(); if (html != "") { var obj = JSON.decode(html) as JavaScriptObject; int recordCount = Convert.ToInt32(obj["recordCount"]); var Rows = obj["rows"] as object[]; for (int i = 0; i < recordCount; i++) { var jobj = Rows[i] as JavaScriptObject; var psData = new PassengersAllData(jobj); passengers.Add(psData); } if (passengers != null) { callback(passengers); } } }
/// <summary> /// 初始化添加信息 /// </summary> /// <param name="data">联系人信息</param> private void InitAddPassengerInfo(PassengersAllData data) { modifyAction.PostData = "org.apache.struts.taglib.html.TOKEN=" + TokenInit + "&name=" + "&card_type=" + "&card_no=" + "&passenger_type=" + "&search=%E8%AF%B7%E8%BE%93%E5%85%A5%E6%B1%89%E5%AD%97%E6%88%96%E6%8B%BC%E9%9F%B3%E9%A6%96%E5%AD%97%E6%AF%8D"; modifyAction.InitAddPassenger((str) => { if (str.IndexOf("保存") > -1) { TokenEdit = System.Text.RegularExpressions.Regex.Match(str, "[0-9abcdefABCDEF]{32}").ToString(); SavePassengerInfo(data); } else { MessageBox.Show("提示", "获取添加页面失败", MessageBoxButtons.OK, MessageBoxIcon.Information); } }, _cookieContainer); }
/// <summary> /// 添加联系人 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { if (!IsaName(txtPassengerName.Text)&&txtPassengerName.Text!="") { MessageBox.Show("请确认乘车人姓名是否合法(姓名应为中文汉字)", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!IsIDCardNo(txtIDCode.Text)&&txtIDCode.Text!="") { MessageBox.Show("请确认身份证号填写正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtMobileNO.Text!=""&&!IsPhoneNum(txtMobileNO.Text)) { MessageBox.Show("请确认手机号码格式正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } PassengersAllData passenger = new PassengersAllData(txtPassengerName.Text,cboIDType.Text, txtIDCode.Text,cboTicketType.Text,txtMobileNO.Text); InitAddPassengerInfo(passenger); }
/// <summary> /// 添加联系人 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { if (!IsaName(txtPassengerName.Text) && txtPassengerName.Text != "") { MessageBox.Show("请确认乘车人姓名是否合法(姓名应为中文汉字)", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!IsIDCardNo(txtIDCode.Text) && txtIDCode.Text != "") { MessageBox.Show("请确认身份证号填写正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtMobileNO.Text != "" && !IsPhoneNum(txtMobileNO.Text)) { MessageBox.Show("请确认手机号码格式正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } PassengersAllData passenger = new PassengersAllData(txtPassengerName.Text, cboIDType.Text, txtIDCode.Text, cboTicketType.Text, txtMobileNO.Text); InitAddPassengerInfo(passenger); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (!IsaName(txtPassengerName.Text) && txtPassengerName.Text != "") { MessageBox.Show("请确认乘车人姓名是否合法(姓名应为中文汉字)", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!IsIDCardNo(txtIDCode.Text) && txtIDCode.Text != "") { MessageBox.Show("请确认身份证号填写正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtMobileNO.Text != "" && !IsPhoneNum(txtMobileNO.Text)) { MessageBox.Show("请确认手机号码格式正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtPassengerName.Tag != null) { PassengersAllData passenger = (PassengersAllData)txtPassengerName.Tag; passenger.old_name = passenger.passenger_name; passenger.old_card_type = passenger.card_type; passenger.old_card_no = passenger.card_no; passenger.passenger_name = txtPassengerName.Text; passenger.card_type = DatasList.CardType[cboIDType.Text].ToString(); passenger.card_no = txtIDCode.Text; passenger.passenger_id_type_name = cboIDType.Text; passenger.passenger_type = DatasList.TicketType[string.Format("{0}票", cboTicketType.Text)].ToString(); passenger.passenger_type_name = cboTicketType.Text; passenger.mobile_no = txtMobileNO.Text; passenger.born_date = txtIDCode.Text.Length > 14 ? string.Format("{0}-{1}-{2}", txtIDCode.Text.Substring(6, 4), txtIDCode.Text.Substring(10, 2), txtIDCode.Text.Substring(12, 2)) : passenger.born_date; InitEditPassengerInfo(passenger); } }
public void TranslationHtml(string html, Action<List<PassengersAllData>> callback) { List<PassengersAllData> passengers = new List<PassengersAllData>(); if (html != "") { var obj = JSON.decode(html) as JavaScriptObject; int recordCount = Convert.ToInt32(obj["recordCount"]); var Rows = obj["rows"] as object[]; for (int i = 0; i < recordCount; i++) { var jobj = Rows[i] as JavaScriptObject; var psData = new PassengersAllData(jobj); passengers.Add(psData); } if (passengers != null) callback(passengers); } }
/// <summary> /// 更新变更 /// </summary> /// <param name="data">乘客信息</param> private void UpdatePassengerInfo(PassengersAllData data) { modifyAction.PostData = string.Format("org.apache.struts.taglib.html.TOKEN={0}&name={1}&old_name={2}&gender={3}&sex_code={4}&born_date={5}&country_code={6}&card_type={7}&old_card_type={8}&card_no={9}&old_card_no={10}&psgTypeCode={11}&passenger_type={12}&mobile_no={13}&phone_no={14}&email={15}&address={16}&postalcode={17}&studentInfo.province_code={18}&studentInfo.school_code{19}&studentInfo.school_name={20}&studentInfo.department={21}&studentInfo.school_class={22}&studentInfo.student_no={23}&schoolSystemDefault={24}&studentInfo.school_system={25}&enterYearCode={26}&studentInfo.enter_year={27}&studentInfo.preference_card_no={28}&studentInfo.preference_from_station_name={29}&studentInfo.preference_from_station_code={30}&studentInfo.preference_to_station_name={31}&studentInfo.preference_to_station_code={32}", TokenEdit, translation.UtfEncode(data.passenger_name), translation.UtfEncode(data.old_name), data.gender, data.sex_code, data.born_date, data.country_code, data.card_type, data.old_card_type, data.card_no, data.old_card_no, data.psgTypeCode, data.passenger_type, data.mobile_no, data.phone_no, data.email, data.address, data.postalcode, data.studentInfo_province_code, data.studentInfo_school_code, data.studentInfo_school_name, data.studentInfo_department, data.studentInfo_school_class, data.studentInfo_student_no, data.schoolSystemDefault, data.studentInfo_school_system, data.enterYearCode, data.studentInfo_enter_year, data.studentInfo_preference_card_no, data.studentInfo_preference_from_station_name, data.studentInfo_preference_from_station_code, data.studentInfo_preference_to_station_name, data.studentInfo_preference_to_station_code); modifyAction.ModifyPassenger((str) => { if (str != "") { if (str.IndexOf("修改常用联系人成功") > -1) { MessageBox.Show("修改常用联系人成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); GetAllPassenger(); } else { string message = System.Text.RegularExpressions.Regex.Match(str, "(?<=var message = \")[\\u4E00-\\u9FFF]+").ToString(); MessageBox.Show(string.Format("修改联系人失败:{0}", message), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } },_cookieContainer); }
/// <summary> /// 初始化编辑 /// </summary> /// <param name="data">乘客信息</param> private void InitEditPassengerInfo(PassengersAllData data) { modifyAction.PostData = "org.apache.struts.taglib.html.TOKEN=" + TokenInit + "&name=" + translation.UtfEncode(data.passenger_name) + "&card_type=" + data.card_type + "&card_no=" + data.card_no + "&passenger_type=" + data.passenger_type; modifyAction.InitModifyPassenger((str) => { if (str.IndexOf("保存") > -1) { TokenEdit = System.Text.RegularExpressions.Regex.Match(str, "[0-9abcdefABCDEF]{32}").ToString(); UpdatePassengerInfo(data); } else { MessageBox.Show("提示", "更新失败", MessageBoxButtons.OK, MessageBoxIcon.Information); } },_cookieContainer); }
/// <summary> /// 初始化添加信息 /// </summary> /// <param name="data">联系人信息</param> private void InitAddPassengerInfo(PassengersAllData data) { modifyAction.PostData = "org.apache.struts.taglib.html.TOKEN=" + TokenInit + "&name=" + "&card_type=" + "&card_no=" + "&passenger_type=" +"&search=%E8%AF%B7%E8%BE%93%E5%85%A5%E6%B1%89%E5%AD%97%E6%88%96%E6%8B%BC%E9%9F%B3%E9%A6%96%E5%AD%97%E6%AF%8D"; modifyAction.InitAddPassenger((str) => { if (str.IndexOf("保存") > -1) { TokenEdit = System.Text.RegularExpressions.Regex.Match(str, "[0-9abcdefABCDEF]{32}").ToString(); SavePassengerInfo(data); } else { MessageBox.Show("提示", "获取添加页面失败", MessageBoxButtons.OK, MessageBoxIcon.Information); } }, _cookieContainer); }