//public static TicketInfoEntity CommonHotelGroupSelect(TicketInfoEntity ticketInfoEntity)
        //{
        //    ticketInfoEntity.LogMessages.MsgType = MessageType.INFO;
        //    ticketInfoEntity.LogMessages.Content = _nameSpaceClass + "CommonHotelGroupSelect";
        //    LoggerHelper.LogWriter(ticketInfoEntity.LogMessages);
        //    try
        //    {
        //        return TicketInfoDA.CommonHotelGroupSelect(ticketInfoEntity);
        //    }
        //    catch (Exception ex)
        //    {
        //        ticketInfoEntity.LogMessages.MsgType = MessageType.ERROR;
        //        ticketInfoEntity.LogMessages.Content = _nameSpaceClass + "CommonHotelGroupSelect  Error: " + ex.Message;
        //        LoggerHelper.LogWriter(ticketInfoEntity.LogMessages);
        //        throw ex;
        //    }
        //}
        public static TicketInfoEntity BindTicketInfoList(TicketInfoEntity ticketInfoEntity)
        {
            ticketInfoEntity.LogMessages.MsgType = MessageType.INFO;
            ticketInfoEntity.LogMessages.Content = _nameSpaceClass + "BindTicketInfoList";
            LoggerHelper.LogWriter(ticketInfoEntity.LogMessages);

            try
            {
                return TicketInfoDA.BindTicketInfoList(ticketInfoEntity);
            }
            catch (Exception ex)
            {
                ticketInfoEntity.LogMessages.MsgType = MessageType.ERROR;
                ticketInfoEntity.LogMessages.Content = _nameSpaceClass + "BindTicketInfoList  Error: " + ex.Message;
                LoggerHelper.LogWriter(ticketInfoEntity.LogMessages);
                throw ex;
            }
        }
    private void SetTicketTypeAreaData()
    {
        string packageName = ViewState["packagename"].ToString();//优惠券礼包名
        string amountFrom = ViewState["amountfrom"].ToString();
        string amountTo = ViewState["amountto"].ToString();
        string pickFromDate = ViewState["pickfromdate"].ToString();
        string pickToDate = ViewState["picktodate"].ToString();
        string packagetype = ViewState["packagetype"].ToString();
        string tickettime = ViewState["tickettime"].ToString();

        TicketInfoEntity _ticketInfoEntity = new TicketInfoEntity();
        _ticketInfoEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _ticketInfoEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _ticketInfoEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _ticketInfoEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _ticketInfoEntity.TicketInfoDBEntity = new List<TicketInfoDBEntity>();
        TicketInfoDBEntity ticketInfoDBEntity = new TicketInfoDBEntity();
        ticketInfoDBEntity.PackageName = packageName;
        ticketInfoDBEntity.AmountFrom = amountFrom;
        ticketInfoDBEntity.AmountTo = amountTo;
        ticketInfoDBEntity.Pickfromdate = pickFromDate;
        ticketInfoDBEntity.Picktodate = pickToDate;
        ticketInfoDBEntity.PackageType = packagetype;
        ticketInfoDBEntity.TicketTime = tickettime;

        _ticketInfoEntity.TicketInfoDBEntity.Add(ticketInfoDBEntity);
        DataSet dsResult = TicketInfoBP.BindTicketInfoList(_ticketInfoEntity).QueryResult;

        decimal decTpOperate = 0;
        decimal decTpMarket = 0;
        decimal decTpOther = 0;

        decimal decAuOperate = 0;
        decimal decAuMarket = 0;
        decimal decAuOther = 0;

        decimal decOuOperate = 0;
        decimal decOuMarket = 0;
        decimal decOuOther = 0;

        if (dsResult.Tables.Count > 0)
        {
            #region 运营 优惠券
            foreach (DataRow drpg in dsResult.Tables["ALLPG"].Rows)
            {
                if ("0".Equals(drpg["packagetype"].ToString().Trim()))
                {
                    decTpOperate = decTpOperate + ConverDataDec(drpg["ALLPG"].ToString().Trim());
                }
                else if ("1".Equals(drpg["packagetype"].ToString().Trim()))
                {
                    decTpMarket = decTpMarket + ConverDataDec(drpg["ALLPG"].ToString().Trim());
                }
                else
                {
                    decTpOther = decTpOther + ConverDataDec(drpg["ALLPG"].ToString().Trim());
                }
            }
            #endregion

            #region 领取用户总数
            foreach (DataRow drUr in dsResult.Tables["ALLUSER"].Rows)
            {
                if ("0".Equals(drUr["packagetype"].ToString().Trim()))
                {
                    decAuOperate = decAuOperate + ConverDataDec(drUr["ALLUSER"].ToString().Trim());
                }
                else if ("1".Equals(drUr["packagetype"].ToString().Trim()))
                {
                    decAuMarket = decAuMarket + ConverDataDec(drUr["ALLUSER"].ToString().Trim());
                }
                else
                {
                    decAuOther = decAuOther + ConverDataDec(drUr["ALLUSER"].ToString().Trim());
                }
            }
            #endregion

            #region 使用用户总数
            foreach (DataRow drOUr in dsResult.Tables["ORDUSER"].Rows)
            {
                if ("0".Equals(drOUr["packagetype"].ToString().Trim()))
                {
                    decOuOperate = decOuOperate + ConverDataDec(drOUr["ORDUSER"].ToString().Trim());
                }
                else if ("1".Equals(drOUr["packagetype"].ToString().Trim()))
                {
                    decOuMarket = decOuMarket + ConverDataDec(drOUr["ORDUSER"].ToString().Trim());
                }
                else
                {
                    decOuOther = decOuOther + ConverDataDec(drOUr["ORDUSER"].ToString().Trim());
                }
            }
            #endregion

            // 运营
            // 共有优惠券活动
            lbTicketOperate.Text = decTpOperate.ToString();
            // 共领用用户数
            lbOperateAllUser.Text = decAuOperate.ToString();
            // 共使用用户数
            lbOperateUsed.Text = decOuOperate.ToString();

            // 市场
            // 共有优惠券活动
            lbTickeMarket.Text = decTpMarket.ToString();
            // 共领用用户数
            lbMarketAllUser.Text = decAuMarket.ToString();
            // 共使用用户数
            lbMarketUsed.Text = decOuMarket.ToString();

            // 其他
            // 共有优惠券活动
            lbTicketOther.Text = decTpOther.ToString();
            // 共领用用户数
            lbOtherAllUser.Text = decAuOther.ToString();
            // 共使用用户数
            lbOtherUsed.Text = decOuOther.ToString();

            #region 优惠券订单总数
            decimal decOrLm = 0;
            decimal decOrLm2 = 0;
            decimal decOrbarb = 0;

            if (dsResult.Tables["ALLORD"].Rows.Count > 0)
            {
                DataRow[] drListOp = dsResult.Tables["ALLORD"].Select("packagetype='0'");
                foreach (DataRow drOp in drListOp)
                {
                    if ("lmbar".Equals(drOp["price_code"].ToString().Trim().ToLower()))
                    {
                        decOrLm = decOrLm + ConverDataDec(drOp["ALLORD"].ToString().Trim());
                    }
                    else if ("lmbar2".Equals(drOp["price_code"].ToString().Trim().ToLower()))
                    {
                        decOrLm2 = decOrLm2 + ConverDataDec(drOp["ALLORD"].ToString().Trim());
                    }
                    else
                    {
                        decOrbarb = decOrbarb + ConverDataDec(drOp["ALLORD"].ToString().Trim());
                    }
                }

                lbOperateLmOrder.Text = decOrLm.ToString();
                lbOperateLm2Order.Text = decOrLm2.ToString();
                lbOperateBarbOrder.Text = decOrbarb.ToString();

                decOrLm = 0;
                decOrLm2 = 0;
                decOrbarb = 0;

                DataRow[] drListMt = dsResult.Tables["ALLORD"].Select("packagetype='1'");
                foreach (DataRow drMt in drListMt)
                {
                    if ("lmbar".Equals(drMt["price_code"].ToString().Trim().ToLower()))
                    {
                        decOrLm = decOrLm + ConverDataDec(drMt["ALLORD"].ToString().Trim());
                    }
                    else if ("lmbar2".Equals(drMt["price_code"].ToString().Trim().ToLower()))
                    {
                        decOrLm2 = decOrLm2 + ConverDataDec(drMt["ALLORD"].ToString().Trim());
                    }
                    else
                    {
                        decOrbarb = decOrbarb + ConverDataDec(drMt["ALLORD"].ToString().Trim());
                    }
                }

                lbMarketLmOrder.Text = decOrLm.ToString();
                lbMarketLm2Order.Text = decOrLm2.ToString();
                lbMarketBarbOrder.Text = decOrbarb.ToString();

                decOrLm = 0;
                decOrLm2 = 0;
                decOrbarb = 0;

                DataRow[] drListOt = dsResult.Tables["ALLORD"].Select("packagetype='2'");
                foreach (DataRow drOt in drListOt)
                {
                    if ("lmbar".Equals(drOt["price_code"].ToString().Trim().ToLower()))
                    {
                        decOrLm = decOrLm + ConverDataDec(drOt["ALLORD"].ToString().Trim());
                    }
                    else if ("lmbar2".Equals(drOt["price_code"].ToString().Trim().ToLower()))
                    {
                        decOrLm2 = decOrLm2 + ConverDataDec(drOt["ALLORD"].ToString().Trim());
                    }
                    else
                    {
                        decOrbarb = decOrbarb + ConverDataDec(drOt["ALLORD"].ToString().Trim());
                    }
                }

                lbOtherLmOrder.Text = decOrLm.ToString();
                lbOtherLm2Order.Text = decOrLm2.ToString();
                lbOtherBarbOrder.Text = decOrbarb.ToString();
            }
            else
            {
                lbOperateLmOrder.Text = "0";
                lbOperateLm2Order.Text = "0";
                lbOperateBarbOrder.Text = "0";

                lbMarketLmOrder.Text = "0";
                lbMarketLm2Order.Text = "0";
                lbMarketBarbOrder.Text = "0";

                lbOtherLmOrder.Text = "0";
                lbOtherLm2Order.Text = "0";
                lbOtherBarbOrder.Text = "0";
            }
            #endregion

            #region 优惠券成功订单总数
            decimal decSuOrLm = 0;
            decimal decSuOrLm2 = 0;
            decimal decSuOrbarb = 0;

            if (dsResult.Tables["SUCORD"].Rows.Count > 0)
            {
                DataRow[] drSuOp = dsResult.Tables["SUCORD"].Select("packagetype='0'");
                foreach (DataRow drAOr in drSuOp)
                {
                    if ("lmbar".Equals(drAOr["price_code"].ToString().Trim().ToLower()))
                    {
                        decSuOrLm = decSuOrLm + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                    else if ("lmbar2".Equals(drAOr["price_code"].ToString().Trim().ToLower()))
                    {
                        decSuOrLm2 = decSuOrLm2 + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                    else
                    {
                        decSuOrbarb = decSuOrbarb + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                }

                lbOperateLmSuOrder.Text = decSuOrLm.ToString();
                lbOperateLm2SuOrder.Text = decSuOrLm2.ToString();
                lbOperateBarbSuOrder.Text = decSuOrbarb.ToString();

                decSuOrLm = 0;
                decSuOrLm2 = 0;
                decSuOrbarb = 0;

                DataRow[] drSuOr = dsResult.Tables["SUCORD"].Select("packagetype='1'");
                foreach (DataRow drAOr in drSuOr)
                {
                    if ("lmbar".Equals(drAOr["price_code"].ToString().Trim().ToLower()))
                    {
                        decSuOrLm = decSuOrLm + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                    else if ("lmbar2".Equals(drAOr["price_code"].ToString().Trim().ToLower()))
                    {
                        decSuOrLm2 = decSuOrLm2 + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                    else
                    {
                        decSuOrbarb = decSuOrbarb + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                }

                lbMarketLmSuOrder.Text = decSuOrLm.ToString();
                lbMarketLm2SuOrder.Text = decSuOrLm2.ToString();
                lbMarketBarbSuOrder.Text = decSuOrbarb.ToString();

                decSuOrLm = 0;
                decSuOrLm2 = 0;
                decSuOrbarb = 0;

                DataRow[] drSuOt = dsResult.Tables["SUCORD"].Select("packagetype='2'");
                foreach (DataRow drAOr in drSuOt)
                {
                    if ("lmbar".Equals(drAOr["price_code"].ToString().Trim().ToLower()))
                    {
                        decSuOrLm = decSuOrLm + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                    else if ("lmbar2".Equals(drAOr["price_code"].ToString().Trim().ToLower()))
                    {
                        decSuOrLm2 = decSuOrLm2 + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                    else
                    {
                        decSuOrbarb = decSuOrbarb + ConverDataDec(drAOr["SUCORD"].ToString().Trim());
                    }
                }

                lbOtherLmSuOrder.Text = decSuOrLm.ToString();
                lbOtherLm2SuOrder.Text = decSuOrLm2.ToString();
                lbOtherBarbSuOrder.Text = decSuOrbarb.ToString();
            }
            else
            {
                lbOperateLmSuOrder.Text = "0";
                lbOperateLm2SuOrder.Text = "0";
                lbOperateBarbSuOrder.Text = "0";

                lbMarketLmSuOrder.Text = "0";
                lbMarketLm2SuOrder.Text = "0";
                lbMarketBarbSuOrder.Text = "0";

                lbOtherLmSuOrder.Text = "0";
                lbOtherLm2SuOrder.Text = "0";
                lbOtherBarbSuOrder.Text = "0";
            }
            #endregion

        }
        else
        {
            lbTicketOperate.Text = "0";
            lbOperateAllUser.Text = "0";
            lbOperateUsed.Text = "0";
            lbOperateLmOrder.Text = "0";
            lbOperateLm2Order.Text = "0";
            lbOperateBarbOrder.Text = "0";
            lbOperateLmSuOrder.Text = "0";
            lbOperateLm2SuOrder.Text = "0";
            lbOperateBarbSuOrder.Text = "0";

            lbTickeMarket.Text = "0";
            lbMarketAllUser.Text = "0";
            lbMarketUsed.Text = "0";
            lbMarketLmOrder.Text = "0";
            lbMarketLm2Order.Text = "0";
            lbMarketBarbOrder.Text = "0";
            lbMarketLmSuOrder.Text = "0";
            lbMarketLm2SuOrder.Text = "0";
            lbMarketBarbSuOrder.Text = "0";

            lbTicketOther.Text = "0";
            lbOtherAllUser.Text = "0";
            lbOtherUsed.Text = "0";
            lbOtherLmOrder.Text = "0";
            lbOtherLm2Order.Text = "0";
            lbOtherBarbOrder.Text = "0";
            lbOtherLmSuOrder.Text = "0";
            lbOtherLm2SuOrder.Text = "0";
            lbOtherBarbSuOrder.Text = "0";
        }

        // 运营
        // 共有优惠券活动
        //lbTicketOperate.Text = decTpOperate.ToString();
        // 共领用用户数
        //lbOperateAllUser.Text = decAuOperate.ToString();
        // 共使用用户数
        //lbOperateUsed.Text = decOuOperate.ToString();
        //// 总产生订单
        //lbOperateLmOrder.Text = "";
        //lbOperateLm2Order.Text = "";
        //lbOperateBarbOrder.Text = "";
        //// 总产生成功订单
        //lbOperateLmSuOrder.Text = "";
        //lbOperateLm2SuOrder.Text = "";
        //lbOperateBarbSuOrder.Text = "";

        // 市场
        // 共有优惠券活动
        //lbTickeMarket.Text = decTpMarket.ToString();
        //// 共领用用户数
        //lbMarketAllUser.Text = decAuMarket.ToString();
        //// 共使用用户数
        //lbMarketUsed.Text = decOuMarket.ToString();
        //// 总产生订单
        //lbMarketLmOrder.Text = "";
        //lbMarketLm2Order.Text = "";
        //lbMarketBarbOrder.Text = "";
        //// 总产生成功订单
        //lbMarketLmSuOrder.Text = "";
        //lbMarketLm2SuOrder.Text = "";
        //lbMarketBarbSuOrder.Text = "";

        // 其他
        // 共有优惠券活动
        //lbTicketOther.Text = decTpOther.ToString();
        //// 共领用用户数
        //lbOtherAllUser.Text = decAuOther.ToString();
        //// 共使用用户数
        //lbOtherUsed.Text = decOuOther.ToString();
        // 总产生订单
        //lbOtherLmOrder.Text = "";
        //lbOtherLm2Order.Text = "";
        //lbOtherBarbOrder.Text = "";
        //// 总产生成功订单
        //lbOtherLmSuOrder.Text = "";
        //lbOtherLm2SuOrder.Text = "";
        //lbOtherBarbSuOrder.Text = "";
    }
        //public static TicketInfoEntity CommonHotelGroupSelect(TicketInfoEntity ticketInfoEntity)
        //{
        //    ticketInfoEntity.QueryResult = HotelVp.Common.DBUtility.DbManager.Query("TicketInfo", "t_lm_b_common_hotelgrouplist", false);
        //    return ticketInfoEntity;
        //}
        public static TicketInfoEntity BindTicketInfoList(TicketInfoEntity ticketInfoEntity)
        {
            OracleParameter[] parm ={
                                    new OracleParameter("PACKAGENAME",OracleType.VarChar),
                                    new OracleParameter("AMOUNTFROM",OracleType.Int32),
                                    new OracleParameter("AMOUNTTO",OracleType.Int32),
                                    new OracleParameter("STARTDATE",OracleType.VarChar),
                                    new OracleParameter("ENDDATE",OracleType.VarChar),
                                    new OracleParameter("PACKAGETYPE",OracleType.VarChar),
                                    new OracleParameter("TICKETDT",OracleType.VarChar)
                                };

            TicketInfoDBEntity dbParm = (ticketInfoEntity.TicketInfoDBEntity.Count > 0) ? ticketInfoEntity.TicketInfoDBEntity[0] : new TicketInfoDBEntity();

            if (String.IsNullOrEmpty(dbParm.PackageName))
            {
                parm[0].Value = DBNull.Value;
            }
            else
            {
                parm[0].Value = dbParm.PackageName;
            }

            if (String.IsNullOrEmpty(dbParm.AmountFrom))
            {
                parm[1].Value = DBNull.Value;
            }
            else
            {
                parm[1].Value = dbParm.AmountFrom;
            }

            if (String.IsNullOrEmpty(dbParm.AmountTo))
            {
                parm[2].Value = DBNull.Value;
            }
            else
            {
                parm[2].Value = dbParm.AmountTo;
            }

            if (String.IsNullOrEmpty(dbParm.Pickfromdate))
            {
                parm[3].Value = DBNull.Value;
            }
            else
            {
                parm[3].Value = dbParm.Pickfromdate;
            }

            if (String.IsNullOrEmpty(dbParm.Picktodate))
            {
                parm[4].Value = DBNull.Value;
            }
            else
            {
                parm[4].Value = dbParm.Picktodate;
            }

            if (String.IsNullOrEmpty(dbParm.PackageType))
            {
                parm[5].Value = DBNull.Value;
            }
            else
            {
                parm[5].Value = dbParm.PackageType;
            }

            if (String.IsNullOrEmpty(dbParm.TicketTime))
            {
                parm[6].Value = DBNull.Value;
            }
            else
            {
                parm[6].Value = dbParm.TicketTime;
            }

            //已过领用期  0  > 领用最大时间

            //已过使用期  1  > 使用最大时间

            //当前可领用  2  领用开始 < 当前时间 < 领用结束

            //当前可使用  3  使用开始 < 当前时间 < 使用结束

            DataSet dsResult = new DataSet();

            DataTable dtAllPg = new DataTable();
            dtAllPg = DbManager.Query("Ticket", "t_lm_ticket_all_type", true, parm).Tables[0].Copy();
            dtAllPg.TableName = "ALLPG";

            DataTable dtAllUser = new DataTable();
            dtAllUser = DbManager.Query("Ticket", "t_lm_ticket_all_user", true, parm).Tables[0].Copy();
            dtAllUser.TableName = "ALLUSER";

            DataTable dtOrdUser = new DataTable();
            dtOrdUser = DbManager.Query("Ticket", "t_lm_ticket_ord_user", true, parm).Tables[0].Copy();
            dtOrdUser.TableName = "ORDUSER";

            DataTable dtAllOrd = new DataTable();
            dtAllOrd = DbManager.Query("Ticket", "t_lm_ticket_all_ord", true, parm).Tables[0].Copy();
            dtAllOrd.TableName = "ALLORD";

            DataTable dtSucOrd = new DataTable();
            dtSucOrd = DbManager.Query("Ticket", "t_lm_ticket_suc_ord", true, parm).Tables[0].Copy();
            dtSucOrd.TableName = "SUCORD";

            dsResult.Tables.Add(dtAllPg);
            dsResult.Tables.Add(dtAllUser);
            dsResult.Tables.Add(dtOrdUser);
            dsResult.Tables.Add(dtAllOrd);
            dsResult.Tables.Add(dtSucOrd);

            ticketInfoEntity.QueryResult = dsResult;
            return ticketInfoEntity;
        }