protected void Page_Load(object sender, EventArgs e) { if (!CheckMasterGrant(YuYingPermission.机票首页管理_团队票申请管理)) { Utils.ResponseNoPermit(YuYingPermission.机票首页管理_团队票申请管理, true); return; } if (!string.IsNullOrEmpty(Request.QueryString["TourId"])) { TourID = Request.QueryString["TourId"]; } if (!IsPostBack) { if (!string.IsNullOrEmpty(TourID)) { EyouSoft.Model.TicketStructure.GroupTickets Model = EyouSoft.BLL.TicketStructure.GroupTickets.CreateInstance().GetGroupTicket(int.Parse(TourID)); if (Model != null) { // 行程类型 ltrJourneyType.Text = Model.GroupType.ToString(); //开始城市 ltrStartCity.Text = Model.StartCity; //结束城市 ltrEndCity.Text = Model.EndCity; //乘机人数 ltrPersonCount.Text = Model.PelopeCount.ToString(); //联系电话 ltrTelephone.Text = Model.Phone; //航空公司 ltrPlaneCompany.Text = string.IsNullOrEmpty(Model.AirlinesType.ToString()) || Model.AirlinesType.ToString() == "0" ? "无" : Model.AirlinesType.ToString(); //去程航班号 ltrToPlaneNo.Text = Model.FlightNumber; //出发时间 ltrStarDate.Text = Model.StartTime; //时间范围 ltrRangeTime.Text = Model.TimeRange; //备注 ltrNotes.Text = Model.Notes; //联系人 ltrContactName.Text = Model.Contact; //联系qq ltrContactQQ.Text = Model.ContactQQ; //希望价格 ltrWishPirce.Text = Utils.FilterEndOfTheZeroDecimal(Model.HopesPrice); //Email地址 ltrEmail.Text = Model.Email; //乘客信息集合 IList <EyouSoft.Model.TicketStructure.PassengerInformation> list = Model.PassengerInformationList; if (list != null && list.Count > 0) { this.crp_PassongerList.DataSource = list; this.crp_PassongerList.DataBind(); } } } } }
/// <summary> /// 申请团队票 /// </summary> /// <param name="item">团队票实体</param> /// <returns>true:成功 false:失败</returns> public bool AddGroupTickets(EyouSoft.Model.TicketStructure.GroupTickets item) { if (item == null) { return(false); } if (item.PelopeCount < 10) //乘机人数必须大于等于10 { return(false); } return(dal.AddGroupTickets(item)); }
/// <summary> /// 分页获取团队票信息 /// </summary> /// <param name="pageSize">每页显示记录数</param> /// <param name="pageIndex">当前页</param> /// <param name="recordCount">总记录数</param> /// <returns>团队票集合</returns> public virtual IList <EyouSoft.Model.TicketStructure.GroupTickets> GetGroupTickets(int pageSize, int pageIndex, ref int recordCount) { string fileds = "ID,GroupType,StartCity,EndCity,PelopeCount,Phone,Airlines,FlightNumber,StartTime,TimeRange,RoundTripTime,Notes,Contact,ContactQQ,HopesPrice,Email,IsChecked,IssueTime"; string tableName = "tbl_GroupTickets"; string primaryKey = "ID"; string orderBy = " IssueTime DESC"; string query = string.Empty; PassengerInformation dalPassengerInformation = new PassengerInformation(); IList <EyouSoft.Model.TicketStructure.GroupTickets> list = new List <EyouSoft.Model.TicketStructure.GroupTickets>(); EyouSoft.Model.TicketStructure.GroupTickets item = null; using (IDataReader reader = DbHelper.ExecuteReader(this._database, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fileds, query, orderBy)) { while (reader.Read()) { item = new EyouSoft.Model.TicketStructure.GroupTickets() { ID = (int)reader["ID"], GroupType = (EyouSoft.Model.TicketStructure.GroupType)Enum.Parse(typeof(EyouSoft.Model.TicketStructure.GroupType), reader["GroupType"].ToString()), StartCity = reader["StartCity"].ToString(), EndCity = reader["EndCity"].ToString(), PelopeCount = (int)reader["PelopeCount"], Phone = reader["Phone"].ToString(), AirlinesType = (EyouSoft.Model.TicketStructure.AirlinesType)Enum.Parse(typeof(EyouSoft.Model.TicketStructure.AirlinesType), reader["Airlines"].ToString()), FlightNumber = reader.IsDBNull(reader.GetOrdinal("FlightNumber")) ? "" : reader["FlightNumber"].ToString(), StartTime = reader["StartTime"].ToString(), TimeRange = reader["TimeRange"].ToString(), RoundTripTime = reader.IsDBNull(reader.GetOrdinal("RoundTripTime")) ? "" : reader["RoundTripTime"].ToString(), Notes = reader.IsDBNull(reader.GetOrdinal("Notes")) ? "" : reader["Notes"].ToString(), Contact = reader.IsDBNull(reader.GetOrdinal("Contact")) ? "" : reader["Contact"].ToString(), ContactQQ = reader.IsDBNull(reader.GetOrdinal("ContactQQ")) ? "" : reader["ContactQQ"].ToString(), HopesPrice = reader.IsDBNull(reader.GetOrdinal("HopesPrice")) ? 0 : decimal.Parse(reader["HopesPrice"].ToString()), Email = reader.IsDBNull(reader.GetOrdinal("Email")) ? "" : reader["Email"].ToString(), IsChecked = reader["IsChecked"].ToString().Equals("1") ? true : false, IssueTime = DateTime.Parse(reader["IssueTime"].ToString()), //乘客信息 PassengerInformationList = dalPassengerInformation.GetPassengerInformation((int)reader["ID"]) }; list.Add(item); } } return(list); }
/// <summary> /// 申请团队票 /// </summary> /// <param name="item">团队票实体</param> /// <returns>true:成功 false:失败</returns> public virtual bool AddGroupTickets(EyouSoft.Model.TicketStructure.GroupTickets item) { DbCommand comm = this._database.GetSqlStringCommand(SQL_GroupTickets_AddGroupTickets); this._database.AddInParameter(comm, "@GroupType", DbType.Byte, (int)item.GroupType); this._database.AddInParameter(comm, "@StartCity", DbType.String, item.StartCity); this._database.AddInParameter(comm, "@EndCity", DbType.String, item.EndCity); this._database.AddInParameter(comm, "@PelopeCount", DbType.Int32, item.PelopeCount); this._database.AddInParameter(comm, "@Phone", DbType.String, item.Phone); this._database.AddInParameter(comm, "@Airlines", DbType.Byte, (int)item.AirlinesType); this._database.AddInParameter(comm, "@FlightNumber", DbType.String, item.FlightNumber); this._database.AddInParameter(comm, "@StartTime", DbType.String, item.StartTime); this._database.AddInParameter(comm, "@TimeRange", DbType.String, item.TimeRange); this._database.AddInParameter(comm, "@RoundTripTime", DbType.String, item.RoundTripTime); this._database.AddInParameter(comm, "@Notes", DbType.String, item.Notes); this._database.AddInParameter(comm, "@Contact", DbType.String, item.Contact); this._database.AddInParameter(comm, "@ContactQQ", DbType.String, item.ContactQQ); this._database.AddInParameter(comm, "@HopesPrice", DbType.Decimal, item.HopesPrice); this._database.AddInParameter(comm, "@Email", DbType.String, item.Email); int groupTicketsID = 0; //记录添加成功后的团队票编号 using (IDataReader reader = DbHelper.ExecuteReader(comm, this._database)) { if (reader.Read()) { groupTicketsID = int.Parse(reader[0].ToString()); } } if (groupTicketsID > 0) //添加成功 { if (item.PassengerInformationList != null && item.PassengerInformationList.Count > 0) { StringBuilder sql = new StringBuilder(); foreach (EyouSoft.Model.TicketStructure.PassengerInformation itemOne in item.PassengerInformationList) { sql.Append("INSERT INTO tbl_PassengerInformation(GroupTicketsID,UName,PassengerType,DocumentType,DocumentNo,Mobile)"); sql.Append("VALUES("); sql.Append(groupTicketsID); sql.Append(",'"); sql.Append(itemOne.UName); sql.Append("',"); if (itemOne.PassengerType.HasValue) { sql.Append((int)itemOne.PassengerType); } else { sql.Append("nullif(1,1)"); } sql.Append(","); if (itemOne.DocumentType.HasValue) { sql.Append((int)itemOne.DocumentType); } else { sql.Append("nullif(1,1)"); } sql.Append(",'"); sql.Append(itemOne.DocumentNo); sql.Append("','"); sql.Append(itemOne.Mobile); sql.Append("');"); //object[] parms = new object[]{ // groupTicketsID, // itemOne.UName, // itemOne.PassengerType.HasValue?(int?)itemOne.PassengerType:null, // itemOne.DocumentType.HasValue?(int?)itemOne.DocumentType:null, // itemOne.DocumentNo, // itemOne.Mobile //}; //sql.AppendFormat(SQL_PassengerInformation_Add, parms); } comm.CommandText = sql.ToString(); return(DbHelper.ExecuteSqlTrans(comm, this._database) > 0 ? true : false); } } return(true); }
protected void Page_Load(object sender, EventArgs e) { (this.Master as UserPublicCenter.MasterPage.NewPublicCenter).HeadMenuIndex = 3; Utils.AddStylesheetInclude(CssManage.GetCssFilePath("index2011")); Utils.AddStylesheetInclude(CssManage.GetCssFilePath("InformationStyle")); if (Utils.GetFormValue("hidSave") == "save") { EyouSoft.Model.TicketStructure.GroupTickets model = new EyouSoft.Model.TicketStructure.GroupTickets(); int airType = Utils.GetInt(Request.Form["selAirCompany"]);//获取航空公司 if (airType > 0) { model.AirlinesType = (EyouSoft.Model.TicketStructure.AirlinesType)airType; } model.Contact = Utils.GetFormValue("txtContacter"); model.ContactQQ = Utils.GetFormValue("txtQQ"); model.Email = Utils.GetFormValue("txtEmail"); model.EndCity = Utils.GetFormValue("txtEndCity"); model.FlightNumber = Utils.GetFormValue("txtNo"); model.GroupType = (EyouSoft.Model.TicketStructure.GroupType)Utils.GetInt(Request.Form["rdiType"], 1); model.HopesPrice = Utils.GetDecimal(Request.Form["txtPrice"]); model.IssueTime = DateTime.Now; model.Notes = Utils.GetFormValue("txtReamrk", 500); model.PelopeCount = Utils.GetInt(Request.Form["txtNum"]); if (model.PelopeCount < 10) { Utils.ShowAndRedirect("预订失败,人数不正确!", this.Request.Url.ToString()); } model.Phone = Utils.GetFormValue("txtTel"); model.StartCity = Utils.GetFormValue("txtStartCity"); model.StartTime = Utils.GetFormValue("txtStartDate"); model.TimeRange = Utils.GetFormValue("selSTime") + "—" + Utils.GetFormValue("selETime"); string[] names = Utils.GetFormValues("txtName"); string[] pTypes = Utils.GetFormValues("selpType"); string[] cTypes = Utils.GetFormValues("selcType"); string[] cNos = Utils.GetFormValues("txtcNo"); string[] mobiles = Utils.GetFormValues("txtMobile"); if (names != null && names.Length > 0) { IList <EyouSoft.Model.TicketStructure.PassengerInformation> passengerList = new List <EyouSoft.Model.TicketStructure.PassengerInformation>(); for (int i = 0; i < names.Length; i++) { EyouSoft.Model.TicketStructure.PassengerInformation passenger = new EyouSoft.Model.TicketStructure.PassengerInformation(); passenger.DocumentNo = cNos[i]; passenger.DocumentType = (EyouSoft.Model.TicketStructure.DocumentType)Utils.GetInt(cTypes[i], 1); passenger.Mobile = mobiles[i]; passenger.PassengerType = (EyouSoft.Model.TicketStructure.PassengerType)Utils.GetInt(pTypes[i], 1); passenger.UName = names[i]; passengerList.Add(passenger); } model.PassengerInformationList = passengerList; } if (EyouSoft.BLL.TicketStructure.GroupTickets.CreateInstance().AddGroupTickets(model)) { Utils.ShowAndRedirect("预订成功!", this.Request.Url.ToString()); } else { Utils.ShowAndRedirect("预订失败!", this.Request.Url.ToString()); } } }