/// <summary> /// 修改常旅客 /// </summary> /// <param name="model">常旅客信息实体</param> /// <returns>1:成功,0:失败</returns> public virtual int Update(EyouSoft.Model.TicketStructure.TicketVistorInfo model) { DbCommand cmd = _db.GetSqlStringCommand(SQL_UPDATE_Update); _db.AddInParameter(cmd, "ID", DbType.AnsiStringFixedLength, model.Id); _db.AddInParameter(cmd, "CardType", DbType.Int32, model.CardType); _db.AddInParameter(cmd, "CardNo", DbType.String, model.CardNo); _db.AddInParameter(cmd, "ChinaName", DbType.String, model.ChinaName); _db.AddInParameter(cmd, "EnglishName", DbType.String, model.EnglishName); _db.AddInParameter(cmd, "ContactSex", DbType.AnsiStringFixedLength, (int)model.ContactSex); _db.AddInParameter(cmd, "ContactTel", DbType.String, model.ContactTel); _db.AddInParameter(cmd, "Remark", DbType.String, model.Remark); _db.AddInParameter(cmd, "NationCode", DbType.String, model.NationInfo.NationId); _db.AddInParameter(cmd, "VistorType", DbType.Byte, model.VistorType); _db.AddInParameter(cmd, "DataType", DbType.AnsiStringFixedLength, (int)model.DataType); _db.AddInParameter(cmd, "Mobile", DbType.String, model.Mobile); _db.AddInParameter(cmd, "MailingAddress", DbType.String, model.Address); _db.AddInParameter(cmd, "ZipCode", DbType.String, model.ZipCode); if (model.BirthDay.HasValue) { _db.AddInParameter(cmd, "Birthday", DbType.DateTime, model.BirthDay); } else { _db.AddInParameter(cmd, "Birthday", DbType.DateTime, DBNull.Value); } _db.AddInParameter(cmd, "IDCard", DbType.String, model.IdCardCode); _db.AddInParameter(cmd, "Passport", DbType.String, model.PassportCode); _db.AddInParameter(cmd, "CountryId", DbType.Int32, model.CountryId); _db.AddInParameter(cmd, "ProvinceId", DbType.Int32, model.ProvinceId); _db.AddInParameter(cmd, "CityId", DbType.Int32, model.CityId); _db.AddInParameter(cmd, "CountyId", DbType.Int32, model.DistrictId); return(DbHelper.ExecuteSql(cmd, this._db)); }
/// <summary> /// 修改常旅客 /// </summary> /// <param name="TicketVisitorInfo">常旅客实体</param> /// <returns></returns> public bool UpdateTicketVisitorInfo(EyouSoft.Model.TicketStructure.TicketVistorInfo TicketVisitorInfo) { if (TicketVisitorInfo == null || string.IsNullOrEmpty(TicketVisitorInfo.Id)) { return(false); } return(idal.Update(TicketVisitorInfo) > 0 ? true : false); }
/// <summary> /// 获取常旅客信息集合 /// </summary> /// <param name="pageSize">每页记录数</param> /// <param name="pageIndex">页索引</param> /// <param name="recordCount">总记录数</param> /// <param name="companyId">公司编号</param> /// <param name="isPaging">是否分页</param> /// <param name="searchInfo">查询信息</param> /// <returns></returns> public virtual IList <EyouSoft.Model.TicketStructure.TicketVistorInfo> GetVisitors(int pageSize, int pageIndex, ref int recordCount, string companyId, bool isPaging, EyouSoft.Model.TicketStructure.MVisitorSearchInfo searchInfo) { IList <EyouSoft.Model.TicketStructure.TicketVistorInfo> items = new List <EyouSoft.Model.TicketStructure.TicketVistorInfo>(); string tableName = "tbl_TicketVistorInfo"; string fileds = "*"; string orderby = " IssueTime ASC"; StringBuilder query = new StringBuilder(); #region 拼接查询 query.AppendFormat(" CompanyId='{0}' ", companyId); if (searchInfo != null) { if (searchInfo.Type.HasValue) { query.AppendFormat(" AND [DataType]='{0}' ", (int)searchInfo.Type.Value); } if (!string.IsNullOrEmpty(searchInfo.Name)) { if (IsLetter(searchInfo.Name)) { query.AppendFormat(" AND EnglishName LIKE '%{0}%' ", searchInfo.Name); } else { query.AppendFormat(" AND ChinaName LIKE '%{0}%' ", searchInfo.Name); } } if (searchInfo.VType.HasValue) { query.AppendFormat(" AND VistorType='{0}' ", (int)searchInfo.VType); } if (!string.IsNullOrEmpty(searchInfo.KeyWord)) { query.AppendFormat( " AND isnull(ChinaName,'') + isnull(EnglishName,'') + isnull(Mobile,'') like '%{0}%' ", searchInfo.KeyWord); } } #endregion using (IDataReader dr = isPaging ? DbHelper.ExecuteReader(this._db, pageSize, pageIndex, ref recordCount, tableName, "ID", fileds, query.ToString(), orderby) : DbHelper.ExecuteReader(_db, tableName, fileds, query.ToString(), orderby)) { while (dr.Read()) { var item = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); InputModelValue(item, dr); items.Add(item); } } return(items); }
/// <summary> /// 添加常旅客 /// </summary> /// <param name="TicketVisitorInfo">常旅客实体</param> /// <returns></returns> public bool AddTicketVisitorInfo(EyouSoft.Model.TicketStructure.TicketVistorInfo TicketVisitorInfo) { if (TicketVisitorInfo == null) { return(false); } TicketVisitorInfo.Id = Guid.NewGuid().ToString(); TicketVisitorInfo.IssueTime = DateTime.Now; return(AddTicketVisitorList(new List <EyouSoft.Model.TicketStructure.TicketVistorInfo>() { TicketVisitorInfo }) == 1 ? true : false); }
protected string CompanyId = string.Empty; //公司id #endregion #region 页面加载 protected void Page_Load(object sender, EventArgs e) { CompanyId = this.SiteUserInfo.CompanyID; this.ImgSave.ImageUrl = ImageManage.GetImagerServerUrl(1) + "/images/jipiao/bc_btn.jpg"; // 初始化旅客类型 BindVisitorType(); //绑定证件类型 BindCardType(); //初始化国家 InitCountryList(); if (!string.IsNullOrEmpty(Utils.InputText(Context.Request.QueryString["EditId"]))) { EditId = Utils.GetString(Context.Request.QueryString["EditId"], ""); } if (!Page.IsPostBack) { //根据旅客ID获得常旅客实体对象 EyouSoft.Model.TicketStructure.TicketVistorInfo TicketVisitorInfo = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().GetTicketVisitorInfo(EditId.ToString()); this.Master.Naviagtion = AirTicketNavigation.机票常旅客管理; this.Title = "常旅客添加_机票"; #region 初始化表单数据 if (TicketVisitorInfo != null) { this.ddlCardType.SelectedValue = ((int)TicketVisitorInfo.CardType).ToString(); this.ddlVisitoryType.SelectedValue = ((int)TicketVisitorInfo.VistorType).ToString(); this.ddlCountry.SelectedValue = ((int)TicketVisitorInfo.NationInfo.NationId).ToString(); this.txtCardNo.Value = TicketVisitorInfo.CardNo.Trim(); this.txtCname.Value = TicketVisitorInfo.ChinaName.Trim(); this.txtEname.Value = TicketVisitorInfo.EnglishName.Trim(); this.txtPhone.Value = TicketVisitorInfo.ContactTel.Trim(); this.txtRemark.Value = TicketVisitorInfo.Remark.Trim(); EyouSoft.Model.CompanyStructure.Sex Gender = TicketVisitorInfo.ContactSex; if (Gender == EyouSoft.Model.CompanyStructure.Sex.男) { this.gender_male.Checked = true; } else { this.gender_female.Checked = true; } } //释放资源 TicketVisitorInfo = null; #endregion } }
/// <summary> /// 获取常旅客实体 /// </summary> /// <param name="TicketVistorId">常旅客Id</param> /// <returns>返回获取常旅客实体</returns> public virtual EyouSoft.Model.TicketStructure.TicketVistorInfo GetModel(string TicketVistorId) { EyouSoft.Model.TicketStructure.TicketVistorInfo model = null; DbCommand dc = this._db.GetSqlStringCommand(Sql_Select_TicketVistorInfo_ByID); this._db.AddInParameter(dc, "ID", DbType.AnsiStringFixedLength, TicketVistorId); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._db)) { while (dr.Read()) { model = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); InputModelValue(model, dr); } } return(model); }
/// <summary> /// 常旅客实体赋值 /// </summary> /// <param name="model">常旅客实体</param> /// <param name="dr">IDataReader</param> private void InputModelValue(EyouSoft.Model.TicketStructure.TicketVistorInfo model, IDataReader dr) { model.Id = dr.GetString(dr.GetOrdinal("Id")); model.CardNo = dr.GetString(dr.GetOrdinal("CardNo")); model.CardType = (EyouSoft.Model.TicketStructure.TicketCardType)Enum.Parse(typeof(EyouSoft.Model.TicketStructure.TicketCardType), dr["CardType"].ToString()); model.ChinaName = dr.IsDBNull(dr.GetOrdinal("ChinaName")) ? string.Empty : dr.GetString(dr.GetOrdinal("ChinaName")); model.CompanyId = dr.GetString(dr.GetOrdinal("CompanyId")); if (!string.IsNullOrEmpty(dr["ContactSex"].ToString())) { model.ContactSex = (EyouSoft.Model.CompanyStructure.Sex)Enum.Parse(typeof(EyouSoft.Model.CompanyStructure.Sex), dr["ContactSex"].ToString()); } model.ContactTel = dr.IsDBNull(dr.GetOrdinal("ContactTel")) ? string.Empty : dr.GetString(dr.GetOrdinal("ContactTel")); model.EnglishName = dr.IsDBNull(dr.GetOrdinal("EnglishName")) ? string.Empty : dr.GetString(dr.GetOrdinal("EnglishName")); model.IssueTime = dr.GetDateTime(dr.GetOrdinal("IssueTime")); model.Remark = dr.IsDBNull(dr.GetOrdinal("Remark")) ? string.Empty : dr.GetString(dr.GetOrdinal("Remark")); model.VistorType = (EyouSoft.Model.TicketStructure.TicketVistorType)Enum.Parse(typeof(EyouSoft.Model.TicketStructure.TicketVistorType), dr["VistorType"].ToString()); //model.NationInfo.CountryName = dr.IsDBNull(dr.GetOrdinal("CountryName")) ? string.Empty : dr.GetString(dr.GetOrdinal("CountryName")); //model.NationInfo.CountryCode = dr.IsDBNull(dr.GetOrdinal("CountryCode")) ? string.Empty : dr.GetString(dr.GetOrdinal("CountryCode")); //model.NationInfo.NationId = dr.IsDBNull(dr.GetOrdinal("NationId")) ? 0 : dr.GetInt32(dr.GetOrdinal("NationId")); model.DataType = (EyouSoft.Model.TicketStructure.TicketDataType) int.Parse(dr.GetString(dr.GetOrdinal("DataType"))); model.Mobile = dr["Mobile"].ToString(); model.Address = dr["MailingAddress"].ToString(); model.ZipCode = dr["ZipCode"].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("Birthday"))) { model.BirthDay = dr.GetDateTime(dr.GetOrdinal("Birthday")); } model.IdCardCode = dr["IDCard"].ToString(); model.PassportCode = dr["Passport"].ToString(); model.CountryId = dr.GetInt32(dr.GetOrdinal("CountryId")); model.ProvinceId = dr.GetInt32(dr.GetOrdinal("ProvinceId")); model.CityId = dr.GetInt32(dr.GetOrdinal("CityId")); model.DistrictId = dr.GetInt32(dr.GetOrdinal("CountyId")); }
protected EyouSoft.Model.TicketStructure.TicketWholesalersAllInfo supplierInfo; //供应商信息 protected void Page_Load(object sender, EventArgs e) { this.Master.Naviagtion = AirTicketNavigation.团队预定散拼; this.Title = "预定-组团预定/散拼-机票"; string method = Utils.GetFormValue("method"); //当前操作 if (method == "") //初次进来显示运价信息 { startDate = Utils.GetQueryStringValue("startDate"); backDate = Utils.GetQueryStringValue("backDate"); startCity = Utils.GetQueryStringValue("startCity"); toCity = Utils.GetQueryStringValue("toCity"); airType = Utils.GetQueryStringValue("airType"); peopleTypeInt = Utils.GetInt(Utils.GetQueryStringValue("peopleType")); peopleType = (EyouSoft.Model.TicketStructure.TravellerType)peopleTypeInt; id = Utils.GetQueryStringValue("id"); info = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetModel(id);//获取运价信息实体 if (info != null) { freightDate = GetDate(info); freightDateBack = GetBackDate(info); startCityName = info.NoGadHomeCityIdName; toCityName = info.NoGadDestCityName; supplierInfo = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(info.Company.ID); //touristCount = info.MaxPCount; touristCount = 100; companyId = SiteUserInfo.CompanyID; } } if (method == "save") //下订单 { id = Utils.GetFormValue("id"); info = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetModel(id); supplierInfo = EyouSoft.BLL.TicketStructure.TicketSupplierInfo.CreateInstance().GetSupplierInfo(info.Company.ID); string[] touristNames = Utils.GetFormValues("tb_tourName1"); string[] tourTypes = Utils.GetFormValues("tb_tourType1"); string[] tourSex = Utils.GetFormValues("tb_tourSex1"); string[] cerTypes = Utils.GetFormValues("tb_cerType1"); string[] cerNos = Utils.GetFormValues("tb_cerNo1"); int length = touristNames.Length; List <EyouSoft.Model.TicketStructure.TicketVistorInfo> visitorList = new List <EyouSoft.Model.TicketStructure.TicketVistorInfo>(); List <EyouSoft.Model.TicketStructure.OrderTravellerInfo> orderVisitorList = new List <EyouSoft.Model.TicketStructure.OrderTravellerInfo>(); int isTableNum = 0;//是否购买行程单的人数 EyouSoft.IBLL.TicketStructure.ITicketVisitor visitorBll = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance(); for (int i = 0; i < length; i++) { EyouSoft.Model.TicketStructure.TicketVistorInfo visitorInfo = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); EyouSoft.Model.TicketStructure.OrderTravellerInfo orderVisitorInfo = new EyouSoft.Model.TicketStructure.OrderTravellerInfo(); //添加订单旅客 orderVisitorInfo.TravellerName = touristNames[i]; orderVisitorInfo.CertNo = cerNos[i]; orderVisitorInfo.TravellerId = Guid.NewGuid().ToString(); orderVisitorInfo.CertType = (EyouSoft.Model.TicketStructure.TicketCardType)Utils.GetInt(cerTypes[i]); orderVisitorInfo.Gender = (EyouSoft.Model.CompanyStructure.Sex)Utils.GetInt(tourSex[i]); orderVisitorInfo.InsPrice = 0; orderVisitorInfo.TravellerType = (EyouSoft.Model.TicketStructure.TicketVistorType)Utils.GetInt(tourTypes[i]); orderVisitorInfo.IsBuyIns = Utils.GetFormValue("tb_isInsure1_" + (i + 1)) == "1"; orderVisitorInfo.IsBuyItinerary = Utils.GetFormValue("tb_isTable1_" + (i + 1)) == "1"; if (orderVisitorInfo.IsBuyItinerary) { isTableNum++; } orderVisitorInfo.TravellerState = EyouSoft.Model.TicketStructure.TravellerState.正常; orderVisitorList.Add(orderVisitorInfo); if (Utils.GetFormValue("tb_isOften1_" + (i + 1)) == "1") { //添加常旅客 if (IsLetter(touristNames[i])) { visitorInfo.EnglishName = touristNames[i]; } else { visitorInfo.ChinaName = touristNames[i]; } visitorInfo.Id = orderVisitorInfo.TravellerId; visitorInfo.CardType = (EyouSoft.Model.TicketStructure.TicketCardType)Utils.GetInt(cerTypes[i]); visitorInfo.CardNo = cerNos[i]; visitorInfo.VistorType = (EyouSoft.Model.TicketStructure.TicketVistorType)Utils.GetInt(tourTypes[i]); visitorInfo.IssueTime = DateTime.Now; visitorInfo.ContactSex = orderVisitorInfo.Gender; visitorInfo.CompanyId = SiteUserInfo.CompanyID; if (!visitorBll.VisitorIsExists(visitorInfo.CardNo, SiteUserInfo.CompanyID, "")) { visitorList.Add(visitorInfo); } } } //添加常旅客到数据库 visitorBll.AddTicketVisitorList(visitorList); //构造订单信息 EyouSoft.IBLL.TicketStructure.ITicketOrder orderBll = EyouSoft.BLL.TicketStructure.TicketOrder.CreateInstance(); EyouSoft.Model.TicketStructure.OrderInfo orderInfo = new EyouSoft.Model.TicketStructure.OrderInfo(); orderInfo.Travellers = orderVisitorList; orderInfo.TravellerType = (EyouSoft.Model.TicketStructure.TravellerType)Utils.GetInt(Utils.GetFormValue("peopleType")); if (info.FreightType == EyouSoft.Model.TicketStructure.FreightType.来回程) { orderInfo.TotalAmount = (info.FromSetPrice + info.ToSetPrice + info.FromFuelPrice + info.ToFuelPrice + info.ToBuildPrice + info.FromBuildPrice) * length + supplierInfo.ServicePrice * isTableNum; } else { orderInfo.TotalAmount = (info.FromSetPrice + info.FromFuelPrice + info.FromBuildPrice) * length + supplierInfo.ServicePrice * isTableNum; } if (isTableNum > 0) { orderInfo.TotalAmount += supplierInfo.DeliveryPrice; } orderInfo.BuyerCId = SiteUserInfo.CompanyID; orderInfo.BuyerCName = SiteUserInfo.CompanyName; orderInfo.BuyerContactAddress = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(SiteUserInfo.CompanyID).CompanyAddress; orderInfo.BuyerContactMobile = SiteUserInfo.ContactInfo.Mobile; orderInfo.BuyerContactMQ = SiteUserInfo.ContactInfo.MQ; orderInfo.BuyerContactName = SiteUserInfo.ContactInfo.ContactName; orderInfo.BuyerRemark = Utils.InputText(Utils.GetFormValue("tb_remark"), 250);//特殊要求备注 orderInfo.BuyerUId = SiteUserInfo.ID; orderInfo.DestCityId = info.NoGadDestCityId; orderInfo.DestCityName = info.NoGadDestCityName; orderInfo.EMSPrice = supplierInfo.DeliveryPrice; orderInfo.FlightId = info.FlightId; orderInfo.FreightType = info.FreightType; orderInfo.HomeCityId = info.NoGadHomeCityId; orderInfo.HomeCityName = info.NoGadHomeCityIdName; orderInfo.ItineraryPrice = supplierInfo.ServicePrice; orderInfo.LeaveTime = DateTime.Parse(Utils.GetFormValue("startDate")); EyouSoft.Model.TicketStructure.OrderRateInfo rateInfo = new EyouSoft.Model.TicketStructure.OrderRateInfo(); rateInfo.DestCityId = info.NoGadDestCityId; rateInfo.DestCityName = info.NoGadDestCityName; rateInfo.FlightId = info.FlightId; rateInfo.FreightType = info.FreightType; rateInfo.HomeCityId = info.NoGadHomeCityId; rateInfo.HomeCityName = info.NoGadHomeCityIdName; rateInfo.LBuildPrice = info.FromBuildPrice; rateInfo.LeaveDiscount = info.FromReferRate; rateInfo.LeaveFacePrice = info.FromReferPrice; rateInfo.LeavePrice = info.FromSetPrice; //计算去程运价有效期 rateInfo.LeaveTimeLimit = GetDate(info); rateInfo.LFuelPrice = info.FromFuelPrice; rateInfo.MaxPCount = info.MaxPCount; rateInfo.RBuildPrice = info.ToBuildPrice; rateInfo.ReturnDiscount = info.ToReferRate; rateInfo.ReturnFacePrice = info.ToReferPrice; rateInfo.ReturnPrice = info.ToSetPrice; //计算回程运价有效期 rateInfo.ReturnTimeLimit = GetBackDate(info); rateInfo.RFuelPrice = info.ToFuelPrice; rateInfo.SupplierRemark = info.SupplierRemark; orderInfo.OrderRateInfo = rateInfo; string act = Utils.GetFormValue("act"); if (act == "0") { orderInfo.OrderState = EyouSoft.Model.TicketStructure.OrderState.等待审核; } else { orderInfo.OrderState = EyouSoft.Model.TicketStructure.OrderState.审核通过; } orderInfo.OrderTime = DateTime.Now; orderInfo.PCount = length; orderInfo.RateType = info.RateType; orderInfo.ReturnTime = Utils.GetDateTime(Utils.GetFormValue("backDate"), DateTime.Now); orderInfo.SupplierCId = info.Company.ID; orderInfo.SupplierCName = info.Company.CompanyName; orderInfo.OrderId = Guid.NewGuid().ToString(); if (orderBll.CreateOrder(orderInfo)) { Utils.ResponseMeg(true, orderInfo.OrderId); } else { Utils.ResponseMegError(); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string cid = context.Request["CompanyId"]; HttpPostedFile file = context.Request.Files[0]; if (file != null && file.ContentLength > 0 && !string.IsNullOrEmpty(file.FileName) && file.FileName.IndexOf(";") == -1 && Path.GetExtension(file.FileName).ToLower() == ".xls" || Path.GetExtension(file.FileName).ToLower() == ".xlsx") { string fileName = Guid.NewGuid().ToString() + Path.GetExtension(file.FileName); //生成将要在服务器保存的文件名 string filePath = System.Web.HttpContext.Current.Server.MapPath("/UploadFiles/AirTicket/"); //要保存的路径 if (!Directory.Exists(filePath)) //判断路径是否存在,不存在就创建 { Directory.CreateDirectory(filePath); } string fullFilePath = filePath + fileName; //文件完整的路径 file.SaveAs(fullFilePath); //保存操作" //OleDbConnection oledbCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=\"Excel 8.0\";Data Source=" + fullFilePath); OleDbConnection oledbCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=\"Excel 8.0;HDR=NO;IMEX=1;\";Data Source=" + fullFilePath); oledbCon.Open(); DataTable table = oledbCon.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);//获取Excel的架构,为了获取表名 oledbCon.Close(); try { if (table != null) { List <string> tblNames = new List <string>(); foreach (DataRow dr in table.Rows) { tblNames.Add(dr[2].ToString());//添加表名 } IList <TicketVistorInfo> visitorList = new List <TicketVistorInfo>(); foreach (string tblName in tblNames) { visitorList = this.GetExcelTableData(fullFilePath, tblName, visitorList);//根据表名获取数据 } IList <EyouSoft.Model.TicketStructure.TicketVistorInfo> list = new List <EyouSoft.Model.TicketStructure.TicketVistorInfo>(); if (visitorList != null && visitorList.Count != 0) { for (int i = 1; i < visitorList.Count; i++)//从1开始,过滤掉第一条数据(表头) { EyouSoft.Model.TicketStructure.TicketVistorInfo visitorModel = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); visitorModel.Id = Guid.NewGuid().ToString(); visitorModel.CompanyId = cid; visitorModel.CardNo = visitorList[i].PapersCode; visitorModel.NationInfo.NationId = 0; if (visitorList[i].PapersType != null && visitorList[i].PapersType.ToString() != "") { visitorModel.CardType = (EyouSoft.Model.TicketStructure.TicketCardType) int.Parse(visitorList[i].PapersType.ToString()); } if (visitorList[i].CName != "") { visitorModel.ChinaName = visitorList[i].CName; } if (visitorList[i].EName != "") { visitorModel.EnglishName = visitorList[i].EName.ToUpper(); } visitorModel.IssueTime = DateTime.Now; //if (visitorList[i].Country != "") // visitorModel.NationInfo.CountryName = visitorList[i].Country; if (visitorList[i].Remark != "") { visitorModel.Remark = visitorList[i].Remark; } if (visitorList[i].Sex.ToString() != "") { visitorModel.ContactSex = (EyouSoft.Model.CompanyStructure.Sex)(int.Parse(visitorList[i].Sex.ToString())); } if (visitorList[i].Telephone != "") { visitorModel.ContactTel = visitorList[i].Telephone; } if (visitorList[i].VisitorType.ToString() != "") { visitorModel.VistorType = (EyouSoft.Model.TicketStructure.TicketVistorType) int.Parse(visitorList[i].VisitorType.ToString()); } list.Add(visitorModel); } } File.Delete(fullFilePath);//删除文件 if (visitorList != null && visitorList.Count != 0) { int result = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().AddTicketVisitorList(list); if (result > 0) { if (result == Convert.ToInt32(visitorList.Count - 1)) { context.Response.Write("001"); } else { context.Response.Write(result.ToString()); } } else { context.Response.Write("0"); } } } }catch (Exception ex)//捕获异常 { context.Response.Write("-1"); } } }
protected string bookPolicy; //预定规则和要求 protected void Page_Load(object sender, EventArgs e) { if (!IsLogin) { EyouSoft.Security.Membership.UserProvider.RedirectLogin(this.Request.Url.ToString(), "请登录后预定"); return; } this.CityAndMenu1.HeadMenuIndex = 4; #region 获取酒店查询条件 hotelCode = Utils.GetQueryStringValue("hotelCode"); //酒店编号 comeDate = Utils.GetQueryStringValue("comeDate"); //入住日期 leaveDate = Utils.GetQueryStringValue("leaveDate"); //离店日期 DateTime cDate = Utils.GetDateTime(comeDate); DateTime lDate = Utils.GetDateTime(leaveDate); inDays = (lDate - cDate).Days; //获取入住天数 roomCode = Utils.GetQueryStringValue("roomCode"); //房型代码 vendorCode = string.Empty; //Utils.GetQueryStringValue("vendorCode");//供应商代码 ratePlanCode = Utils.GetQueryStringValue("ratePlanCode"); //价格计划代码 #endregion HotelSearch1.CityId = Utils.GetInt(Utils.GetQueryStringValue("CityID")); CommonUser1.CityId = HotelSearch1.CityId; SpecialHotel1.CityId = HotelSearch1.CityId; HotHotel1.CityId = HotelSearch1.CityId; string method = Utils.GetFormValue("method");//当前操作 #region 查询酒店实体 //设置查询条件 EyouSoft.HotelBI.SingleSeach searchModel = new EyouSoft.HotelBI.SingleSeach(); searchModel.HotelCode = hotelCode; //酒店代码 searchModel.CheckInDate = comeDate; //入住时间 searchModel.CheckOutDate = leaveDate; //离店时间 searchModel.RoomTypeCode = roomCode; //房型代码 searchModel.VendorCode = vendorCode; //供应商代码 searchModel.RatePlanCode = ratePlanCode; //价格计划代码 searchModel.AvailReqType = EyouSoft.HotelBI.AvailReqTypeEnum.includeStatic; //查询完整酒店信息 EyouSoft.HotelBI.ErrorInfo errorInfo = null; //错误信息实体 EyouSoft.Model.HotelStructure.HotelInfo hotelModel = EyouSoft.BLL.HotelStructure.Hotel.CreateInstance().GetHotelModel(searchModel, out errorInfo); //酒店实体 #endregion string themess = IsOk(errorInfo, hotelModel);//获取错误信息 //如果没有错误信息则获取酒店各种信息 if (themess == "") { #region 获取酒店实体中的信息 hotelName = hotelModel.HotelName; this.Page.Title = hotelName + "_酒店预订_同业114酒店频道"; //根据房型代码获取酒店中的房型 if (hotelModel.RoomTypeList != null && hotelModel.RoomTypeList.Count > 0) { roomTypeModel = hotelModel.RoomTypeList.FirstOrDefault(r => r.RoomTypeCode == roomCode && /*r.VendorCode == vendorCode &&*/ r.RatePlanCode == ratePlanCode);//获取房型信息 } visistList = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().GetHotelListByName("", SiteUserInfo.CompanyID);//获取酒店常旅客 //获取房型明细中的第一条 if (roomTypeModel != null && roomTypeModel.RoomRate.RateInfos.Count > 0) { payType = roomTypeModel.RoomRate.Payment == EyouSoft.HotelBI.HBEPaymentType.T ? "前台现付" : ""; backPrice = roomTypeModel.RoomRate.RateInfos.Sum(r => r.CommissionAmount); //取得总反佣价 rateModel = roomTypeModel.RoomRate.RateInfos[0]; //获取第一条明细 }//如果房型信息不存在则显示房型已满 else { Utils.ShowError(string.Format("{0}至{1}房型已满", comeDate, leaveDate), "hotel"); roomTypeModel = new EyouSoft.Model.HotelStructure.RoomTypeInfo(); EyouSoft.Model.HotelStructure.RoomRateInfo roomRateModel = new EyouSoft.Model.HotelStructure.RoomRateInfo(); roomRateModel.RateInfos = new List <EyouSoft.Model.HotelStructure.RateInfo>(); roomTypeModel.RoomRate = roomRateModel; rateModel = new EyouSoft.Model.HotelStructure.RateInfo(); return; } //获取预定规则和要求 if (roomTypeModel.RoomRate.BookPolicy != null) { bookPolicy = roomTypeModel.RoomRate.BookPolicy.LongDesc; } #endregion #region 单操作 if (method == "save") //下单操作 { if (hotelModel.HotelCode == "") //如果传入不存在的酒店则输出失败 { Utils.ResponseMeg(false, string.Format("{0}至{1}房型已满", comeDate, leaveDate)); return; } string aEarlyTime = Utils.GetFormValue("hb_selETime"); //最早到达时间 string aLateTime = Utils.GetFormValue("hb_selLTime"); //最迟到达时间 int intLateTime = Utils.GetInt(aLateTime); if (intLateTime > 24) { aLateTime = (intLateTime - 24).ToString(); } EyouSoft.Model.HotelStructure.OrderInfo orderModel = new EyouSoft.Model.HotelStructure.OrderInfo(); orderModel.ArriveEarlyTime = (aEarlyTime.Length == 1 ? ("0" + aEarlyTime) : aEarlyTime) + "00"; //到店最早时间 orderModel.ArriveLateTime = (aLateTime.Length == 1 ? ("0" + aLateTime) : aLateTime) + "00"; //到店最晚时间 orderModel.BuyerCId = SiteUserInfo.CompanyID; //采购公司编号 orderModel.BuyerCName = SiteUserInfo.CompanyName; //采购公司名 orderModel.BuyerUFullName = SiteUserInfo.ContactInfo.ContactName; //采购用户姓名 orderModel.BuyerUId = SiteUserInfo.ID; //采购用户编号 orderModel.BuyerUName = SiteUserInfo.UserName; //采购用户名 orderModel.CheckInDate = cDate; //入住时间 orderModel.CheckOutDate = lDate; //离店时间 orderModel.CheckState = EyouSoft.Model.HotelStructure.CheckStateList.待审结; orderModel.CityCode = hotelModel.CityCode; //城市代码 orderModel.CityName = hotelModel.CityCode; //城市名称 orderModel.Comments = bookPolicy; //备注 orderModel.CommissionFix = rateModel.Fix; //固定反佣 orderModel.CommissionPercent = rateModel.Percent; //反佣比例 orderModel.CommissionType = EyouSoft.HotelBI.HBECommissionType.FIX; orderModel.ContacterFullname = Utils.GetFormValue("hb_txtContactName"); //联系人姓名 orderModel.ContacterMobile = Utils.GetFormValue("hb_txtContactMoible"); //联系人手机 orderModel.ContacterTelephone = Utils.GetFormValue("hb_txtContactArea") + "-" + Utils.GetFormValue("hb_txtContactTel") + (!string.IsNullOrEmpty(Utils.GetFormValue("hb_txtContactFen")) ? ("-" + Utils.GetFormValue("hb_txtContactFen")) : ""); //联系人电话 if (!string.IsNullOrEmpty(hotelModel.CountryCode)) { orderModel.CountryCode = hotelModel.CountryCode;//国家代码 } orderModel.CreateDateTime = DateTime.Now; orderModel.HotelCode = hotelModel.HotelCode; orderModel.HotelName = hotelModel.HotelName; orderModel.IsMobileContact = Utils.GetFormValue("hb_chkIsMoible") == "1";//是否短信通知客人 orderModel.OrderType = EyouSoft.Model.HotelStructure.OrderType.国内现付; orderModel.PaymentType = EyouSoft.HotelBI.HBEPaymentType.T; orderModel.Quantity = Utils.GetInt(Utils.GetFormValue("hb_selRoom")); orderModel.RatePlanCode = roomTypeModel.RatePlanCode ?? "RatePlanCode"; orderModel.RoomTypeCode = roomTypeModel.RoomTypeCode ?? "RoomTypeCode"; orderModel.RoomTypeName = roomTypeModel.RoomTypeName; decimal ExcessiveFee = 0;//额外收费 IList <EyouSoft.Model.HotelStructure.RateInfo> riList = roomTypeModel.RoomRate.RateInfos; if (riList != null && riList.Count >= 0) { foreach (EyouSoft.Model.HotelStructure.RateInfo rate in riList) { if (rate.ExcessiveFees != null) { ExcessiveFee += rate.ExcessiveFees.Sum(ef => ef.Amount);//计算额外收费 } } } orderModel.TotalAmount = roomTypeModel.RoomRate.AmountPrice * orderModel.Quantity + ExcessiveFee; //总房价(总销售+额外收费) orderModel.TotalCommission = roomTypeModel.RoomRate.RateInfos.Sum(r => r.CommissionPrice) * orderModel.Quantity; //总佣金 orderModel.VendorCode = roomTypeModel.VendorCode; orderModel.VendorName = roomTypeModel.VendorName; //特殊要求 orderModel.SpecialRequest = string.Format("无烟要求:{0},早餐:{1},{2},{3}", Utils.GetFormValue("hb_selIsSmoke"), Utils.GetFormValue("hb_selIsBreakfast"), Utils.GetFormValue("hb_chkFloor"), Utils.GetFormValue("hb_chkRoom")); IList <EyouSoft.HotelBI.HBEResGuestInfo> guestList = new List <EyouSoft.HotelBI.HBEResGuestInfo>(); string[] guestName = Utils.GetFormValues("hb_txtGuestName"); //获取客户姓名 string[] guestType = Utils.GetFormValues("hb_selGuestType"); //获取客户类型 string guestMoible = Utils.GetFormValue("hb_chkGuestMoible"); //获取通知手机 //添加酒店旅客 EyouSoft.IBLL.TicketStructure.ITicketVisitor visistorBll = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance(); for (int i = 0; i < orderModel.Quantity; i++) { //添加常旅客 if (i == 0) { string cName = ""; string eName = ""; if (IsLetter(guestName[i]))//判断中文或英文 { eName = guestName[i]; } else { cName = guestName[i]; } //判断常旅客是否存在 if (!visistorBll.HotelVistorIsExist(cName, eName, guestMoible, SiteUserInfo.CompanyID, null)) { EyouSoft.Model.TicketStructure.TicketVistorInfo vInfo = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); vInfo.ChinaName = cName; vInfo.EnglishName = eName; vInfo.CompanyId = SiteUserInfo.CompanyID; vInfo.Id = Guid.NewGuid().ToString(); vInfo.ContactTel = guestMoible; vInfo.CardNo = ""; vInfo.CardType = EyouSoft.Model.TicketStructure.TicketCardType.None; vInfo.ContactSex = EyouSoft.Model.CompanyStructure.Sex.未知; EyouSoft.Model.TicketStructure.TicketNationInfo nation = new EyouSoft.Model.TicketStructure.TicketNationInfo(); nation.CountryCode = ""; nation.CountryName = ""; vInfo.NationInfo = nation; vInfo.VistorType = EyouSoft.Model.TicketStructure.TicketVistorType.成人; vInfo.DataType = EyouSoft.Model.TicketStructure.TicketDataType.酒店常旅客; visistorBll.AddTicketVisitorInfo(vInfo);//执行添加 } } EyouSoft.HotelBI.HBEResGuestInfo guest = new EyouSoft.HotelBI.HBEResGuestInfo(); guest.GuestTypeIndicator = (EyouSoft.HotelBI.HBEGuestTypeIndicator)(int.Parse(guestType[i])); guest.IsMobileContact = orderModel.IsMobileContact; guest.Mobile = guestMoible; guest.PersonName = guestName[i]; guestList.Add(guest); } orderModel.ResGuests = guestList; //赋值旅客信息 string errorDesc = ""; //错误描述 if (EyouSoft.BLL.HotelStructure.HotelOrder.CreateInstance().Add(orderModel, out errorDesc) > 0) { Utils.ResponseMeg(true, orderModel.ResOrderId); } else { Utils.ResponseMeg(false, errorDesc == "" ? "下单失败" : "下单失败:" + errorDesc);//下单失败 } } #endregion else { #region 绑定酒店房费 HotelSearch1.ImageServerPath = ImageServerPath; if (hotelModel.HotelCode == "")//如果出入不存在酒店则返回到查询列表 { Utils.ShowError(string.Format("{0}至{1}房型已满", comeDate, leaveDate), "hotel"); return; } GetRateInfoList();//绑定酒店房费列表 #endregion } } else//如果错误信息不为空 { //如果是保存操作则输出错误信息 if (method == "save") { Utils.ResponseMeg(false, themess); } else//如果是初始化页面时则跳转到错误页面 { Utils.ShowError(themess, "hotel"); } } }
protected void Page_Load(object sender, EventArgs e) { // 初始化旅客类型 BindVisitorType(); //绑定证件类型 BindCardType(); //初始化国家 InitCountryList(); string method = Utils.GetFormValue("method"); if (!string.IsNullOrEmpty(Utils.InputText(Context.Request.QueryString["EditId"]))) { EditId = Utils.GetString(Context.Request.QueryString["EditId"], ""); this.hvp_hfEditId.Value = EditId; } if (method == "save") { SaveHotelVisitors(); return; } if (!Page.IsPostBack) { if (this.SiteUserInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.其他采购商) && this.SiteUserInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.组团)) { Response.Clear(); Response.Write("对不起,您没有权限"); Response.End(); return; } //根据旅客ID获得常旅客实体对象 EyouSoft.Model.TicketStructure.TicketVistorInfo HotelVisitorInfo = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().GetTicketVisitorInfo(EditId); #region 初始化表单数据 if (HotelVisitorInfo != null) { FlageName = "修改常旅客"; this.hvp_ddlCardType.SelectedValue = ((int)HotelVisitorInfo.CardType).ToString(); this.hvp_ddlVisitorType.SelectedValue = ((int)HotelVisitorInfo.VistorType).ToString(); if (HotelVisitorInfo.NationInfo.NationId.ToString() != "") { this.hvp_ddlCountry.SelectedValue = ((int)HotelVisitorInfo.NationInfo.NationId).ToString(); } this.hvp_txtChinaName.Value = HotelVisitorInfo.ChinaName.Trim(); this.hvp_txtEnglishName.Value = HotelVisitorInfo.EnglishName.Trim(); this.hvp_txtCardNo.Value = HotelVisitorInfo.CardNo.Trim(); this.hvp_txtMobilePhone.Value = HotelVisitorInfo.ContactTel.Trim(); this.hvp_txtReamrk.Value = HotelVisitorInfo.Remark.Trim(); EyouSoft.Model.CompanyStructure.Sex Gender = HotelVisitorInfo.ContactSex; if (Gender == EyouSoft.Model.CompanyStructure.Sex.男) { this.hvp_rdoMale.Checked = true; this.hvp_rdoFemale.Checked = false; } else { this.hvp_rdoFemale.Checked = true; this.hvp_rdoMale.Checked = false; } } //释放资源 HotelVisitorInfo = null; #endregion } }
private void SaveHotelVisitors() { string companyId = this.SiteUserInfo.CompanyID; //公司ID string chinaName = Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_txtChinaName", 13); //中文名 string englishName = Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_txtEnglishName", 27); //英文名 string cardNo = Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_txtCardNo"); //证件号码 string cardType = string.Empty; if (Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_ddlCardType").ToString() != "") { cardType = Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_ddlCardType"); //证件类型 } string phone = Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_txtMobilePhone"); //联系电话 string remark = Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_txtReamrk", 450).Trim(); //备注 string sex = string.Empty; if (this.hvp_rdoFemale.Checked)//性别 { sex = this.hvp_rdoFemale.Value; } if (this.hvp_rdoMale.Checked) { sex = this.hvp_rdoMale.Value; } string country = string.Empty; if (Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_ddlCountry").ToString() != "") { country = Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_ddlCountry").ToString();//国籍 } string visitorType = string.Empty; if (Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_ddlVisitorType").ToString() != "") { visitorType = Utils.GetFormValue("ctl00$ContentPlaceHolder1$hvp_ddlVisitorType").ToString();//旅客类型 } bool result = true; // //创建一个常旅客实体,并实例化该对象 EyouSoft.Model.TicketStructure.TicketVistorInfo Model = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); Model.ChinaName = chinaName; //中文名 Model.EnglishName = englishName.ToUpper().ToString(); //英文名 Model.ContactSex = (EyouSoft.Model.CompanyStructure.Sex) int.Parse(sex); //性别 if (visitorType != "") { Model.VistorType = (EyouSoft.Model.TicketStructure.TicketVistorType) int.Parse(visitorType); //常旅客类型 } Model.ContactTel = phone; //联系电话 if (cardType != "") { Model.CardType = (EyouSoft.Model.TicketStructure.TicketCardType) int.Parse(cardType); //证件类型 } Model.CardNo = cardNo.Trim(); //证件号 if (country != "") { Model.NationInfo.NationId = int.Parse(country); //所属国家 } Model.Remark = remark.Trim(); //备注 Model.IssueTime = DateTime.Now; //创建时间 Model.CompanyId = companyId; //公司ID Model.DataType = EyouSoft.Model.TicketStructure.TicketDataType.酒店常旅客; EditId = this.hvp_hfEditId.Value.ToString(); if (EditId != "") { result = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().HotelVistorIsExist(chinaName, englishName, phone, companyId, EditId); } else { result = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().HotelVistorIsExist(chinaName, englishName, phone, companyId, null); } if (result) { Response.Clear(); Response.Write("-1");//已经存在 Response.End(); } else {//如果不存在,就执行修改/添加操作 if (EditId != "") { Model.Id = EditId; if (EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().UpdateTicketVisitorInfo(Model)) { Response.Clear(); Response.Write("1");//修改成功 Response.End(); } else { Response.Clear(); Response.Write("0");//修改失败 Response.End(); } } else { Model.Id = Guid.NewGuid().ToString(); result = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().AddTicketVisitorInfo(Model); if (result) { Response.Clear(); Response.Write("2"); //新增成功 Response.End(); } else { Response.Clear(); Response.Write("-2"); Response.End(); } } } }
protected void ImgSave_Click(object sender, ImageClickEventArgs e) { string strError = string.Empty; string sex = string.Empty; string companyId = this.SiteUserInfo.CompanyID; //公司ID string cName = Utils.GetFormValue("ctl00$c1$txtCname", 13); //中文名 string eName = Utils.GetFormValue("ctl00$c1$txtEname", 27); //英文名 string cardNo = Utils.GetFormValue("ctl00$c1$txtCardNo"); //证件号码 int cardType = int.Parse(Utils.GetFormValue("ctl00$c1$ddlCardType")); //证件类型 string phone = Utils.GetFormValue("ctl00$c1$txtPhone"); //联系电话 string remark = Utils.GetFormValue("ctl00$c1$txtRemark", 450).Trim(); //备注 if (this.gender_female.Checked) //性别 { sex = this.gender_female.Value; } if (this.gender_male.Checked) { sex = this.gender_male.Value; } int country = int.Parse(Utils.GetFormValue("ctl00$c1$ddlCountry").ToString()); //国籍 int visitorType = int.Parse(Utils.GetFormValue("ctl00$c1$ddlVisitoryType").ToString()); //旅客类型 if (cName.Trim() == "" && eName.Trim() == "") { strError += "常旅客中文名和英文名不能都为空!\\n"; } if (cName.Trim() != "" && eName.Trim() != "") { strError += "常旅客中文名和英文名只能填一个!\\n"; } if (cName.Trim() != "") { bool count = Regex.IsMatch(cName, @"(^[\u0391-\uFFE5]+$)"); if (!count) { strError += "请输入正确的中文名!\\n"; } else { if (cName.Length > 13) { strError += "中文名的长度不能超过13位!\\n"; } } } if (eName != "") { bool count = Regex.IsMatch(eName, @"^[a-zA-Z]+\/[a-zA-Z]+$"); if (!count) { strError += "请输入正确的英文名!\\n"; } else { if (eName.Length > 27) { strError += "英文名的长度不能超过27位!\\n"; } } } if (visitorType.ToString() == "") { strError += "请选择旅客类型!\\n"; } if (sex == "") { strError += "请选择性别!\\n"; } if (cardType.ToString() == "") { strError += "证件类型不能为空!\\n"; } if (cardNo == "") { strError += "证件号码不能为空!\\n"; } if (cardType.ToString() == "0")//假如是身份证 { bool count = Regex.IsMatch(cardNo, @"(^\d{15}$)|(^\d{17}[0-9Xx]$)"); if (!count) { strError += "请输入正确的身份证号码!\\n"; } } if (phone == "") { strError += "联系电话不能为空!\\n"; } if (phone != "") { bool count = Regex.IsMatch(phone, @"(^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-?)?[1-9]\d{6,7}(\-\d{1,4})?$)"); if (!count) { strError += "请输入正确的联系电话!\\n"; } } if (country.ToString() == "") { strError += "请选择国家!\\n"; } if (remark == "") { strError += "备注不能为空!\\n"; } if (remark.Length > 500) { strError += "备注长度过长!\\n"; } if (strError != "") { MessageBox.Show(this, strError); return; } //创建一个常旅客实体,并实例化该对象 EyouSoft.Model.TicketStructure.TicketVistorInfo Model = new EyouSoft.Model.TicketStructure.TicketVistorInfo(); Model.ChinaName = cName.Trim(); //中文名 Model.EnglishName = eName.Trim().ToUpper(); //英文名 Model.ContactSex = (EyouSoft.Model.CompanyStructure.Sex) int.Parse(sex); //性别 Model.VistorType = (EyouSoft.Model.TicketStructure.TicketVistorType)visitorType; //常旅客类型 Model.ContactTel = phone; //联系电话 Model.CardType = (EyouSoft.Model.TicketStructure.TicketCardType)cardType; //证件类型 Model.CardNo = cardNo.Trim(); //证件号 Model.NationInfo.NationId = country; //所属国家 Model.Remark = remark.Trim(); //备注 Model.IssueTime = DateTime.Now; //创建时间 Model.CompanyId = this.SiteUserInfo.CompanyID; //公司ID bool result = true; if (EditId != "") { result = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().VisitorIsExists(cardNo, companyId, EditId); } else { result = EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().VisitorIsExists(cardNo, companyId, null); } if (result) { MessageBox.ShowAndRedirect(this, "该常旅客已存在!", "VisitorsPage.aspx"); } else {//如果不存在,就执行修改/添加操作 if (EditId != "") { Model.Id = EditId; if (EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().UpdateTicketVisitorInfo(Model)) { MessageBox.ShowAndRedirect(this, "修改成功", "VisitorList.aspx"); } else { MessageBox.ShowAndRedirect(this, "修改失败", "VisitorsPage.aspx"); } } else { Model.Id = Guid.NewGuid().ToString(); if (EyouSoft.BLL.TicketStructure.TicketVisitor.CreateInstance().AddTicketVisitorInfo(Model)) { MessageBox.ShowAndRedirect(this, "新增成功", "VisitorList.aspx"); } else { MessageBox.ShowAndRedirect(this, "新增失败", "VisitorsPage.aspx"); } } } }