Пример #1
0
        /// <summary>
        /// 添加团队信息
        /// </summary>
        /// <returns></returns>
        private bool InsertTourInfo()
        {
            bool IsResult = false;
            // 团队基本信息
            string hidTourID        = Utils.GetFormValue(this.AddQuickTour_hidTourID.UniqueID);      // 用于判断是添加还是修改
            string TemplateTourID   = Utils.GetFormValue(this.AddQuickTour_TemplateTourID.UniqueID); // 需要修改的模板团ID
            string hidTourLeaveDate = Utils.GetFormValue(this.hidTourLeaveDate.UniqueID);

            string RouteArea    = Utils.GetFormValue(this.AddQuickTour_RouteArea.UniqueID);
            string RouteName    = Utils.GetFormValue(this.AddQuickTour_RouteName.UniqueID);
            string TourDays     = Utils.GetFormValue(this.AddQuickTour_TourDays.UniqueID);
            string PeopleNumber = Utils.GetFormValue(this.AddQuickTour_PeopleNumber.UniqueID);
            string RouteTopic   = Utils.GetFormValue("AddQuickTour_chkRouteTopic");
            string LeaveCity    = Utils.GetFormValue("AddQuickTour_radPortCity");
            string SaleCity     = Utils.GetFormValue("AddQuickTour_chkSaleCity");

            if (LeaveCity == null || LeaveCity == string.Empty)
            {
                LeaveCity = "0";
            }
            // 快速发布团队行程信息
            string QuickPlan = Utils.EditInputText(Server.UrlDecode(Request.Form["AddQuickTour_divFCK"]));

            if (QuickPlan == string.Empty || QuickPlan == "点击添加行程信息")
            {
                QuickPlan = string.Empty;
            }
            // 自动停收时间
            string AutoOffDays = Utils.GetFormValue(this.AddQuickTour_AutoOffDays.UniqueID);

            #region 线路区域处理
            string AreaName = string.Empty;
            int    AreaID   = 0;
            EyouSoft.Model.SystemStructure.AreaType Areatype = EyouSoft.Model.SystemStructure.AreaType.国内短线;
            if (!String.IsNullOrEmpty(RouteArea))
            {
                EyouSoft.IBLL.SystemStructure.ISysArea AreaBll   = EyouSoft.BLL.SystemStructure.SysArea.CreateInstance();
                EyouSoft.Model.SystemStructure.SysArea AreaModel = AreaBll.GetSysAreaModel(int.Parse(RouteArea.Split('|')[0]));
                if (AreaModel != null)
                {
                    AreaID   = AreaModel.AreaId;
                    AreaName = AreaModel.AreaName;
                    Areatype = AreaModel.RouteType;
                }
                AreaModel = null;
                AreaBll   = null;
            }
            #endregion

            #region 线路主题
            IList <int> RouteThemeList = new List <int>();
            if (!String.IsNullOrEmpty(RouteTopic))
            {
                string[] strRouteTopic = RouteTopic.Split(',');
                foreach (string str in strRouteTopic)
                {
                    RouteThemeList.Add(int.Parse(str));
                }
            }
            #endregion

            #region 销售城市
            IList <int> SaleCityList = new List <int>();
            if (!String.IsNullOrEmpty(SaleCity))
            {
                string[] strSaleCity = SaleCity.Split(',');
                foreach (string str in strSaleCity)
                {
                    SaleCityList.Add(int.Parse(str));
                }
            }
            #endregion

            if (this.AddQuickTour_AddToRoute.Checked)
            {
                #region 回写线路信息
                try
                {
                    EyouSoft.Model.TourStructure.RouteBasicInfo RouteModel = new EyouSoft.Model.TourStructure.RouteBasicInfo();
                    RouteModel.ID              = Guid.NewGuid().ToString();
                    RouteModel.AreaId          = AreaID;
                    RouteModel.AreaType        = Areatype;
                    RouteModel.CompanyID       = UserInfoModel.CompanyID;
                    RouteModel.CompanyName     = UserInfoModel.CompanyName;
                    RouteModel.ContactMQID     = ContactMQID;
                    RouteModel.ContactName     = ContactName;
                    RouteModel.ContactTel      = ContactTel;
                    RouteModel.ContactUserName = UserInfoModel.UserName;
                    RouteModel.IsAccept        = false;
                    RouteModel.IssueTime       = DateTime.Now;
                    RouteModel.LeaveCityId     = int.Parse(LeaveCity);
                    RouteModel.OperatorID      = UserInfoModel.ID;
                    RouteModel.PriceDetails    = InsertRoutePriceDetail();
                    RouteModel.QuickPlan       = QuickPlan;
                    RouteModel.ReleaseType     = EyouSoft.Model.TourStructure.ReleaseType.Quick;
                    RouteModel.RouteName       = RouteName;
                    RouteModel.RouteTheme      = RouteThemeList;
                    RouteModel.SaleCity        = SaleCityList;
                    RouteModel.ServiceStandard = null;
                    RouteModel.StandardPlans   = null;
                    RouteModel.TourDays        = int.Parse(TourDays);
                    EyouSoft.IBLL.TourStructure.IRouteBasicInfo RouteBll = EyouSoft.BLL.TourStructure.RouteBasicInfo.CreateInstance();
                    RouteBll.InsertRouteInfo(RouteModel);
                    RouteModel = null;
                    RouteBll   = null;
                }
                catch
                {
                    return(false);
                }
                #endregion
            }
            EyouSoft.IBLL.TourStructure.ITour TourBll = EyouSoft.BLL.TourStructure.Tour.CreateInstance();

            #region 写入团队信息
            if (!String.IsNullOrEmpty(hidTourID) || !String.IsNullOrEmpty(TemplateTourID)) // 修改
            {
                if (!String.IsNullOrEmpty(TemplateTourID))                                 // 修改模板团
                {
                    EyouSoft.Model.TourStructure.TourInfo TourModel = new EyouSoft.Model.TourStructure.TourInfo();
                    TourModel.ID              = TemplateTourID;
                    TourModel.AreaId          = AreaID;
                    TourModel.AreaName        = AreaName;
                    TourModel.AreaType        = Areatype;
                    TourModel.AutoOffDays     = int.Parse(AutoOffDays);
                    TourModel.CompanyID       = CompanyId;
                    TourModel.CompanyName     = UserInfoModel.CompanyName;
                    TourModel.LeaveCity       = int.Parse(LeaveCity);
                    TourModel.OperatorID      = UserID;
                    TourModel.PlanPeopleCount = int.Parse(PeopleNumber);
                    TourModel.QuickPlan       = QuickPlan;
                    TourModel.ReleaseType     = EyouSoft.Model.TourStructure.ReleaseType.Quick;
                    TourModel.RouteName       = RouteName;
                    TourModel.RouteTheme      = RouteThemeList;
                    TourModel.SaleCity        = SaleCityList;
                    // 服务标准
                    TourModel.ServiceStandard    = null;
                    TourModel.StandardPlan       = null;
                    TourModel.TourContacMQ       = ContactMQID;
                    TourModel.TourContact        = ContactName;
                    TourModel.TourContactTel     = ContactTel;
                    TourModel.TourContacUserName = UserInfoModel.UserName;
                    TourModel.TourDays           = int.Parse(TourDays);
                    TourModel.TourNo             = string.Empty;
                    TourModel.TourPriceDetail    = InsertTourPriceDetail();
                    TourModel.TourState          = EyouSoft.Model.TourStructure.TourState.收客;
                    TourModel.TourType           = EyouSoft.Model.TourStructure.TourType.组团散拼;
                    if (TourBll.UpdateTemplateTourInfo(TourModel) > 0)
                    {
                        IsResult = true;
                    }
                    TourModel = null;
                }
                else
                {    // 修改子团
                    #region
                    EyouSoft.Model.TourStructure.TourInfo TourModel = new EyouSoft.Model.TourStructure.TourInfo();
                    TourModel.ID              = hidTourID;
                    TourModel.AreaId          = AreaID;
                    TourModel.AreaName        = AreaName;
                    TourModel.AreaType        = Areatype;
                    TourModel.AutoOffDays     = int.Parse(AutoOffDays);
                    TourModel.CompanyID       = CompanyId;
                    TourModel.CompanyName     = UserInfoModel.CompanyName;
                    TourModel.LeaveCity       = int.Parse(LeaveCity);
                    TourModel.OperatorID      = UserID;
                    TourModel.ParentTourID    = TemplateTourID;
                    TourModel.PlanPeopleCount = int.Parse(PeopleNumber);
                    TourModel.QuickPlan       = QuickPlan;
                    TourModel.ReleaseType     = EyouSoft.Model.TourStructure.ReleaseType.Quick;
                    TourModel.RouteName       = RouteName;
                    TourModel.RouteTheme      = RouteThemeList;
                    TourModel.SaleCity        = SaleCityList;
                    // 服务标准
                    TourModel.ServiceStandard    = null;
                    TourModel.StandardPlan       = null;
                    TourModel.TourContacMQ       = ContactMQID;
                    TourModel.TourContact        = ContactName;
                    TourModel.TourContactTel     = ContactTel;
                    TourModel.TourContacUserName = UserInfoModel.UserName;
                    TourModel.TourDays           = int.Parse(TourDays);
                    TourModel.TourNo             = string.Empty;
                    TourModel.TourPriceDetail    = InsertTourPriceDetail();
                    TourModel.TourState          = EyouSoft.Model.TourStructure.TourState.收客;
                    TourModel.TourType           = EyouSoft.Model.TourStructure.TourType.组团散拼;
                    if (TourBll.UpdateTourInfo(TourModel) > 0)
                    {
                        IsResult = true;
                    }
                    TourModel = null;
                    #endregion
                }
            }
            else
            {   // 添加
                #region 添加团队

                #region 子团信息
                IList <EyouSoft.Model.TourStructure.ChildrenTourInfo> ChildrensTourList = new List <EyouSoft.Model.TourStructure.ChildrenTourInfo>();
                if (!String.IsNullOrEmpty(hidTourLeaveDate))
                {
                    string[] tmpLeaveDate = hidTourLeaveDate.Split(',');

                    for (int i = 0; i < tmpLeaveDate.Length; i++)
                    {
                        if (!String.IsNullOrEmpty(tmpLeaveDate[i]))
                        {
                            EyouSoft.Model.TourStructure.ChildrenTourInfo ChildTour = new EyouSoft.Model.TourStructure.ChildrenTourInfo();
                            ChildTour.ChildrenId = Guid.NewGuid().ToString();
                            ChildTour.LeaveDate  = Utils.GetDateTime(tmpLeaveDate[i]);
                            ChildTour.TourState  = EyouSoft.Model.TourStructure.TourState.收客;
                            ChildrensTourList.Add(ChildTour);
                            ChildTour = null;
                        }
                    }
                }
                #endregion

                EyouSoft.Model.TourStructure.TourInfo TourModel = new EyouSoft.Model.TourStructure.TourInfo();
                TourModel.ID              = Guid.NewGuid().ToString();
                TourModel.AreaId          = AreaID;
                TourModel.AreaName        = AreaName;
                TourModel.AreaType        = Areatype;
                TourModel.AutoOffDays     = int.Parse(AutoOffDays);
                TourModel.Childrens       = ChildrensTourList;
                TourModel.CompanyID       = CompanyId;
                TourModel.CompanyName     = UserInfoModel.CompanyName;
                TourModel.LeaveCity       = int.Parse(LeaveCity);
                TourModel.OperatorID      = UserID;
                TourModel.PlanPeopleCount = int.Parse(PeopleNumber);
                TourModel.QuickPlan       = QuickPlan;
                TourModel.ReleaseType     = EyouSoft.Model.TourStructure.ReleaseType.Quick;
                TourModel.RouteName       = RouteName;
                TourModel.RouteTheme      = RouteThemeList;
                TourModel.SaleCity        = SaleCityList;
                // 服务标准
                TourModel.ServiceStandard    = null;
                TourModel.StandardPlan       = null;
                TourModel.TourContacMQ       = ContactMQID;
                TourModel.TourContact        = ContactName;
                TourModel.TourContactTel     = ContactTel;
                TourModel.TourContacUserName = UserInfoModel.UserName;
                TourModel.TourDays           = int.Parse(TourDays);
                TourModel.TourNo             = string.Empty;
                TourModel.TourPriceDetail    = InsertTourPriceDetail();
                TourModel.TourState          = EyouSoft.Model.TourStructure.TourState.收客;
                TourModel.TourType           = EyouSoft.Model.TourStructure.TourType.组团散拼;
                if (TourBll.InsertTemplateTourInfo(TourModel) > 0)
                {
                    IsResult = true;
                }
                TourModel = null;
                #endregion
            }
            #endregion
            return(IsResult);
        }