Example #1
0
        public Nomal_Passengers CloneNomalPassengers()
        {
            var passenger = new Nomal_Passengers();

            passenger.Code                   = code;
            passenger.Passenger_name         = passenger_name;
            passenger.Sex_code               = sex_code;
            passenger.Sex_name               = sex_name;
            passenger.Born_date              = born_date;
            passenger.Country_code           = country_code;
            passenger.Passenger_id_type_code = passenger_id_type_code;
            passenger.Passenger_id_type_name = passenger_id_type_name;
            passenger.Passenger_id_no        = passenger_id_no;
            passenger.Passenger_type         = passenger_type;
            passenger.Passenger_flag         = passenger_flag;
            passenger.Passenger_type_name    = passenger_type_name;
            passenger.Mobile_no              = mobile_no;
            passenger.Phone_no               = phone_no;
            passenger.Email                  = email;
            passenger.Address                = address;
            passenger.Postalcode             = postalcode;
            passenger.First_letter           = first_letter;
            passenger.RecordCount            = recordCount;
            passenger.TotalTimes             = total_times;
            passenger.Status                 = status;
            passenger.Information            = information;
            return(passenger);
        }
Example #2
0
        public void TranslationPassengerJson(string json, Action <List <Nomal_Passengers> > callback)
        {
            var passengerList = new List <Nomal_Passengers>();

            try
            {
                if (json != "")
                {
                    var obj = (JObject)JsonConvert.DeserializeObject(json);
                    if (obj["data"]["normal_passengers"].Any())
                    {
                        for (int i = 0; i < obj["data"]["normal_passengers"].Count(); i++)
                        {
                            var passengerObj = obj["data"]["normal_passengers"][i] as JObject;
                            var passenger    = new Nomal_Passengers(passengerObj);
                            passengerList.Add(passenger);
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                new LogInfo().WriteLine(String.Format("Entry:HTML_Translation_TranslationPassengerJson()\r\nException Catch:{0}\r\nSource:{1}\r\nException:{2}", ee.Message, ee.Source, ee.InnerException));
            }
            callback(passengerList);
        }
        /// <summary>
        /// 添加联系人
        /// </summary>
        /// <param name="data">联系人信息</param>
        private void AddPassengerInfo(Nomal_Passengers data)
        {
            modifyAction.PostData = String.Format("passenger_name={0}&sex_code={1}&_birthDate={2}&country_code={3}&passenger_id_type_code={4}&passenger_id_no={5}&mobile_no={6}&passenger_type={7}",
                            System.Web.HttpUtility.UrlEncode(data.Passenger_name), data.Sex_code, data.Born_date, data.Country_code, data.Passenger_id_type_code, data.Passenger_id_no, data.Mobile_no, data.Passenger_type);
            modifyAction.InitAddPassenger((str) =>
            {
                var returnString = translation.TranslationHtmlEx(str);
                if (returnString["messages"].Any())
                {
                    MessageBox.Show(returnString["messages"][0].ToString(), "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else if (returnString["data"]["message"] != null && returnString["data"]["message"].ToString() != "")
                {
                    MessageBox.Show(returnString["data"]["message"].ToString(), "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    MessageBox.Show("添加联系人成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //GetAllPassenger();
                    BeginGetPassengers();
                }

            }, _cookieContainer);
        }
        private void AddPassengerToGrid(string text,  Nomal_Passengers passenger, int index, string def)
        {
            dgvPassenger.Rows[index].Cells["xingming"].Value = text;
            dgvPassenger.Rows[index].Cells["xingming"].Tag = passenger;//存储乘车人信息
            dgvPassenger.Rows[index].Cells["zhengjianhao"].Value = passenger.Passenger_id_no;
            dgvPassenger.Rows[index].Cells["shoujihao"].Value = passenger.Mobile_no;
            if (def != "")
            {
                try
                {
                    dgvPassenger.Rows[index].Cells["xibie"].Value = ((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items[((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items.IndexOf(def)].ToString();
                }
                catch {
                    dgvPassenger.Rows[index].Cells["xibie"].Value = ((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items[((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items.Count - 1].ToString();
                }
            }
            else
                dgvPassenger.Rows[index].Cells["xibie"].Value = ((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items[((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items.Count - 1].ToString();
            //有其它座位可以选择的时候不选择无座为默认坐席
            if (dgvPassenger.Rows[index].Cells["xibie"].Value.ToString() == "无座" && ((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items.Count > 1)
            {
                dgvPassenger.Rows[index].Cells["xibie"].Value = ((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items[((DataGridViewComboBoxColumn)dgvPassenger.Columns[1]).Items.Count - 2].ToString();
            }
            string typeCode = passenger.Passenger_id_type_code;
            foreach (var v in DatasList.CardType.Keys)
            {
                if (DatasList.CardType[v].ToString() == typeCode)
                {
                    typeCode = v.ToString();
                    break;
                }
            }
            dgvPassenger.Rows[index].Cells["zhengjian"].Value = typeCode.Length >= 2 ? typeCode : ((DataGridViewComboBoxColumn)dgvPassenger.Columns[3]).Items[0].ToString();

            dgvPassenger.Rows[index].Cells["piaozhong"].Value = passenger.TicketCodeName;

            dgvPassenger.Refresh();
        }
 public void TranslationPassengerJson(string json, Action<List<Nomal_Passengers>> callback)
 {
     var passengerList = new List<Nomal_Passengers>();
     try
     {
         if (json != "")
         {
             var obj = (JObject) JsonConvert.DeserializeObject(json);
             if (obj["data"]["normal_passengers"].Any())
             {
                 for (int i = 0; i < obj["data"]["normal_passengers"].Count(); i++)
                 {
                     var passengerObj = obj["data"]["normal_passengers"][i] as JObject;
                     var passenger = new Nomal_Passengers(passengerObj);
                     passengerList.Add(passenger);
                 }
             }
         }
     }
     catch (Exception ee)
     {
         new LogInfo().WriteLine(String.Format("Entry:HTML_Translation_TranslationPassengerJson()\r\nException Catch:{0}\r\nSource:{1}\r\nException:{2}", ee.Message, ee.Source, ee.InnerException));
     }
     callback(passengerList);
 }
 /// <summary>
 /// 检查联系人的身份核实状态
 /// </summary>
 /// <param name="passenger"></param>
 /// <returns></returns>
 private string CheckPassengerStatus(Nomal_Passengers passenger)
 {
     if (passenger.Passenger_id_type_code == "2")
     {
         this.Information = "12306不再支持一代居民身份证,请更改为二代居民身份证";
         return "未通过";
     }
     else
     {
         if (passenger.TotalTimes == "95" || passenger.TotalTimes == "97")
         {
             return "已通过";
         }
         else if (passenger.TotalTimes == "93" || passenger.TotalTimes == "99")
         {
             if (passenger.Passenger_id_type_code == "1")
             {
                 return "已通过";
             }
             else
             {
                 return "预通过";
             }
         }
         else if (passenger.TotalTimes == "94" || passenger.TotalTimes == "96")
         {
             if (passenger.Passenger_id_type_code == "1")
             {
                 this.Information = "身份信息经过核验但未通过,需修改在12306中所填写的身份信息内容与二代居民身份证原件完全一致,\r\n保存后状态仍显示“待核验”时,需持二代居民身份证原件到车站售票窗口或铁路客票代售点办理核验,\r\n详见《铁路互联网购票身份核验须知》";
                 return "未通过";
             }
             else
             {
                 this.Information = "身份信息核验未通过,详见《铁路互联网购票身份核验须知》";
                 return "未通过";
             }
         }
         else if(passenger.TotalTimes == "92" || passenger.TotalTimes == "98")
         {
             if (passenger.Passenger_id_type_code == "B" || passenger.Passenger_id_type_code == "C" || passenger.Passenger_id_type_code == "G")
             {
                 this.Information = "身份信息未经核验,需持在12306中填写的有效身份证件原件到车站售票窗口办理预核验,\r\n详见《铁路互联网购票身份核验须知》";
                 return "请报验";
             }
             else
             {
                 this.Information = "身份信息未经核验,需持二代居民身份证原件到车站售票窗口或铁路客票代售点办理核验,\r\n详见《铁路互联网购票身份核验须知》";
                 return "待核验";
             }
         }
         else if (passenger.TotalTimes == "91")
         {
             if (passenger.Passenger_id_type_code == "B" || passenger.Passenger_id_type_code == "C" || passenger.Passenger_id_type_code == "G")
             {
                 this.Information = "身份信息未经核验,需持在12306中填写的有效身份证件原件到车站售票窗口办理预核验,\r\n详见《铁路互联网购票身份核验须知》";
                 return "请报验";
             }
         }
     }
     this.Information = "身份信息未经核验,需持在12306中填写的有效身份证件原件到车站售票窗口办理预核验,\r\n详见《铁路互联网购票身份核验须知》";
     return "请报验";
 }
 public Nomal_Passengers CloneNomalPassengers()
 {
     var passenger = new Nomal_Passengers();
     passenger.Code = code;
     passenger.Passenger_name = passenger_name;
     passenger.Sex_code = sex_code;
     passenger.Sex_name = sex_name;
     passenger.Born_date = born_date;
     passenger.Country_code = country_code;
     passenger.Passenger_id_type_code = passenger_id_type_code;
     passenger.Passenger_id_type_name = passenger_id_type_name;
     passenger.Passenger_id_no = passenger_id_no;
     passenger.Passenger_type = passenger_type;
     passenger.Passenger_flag = passenger_flag;
     passenger.Passenger_type_name = passenger_type_name;
     passenger.Mobile_no = mobile_no;
     passenger.Phone_no = phone_no;
     passenger.Email = email;
     passenger.Address = address;
     passenger.Postalcode = postalcode;
     passenger.First_letter = first_letter;
     passenger.RecordCount = recordCount;
     passenger.TotalTimes = total_times;
     passenger.Status = status;
     passenger.Information = information;
     return passenger;
 }
Example #8
0
 /// <summary>
 /// 检查联系人的身份核实状态
 /// </summary>
 /// <param name="passenger"></param>
 /// <returns></returns>
 private string CheckPassengerStatus(Nomal_Passengers passenger)
 {
     if (passenger.Passenger_id_type_code == "2")
     {
         this.Information = "12306不再支持一代居民身份证,请更改为二代居民身份证";
         return("未通过");
     }
     else
     {
         if (passenger.TotalTimes == "95" || passenger.TotalTimes == "97")
         {
             return("已通过");
         }
         else if (passenger.TotalTimes == "93" || passenger.TotalTimes == "99")
         {
             if (passenger.Passenger_id_type_code == "1")
             {
                 return("已通过");
             }
             else
             {
                 return("预通过");
             }
         }
         else if (passenger.TotalTimes == "94" || passenger.TotalTimes == "96")
         {
             if (passenger.Passenger_id_type_code == "1")
             {
                 this.Information = "身份信息经过核验但未通过,需修改在12306中所填写的身份信息内容与二代居民身份证原件完全一致,\r\n保存后状态仍显示“待核验”时,需持二代居民身份证原件到车站售票窗口或铁路客票代售点办理核验,\r\n详见《铁路互联网购票身份核验须知》";
                 return("未通过");
             }
             else
             {
                 this.Information = "身份信息核验未通过,详见《铁路互联网购票身份核验须知》";
                 return("未通过");
             }
         }
         else if (passenger.TotalTimes == "92" || passenger.TotalTimes == "98")
         {
             if (passenger.Passenger_id_type_code == "B" || passenger.Passenger_id_type_code == "C" || passenger.Passenger_id_type_code == "G")
             {
                 this.Information = "身份信息未经核验,需持在12306中填写的有效身份证件原件到车站售票窗口办理预核验,\r\n详见《铁路互联网购票身份核验须知》";
                 return("请报验");
             }
             else
             {
                 this.Information = "身份信息未经核验,需持二代居民身份证原件到车站售票窗口或铁路客票代售点办理核验,\r\n详见《铁路互联网购票身份核验须知》";
                 return("待核验");
             }
         }
         else if (passenger.TotalTimes == "91")
         {
             if (passenger.Passenger_id_type_code == "B" || passenger.Passenger_id_type_code == "C" || passenger.Passenger_id_type_code == "G")
             {
                 this.Information = "身份信息未经核验,需持在12306中填写的有效身份证件原件到车站售票窗口办理预核验,\r\n详见《铁路互联网购票身份核验须知》";
                 return("请报验");
             }
         }
     }
     this.Information = "身份信息未经核验,需持在12306中填写的有效身份证件原件到车站售票窗口办理预核验,\r\n详见《铁路互联网购票身份核验须知》";
     return("请报验");
 }
        /// <summary>
        /// 初始化编辑
        /// </summary>
        /// <param name="data">乘客信息</param>
        private void InitEditPassengerInfo(Nomal_Passengers oldPas, Nomal_Passengers newPas)
        {
            modifyAction.PostData = String.Format("passenger_name={0}&old_passenger_name={1}&passenger_id_type_code={2}&old_passenger_id_type_code={3}&passenger_id_no={4}&old_passenger_id_no={5}&mobile_no={6}&passenger_type={7}&sex_code={8}&_birthDate={9}&country_code={10}",
                System.Web.HttpUtility.UrlEncode(newPas.Passenger_name), System.Web.HttpUtility.UrlEncode(oldPas.Passenger_name), newPas.Passenger_id_type_code, oldPas.Passenger_id_type_code, newPas.Passenger_id_no, oldPas.Passenger_id_no, newPas.Mobile_no, newPas.Passenger_type, newPas.Sex_code, newPas.Born_date, newPas.Country_code);
            modifyAction.InitModifyPassenger((str) =>
            {
                var returnString = translation.TranslationHtmlEx(str);
                if (returnString["messages"].Any())
                    MessageBox.Show(returnString["messages"][0].ToString(), "更新失败", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);

                else if (returnString["data"]["message"] != null && returnString["data"]["message"].ToString() != "")
                {
                    MessageBox.Show(returnString["data"]["message"].ToString(), "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    MessageBox.Show("更新成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    BeginGetPassengers();
                    //GetAllPassenger();
                }

            }, _cookieContainer);
        }
 /// <summary>
 /// 添加联系人
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtPassengerName.Text == "" && txtIDCode.Text == "") return;
     if (!IsaName(txtPassengerName.Text) && txtPassengerName.Text != "")
     {
         //MessageBox.Show("请确认乘车人姓名是否合法(姓名应为中文汉字)", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         tt.SetToolTip(txtPassengerName, "请确认乘车人姓名是否合法(姓名应为中文汉字)");
         tt.Show("请确认乘车人姓名是否合法(姓名应为中文汉字)", txtPassengerName, 2500);
         return;
     }
     if (!IsIDCardNo(txtIDCode.Text) && txtIDCode.Text != "")
     {
         //MessageBox.Show("请确认身份证号填写正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         tt.SetToolTip(txtIDCode, "请确认身份证号填写正确");
         tt.Show("请确认身份证号填写正确", txtIDCode, 2500);
         return;
     }
     if (txtMobileNO.Text != "" && !IsPhoneNum(txtMobileNO.Text))
     {
         //MessageBox.Show("请确认手机号码格式正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         tt.SetToolTip(txtMobileNO, "请确认手机号码格式正确");
         tt.Show("请确认手机号码格式正确", txtMobileNO, 2500);
         return;
     }
     var passenger = new Nomal_Passengers();
     passenger.Passenger_name = txtPassengerName.Text.Trim();//姓名
     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;//生日
     passenger.Country_code = "CN";
     passenger.Passenger_id_type_code = DatasList.TicketType[string.Format("{0}票", cboTicketType.Text)].ToString();//票种
     passenger.Passenger_type = DatasList.CardType[cboIDType.Text].ToString(); //证件类型
     passenger.Passenger_id_no = txtIDCode.Text.Trim(); //证件号
     passenger.Sex_code = int.Parse(passenger.Passenger_id_no.Substring(passenger.Passenger_id_no.Length - 2, 1)) / 2 == 0 ? "F" : "M";
     passenger.Mobile_no = txtMobileNO.Text.Trim(); //手机
     AddPassengerInfo(passenger);
 }