Example #1
0
        protected void PageInitForOrder(string orderID)
        {
            EyouSoft.BLL.TourStructure.BTourOrder         bll        = new EyouSoft.BLL.TourStructure.BTourOrder();
            EyouSoft.Model.TourStructure.MTourOrderExpand orderModel = bll.GetTourOrderExpandByOrderId(orderID);
            if (orderModel != null)
            {
                if (orderModel.TourType == EyouSoft.Model.EnumType.TourStructure.TourType.组团散拼短线)
                {
                    Utils.ResponseGoBack();
                    return;
                }

                this.lblOrderNum.Text       = orderModel.OrderCode;
                this.SellsSelect1.SellsID   = orderModel.SellerId;
                this.SellsSelect1.SellsName = orderModel.SellerName;
                this.hideDeptID.Value       = orderModel.DeptId.ToString();
                this.CountryID  = orderModel.BuyCountryId.ToString();
                this.ProvinceID = orderModel.BuyProvincesId.ToString();
                this.CustomerUnitSelect1.CustomerUnitId   = orderModel.BuyCompanyId;
                this.CustomerUnitSelect1.CustomerUnitName = orderModel.BuyCompanyName;
                this.txtContact.Text         = orderModel.ContactName;
                this.txtContactTel.Text      = orderModel.ContactTel;
                this.hideContactDeptId.Value = orderModel.ContactDepartId;
                this.lblOrderMan.Text        = orderModel.Operator;
                this.txtAdultCount.Text      = orderModel.Adults.ToString();
                this.txtChildCount.Text      = orderModel.Childs.ToString();
                this.hideTourId.Value        = orderModel.TourId;
                this.hideOldAdultCount.Value = orderModel.Adults.ToString() + "|" + orderModel.Childs.ToString();
                txtHeTongHao.HeTongId        = orderModel.ContractId;
                txtHeTongHao.HeTongCode      = orderModel.ContractCode;
                this.hideSourceID.Value      = orderModel.SourceId;

                if (orderModel.OrderType == EyouSoft.Model.EnumType.TourStructure.OrderType.分销商下单)
                {
                    phKeHuKeYuanDanWei.Visible           = true;
                    ltrKeHuKeYuanDanWeiName.Text         = orderModel.DCompanyName;
                    ltrKeHuKeYuanDanWeiLxrName.Text      = orderModel.DContactName;
                    ltrKeHuKeYuanDanWeiLxrTelephone.Text = orderModel.DContactTel;
                }
                txtNeiBuXinXi.Text = orderModel.NeiBuXinXi;

                #region 销售价与报价等级
                this.hideLevelID.Value      = orderModel.LevId.ToString();
                this.hidePriceStandID.Value = orderModel.PriceStandId.ToString();
                this.hideAdultPrice.Value   = Utils.FilterEndOfTheZeroDecimal(orderModel.AdultPrice);
                this.hideChildPrcie.Value   = Utils.FilterEndOfTheZeroDecimal(orderModel.ChildPrice);
                #endregion

                #region 结算价与报价等级
                this.hideSettAdultPrice.Value = Utils.FilterEndOfTheZeroDecimal(orderModel.PeerAdultPrice);
                this.hideSettChildPrice.Value = Utils.FilterEndOfTheZeroDecimal(orderModel.PeerChildPrice);
                #endregion


                EyouSoft.Model.TourStructure.MTourSanPinInfo tourModel = (EyouSoft.Model.TourStructure.MTourSanPinInfo) new EyouSoft.BLL.TourStructure.BTour().GetTourInfo(orderModel.TourId);
                if (tourModel != null)
                {
                    //权限控制
                    PowerControl(tourModel.TourType);

                    this.hideTourType.Value           = ((int)tourModel.TourType).ToString();
                    this.PriceStand1.SetPriceStandard = tourModel.MTourPriceStandard;
                    if (orderModel.MTourOrderTravellerList != null)
                    {
                        switch (tourModel.TourType)
                        {
                        case EyouSoft.Model.EnumType.TourStructure.TourType.出境散拼:
                        case EyouSoft.Model.EnumType.TourStructure.TourType.出境团队:
                            this.pnlTravelFrist.Visible        = false;
                            this.TravelControlS1.SetTravelList = orderModel.MTourOrderTravellerList.Where(p => p.TravellerStatus == EyouSoft.Model.EnumType.TourStructure.TravellerStatus.在团).ToList();

                            break;

                        default:
                            this.pnlTravelSecond.Visible      = false;
                            this.TravelControl1.SetTravelList = orderModel.MTourOrderTravellerList.Where(p => p.TravellerStatus == EyouSoft.Model.EnumType.TourStructure.TravellerStatus.在团).ToList();
                            break;
                        }

                        IList <EyouSoft.Model.TourStructure.MTourOrderTraveller> outTraveller = orderModel.MTourOrderTravellerList.Where(p => p.TravellerStatus == EyouSoft.Model.EnumType.TourStructure.TravellerStatus.退团).ToList();
                        if (outTraveller != null && outTraveller.Count > 0)
                        {
                            this.rptOutTraveller.DataSource = outTraveller;
                            this.rptOutTraveller.DataBind();
                        }
                    }
                }
                this.txtAddPrice.Text      = Utils.FilterEndOfTheZeroDecimal(orderModel.SaleAddCost);
                this.txtRemarksFrist.Text  = orderModel.SaleAddCostRemark;
                this.txtReducePrice.Text   = Utils.FilterEndOfTheZeroDecimal(orderModel.SaleReduceCost);
                this.txtRemarksSecond.Text = orderModel.SaleReduceCostRemark;
                this.txtTotalPrice.Text    = Utils.FilterEndOfTheZeroDecimal(orderModel.SumPrice);
                this.hideOldSumMoney.Value = Utils.FilterEndOfTheZeroDecimal(orderModel.SumPrice);
                this.txtGuidePrice.Text    = Utils.FilterEndOfTheZeroDecimal(orderModel.GuideIncome);
                this.lblSellPrice.Text     = Utils.FilterEndOfTheZeroDecimal(orderModel.SalerIncome);
                this.txtSaveSeatDate.Text  = orderModel.SaveSeatDate.HasValue ? orderModel.SaveSeatDate.Value.ToString("yyyy-MM-dd HH:mm") : "";
                this.txtRemarksOrder.Text  = orderModel.OrderRemark;
                this.hideOrderFrom.Value   = ((int)orderModel.OrderType).ToString();


                this.pdhJiXuLiuWei.Visible      = false;
                this.phdQueRenYuLiu.Visible     = false;
                this.pdhBaoCun.Visible          = false;
                this.phdQuXiao.Visible          = false;
                this.phdBuShouLi.Visible        = false;
                this.phsQueRenChengJiao.Visible = false;

                #region 获得该订单的计划状态
                EyouSoft.BLL.TourStructure.BTour btour = new EyouSoft.BLL.TourStructure.BTour();
                EyouSoft.Model.EnumType.TourStructure.TourStatus tourStatus = btour.GetTourStatus(SiteUserInfo.CompanyId, orderModel.TourId);
                if (tourStatus != EyouSoft.Model.EnumType.TourStructure.TourStatus.销售未派计划)
                {
                    //该团已派计调
                    this.hideOrderBianGeng.Value = "true";
                }
                else
                {
                    this.hideOrderBianGeng.Value = "false";
                }
                #endregion

                //必须是下单人或者是销售员才可以修改订单 或者拥有修改所有数据的权限

                bool isUpdate = false;
                if (!SiteUserInfo.IsHandleElse)
                {
                    if (orderModel.SellerId == SiteUserInfo.UserId || orderModel.OperatorId == SiteUserInfo.UserId || orderModel.TourSellerId == SiteUserInfo.UserId)
                    {
                        isUpdate = true;
                    }
                    if (isUpdate == false)
                    {
                        if (orderModel.TourPlanerList != null && orderModel.TourPlanerList.Count > 0)
                        {
                            for (int i = 0; i < orderModel.TourPlanerList.Count; i++)
                            {
                                if (orderModel.TourPlanerList[i].PlanerId == SiteUserInfo.UserId)
                                {
                                    isUpdate = true;
                                }
                            }
                        }
                    }
                }

                if (isUpdate)
                {
                    this.hideOrderState.Value = ((int)orderModel.OrderStatus).ToString();

                    if (!string.IsNullOrEmpty(orderModel.SourceId) && orderModel.SourceId.Trim() != "")
                    {
                        if (orderModel.OrderType == EyouSoft.Model.EnumType.TourStructure.OrderType.分销商下单)
                        {
                            if (orderModel.OrderStatus == EyouSoft.Model.EnumType.TourStructure.OrderStatus.未处理)
                            {
                                this.pdhBaoCun.Visible = true;
                            }
                            else
                            {
                                this.pdhAllBtns.Visible = false;
                            }
                        }
                        else
                        {
                            if ((orderModel.OrderStatus == EyouSoft.Model.EnumType.TourStructure.OrderStatus.未处理 || orderModel.OrderStatus == EyouSoft.Model.EnumType.TourStructure.OrderStatus.垫付申请审核成功) && orderModel.TourStatus != EyouSoft.Model.EnumType.TourStructure.TourStatus.封团 && orderModel.TourStatus != EyouSoft.Model.EnumType.TourStructure.TourStatus.已取消)
                            {
                                this.pdhBaoCun.Visible = true;
                                this.phdQuXiao.Visible = true;
                            }
                            else
                            {
                                this.pdhAllBtns.Visible = false;
                            }
                        }
                    }
                    else
                    {
                        var _tourStatus = new EyouSoft.Model.EnumType.TourStructure.TourStatus[] {
                            EyouSoft.Model.EnumType.TourStructure.TourStatus.销售未派计划
                            , EyouSoft.Model.EnumType.TourStructure.TourStatus.计调未接收
                            , EyouSoft.Model.EnumType.TourStructure.TourStatus.计调配置
                            , EyouSoft.Model.EnumType.TourStructure.TourStatus.计调配置完毕
                            , EyouSoft.Model.EnumType.TourStructure.TourStatus.导游带团
                            , EyouSoft.Model.EnumType.TourStructure.TourStatus.导游报帐
                        };

                        switch (orderModel.OrderStatus)
                        {
                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.受理:
                            this.litOrderMsg.Text = "<div class='tishi_info'>该订单不受理,无法操作!</div>";
                            break;

                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.已取消:
                            this.litOrderMsg.Text = "<div class='tishi_info'>该订单已取消,无法操作!</div>";
                            break;

                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.垫付申请审核:
                            this.litOrderMsg.Text = "<div class='tishi_info'>该订单正在垫付申请审核中,无法操作!</div>";
                            break;

                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.垫付申请审核失败:
                            if (orderModel.OrderType == EyouSoft.Model.EnumType.TourStructure.OrderType.分销商下单)
                            {
                                this.phdBuShouLi.Visible = true;
                            }
                            else
                            {
                                this.phdQuXiao.Visible = true;
                            }
                            break;

                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.垫付申请审核成功:
                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.未处理:
                            if (_tourStatus.Contains(orderModel.TourStatus))
                            {
                                this.pdhBaoCun.Visible          = true;
                                this.phdQueRenYuLiu.Visible     = true;
                                this.phsQueRenChengJiao.Visible = true;

                                if (orderModel.OrderType == EyouSoft.Model.EnumType.TourStructure.OrderType.分销商下单)
                                {
                                    this.phdBuShouLi.Visible = true;
                                }
                                else
                                {
                                    this.phdQuXiao.Visible = true;
                                }
                            }
                            break;

                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.留位过期:
                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.已留位:
                            if (_tourStatus.Contains(orderModel.TourStatus))
                            {
                                if (orderModel.OrderType == EyouSoft.Model.EnumType.TourStructure.OrderType.分销商下单)
                                {
                                    this.phdBuShouLi.Visible = true;
                                }
                                else
                                {
                                    this.phdQuXiao.Visible = true;
                                }
                                this.pdhJiXuLiuWei.Visible      = true;
                                this.phsQueRenChengJiao.Visible = true;
                            }
                            break;

                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.已成交:
                            if (_tourStatus.Contains(orderModel.TourStatus))
                            {
                                this.pdhBaoCun.Visible = true;
                                this.phdQuXiao.Visible = true;
                            }
                            break;

                        case EyouSoft.Model.EnumType.TourStructure.OrderStatus.资金超限:
                            if (orderModel.OrderType == EyouSoft.Model.EnumType.TourStructure.OrderType.分销商下单)
                            {
                                this.phdBuShouLi.Visible = true;
                            }
                            else
                            {
                                this.phdQuXiao.Visible = true;
                            }
                            break;
                        }
                    }
                }
            }
            else
            {
                Utils.ResponseGoBack();
            }
        }