Ejemplo n.º 1
0
        protected void DataInit(int airComPanyId, int beginId, int endId, int orderIndex)
        {
            EyouSoft.Model.TicketStructure.QueryTicketFreightInfo model = new EyouSoft.Model.TicketStructure.QueryTicketFreightInfo(SiteUserInfo.CompanyID, null, beginId, endId, 0, null, null, airComPanyId, null);

            IList <EyouSoft.Model.TicketStructure.TicketFreightInfo> list = EyouSoft.BLL.TicketStructure.TicketFreightInfo.CreateInstance().GetList(pageSize, pageIndex, ref recordCount, orderIndex, model);

            this.mai_rptList.DataSource = list;
            this.mai_rptList.DataBind();
            BindPage();
            if (list != null && list.Count == 0)
            {
                this.lblMsg.Text             = "未找到相关数据";
                this.ExportPageInfo1.Visible = false;
            }
            list = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取采购商查看运价信息集合
        /// </summary>
        /// <param name="QueryTicketFreightInfo">查询条件实体</param>
        /// <returns>返回运价信息实体集合</returns>
        public virtual IList <EyouSoft.Model.TicketStructure.TicketFreightInfoList> GetFreightInfoList(EyouSoft.Model.TicketStructure.QueryTicketFreightInfo QueryTicketFreightInfo)
        {
            List <EyouSoft.Model.TicketStructure.TicketFreightInfoList> list = new List <EyouSoft.Model.TicketStructure.TicketFreightInfoList>();

            System.Xml.XmlAttributeCollection attList     = null;
            System.Xml.XmlDocument            xml         = null;
            System.Xml.XmlNodeList            xmlNodeList = null;

            #region 拼接Sql

            StringBuilder strSql = new StringBuilder();
            strSql.Append(" select PayPrice,FreightAddition,Id,FlightId,FlightName,CompanyId,CompanyName,ProductType,MaxPCount,SupplierRemark,FreightType,ContactMQ,FreightStartDate,FreightEndDate from view_TicketFreightInfo where IsEnabled = '1' and IsExpired = '0' ");

            if (QueryTicketFreightInfo != null)
            {
                if (QueryTicketFreightInfo.FreightType.HasValue)
                {
                    strSql.AppendFormat(" and FreightType = {0} ", (int)QueryTicketFreightInfo.FreightType);
                }
                if (QueryTicketFreightInfo.HomeCity > 0)
                {
                    strSql.AppendFormat(" and NoGadHomeCityId = {0} ", QueryTicketFreightInfo.HomeCity);
                }
                if (QueryTicketFreightInfo.DestCity > 0)
                {
                    strSql.AppendFormat(" and NoGadDestCityId = {0} ", QueryTicketFreightInfo.DestCity);
                }
                if (QueryTicketFreightInfo.AirportId > 0)
                {
                    strSql.AppendFormat(" and FlightId = {0} ", QueryTicketFreightInfo.AirportId);
                }
            }

            strSql.Append(" order by PayPrice desc ");

            #endregion

            #region 实体赋值

            DbCommand dc = this._dataBase.GetSqlStringCommand(strSql.ToString());

            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._dataBase))
            {
                EyouSoft.Model.TicketStructure.TicketFreightInfo model = null;

                while (dr.Read())
                {
                    if (dr.IsDBNull(dr.GetOrdinal("FlightId")))
                    {
                        continue;
                    }

                    EyouSoft.Model.TicketStructure.TicketFreightInfoList modelFreightInfoList = list.Find(
                        (EyouSoft.Model.TicketStructure.TicketFreightInfoList tmp) =>
                    {
                        if (int.Parse(dr["FlightId"].ToString()) == tmp.Id)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    });

                    modelFreightInfoList = modelFreightInfoList ?? new EyouSoft.Model.TicketStructure.TicketFreightInfoList();
                    if (modelFreightInfoList.Id <= 0)
                    {
                        modelFreightInfoList.FreightInfoList = new List <EyouSoft.Model.TicketStructure.TicketFreightInfo>();
                        list.Add(modelFreightInfoList);  //集合不存在,加入集合中
                    }

                    #region 航空公司信息

                    modelFreightInfoList.Id          = int.Parse(dr["FlightId"].ToString());
                    modelFreightInfoList.AirportName = dr["FlightName"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("PayPrice")))
                    {
                        modelFreightInfoList.AirportPayPrice = modelFreightInfoList.AirportPayPrice + decimal.Parse(dr["PayPrice"].ToString());
                    }

                    #endregion

                    #region 运价信息

                    model                     = new EyouSoft.Model.TicketStructure.TicketFreightInfo();
                    model.Id                  = dr.GetString(dr.GetOrdinal("Id"));
                    model.FlightId            = dr.GetInt32(dr.GetOrdinal("FlightId"));
                    model.FlightName          = dr.GetString(dr.GetOrdinal("FlightName"));
                    model.Company.ID          = dr.GetString(dr.GetOrdinal("CompanyId"));
                    model.Company.CompanyName = dr["CompanyName"].ToString();
                    model.ContactMQ           = dr["ContactMQ"].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("ProductType")))
                    {
                        model.ProductType = (EyouSoft.Model.TicketStructure.ProductType) int.Parse(dr.GetByte(dr.GetOrdinal("ProductType")).ToString());
                    }
                    model.MaxPCount      = dr.GetInt32(dr.GetOrdinal("MaxPCount"));
                    model.SupplierRemark = dr.GetString(dr.GetOrdinal("SupplierRemark"));
                    if (!dr.IsDBNull(dr.GetOrdinal("FreightType")))
                    {
                        model.FreightType = (EyouSoft.Model.TicketStructure.FreightType) int.Parse(dr.GetByte(dr.GetOrdinal("FreightType")).ToString());
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("FreightStartDate")))
                    {
                        model.FreightStartDate = DateTime.Parse(dr["FreightStartDate"].ToString());
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("FreightEndDate")))
                    {
                        model.FreightEndDate = DateTime.Parse(dr["FreightEndDate"].ToString());
                    }

                    #endregion

                    #region 运价扩展信息

                    if (!string.IsNullOrEmpty(dr["FreightAddition"].ToString()))
                    {
                        xml = new System.Xml.XmlDocument();
                        xml.LoadXml(dr["FreightAddition"].ToString());
                        xmlNodeList = xml.GetElementsByTagName("tbl_TicketFreightAddition");
                        if (xmlNodeList != null)
                        {
                            for (int i = 0; i < xmlNodeList.Count; i++)
                            {
                                if (i > 1)
                                {
                                    break;
                                }

                                attList = xmlNodeList[i].Attributes;
                                switch (attList["FromType"].Value)
                                {
                                case "0":      //去程
                                    if (attList["SelfDate"] != null && !string.IsNullOrEmpty(attList["SelfDate"].Value))
                                    {
                                        model.FromSelfDate = DateTime.Parse(attList["SelfDate"].Value);
                                    }
                                    if (attList["ForDay"] != null)
                                    {
                                        model.FromForDay = attList["ForDay"].Value;
                                    }
                                    if (attList["ReferPrice"] != null && !string.IsNullOrEmpty(attList["ReferPrice"].Value))
                                    {
                                        model.FromReferPrice = decimal.Parse(attList["ReferPrice"].Value);
                                    }
                                    if (attList["ReferRate"] != null && !string.IsNullOrEmpty(attList["ReferRate"].Value))
                                    {
                                        model.FromReferRate = decimal.Parse(attList["ReferRate"].Value);
                                    }
                                    if (attList["SetPrice"] != null && !string.IsNullOrEmpty(attList["SetPrice"].Value))
                                    {
                                        model.FromSetPrice = decimal.Parse(attList["SetPrice"].Value);
                                    }
                                    if (attList["FuelPrice"] != null && !string.IsNullOrEmpty(attList["FuelPrice"].Value))
                                    {
                                        model.FromFuelPrice = decimal.Parse(attList["FuelPrice"].Value);
                                    }
                                    if (attList["BuildPrice"] != null && !string.IsNullOrEmpty(attList["BuildPrice"].Value))
                                    {
                                        model.FromBuildPrice = decimal.Parse(attList["BuildPrice"].Value);
                                    }
                                    break;

                                case "1":      //回程
                                    if (attList["SelfDate"] != null && !string.IsNullOrEmpty(attList["SelfDate"].Value))
                                    {
                                        model.ToSelfDate = DateTime.Parse(attList["SelfDate"].Value);
                                    }
                                    if (attList["ForDay"] != null)
                                    {
                                        model.ToForDay = attList["ForDay"].Value;
                                    }
                                    if (attList["ReferPrice"] != null && !string.IsNullOrEmpty(attList["ReferPrice"].Value))
                                    {
                                        model.ToReferPrice = decimal.Parse(attList["ReferPrice"].Value);
                                    }
                                    if (attList["ReferRate"] != null && !string.IsNullOrEmpty(attList["ReferRate"].Value))
                                    {
                                        model.ToReferRate = decimal.Parse(attList["ReferRate"].Value);
                                    }
                                    if (attList["SetPrice"] != null && !string.IsNullOrEmpty(attList["SetPrice"].Value))
                                    {
                                        model.ToSetPrice = decimal.Parse(attList["SetPrice"].Value);
                                    }
                                    if (attList["FuelPrice"] != null && !string.IsNullOrEmpty(attList["FuelPrice"].Value))
                                    {
                                        model.ToFuelPrice = decimal.Parse(attList["FuelPrice"].Value);
                                    }
                                    if (attList["BuildPrice"] != null && !string.IsNullOrEmpty(attList["BuildPrice"].Value))
                                    {
                                        model.ToBuildPrice = decimal.Parse(attList["BuildPrice"].Value);
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    if (attList != null)
                    {
                        attList.RemoveAll();
                    }
                    attList     = null;
                    xmlNodeList = null;
                    xml         = null;

                    #endregion

                    modelFreightInfoList.FreightInfoList.Add(model);
                }
            }

            #endregion

            if (attList != null)
            {
                attList.RemoveAll();
            }
            attList     = null;
            xmlNodeList = null;
            xml         = null;

            return(list.OrderByDescending(Item => (Item.AirportPayPrice)).ToList());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取供应商的运价信息集合
        /// </summary>
        /// <param name="PageSize">当前页数</param>
        /// <param name="PageIndex">每页条数</param>
        /// <param name="RecordCount">总记录数</param>
        /// <param name="OrderIndex">排序索引:0/1运价添加时间升/降序;2/3最后修改时间升/降序;4/5套餐类型升/降序;6/7启用状态升/降序;8/9航空公司编号升/降序;</param>
        /// <param name="QueryTicketFreightInfo">查询条件实体</param>
        /// <returns>返回运价信息实体集合</returns>
        public virtual IList <EyouSoft.Model.TicketStructure.TicketFreightInfo> GetList(int PageSize, int PageIndex, ref int RecordCount, int OrderIndex, EyouSoft.Model.TicketStructure.QueryTicketFreightInfo QueryTicketFreightInfo)
        {
            IList <EyouSoft.Model.TicketStructure.TicketFreightInfo> list = new List <EyouSoft.Model.TicketStructure.TicketFreightInfo>();
            StringBuilder strWhere = new StringBuilder(" 1 = 1 ");
            string        strFiles = " [Id],[CompanyId],(select CompanyName from tbl_CompanyInfo where tbl_CompanyInfo.ID = tbl_TicketFreightInfo.CompanyId) as CompanyName,[RateType],[FreightType],[ProductType],[BuyType],[FlightId],[FlightName],[NoGadHomeCityId],[NoGadHomeCityIdName],[NoGadDestCityId],[NoGadDestCityName],[GadHomeCityId],[GadHomeCityName],[GadDestCityId],[GadDestCityName],[IsEnabled],[IsCheckPNR],[IsExpired],[FreightStartDate],[FreightEndDate],[MaxPCount],[WorkStartTime],[WorkEndTime],[SupplierRemark],[LastUpdateDate],[FreightBuyId],[OperatorId],[IssueTime] ";
            string        strOrder = string.Empty;

            switch (OrderIndex)
            {
            case 0: strOrder = " IssueTime asc "; break;

            case 1: strOrder = " IssueTime desc "; break;

            case 2: strOrder = " LastUpdateDate asc "; break;

            case 3: strOrder = " LastUpdateDate desc "; break;

            case 4: strOrder = " BuyType asc "; break;

            case 5: strOrder = " BuyType desc "; break;

            case 6: strOrder = " IsEnabled asc "; break;

            case 7: strOrder = " IsEnabled desc "; break;

            case 8: strOrder = " FlightId asc "; break;

            case 9: strOrder = " FlightId desc "; break;
            }

            if (QueryTicketFreightInfo != null)
            {
                if (!string.IsNullOrEmpty(QueryTicketFreightInfo.SellCompanyId))
                {
                    if (QueryTicketFreightInfo.SellCompanyId != "14ab1cc4-055e-47b2-87b6-eb51c17a2921")//某家供应商能查看所有运价(暂时保留功能)
                    {
                        strWhere.AppendFormat(" and CompanyId = '{0}' ", QueryTicketFreightInfo.SellCompanyId);
                    }
                }
                if (QueryTicketFreightInfo.FreightType.HasValue)
                {
                    strWhere.AppendFormat(" and FreightType = {0} ", (int)QueryTicketFreightInfo.FreightType);
                }
                if (QueryTicketFreightInfo.HomeCity > 0)
                {
                    strWhere.AppendFormat(" and NoGadHomeCityId = {0} ", QueryTicketFreightInfo.HomeCity);
                }
                if (QueryTicketFreightInfo.DestCity > 0)
                {
                    strWhere.AppendFormat(" and NoGadDestCityId = {0} ", QueryTicketFreightInfo.DestCity);
                }
                if (QueryTicketFreightInfo.AirportId > 0)
                {
                    strWhere.AppendFormat(" and FlightId = {0} ", QueryTicketFreightInfo.AirportId);
                }
            }

            using (IDataReader dr = DbHelper.ExecuteReader(this._dataBase, PageSize, PageIndex, ref RecordCount, "tbl_TicketFreightInfo", "Id", strFiles, strWhere.ToString(), strOrder))
            {
                list = GetSelectModel(dr);
            }

            return(list);
        }