Ejemplo n.º 1
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="model">团队定制实体</param>
 /// <returns>true:成功 false:失败</returns>
 public bool Add(EyouSoft.Model.HotelStructure.HotelTourCustoms model)
 {
     if (model == null)
     {
         return(false);
     }
     return(dal.Add(model));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model">团队定制实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Add(EyouSoft.Model.HotelStructure.HotelTourCustoms model)
        {
            DbCommand dc = this._database.GetSqlStringCommand(Sql_HotelTourCustoms_INSERT);

            this._database.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, model.CompanyId);
            this._database.AddInParameter(dc, "HotelCode", DbType.String, model.HotelCode);
            this._database.AddInParameter(dc, "HotelName", DbType.String, model.HotelName);
            this._database.AddInParameter(dc, "HotelStar", DbType.Int32, (int)model.HotelStar);
            this._database.AddInParameter(dc, "CityCode", DbType.String, model.CityCode);
            this._database.AddInParameter(dc, "LocationAsk", DbType.String, model.LocationAsk);
            this._database.AddInParameter(dc, "RoomAsk", DbType.String, model.RoomAsk);
            this._database.AddInParameter(dc, "LiveStartDate", DbType.DateTime, model.LiveStartDate);
            this._database.AddInParameter(dc, "LiveEndDate", DbType.DateTime, model.LiveEndDate);
            this._database.AddInParameter(dc, "RoomCount", DbType.Int32, model.RoomCount);
            this._database.AddInParameter(dc, "PeopleCount", DbType.Int32, model.PeopleCount);
            this._database.AddInParameter(dc, "BudgetMin", DbType.Decimal, model.BudgetMin);
            this._database.AddInParameter(dc, "BudgetMax", DbType.Decimal, model.BudgetMax);
            this._database.AddInParameter(dc, "Payment", DbType.Int32, (int)model.Payment);
            this._database.AddInParameter(dc, "GuestType", DbType.Int32, (int)model.GuestType);
            this._database.AddInParameter(dc, "TourType", DbType.Int32, (int)model.TourType);
            this._database.AddInParameter(dc, "OtherRemark", DbType.String, model.OtherRemark);
            this._database.AddInParameter(dc, "TreatState", DbType.Int32, (int)model.TreatState);
            return(DbHelper.ExecuteSql(dc, this._database) > 0 ? true : false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取团队定制实体
        /// </summary>
        /// <param name="Id">主键编号</param>
        /// <returns>团队预定实体</returns>
        public EyouSoft.Model.HotelStructure.HotelTourCustoms GetModel(int Id)
        {
            EyouSoft.Model.HotelStructure.HotelTourCustoms model = null;
            var strSql = new StringBuilder();

            strSql.Append(
                @" SELECT [Id],[CompanyId],[HotelCode],[HotelName],[HotelStar],[CityCode],[LocationAsk],[RoomAsk],
                    [LiveStartDate],[LiveEndDate],[RoomCount],[PeopleCount],[BudgetMin],[BudgetMax],[Payment],[GuestType],
                    [TourType],[OtherRemark],[TreatState],[TreateTime],[OperatorId],
                    (select top 1 ContactName,ContactSex,ContactTel,ContactFax,ContactMobile,ContactEmail,QQ,MQ,MSN from 
                    tbl_CompanyUser where tbl_CompanyUser.CompanyId = tbl_HotelTourCustoms.CompanyId and IsDeleted = '0' and 
                    IsEnable = '1' and IsAdmin = '1' for xml raw,root('Root')) as Contact
                    from tbl_HotelTourCustoms where Id=@Id; ");
            DbCommand dc = this._database.GetSqlStringCommand(strSql.ToString());

            this._database.AddInParameter(dc, "Id", DbType.Int32, Id);
            using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database))
            {
                if (dr.Read())
                {
                    model = new EyouSoft.Model.HotelStructure.HotelTourCustoms();
                    if (!dr.IsDBNull(dr.GetOrdinal("BudgetMax")))
                    {
                        model.BudgetMax = dr.GetDecimal(dr.GetOrdinal("BudgetMax"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("BudgetMin")))
                    {
                        model.BudgetMin = dr.GetDecimal(dr.GetOrdinal("BudgetMin"));
                    }
                    model.CityCode  = dr[dr.GetOrdinal("CityCode")].ToString();
                    model.CompanyId = dr[dr.GetOrdinal("CompanyId")].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("GuestType")))
                    {
                        model.GuestType = (EyouSoft.HotelBI.HBEGuestTypeIndicator) int.Parse(dr[dr.GetOrdinal("GuestType")].ToString());
                    }
                    model.HotelCode = dr[dr.GetOrdinal("HotelCode")].ToString();
                    model.HotelName = dr[dr.GetOrdinal("HotelName")].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("HotelStar")))
                    {
                        model.HotelStar = (EyouSoft.HotelBI.HotelRankEnum) int.Parse(dr[dr.GetOrdinal("HotelStar")].ToString());
                    }
                    model.Id = dr.GetInt32(dr.GetOrdinal("Id"));
                    if (!dr.IsDBNull(dr.GetOrdinal("LiveEndDate")))
                    {
                        model.LiveEndDate = dr.GetDateTime(dr.GetOrdinal("LiveEndDate"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("LiveStartDate")))
                    {
                        model.LiveStartDate = dr.GetDateTime(dr.GetOrdinal("LiveStartDate"));
                    }
                    model.LocationAsk = dr[dr.GetOrdinal("LocationAsk")].ToString();
                    model.OtherRemark = dr[dr.GetOrdinal("OtherRemark")].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("Payment")))
                    {
                        model.Payment = (EyouSoft.HotelBI.HBEPaymentType) int.Parse(dr[dr.GetOrdinal("Payment")].ToString());
                    }
                    model.PeopleCount = dr.GetInt32(dr.GetOrdinal("PeopleCount"));
                    model.RoomAsk     = dr[dr.GetOrdinal("RoomAsk")].ToString();
                    model.RoomCount   = dr.GetInt32(dr.GetOrdinal("RoomCount"));
                    if (!dr.IsDBNull(dr.GetOrdinal("TourType")))
                    {
                        model.TourType = (EyouSoft.Model.HotelStructure.TourTypeList) int.Parse(dr[dr.GetOrdinal("TourType")].ToString());
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("TreatState")))
                    {
                        model.TreatState = (EyouSoft.Model.HotelStructure.OrderStateList) int.Parse(dr[dr.GetOrdinal("TreatState")].ToString());
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("TreateTime")))
                    {
                        model.TreateTime = dr.GetDateTime(dr.GetOrdinal("TreateTime"));
                    }
                    model.OperatorId = dr.GetInt32(dr.GetOrdinal("OperatorId"));

                    #region 2011-12-20线路改版增加

                    if (!dr.IsDBNull(dr.GetOrdinal("Contact")))
                    {
                        var xRoot = XElement.Parse(dr.GetString(dr.GetOrdinal("Contact")));
                        var xRows = Common.Utility.GetXElements(xRoot, "row");
                        if (xRows != null && xRows.Any())
                        {
                            model.Contact = new Model.CompanyStructure.ContactPersonInfo();
                            foreach (var t in xRows)
                            {
                                if (t == null)
                                {
                                    continue;
                                }

                                model.Contact.ContactName = Common.Utility.GetXAttributeValue(t, "ContactName");
                                model.Contact.ContactSex  =
                                    (Model.CompanyStructure.Sex)
                                    Common.Utility.GetInt(Common.Utility.GetXAttributeValue(t, "ContactSex"));
                                model.Contact.Tel    = Common.Utility.GetXAttributeValue(t, "ContactTel");
                                model.Contact.Fax    = Common.Utility.GetXAttributeValue(t, "ContactFax");
                                model.Contact.Mobile = Common.Utility.GetXAttributeValue(t, "ContactMobile");
                                model.Contact.Email  = Common.Utility.GetXAttributeValue(t, "ContactEmail");
                                model.Contact.QQ     = Common.Utility.GetXAttributeValue(t, "QQ");
                                model.Contact.MQ     = Common.Utility.GetXAttributeValue(t, "MQ");
                                model.Contact.MSN    = Common.Utility.GetXAttributeValue(t, "MSN");
                            }
                        }
                    }

                    #endregion
                }
            }
            return(model);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取团队定制列表
        /// </summary>
        /// <param name="PageSize">每页显示条数</param>
        /// <param name="PageIndex">当前页码</param>
        /// <param name="RecordCount">总记录数</param>
        /// <param name="SearchInfo">团队定制查询实体</param>
        /// <returns>团队定制列表</returns>
        public IList <EyouSoft.Model.HotelStructure.HotelTourCustoms> GetList(int PageSize, int PageIndex, ref int RecordCount, EyouSoft.Model.HotelStructure.SearchTourCustomsInfo SearchInfo)
        {
            IList <EyouSoft.Model.HotelStructure.HotelTourCustoms> list = new List <EyouSoft.Model.HotelStructure.HotelTourCustoms>();
            string        tableName  = "tbl_HotelTourCustoms";
            string        fields     = @" Id,CompanyId,HotelCode,HotelName,HotelStar,LiveStartDate,LiveEndDate,RoomCount,PeopleCount,Payment,
                                IssueTime,TreatState,RoomAsk,OtherRemark,LocationAsk,GuestType,TourType,BudgetMin,BudgetMax,
                                (select top 1 ContactName,ContactSex,ContactTel,ContactFax,ContactMobile,ContactEmail,QQ,MQ,MSN 
                                    from tbl_CompanyUser where tbl_CompanyUser.CompanyId = tbl_HotelTourCustoms.CompanyId 
                                    and IsDeleted = '0' and IsEnable = '1' and IsAdmin = '1' for xml raw,root('Root')) as Contact";
            string        orderByStr = " IssueTime DESC ";
            string        PrimaryKey = "Id";
            StringBuilder strWhere   = new StringBuilder(" 1=1 ");

            if (SearchInfo != null)
            {
                if (!string.IsNullOrEmpty(SearchInfo.HotelCode))
                {
                    strWhere.AppendFormat(" and HotelCode='{0}' ", SearchInfo.HotelCode);
                }
                if (!string.IsNullOrEmpty(SearchInfo.HotelName))
                {
                    strWhere.AppendFormat(" and HotelName like '%{0}%' ", SearchInfo.HotelName);
                }
                if (SearchInfo.CheckInSDate.HasValue)
                {
                    strWhere.AppendFormat(" and datediff(dd,'{0}',LiveStartDate) >= 0 ", SearchInfo.CheckInSDate.Value.ToString());
                }
                if (SearchInfo.CheckInEDate.HasValue)
                {
                    strWhere.AppendFormat(" and datediff(dd,'{0}',LiveStartDate) <= 0 ", SearchInfo.CheckInEDate.Value.ToString());
                }
                if (SearchInfo.CheckOutSDate.HasValue)
                {
                    strWhere.AppendFormat(" and datediff(dd,'{0}',LiveEndDate) >= 0 ", SearchInfo.CheckOutSDate.Value.ToString());
                }
                if (SearchInfo.CheckOutEDate.HasValue)
                {
                    strWhere.AppendFormat(" and datediff(dd,'{0}',LiveEndDate) <= 0 ", SearchInfo.CheckOutEDate.Value.ToString());
                }
                if (!string.IsNullOrEmpty(SearchInfo.CompanyId))
                {
                    strWhere.AppendFormat(" and CompanyId = '{0}' ", SearchInfo.CompanyId);
                }
            }
            using (IDataReader dr = DbHelper.ExecuteReader(this._database, PageSize, PageIndex, ref RecordCount, tableName, PrimaryKey, fields, strWhere.ToString(), orderByStr))
            {
                while (dr.Read())
                {
                    EyouSoft.Model.HotelStructure.HotelTourCustoms model = new EyouSoft.Model.HotelStructure.HotelTourCustoms();
                    model.Id        = dr.GetInt32(dr.GetOrdinal("Id"));
                    model.CompanyId = dr["CompanyId"].ToString();
                    model.HotelName = dr[dr.GetOrdinal("HotelName")].ToString();
                    if (!dr.IsDBNull(dr.GetOrdinal("HotelCode")))
                    {
                        model.HotelCode = dr[dr.GetOrdinal("HotelCode")].ToString();
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("LiveStartDate")))
                    {
                        model.LiveStartDate = dr.GetDateTime(dr.GetOrdinal("LiveStartDate"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("LiveEndDate")))
                    {
                        model.LiveEndDate = dr.GetDateTime(dr.GetOrdinal("LiveEndDate"));
                    }
                    model.RoomCount   = dr.GetInt32(dr.GetOrdinal("RoomCount"));
                    model.PeopleCount = dr.GetInt32(dr.GetOrdinal("PeopleCount"));
                    if (!dr.IsDBNull(dr.GetOrdinal("Payment")))
                    {
                        model.Payment = (EyouSoft.HotelBI.HBEPaymentType) int.Parse(dr[dr.GetOrdinal("Payment")].ToString());
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("TreatState")))
                    {
                        model.TreatState = (EyouSoft.Model.HotelStructure.OrderStateList) int.Parse(dr[dr.GetOrdinal("TreatState")].ToString());
                    }
                    model.IssueTime   = dr.GetDateTime(dr.GetOrdinal("IssueTime"));
                    model.RoomAsk     = dr["RoomAsk"].ToString();
                    model.OtherRemark = dr["OtherRemark"].ToString();
                    model.LocationAsk = dr["LocationAsk"].ToString();

                    if (!dr.IsDBNull(dr.GetOrdinal("GuestType")))
                    {
                        model.GuestType = (EyouSoft.HotelBI.HBEGuestTypeIndicator)dr.GetByte(dr.GetOrdinal("GuestType"));
                    }

                    if (!dr.IsDBNull(dr.GetOrdinal("TourType")))
                    {
                        model.TourType = (EyouSoft.Model.HotelStructure.TourTypeList)dr.GetByte(dr.GetOrdinal("TourType"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("BudgetMin")))
                    {
                        model.BudgetMin = dr.GetDecimal(dr.GetOrdinal("BudgetMin"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("BudgetMax")))
                    {
                        model.BudgetMax = dr.GetDecimal(dr.GetOrdinal("BudgetMax"));
                    }
                    model.HotelStar = (EyouSoft.HotelBI.HotelRankEnum)dr.GetByte(dr.GetOrdinal("HotelStar"));

                    #region 2011-12-20线路改版增加

                    if (!dr.IsDBNull(dr.GetOrdinal("Contact")))
                    {
                        var xRoot = XElement.Parse(dr.GetString(dr.GetOrdinal("Contact")));
                        var xRows = Common.Utility.GetXElements(xRoot, "row");
                        if (xRows != null && xRows.Any())
                        {
                            model.Contact = new Model.CompanyStructure.ContactPersonInfo();
                            foreach (var t in xRows)
                            {
                                if (t == null)
                                {
                                    continue;
                                }

                                model.Contact.ContactName = Common.Utility.GetXAttributeValue(t, "ContactName");
                                model.Contact.ContactSex  =
                                    (Model.CompanyStructure.Sex)
                                    Common.Utility.GetInt(Common.Utility.GetXAttributeValue(t, "ContactSex"));
                                model.Contact.Tel    = Common.Utility.GetXAttributeValue(t, "ContactTel");
                                model.Contact.Fax    = Common.Utility.GetXAttributeValue(t, "ContactFax");
                                model.Contact.Mobile = Common.Utility.GetXAttributeValue(t, "ContactMobile");
                                model.Contact.Email  = Common.Utility.GetXAttributeValue(t, "ContactEmail");
                                model.Contact.QQ     = Common.Utility.GetXAttributeValue(t, "QQ");
                                model.Contact.MQ     = Common.Utility.GetXAttributeValue(t, "MQ");
                                model.Contact.MSN    = Common.Utility.GetXAttributeValue(t, "MSN");
                            }
                        }
                    }

                    #endregion

                    list.Add(model);
                    model = null;
                }
            }
            return(list);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存提交信息
        /// </summary>
        protected void Save()
        {
            bool result = false; //验证是否添加成功

            EyouSoft.Model.HotelStructure.HotelTourCustoms Model_TotelTourCustoms = new EyouSoft.Model.HotelStructure.HotelTourCustoms();
            EyouSoft.BLL.HotelStructure.HotelTourCustoms   Bll_TotelTourCustoms   = new EyouSoft.BLL.HotelStructure.HotelTourCustoms();
            Model_TotelTourCustoms.CompanyId = CompanyID;//公司编号

            if (string.IsNullOrEmpty(Utils.GetFormValue("startDateTime")))
            {
                SetErrorMsg(false, "请填写入住时间");
                return;
            }

            if (string.IsNullOrEmpty(Utils.GetFormValue("endDateTime")))
            {
                SetErrorMsg(false, "请填写离店时间");
                return;
            }

            if (Utils.GetFormValue(this.tos_destination.UniqueID) == "0")
            {
                SetErrorMsg(false, "请填写城市");
                return;
            }

            Model_TotelTourCustoms.LiveStartDate = Utils.GetDateTime(Utils.GetFormValue("startDateTime"));
            Model_TotelTourCustoms.LiveEndDate   = Utils.GetDateTime(Utils.GetFormValue("endDateTime"));
            Model_TotelTourCustoms.CityCode      = Utils.GetFormValue(this.tos_destination.UniqueID);
            Model_TotelTourCustoms.LocationAsk   = Utils.GetString(Utils.GetFormValue("tos_statusrequirement"), "");                                                //地理位置要求
            Model_TotelTourCustoms.HotelStar     = (EyouSoft.HotelBI.HotelRankEnum)Utils.GetInt(Utils.GetFormValue(tos_starrequirement.UniqueID).Trim());           //星级要求
            Model_TotelTourCustoms.RoomAsk       = Utils.GetString(Utils.GetFormValue("tos_roomtyperequirements"), "");                                             //房型要求
            Model_TotelTourCustoms.GuestType     = (EyouSoft.HotelBI.HBEGuestTypeIndicator)Utils.GetInt(Utils.GetFormValue(this.tos_visitorstype.UniqueID).Trim()); //宾客类型
            Model_TotelTourCustoms.TourType      = (EyouSoft.Model.HotelStructure.TourTypeList)Utils.GetInt(Utils.GetFormValue(this.tos_teamtype.UniqueID).Trim()); //团队类型
            Model_TotelTourCustoms.OtherRemark   = Utils.GetString(Utils.GetFormValue("textarea"), "");                                                             //其它要求

            if (Utils.GetInt(Utils.GetFormValue("tos_result")) == 1)                                                                                                //有指定酒店
            {
                if (Utils.GetFormValue("tos_HotelName") == "请填写酒店官方名称")
                {
                    SetErrorMsg(false, "请填写酒店官方名称");
                    return;
                }
                else
                {
                    Model_TotelTourCustoms.HotelName = Utils.GetString(Utils.GetFormValue("tos_HotelName"), "");  //酒店名称
                }
            }
            else
            {
                Model_TotelTourCustoms.HotelName = "";                   //酒店名称为空
            }
            if (Utils.GetInt(Utils.GetFormValue("tos_roomnumber")) == 0) //团队预订的房间数量是0
            {
                SetErrorMsg(false, "请填写预订的房间数量!");
                return;
            }

            if (Utils.GetInt(Utils.GetFormValue("tos_roomnumber")) < 7)  //预订的房间数量小于7
            {
                SetErrorMsg(false, "至少要预订7间房间!");
                return;
            }
            Model_TotelTourCustoms.RoomCount = Utils.GetInt(Utils.GetFormValue("tos_roomnumber"));  //房间数量


            if (Utils.GetInt(Utils.GetFormValue("tos_Number")) == 0) //入住的人数是0
            {
                SetErrorMsg(false, "请填写入住的人数!");
                return;
            }
            Model_TotelTourCustoms.PeopleCount = Utils.GetInt(Utils.GetFormValue("tos_Number"));  //入住人数

            if (Utils.GetDecimal(Utils.GetFormValue("tos_budget1")) == 0)
            {
                SetErrorMsg(false, "请填写团队房预算最小数!");
                return;
            }
            Model_TotelTourCustoms.BudgetMin = Utils.GetDecimal(Utils.GetFormValue("tos_budget1")); //团房预算最小值

            if (Utils.GetDecimal(Utils.GetFormValue("tos_budget2")) == 0)
            {
                SetErrorMsg(false, "请填写团队房预算最大数!");
                return;
            }

            if (Utils.GetDecimal(Utils.GetFormValue("tos_budget1")) > Utils.GetDecimal(Utils.GetFormValue("tos_budget2")))
            {
                SetErrorMsg(false, "团队房预算最大数不能小于最小数!");
                return;
            }

            Model_TotelTourCustoms.BudgetMax = Utils.GetDecimal(Utils.GetFormValue("tos_budget2")); //团房预算最大值

            result = Bll_TotelTourCustoms.Add(Model_TotelTourCustoms);                              //执行添加的方法
            if (result)
            {
                SetErrorMsg(true, "提交成功!");
            }
            else
            {
                SetErrorMsg(false, "提交失败");
            }

            Model_TotelTourCustoms = null; //释放资源
            Bll_TotelTourCustoms   = null;
        }