Exemplo n.º 1
0
 protected void initData(string id)
 {
     this.BindVisitorType();
     this.BindCardType();
     this.InitCountryList();
     this.InitProvince();
     //编辑时初始化
     if (!string.IsNullOrEmpty(id))
     {
         EyouSoft.BLL.TicketStructure.TicketVisitor BLL = new EyouSoft.BLL.TicketStructure.TicketVisitor();
         TicketVistorInfo Model = BLL.GetTicketVisitorInfo(id);
         if (null != Model)
         {
             this.txtNameCn.Value       = Model.ChinaName;                                                                                                                       //中文名
             this.txtNameEn.Value       = Model.EnglishName;                                                                                                                     //英文名
             this.ddlType.SelectedValue = ((int)Model.VistorType).ToString();                                                                                                    //旅客类型
             this.Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), string.Format("TravelersAdd.setSex('{0}');", (int)Model.ContactSex), true); //性别
             this.txtMobile.Value            = Model.Mobile;                                                                                                                     //手机号码
             this.txtTel.Value               = Model.ContactTel;                                                                                                                 //电话号码
             this.txtAddress.Value           = Model.Address;                                                                                                                    //邮寄地址
             this.txtPostCode.Value          = Model.ZipCode;                                                                                                                    //邮编
             this.txtBirth.Value             = string.Format("{0:yyyy-MM-dd}", Model.BirthDay);                                                                                  //生日
             this.txtCardId.Value            = Model.IdCardCode;                                                                                                                 //身份证
             this.txtPassport.Value          = Model.PassportCode;                                                                                                               //护照
             this.ddlOtherCard.SelectedValue = ((int)Model.CardType).ToString();                                                                                                 //其它证件
             this.txtCardNum.Value           = Model.CardNo;                                                                                                                     //证件号码
             this.ddlCountry.SelectedValue   = Model.CountryId.ToString();                                                                                                       //所在国家
             //地区,省、市、区
             this.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), string.Format("TravelersAdd.InitPlace('{0}','{1}','{2}');", Model.ProvinceId, Model.CityId, Model.DistrictId), true);
             this.txtRemark.Value = Model.Remark;//备注
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        protected void pageSave(string id)
        {
            StringBuilder strMsg = new StringBuilder();

            EyouSoft.BLL.TicketStructure.TicketVisitor BLL = new EyouSoft.BLL.TicketStructure.TicketVisitor();
            TicketVistorInfo Model;

            if (string.IsNullOrEmpty(id))
            {//新增
                Model           = new TicketVistorInfo();
                Model.IssueTime = DateTime.Now;
                strMsg.Append(this.commonModel(Model));
                if (strMsg.Length == 0 && BLL.AddTicketVisitorInfo(Model))
                {
                    strMsg.Append("添加成功!");
                }
                else
                {
                    strMsg.Remove(0, strMsg.Length);
                    strMsg.Append("添加失败!");
                }
            }
            else
            { //编辑
                Model = BLL.GetTicketVisitorInfo(id);
                if (null != Model)
                {
                    strMsg.Append(this.commonModel(Model));
                    if (strMsg.Length == 0 && BLL.UpdateTicketVisitorInfo(Model))
                    {
                        strMsg.Append("更新成功!");
                    }
                    else
                    {
                        strMsg.Remove(0, strMsg.Length);
                        strMsg.Append("更新失败!");
                    }
                }
            }
            Response.Clear();
            Response.Write(strMsg);
            Response.End();
        }