Esempio n. 1
0
        protected void SaveOrder()
        {
            //团队所属公司ID
            string TourCompanyId = "";

            //获得订单信息
            tourModel = tourBll.GetTourInfo(tourId);
            string priceId = Utils.GetFormValue("ro_rdiPriceStandId");//获取选择的报价等级编号

            EyouSoft.Model.TourStructure.TourOrder orderModel = new EyouSoft.Model.TourStructure.TourOrder();
            orderModel.AdultNumber    = Utils.GetInt(Utils.GetFormValue("ro_txtManCount"), 0);   //获取成人数
            orderModel.BuyCompanyID   = SiteUserInfo.CompanyID;                                  //预定单位
            orderModel.BuyCompanyName = SiteUserInfo.CompanyName;                                //预定单位名
            orderModel.ChildNumber    = Utils.GetInt(Utils.GetFormValue("ro_txtChildCount"), 0); //儿童数
            EyouSoft.Model.TourStructure.TourPriceDetail price = tourModel.TourPriceDetail.Where(i => i.PriceStandId == priceId).First();
            //根据获取的报价等级编号获取相应报价等级
            orderModel.ChildPrice      = price.PriceDetail.Where(i => i.CustomerLevelType == EyouSoft.Model.CompanyStructure.CustomerLevelType.行).First().ChildrenPrice;//儿童价
            TourCompanyId              = tourModel.CompanyID;
            orderModel.CompanyID       = TourCompanyId;
            orderModel.ContactFax      = SiteUserInfo.ContactInfo.Fax;
            orderModel.ContactMQ       = SiteUserInfo.ContactInfo.MQ;
            orderModel.ContactName     = SiteUserInfo.ContactInfo.ContactName;
            orderModel.ContactQQ       = SiteUserInfo.ContactInfo.QQ;
            orderModel.ContactTel      = SiteUserInfo.ContactInfo.Tel;
            orderModel.LastOperatorID  = SiteUserInfo.ID;                                                                                                               //最后操作人
            orderModel.MarketNumber    = int.Parse(Utils.GetFormValue("ro_txtOneRoomCount"));                                                                           //单房差数
            orderModel.MarketPrice     = price.PriceDetail.Where(i => i.CustomerLevelType == EyouSoft.Model.CompanyStructure.CustomerLevelType.单房差).First().AdultPrice; //单房差价
            orderModel.OperatorContent = Utils.GetFormValue("ro_txtOperatorContent");                                                                                   //操作留言
            orderModel.OperatorID      = SiteUserInfo.ID;                                                                                                               //操作人ID
            orderModel.OperatorName    = SiteUserInfo.ContactInfo.ContactName;                                                                                          //操作人名
            orderModel.OrderType       = 0;                                                                                                                             //预定类型
            orderModel.OtherPrice      = decimal.Parse(Utils.GetFormValue("ro_txtOtherPrice"));                                                                         //其他费用
            orderModel.PeopleNumber    = orderModel.ChildNumber + orderModel.AdultNumber;                                                                               //总人数
            if (orderModel.PeopleNumber == 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "<script>;alert('请填写游客!');</script>");
            }
            orderModel.AreaType        = tourModel.AreaType;
            orderModel.AreaId          = tourModel.AreaId;
            orderModel.PersonalPrice   = price.PriceDetail.Where(i => i.CustomerLevelType == EyouSoft.Model.CompanyStructure.CustomerLevelType.行).First().AdultPrice;                                                   //成人价
            orderModel.PriceStandId    = priceId;                                                                                                                                                                       //报价等级
            orderModel.RouteName       = tourModel.RouteName;
            orderModel.LeaveDate       = tourModel.LeaveDate;                                                                                                                                                           //出发时间
            orderModel.SpecialContent  = Utils.GetFormValue("ro_txtSpecialContent");                                                                                                                                    //特别要求
            orderModel.SumPrice        = orderModel.AdultNumber * orderModel.PersonalPrice + orderModel.ChildNumber * orderModel.ChildPrice + orderModel.MarketNumber * orderModel.MarketPrice + orderModel.OtherPrice; //总金额
            orderModel.TourCompanyId   = tourModel.CompanyID;                                                                                                                                                           //专线编号
            orderModel.TourCompanyName = tourModel.CompanyName;                                                                                                                                                         //专线公司名
            orderModel.TourDays        = tourModel.TourDays;                                                                                                                                                            //天数
            orderModel.SaveSeatDate    = DateTime.Now;                                                                                                                                                                  //留位时间
            orderModel.TourId          = tourModel.ID;                                                                                                                                                                  //团队编号
            orderModel.TourNo          = tourModel.TourNo;                                                                                                                                                              //团号
            orderModel.TourType        = EyouSoft.Model.TourStructure.TourType.组团团队;
            orderModel.IssueTime       = DateTime.Now;                                                                                                                                                                  //添加时间
            orderModel.OrderSource     = EyouSoft.Model.TourStructure.TourOrderOperateType.组团社下单;                                                                                                                       //订单来源

            //获得游客信息
            List <EyouSoft.Model.TourStructure.TourOrderCustomer> customerList = new List <EyouSoft.Model.TourStructure.TourOrderCustomer>();
            List <string> custNoList = Request.Form.AllKeys.Where(i => i.Contains("CustomerName")).Select(i => i.Substring(12, i.Length - 12)).ToList();

            foreach (string customerNo in custNoList)
            {
                EyouSoft.Model.TourStructure.TourOrderCustomer customerModel = new EyouSoft.Model.TourStructure.TourOrderCustomer();
                customerModel.CompanyID   = SiteUserInfo.CompanyID;                                                                                //所属公司
                customerModel.CompanyName = SiteUserInfo.CompanyName;                                                                              //所属公司名
                customerModel.ContactTel  = Utils.GetFormValue("CustomerTelphone" + customerNo);
                customerModel.CradNumber  = Utils.GetFormValue("CertificateNo" + customerNo);                                                      //证件编号
                customerModel.CradType    = (EyouSoft.Model.TourStructure.CradType) int.Parse(Utils.GetFormValue("CertificateName" + customerNo)); //证件类型
                customerModel.Remark      = Utils.GetFormValue("CustomerRemark" + customerNo);                                                     //备注信息
                customerModel.Sex         = Utils.GetFormValue("CustomerSex" + customerNo) == "1"?true:false;                                      //性别
                customerModel.SiteNo      = Utils.GetFormValue("CustomerSiteNo" + customerNo);                                                     //座位号
                orderModel.SeatList      += customerModel.SiteNo + ",";                                                                            //座位号集
                customerModel.VisitorName = Utils.GetFormValue("CustomerName" + customerNo);                                                       //姓名
                customerModel.VisitorType = Utils.GetFormValue("CustomerType" + customerNo) == "1"?true:false;                                     //类型(成人,儿童)
                customerModel.IssueTime   = DateTime.Now;
                customerModel.RouteName   = routeName;
                customerModel.TourId      = tourId;           //团队ID
                customerModel.TourNo      = tourModel.TourNo; //团号
                customerList.Add(customerModel);
            }
            orderModel.SeatList          = orderModel.SeatList.TrimEnd(','); //获得座位号
            orderModel.TourOrderCustomer = customerList;                     //保存游客信息
            EyouSoft.IBLL.TourStructure.ITourOrder tourOrderBll = EyouSoft.BLL.TourStructure.TourOrder.CreateInstance();
            //开始下订单
            if (tourOrderBll.AddTourOrder(orderModel) > 0)
            {
                EyouSoft.Model.CompanyStructure.CompanyDetailInfo _companyInfo =
                    EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(TourCompanyId);

                bool isSend = Utils.SendSMSForReminderOrder(
                    TourCompanyId,
                    SiteUserInfo.CompanyName,
                    SiteUserInfo.ContactInfo.ContactName,
                    _companyInfo != null ? _companyInfo.CityId : 0);


                if (isSend)
                {
                    EyouSoft.Model.CompanyStructure.CompanyDetailInfo model =
                        EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(TourCompanyId);
                    //发送短信记录
                    EyouSoft.Model.ToolStructure.MsgTipRecord tipModel = new EyouSoft.Model.ToolStructure.MsgTipRecord();
                    tipModel.Email    = string.Empty;
                    tipModel.FromMQID = SiteUserInfo.ContactInfo.MQ;
                    tipModel.ToMQID   = model.ContactInfo.MQ;     //接收方MQ
                    tipModel.Mobile   = model.ContactInfo.Mobile; //接收方手机
                    tipModel.MsgType  = EyouSoft.Model.ToolStructure.MsgType.NewOrder;
                    tipModel.SendWay  = EyouSoft.Model.ToolStructure.MsgSendWay.SMS;

                    EyouSoft.BLL.ToolStructure.MsgTipRecord msgTipBll = new EyouSoft.BLL.ToolStructure.MsgTipRecord();
                    msgTipBll.Add(tipModel);
                }

                Utils.SendEmailForReminderOrder(TourCompanyId, SiteUserInfo.CompanyName, SiteUserInfo.UserName);
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "<script>;alert('预定成功!');if(window.parent.Boxy){window.parent.Boxy.getIframeDialog('" + Request.QueryString["iframeId"] + "').hide();if(window.parent.RouteStock){window.parent.RouteStock.refresh();};}else{window.close();}</script>");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "<script>;alert('预定失败!');</script>");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 代客预订
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LeaveBook()
        {
            if (!IsCompanyCheck)
            {
                Response.Clear();
                Response.Write("[{isSuccess:false,ErrorMessage:'对不起,你当前登录的账户还未审核,没有权限执行该操作!'}]");
                Response.End();
            }
            string ReturnString = string.Empty;

            EyouSoft.IBLL.TourStructure.ITour     Ibll      = EyouSoft.BLL.TourStructure.Tour.CreateInstance();
            EyouSoft.Model.TourStructure.TourInfo tourModel = new EyouSoft.Model.TourStructure.TourInfo();
            tourModel    = Ibll.GetTourInfo(TourID);
            PriceStandId = Utils.GetFormValue("hidPriceStandId");
            EyouSoft.IBLL.TourStructure.ITourOrder Orderbll   = EyouSoft.BLL.TourStructure.TourOrder.CreateInstance();
            EyouSoft.Model.TourStructure.TourOrder orderModel = new EyouSoft.Model.TourStructure.TourOrder();
            if (Utils.GetQueryStringValue("action") == "LeaveBook")
            {
                orderModel.OrderState   = EyouSoft.Model.TourStructure.OrderState.已留位;
                orderModel.SaveSeatDate = Utils.GetDateTime(Utils.GetFormValue("txtEndTime$dateTextBox"));
                if (Utils.GetDateTime(Utils.GetFormValue("txtEndTime$dateTextBox")) < DateTime.Now)
                {
                    Response.Clear();
                    Response.Write("[{isSuccess:false,ErrorMessage:'留位时间不能小于当前时间!'}]");
                    Response.End();
                }
            }
            else
            {
                orderModel.SaveSeatDate = DateTime.Now;
                orderModel.OrderState   = EyouSoft.Model.TourStructure.OrderState.未处理;
            }
            orderModel.AreaId            = tourModel.AreaId;
            orderModel.SeatList          = SeatList.Trim(',');
            orderModel.LeaveTraffic      = Utils.GetFormValue("Traffic");
            orderModel.AdultNumber       = Utils.GetInt(Utils.GetFormValue(PriceStandId + "AdultNumber"));
            orderModel.ChildNumber       = Utils.GetInt(Utils.GetFormValue(PriceStandId + "ChildNumber"));
            orderModel.ChildPrice        = decimal.Parse(Utils.GetFormValue(PriceStandId + "ChildrenPrice1"));
            orderModel.MarketPrice       = Utils.GetDecimal(Utils.GetFormValue(PriceStandId + "MarketPrice"));
            orderModel.BuyCompanyID      = Utils.GetFormValue("BuyCompanyID");
            orderModel.BuyCompanyName    = Utils.GetFormValue("BuyCompanyName");
            orderModel.CompanyID         = SiteUserInfo.CompanyID;
            orderModel.ContactFax        = Utils.GetFormValue("BuyCompanyFax");
            orderModel.ContactMQ         = Utils.GetFormValue("BuyCompanyMQ");
            orderModel.ContactName       = Utils.GetFormValue("BuyCompanyContactName");
            orderModel.ContactQQ         = Utils.GetFormValue("BuyCompanyQQ");
            orderModel.ContactTel        = Utils.GetFormValue("BuyCompanyTel");
            orderModel.LastOperatorID    = SiteUserInfo.ID;
            orderModel.MarketNumber      = Utils.GetInt(Utils.GetFormValue(PriceStandId + "MarketNumber"));
            orderModel.OperatorID        = SiteUserInfo.ID;
            orderModel.OperatorName      = SiteUserInfo.ContactInfo.ContactName;
            orderModel.OrderType         = 1;
            orderModel.OtherPrice        = Utils.GetDecimal(Utils.GetFormValue(PriceStandId + "OtherPrice"));
            orderModel.PersonalPrice     = Utils.GetDecimal(Utils.GetFormValue(PriceStandId + "PersonalPrice"));
            orderModel.SumPrice          = orderModel.AdultNumber * orderModel.PersonalPrice + orderModel.ChildNumber * orderModel.ChildPrice + orderModel.MarketNumber * orderModel.MarketPrice + orderModel.OtherPrice;
            orderModel.PeopleNumber      = orderModel.ChildNumber + orderModel.AdultNumber;
            orderModel.PriceStandId      = PriceStandId;
            orderModel.RouteName         = Utils.GetFormValue("RouteName");
            orderModel.LeaveDate         = Utils.GetDateTime(Utils.GetFormValue("LeaveDate"));
            orderModel.SpecialContent    = Utils.GetFormValue("SpecialContent");
            orderModel.TourCompanyId     = SiteUserInfo.CompanyID;
            orderModel.TourCompanyName   = SiteUserInfo.CompanyName;
            orderModel.TourDays          = tourModel.TourDays;
            orderModel.TourId            = Utils.GetFormValue("TourId");
            orderModel.TourNo            = tourModel.TourNo;
            orderModel.TourType          = EyouSoft.Model.TourStructure.TourType.组团散拼;
            orderModel.IssueTime         = DateTime.Now;
            orderModel.OrderSource       = EyouSoft.Model.TourStructure.TourOrderOperateType.代客预定;
            orderModel.TourOrderCustomer = TourOrderCustomer();
            if (orderModel.TourOrderCustomer == null || orderModel.TourOrderCustomer.Count == 0)
            {
                ReturnString = "[{isSuccess:false,ErrorMessage:'游客总人数必须大于0,否则将不能保存,请填写正确的游客人数及信息!'}]";
                Response.Clear();
                Response.Write(ReturnString);
                Response.End();
            }
            if (orderModel.PeopleNumber > Utils.GetInt(Utils.GetFormValue("RemnantNumber")))
            {
                ReturnString = "[{isSuccess:false,ErrorMessage:'游客总人数大于剩余人数,不能保存请重新填写游客资料!'}]";
                Response.Clear();
                Response.Write(ReturnString);
                Response.End();
            }
            int ReturnValue = Orderbll.AddTourOrder(orderModel);

            Ibll       = null;
            tourModel  = null;
            Orderbll   = null;
            orderModel = null;
            switch (ReturnValue)
            {
            case -1:
                ReturnString = "[{isSuccess:false,ErrorMessage:'写入订单信息失败!'}]";
                break;

            case 0:
                ReturnString = "[{isSuccess:false,ErrorMessage:'订单实体为空!'}]";
                break;

            default:
                ReturnString = "[{isSuccess:true,ErrorMessage:'订单代客预订成功!'}]";
                break;
            }
            Response.Clear();
            Response.Write(ReturnString);
            Response.End();
        }