Exemplo n.º 1
0
        /// <summary>
        /// 保存按钮点击事件执行方法
        /// </summary>
        protected string PageSave()
        {
            #region 表单赋值
            string setsrrorMsg = string.Empty;
            string msg         = string.Empty;
            //酒店名称
            string hotelName = Utils.GetFormValue(this.supplierControl1.ClientText);
            //酒店id
            string hotelId = Utils.GetFormValue(this.supplierControl1.ClientValue);
            //星级
            string hotelStart = Utils.GetFormValue(this.ddlHotelStart.UniqueID);
            //联系人 联系电话 联系传真
            string contectName  = Utils.GetFormValue(this.txtContectName.UniqueID);
            string contectPhone = Utils.GetFormValue(this.txtContectPhone.UniqueID);
            string contectFax   = Utils.GetFormValue(this.txtContectFax.UniqueID);
            //入住时间 离店时间 天数
            DateTime?startTime = Utils.GetDateTimeNullable(Utils.GetFormValue(this.txtStartTime.UniqueID));
            DateTime?endTime   = Utils.GetDateTimeNullable(Utils.GetFormValue(this.txtEndTime.UniqueID));
            string   days      = Utils.GetFormValue(this.txtroomDays.UniqueID);
            //房型 单价 计算方式 数量 小计
            string[] roomType        = Utils.GetFormValues("ddlRoomType");
            string[] unitPirces      = Utils.GetFormValues("txtunitPrice");
            string[] selectType      = Utils.GetFormValues("select");
            string[] numbers         = Utils.GetFormValues("txtRoomNumber");
            string[] roomItemDays    = Utils.GetFormValues("txtRoomItemDays");
            string[] TotalMoney      = Utils.GetFormValues("txtTotalMoney");
            string[] txtCheckInDate  = Utils.GetFormValues("txtCheckInDate");
            string[] txtCheckOutDate = Utils.GetFormValues("txtCheckOutDate");

            //付房数量 免房数量
            string payRoomNum = Utils.GetFormValue(this.txtPayRoomNumbers.UniqueID);
            string FreRoomNum = Utils.GetFormValue(this.txtFreRoomNumber.UniqueID);
            //是否含早
            string ContainsEarly = Utils.GetFormValue(this.ddlContainsEarly.UniqueID);
            //早餐费用 单价 人数 次数
            decimal unitPricesEarly  = Utils.GetDecimal(Utils.GetFormValue(this.txtunitPricesEarly.UniqueID));
            string  earlyPeopleNum   = Utils.GetFormValue(this.txtPeopleNumEarly.UniqueID);
            string  sequenceNumEarly = Utils.GetFormValue(this.txtsequenceNumEarly.UniqueID);
            //结算费用 费用明细
            decimal totalMoney  = Utils.GetDecimal(Utils.GetFormValue(this.txtTotalPrices.UniqueID));
            string  CostParticu = Utils.GetFormValue(this.txtCostParticu.UniqueID);

            //导游须知 其它备注
            string guidNotes  = Utils.GetFormValue(this.txtGuidNotes.UniqueID);
            string otherMarks = Utils.GetFormValue(this.txtOtherRemark.UniqueID);
            //返利 状态
            bool profit = Utils.GetFormValue(this.Selprofit1.UniqueID) == "0" ? true : false;
            #endregion

            #region 后台验证
            if (string.IsNullOrEmpty(hotelName) && string.IsNullOrEmpty(hotelId))
            {
                msg += "请选择酒店名称!<br/>";
            }
            if (string.IsNullOrEmpty(startTime.ToString()))
            {
                msg += "请填写入住时间!<br/>";
            }
            if (string.IsNullOrEmpty(endTime.ToString()))
            {
                msg += "请填写离店时间!<br/>";
            }
            if (string.IsNullOrEmpty(days))
            {
                msg += "请填写入住天数!<br/>";
            }

            if (roomType.Length > 0)
            {
                for (int i = 0; i < roomType.Length; i++)
                {
                    if (string.IsNullOrEmpty(roomType[i]))
                    {
                        msg += "第" + (i + 1) + "行请选择房型!<br/>";
                    }
                }
            }

            if (unitPirces.Length > 0)
            {
                for (int i = 0; i < unitPirces.Length; i++)
                {
                    if (string.IsNullOrEmpty(unitPirces[i]))
                    {
                        msg += "第" + (i + 1) + "行请输入单价!<br/>";
                    }
                }
            }
            if (numbers.Length > 0)
            {
                for (int i = 0; i < numbers.Length; i++)
                {
                    if (string.IsNullOrEmpty(numbers[i]))
                    {
                        msg += "第" + (i + 1) + "行请输入数量!<br/>";
                    }
                }
            }
            string[] totalPrices = Utils.GetFormValues("txtTotalMoney");
            if (totalPrices.Length > 0)
            {
                for (int i = 0; i < totalPrices.Length; i++)
                {
                    if (string.IsNullOrEmpty(totalPrices[i]) && Utils.GetDecimal(totalPrices[i]) <= 0)
                    {
                        msg += "第" + totalPrices[i] + "行请输入小计费用!<br/>";
                    }
                }
            }

            if (string.IsNullOrEmpty(ContainsEarly))
            {
                msg += "请选择是否含早餐!<br/>";
            }

            if (totalMoney <= 0)
            {
                msg += "请填写结算费用!<br/>";
            }

            if (profit.ToString() == "-1")
            {
                msg += "请选择是否返利!<br/>";
            }
            string status = Utils.GetFormValue("SelStatus");
            if (string.IsNullOrEmpty(status))
            {
                msg += "请选择状态!<br/>";
            }
            if (string.IsNullOrEmpty(Utils.GetFormValue("SelPanyMent")))
            {
                msg += "请选择支付方式!<br/>";
            }
            if (msg != "")
            {
                setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                return(setsrrorMsg);
            }
            #endregion

            #region 实体赋值
            EyouSoft.Model.PlanStructure.MPlanBaseInfo baseinfo = new EyouSoft.Model.PlanStructure.MPlanBaseInfo();
            baseinfo.AddStatus                   = EyouSoft.Model.EnumType.PlanStructure.PlanAddStatus.计调安排时添加;
            baseinfo.CompanyId                   = this.SiteUserInfo.CompanyId;
            baseinfo.Confirmation                = totalMoney;
            baseinfo.PlanCost                    = totalMoney;
            baseinfo.ContactFax                  = contectFax;
            baseinfo.ContactName                 = contectName;
            baseinfo.ContactPhone                = contectPhone;
            baseinfo.EndDate                     = endTime;
            baseinfo.GuideNotes                  = guidNotes;
            baseinfo.IsRebate                    = profit;
            baseinfo.IssueTime                   = System.DateTime.Now;
            baseinfo.Num                         = Utils.GetInt(payRoomNum);
            baseinfo.PaymentType                 = (EyouSoft.Model.EnumType.PlanStructure.Payment)Utils.GetInt(Utils.GetFormValue("SelPanyMent"));
            baseinfo.PlanHotel                   = new EyouSoft.Model.PlanStructure.MPlanHotel();
            baseinfo.PlanHotel.Days              = Utils.GetInt(days);
            baseinfo.PlanHotel.FreeNumber        = Utils.GetInt(FreRoomNum);
            baseinfo.PlanHotel.IsMeal            = (EyouSoft.Model.EnumType.PlanStructure.PlanHotelIsMeal)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanHotelIsMeal), ContainsEarly);
            baseinfo.PlanHotel.MealFrequency     = Utils.GetInt(sequenceNumEarly);
            baseinfo.PlanHotel.MealNumber        = Utils.GetInt(earlyPeopleNum);
            baseinfo.PlanHotel.MealPrice         = unitPricesEarly;
            baseinfo.PlanHotel.Star              = (EyouSoft.Model.EnumType.SourceStructure.HotelStar)Enum.Parse(typeof(EyouSoft.Model.EnumType.SourceStructure.HotelStar), hotelStart);
            baseinfo.PlanHotel.QianTaiTelephone  = Utils.GetFormValue(txtQianTaiTelephone.UniqueID);
            baseinfo.PlanHotel.PlanHotelRoomList = new List <EyouSoft.Model.PlanStructure.MPlanHotelRoom>();
            for (int i = 0; i < roomType.Length; i++)
            {
                var roomHotel = new EyouSoft.Model.PlanStructure.MPlanHotelRoom();

                roomHotel.RoomType     = roomType[i].Split(',')[1];
                roomHotel.RoomId       = roomType[i].Split(',')[0];
                roomHotel.UnitPrice    = Utils.GetDecimal(unitPirces[i]);
                roomHotel.Days         = Utils.GetInt(roomItemDays[i]);
                roomHotel.PriceType    = (EyouSoft.Model.EnumType.PlanStructure.PlanHotelPriceType)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanHotelPriceType), selectType[i]);
                roomHotel.Quantity     = Utils.GetInt(numbers[i]);
                roomHotel.Total        = Utils.GetDecimal(TotalMoney[i]);
                roomHotel.CheckInDate  = Utils.GetDateTimeNullable(txtCheckInDate[i]);
                roomHotel.CheckOutDate = Utils.GetDateTimeNullable(txtCheckOutDate[i]);

                baseinfo.PlanHotel.PlanHotelRoomList.Add(roomHotel);
            }
            baseinfo.Remarks    = otherMarks;
            baseinfo.SourceId   = hotelId;
            baseinfo.SourceName = hotelName;
            baseinfo.StartDate  = startTime;
            baseinfo.Status     = (EyouSoft.Model.EnumType.PlanStructure.PlanState)Utils.GetInt(Utils.GetFormValue("SelStatus"));
            if (Utils.GetFormValue(this.supplierControl1.ClientIsyukong) == "1")
            {
                baseinfo.SueId = Utils.GetFormValue(this.supplierControl1.ClientzyykValue);
            }
            baseinfo.TourId       = Utils.GetQueryStringValue("tourId");
            baseinfo.Type         = EyouSoft.Model.EnumType.PlanStructure.PlanProject.酒店;
            baseinfo.OperatorId   = this.SiteUserInfo.UserId;
            baseinfo.OperatorName = this.SiteUserInfo.Name;
            baseinfo.CostDetail   = CostParticu;
            #endregion

            #region 提交操作
            //酒店id
            string planID = Utils.GetQueryStringValue("planId");
            int    result = 0;
            EyouSoft.BLL.PlanStructure.BPlan bll = new EyouSoft.BLL.PlanStructure.BPlan();
            if (planID != null && planID != "")
            {
                baseinfo.PlanId           = planID;
                baseinfo.PlanHotel.PlanId = planID;
                result = bll.UpdPlan(baseinfo);
                if (result == 1)
                {
                    msg        += "修改成功!";
                    setsrrorMsg = UtilsCommons.AjaxReturnJson("1", "" + msg + "");
                }
                else if (result == 0)
                {
                    msg        += "修改失败!";
                    setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                }
                else if (result == -2)
                {
                    msg        += "预控数量不足,修改失败!";
                    setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                }
            }
            else
            {
                result = bll.AddPlan(baseinfo);
                if (result == 1)
                {
                    msg        += "添加成功!";
                    setsrrorMsg = UtilsCommons.AjaxReturnJson("1", "" + msg + "");
                }
                else if (result == 0)
                {
                    msg        += "添加失败!";
                    setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                }
                else if (result == -2)
                {
                    msg        += "预控数量不足,添加失败!";
                    setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                }
            }

            #endregion

            return(setsrrorMsg);
        }
Exemplo n.º 2
0
        protected string PageSaveForeign()
        {
            #region 表单取值
            string msg         = string.Empty;
            string seterrormsg = string.Empty;
            //游船公司
            string shipComName = Utils.GetFormValue(this.SupplierControl1.ClientText);
            string shipComID   = Utils.GetFormValue(this.SupplierControl1.ClientValue);
            //联系人 电话 传真
            string contectName  = Utils.GetFormValue(this.txtContectName.UniqueID);
            string contectPhone = Utils.GetFormValue(this.txtContectPhone.UniqueID);
            string contectFax   = Utils.GetFormValue(this.txtContectFax.UniqueID);
            //船名 船载电话
            string shipName  = Utils.GetFormValue("ddlShipNameList").Split(',')[1];
            string shipPhone = Utils.GetFormValue(this.txtShipPhone.UniqueID);
            //登船日期 时间 船载码头
            DateTime?boardDate   = Utils.GetDateTimeNullable(Utils.GetFormValue(this.txtBoardDate.UniqueID));
            string   boardTime   = Utils.GetFormValue(this.txtBoardTime.UniqueID);
            string   boardWharif = Utils.GetFormValue(this.txtBoardWharif.UniqueID);
            //登船号 航线
            string boardCode = Utils.GetFormValue(this.txtBoardCode.UniqueID);
            string route     = Utils.GetFormValue(this.txtRoute.UniqueID);
            //停靠景点
            string stopAttr = Utils.GetFormValue(this.txtStopAttr.UniqueID);
            //价格组成
            string[] roomTypes   = Utils.GetFormValues("selRoomTypeList");
            string[] CrowdTypes  = Utils.GetFormValues("selCrowdType");
            string[] adultNums   = Utils.GetFormValues("txtAdultNum");
            string[] adultPrices = Utils.GetFormValues("txtAdultPrice");
            //string[] childNums = Utils.GetFormValues("txtChildNum");
            //string[] childPrices = Utils.GetFormValues("txtChildPrice");
            //string[] childNoNums = Utils.GetFormValues("txtChildNoNum");
            //string[] childNoPrices = Utils.GetFormValues("txtChildNoPrice");
            //string[] bobyNums = Utils.GetFormValues("txtBobyNum");
            //string[] bobyPrices = Utils.GetFormValues("txtBobyPrice");
            string[] totalPrices = Utils.GetFormValues("txtTotalPrice");
            //楼层
            string[] floors     = Utils.GetFormValues("selFloorList");
            string[] peopleNums = Utils.GetFormValues("txtPeopleNum");
            string[] unitPrices = Utils.GetFormValues("txtUnitPrice");
            //自费项目
            //string ownCost = Utils.GetFormValue(this.txtOwnCost.UniqueID);
            //string ownPrices = Utils.GetFormValue(this.txtOwnCostPrice.UniqueID);
            //string ownNums = Utils.GetFormValue(this.txtOwnCostNums.UniqueID);
            //结算费用
            decimal totalCost = Utils.GetDecimal(Utils.GetFormValue(this.txtTotalPrices.UniqueID));
            //游客资料
            string customerInfo = Utils.GetFormValue(this.txtCustomerInfo.UniqueID);
            //费用明细
            string costDetail = Utils.GetFormValue(this.txtCostDetail.UniqueID);
            //导游需知 其它备注
            string   guidNotes       = Utils.GetFormValue(this.txtGuidNOtes.UniqueID);
            string   otherMarks      = Utils.GetFormValue(this.txtOtherRemarks.UniqueID);
            string[] txtSheWaiBeiZhu = Utils.GetFormValues("txtSheWaiBeiZhu");
            #endregion

            #region 后台验证
            if (string.IsNullOrEmpty(shipComID) && string.IsNullOrEmpty(shipComName))
            {
                msg += "请选择游船公司!<br/>";
            }
            if (string.IsNullOrEmpty(shipName))
            {
                msg += "请输入船名!<br/>";
            }
            if (string.IsNullOrEmpty(boardWharif))
            {
                msg += "请输入登船码头!<br/>";
            }
            if (roomTypes.Length > 0)
            {
                for (int i = 0; i < roomTypes.Length; i++)
                {
                    if (string.IsNullOrEmpty(roomTypes[i]))
                    {
                        msg += "请选择房型!<br/>";
                    }
                }
            }
            if (CrowdTypes.Length > 0)
            {
                for (int i = 0; i < CrowdTypes.Length; i++)
                {
                    if (string.IsNullOrEmpty(CrowdTypes[i]))
                    {
                        msg += "请选择人群类型!<br/>";
                    }
                }
            }
            if (adultNums.Length > 0)
            {
                for (int i = 0; i < adultNums.Length; i++)
                {
                    if (string.IsNullOrEmpty(adultNums[i]) || Utils.GetInt(adultNums[i]) < 0)
                    {
                        msg += "请输入人数!<br/>";
                    }
                }
            }
            if (adultPrices.Length > 0)
            {
                for (int i = 0; i < adultPrices.Length; i++)
                {
                    if (Utils.GetDecimal(adultPrices[i]) < 0 || string.IsNullOrEmpty(adultPrices[i]))
                    {
                        msg += "请输入单价!<br/>";
                    }
                }
            }
            if (totalCost < 0)
            {
                msg += "请输入结算费用!<br/>";
            }
            if (string.IsNullOrEmpty(Utils.GetFormValue("SelPanyMent")))
            {
                msg += "请选择支付方式!<br/>";
            }
            if (string.IsNullOrEmpty(Utils.GetFormValue("SelStatus")))
            {
                msg += "请选择状态!<br/>";
            }
            if (string.IsNullOrEmpty(Utils.GetFormValue(this.ddlprofit1.UniqueID)))
            {
                msg += "请选择是否返利!<br/>";
            }
            if (msg != "")
            {
                seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                return(seterrormsg);
            }
            #endregion

            #region 实体赋值
            EyouSoft.Model.PlanStructure.MPlanBaseInfo baseinfo = new EyouSoft.Model.PlanStructure.MPlanBaseInfo();
            baseinfo.AddStatus          = EyouSoft.Model.EnumType.PlanStructure.PlanAddStatus.计调安排时添加;
            baseinfo.CompanyId          = this.SiteUserInfo.CompanyId;
            baseinfo.Confirmation       = totalCost;
            baseinfo.PlanCost           = totalCost;
            baseinfo.ContactFax         = contectFax;
            baseinfo.ContactName        = contectName;
            baseinfo.ContactPhone       = contectPhone;
            baseinfo.CostDetail         = costDetail;
            baseinfo.CustomerInfo       = customerInfo;
            baseinfo.GuideNotes         = guidNotes;
            baseinfo.IsRebate           = Utils.GetFormValue(this.ddlprofit1.UniqueID) == "0" ? true : false;
            baseinfo.IssueTime          = System.DateTime.Now;
            baseinfo.PaymentType        = (EyouSoft.Model.EnumType.PlanStructure.Payment)Utils.GetInt(Utils.GetFormValue("SelPanyMent"));
            baseinfo.PlanShip           = new EyouSoft.Model.PlanStructure.MPlanShip();
            baseinfo.PlanShip.Line      = route;
            baseinfo.PlanShip.LoadCode  = boardCode;
            baseinfo.PlanShip.LoadDock  = boardWharif;
            baseinfo.PlanShip.ShipCalls = shipPhone;
            baseinfo.PlanShip.ShipName  = shipName;
            baseinfo.PlanShip.SubId     = Utils.GetFormValue("ddlShipNameList").Split(',')[0];
            baseinfo.PlanShip.Sight     = stopAttr;
            //自费项目
            //baseinfo.PlanShip.PlanShipOwnCostList = new List<EyouSoft.Model.PlanStructure.MPlanShipOwnCost>();
            //EyouSoft.Model.PlanStructure.MPlanShipOwnCost OwnCostM = new EyouSoft.Model.PlanStructure.MPlanShipOwnCost();
            //OwnCostM.OwnItem = ownCost;
            //OwnCostM.PeopleNum = Utils.GetInt(ownNums);
            //OwnCostM.Price = Utils.GetDecimal(ownPrices);
            //OwnCostM.IsFloor = false;
            //baseinfo.PlanShip.PlanShipOwnCostList.Add(OwnCostM);
            //楼层
            //for (int i = 0; i < floors.Length; i++)
            //{
            //    EyouSoft.Model.PlanStructure.MPlanShipOwnCost OwnCostF = new EyouSoft.Model.PlanStructure.MPlanShipOwnCost();
            //    OwnCostF.IsFloor = true;
            //    OwnCostF.OwnItem = floors[i];
            //    OwnCostF.PeopleNum = Utils.GetInt(peopleNums[i]);
            //    OwnCostF.Price = Utils.GetDecimal(unitPrices[i]);
            //    baseinfo.PlanShip.PlanShipOwnCostList.Add(OwnCostF);
            //}
            decimal nums = 0;
            //价格组成
            baseinfo.PlanShip.PlanShipPriceList = new List <EyouSoft.Model.PlanStructure.MPlanShipPrice>();
            for (int i = 0; i < roomTypes.Length; i++)
            {
                EyouSoft.Model.PlanStructure.MPlanShipPrice pricesM = new EyouSoft.Model.PlanStructure.MPlanShipPrice();
                pricesM.DNum        = Utils.GetDecimal(adultNums[i]);
                pricesM.AdultNumber = Utils.GetInt(adultNums[i]);
                pricesM.AdultNumber = Convert.ToInt32(pricesM.DNum);
                pricesM.AdultPrice  = Utils.GetDecimal(adultPrices[i]);
                //pricesM.BabyNumber = Utils.GetInt(bobyNums[i]);
                //pricesM.BabyNumberPrice = Utils.GetDecimal(bobyPrices[i]);
                //pricesM.ChildNoOccupancy = Utils.GetInt(childNoNums[i]);
                //pricesM.ChildNoOccupancyPrice = Utils.GetDecimal(childNoPrices[i]);
                //pricesM.ChildNumber = Utils.GetInt(childNums[i]);
                //pricesM.ChildPrice = Utils.GetDecimal(childPrices[i]);
                pricesM.SumPrice = Utils.GetDecimal(totalPrices[i]);;
                //nums += Utils.GetInt(adultNums[i]) + Utils.GetInt(bobyNums[i]) + Utils.GetInt(childNoNums[i]) + Utils.GetInt(childNums[i]);
                nums += Utils.GetDecimal(adultNums[i]);
                pricesM.CrowdType = (EyouSoft.Model.EnumType.PlanStructure.PlanShipCrowdType)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanShipCrowdType), CrowdTypes[i]);
                pricesM.RoomType  = (EyouSoft.Model.EnumType.PlanStructure.PlanShipRoomType)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanShipRoomType), roomTypes[i]);
                pricesM.BeiZhu    = txtSheWaiBeiZhu[i];
                //小计
                baseinfo.PlanShip.PlanShipPriceList.Add(pricesM);
            }
            baseinfo.Num        = Convert.ToInt32(nums);
            baseinfo.DNum       = nums;
            baseinfo.Remarks    = otherMarks;
            baseinfo.SourceId   = shipComID;
            baseinfo.SourceName = shipComName;
            baseinfo.StartDate  = boardDate;
            baseinfo.StartTime  = boardTime;
            baseinfo.Status     = (EyouSoft.Model.EnumType.PlanStructure.PlanState)Utils.GetInt(Utils.GetFormValue("SelStatus"));
            if (Utils.GetFormValue(this.SupplierControl1.ClientIsyukong) == "1")
            {
                baseinfo.SueId = Utils.GetFormValue(this.SupplierControl1.ClientzyykValue);
            }
            baseinfo.TourId       = Utils.GetQueryStringValue("tourId");
            baseinfo.Type         = EyouSoft.Model.EnumType.PlanStructure.PlanProject.涉外游轮;
            baseinfo.OperatorId   = this.SiteUserInfo.UserId;
            baseinfo.OperatorName = this.SiteUserInfo.Name;
            #endregion

            #region 提交操作
            int result = 0;
            EyouSoft.BLL.PlanStructure.BPlan bll = new EyouSoft.BLL.PlanStructure.BPlan();
            if (Utils.GetQueryStringValue("action") == "save")
            {
                string editID = Utils.GetQueryStringValue("planId");
                if (!string.IsNullOrEmpty(editID))
                {
                    baseinfo.PlanShip.PlanId = editID;
                    baseinfo.PlanId          = editID;
                    result = bll.UpdPlan(baseinfo);
                    if (result == 1)
                    {
                        msg        += "修改成功!";
                        seterrormsg = UtilsCommons.AjaxReturnJson("1", "" + msg + "");
                    }
                    else if (result == 0)
                    {
                        msg        += "修改失败!";
                        seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                    }
                    else if (result == -2)
                    {
                        msg        += "预控数量不足,修改失败!";
                        seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                    }
                }
                else
                {
                    result = bll.AddPlan(baseinfo);
                    if (result == 1)
                    {
                        msg        += "添加成功!";
                        seterrormsg = UtilsCommons.AjaxReturnJson("1", "" + msg + "");
                    }
                    else if (result == 0)
                    {
                        msg        += "添加失败!";
                        seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                    }
                    else if (result == -2)
                    {
                        msg        += "预控数量不足,添加失败!";
                        seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                    }
                }
            }
            #endregion

            return(seterrormsg);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        protected string PageSave()
        {
            #region 表单赋值
            string msg         = string.Empty;
            string seterrorMsg = string.Empty;
            //车队
            string CarName = Utils.GetFormValue(this.SupplierControl1.ClientText);
            string CarId   = Utils.GetFormValue(this.SupplierControl1.ClientValue);
            //联系人 联系电话 联系传真
            string contectName  = Utils.GetFormValue(this.txtContectName.UniqueID);
            string contectPhone = Utils.GetFormValue(this.txtContectPhone.UniqueID);
            string contectFax   = Utils.GetFormValue(this.txtContectFax.UniqueID);
            //用车时间开始 开始时间点 结束 结束时间点
            DateTime startTime  = Utils.GetDateTime(Utils.GetFormValue(this.txtUseCarTime.UniqueID));
            string   timeHours1 = Utils.GetFormValue(this.txttime1.UniqueID);
            DateTime endTime    = Utils.GetDateTime(Utils.GetFormValue(this.txtUseCarTime2.UniqueID));
            string   timeHours2 = Utils.GetFormValue(this.txttime2.UniqueID);
            //用车类型 车型 车牌号
            string useCarType = Utils.GetFormValue(this.ddlUserCarType.UniqueID);
            string carTypeId  = Utils.GetFormValue("selCarModel").Split(',')[0];
            string carType    = Utils.GetFormValue("selCarModel").Split(',')[1];
            string carNumber  = Utils.GetFormValue(this.txtCarNumber.UniqueID);
            //司机 司机电话
            string driverName  = Utils.GetFormValue(this.txtDirverName.UniqueID);
            string driverPhone = Utils.GetFormValue(this.txDirverPhone.UniqueID);
            //费用明细 用车数量  结算费用
            string  CostParticu = Utils.GetFormValue(this.txtCostParticu.UniqueID);
            string  useCarnums  = Utils.GetFormValue(this.txtUseCarNums.UniqueID);
            decimal totalMoney  = Utils.GetDecimal(Utils.GetFormValue(this.txttotalMoney.UniqueID));

            //接待行程 导游需知 其它备注 返利 支付方式 状态
            string travel      = Utils.GetFormValue(this.txtTravel.UniqueID);
            string guidNotes   = Utils.GetFormValue(this.txtGuidNotes.UniqueID);
            string otherRemark = Utils.GetFormValue(this.txtOtherRemark.UniqueID);
            bool   profit      = Utils.GetFormValue(this.ddlProfit.UniqueID) == "0" ? true : false;
            #endregion

            #region 表单验证
            if (string.IsNullOrEmpty(CarId) && string.IsNullOrEmpty(CarName))
            {
                msg += "请选择车队!<br/>";
            }
            if (string.IsNullOrEmpty(startTime.ToString()))
            {
                msg += "请输入用车开始时间天!<br/>";
            }

            /*if (string.IsNullOrEmpty(timeHours1) || timeHours1 == "点时间")
             * {
             *  msg += "请输入用车开始时间点!<br/>";
             * }*/
            /*if (string.IsNullOrEmpty(endTime.ToString()))
             * {
             *  msg += "请输入用车结束时间天!<br/>";
             * }*/
            /*if (string.IsNullOrEmpty(timeHours2) || timeHours2 == "点时间")
             * {
             *  msg += "请输入用车结束时间点!<br/>";
             * }*/
            if (useCarType.ToString() == "-1")
            {
                msg += "请选择用车类型!<br/>";
            }
            if (string.IsNullOrEmpty(CostParticu))
            {
                msg += "请输入费用明细!<br/>";
            }
            if (totalMoney <= 0)
            {
                msg += "请输入结算费用!<br/>";
            }
            if (string.IsNullOrEmpty(Utils.GetFormValue("selPenyMent")))
            {
                msg += "请选择支付方式!<br/>";
            }
            if (string.IsNullOrEmpty(Utils.GetFormValue("SelStatus")))
            {
                msg += "请选择状态!<br/>";
            }
            if (string.IsNullOrEmpty(Utils.GetFormValue(this.ddlProfit.UniqueID)))
            {
                msg += "请选择是否返利!<br/>";
            }
            if (msg != "")
            {
                seterrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                return(seterrorMsg);
            }
            #endregion

            #region 实体赋值
            EyouSoft.Model.PlanStructure.MPlanBaseInfo baseinfo = new EyouSoft.Model.PlanStructure.MPlanBaseInfo();
            baseinfo.AddStatus    = EyouSoft.Model.EnumType.PlanStructure.PlanAddStatus.计调安排时添加;
            baseinfo.CompanyId    = this.SiteUserInfo.CompanyId;
            baseinfo.Confirmation = totalMoney;
            baseinfo.PlanCost     = totalMoney;
            baseinfo.ContactFax   = contectFax;
            baseinfo.ContactName  = contectName;
            baseinfo.ContactPhone = contectPhone;
            baseinfo.CostDetail   = CostParticu;
            baseinfo.StartTime    = (timeHours1 == "点时间" ? "" : timeHours1);
            baseinfo.StartDate    = startTime;
            baseinfo.EndTime      = (timeHours2 == "点时间" ? "" : timeHours2);
            baseinfo.EndDate      = endTime;
            baseinfo.GuideNotes   = guidNotes;
            baseinfo.IsRebate     = profit;
            baseinfo.IssueTime    = System.DateTime.Now;
            baseinfo.Num          = Utils.GetInt(useCarnums);
            baseinfo.PaymentType  = (EyouSoft.Model.EnumType.PlanStructure.Payment)Utils.GetInt(Utils.GetFormValue("selPenyMent"));
            baseinfo.Status       = (EyouSoft.Model.EnumType.PlanStructure.PlanState)Utils.GetInt(Utils.GetFormValue("SelStatus"));
            baseinfo.SourceId     = Utils.GetFormValue(this.SupplierControl1.ClientValue);
            baseinfo.SourceName   = Utils.GetFormValue(this.SupplierControl1.ClientText);
            if (Utils.GetFormValue(this.SupplierControl1.ClientIsyukong) == "1")
            {
                baseinfo.SueId = Utils.GetFormValue(this.SupplierControl1.ClientzyykValue);
            }
            baseinfo.Type                = EyouSoft.Model.EnumType.PlanStructure.PlanProject.用车;
            baseinfo.TourId              = Utils.GetQueryStringValue("tourId");
            baseinfo.ReceiveJourney      = travel;
            baseinfo.PlanCar             = new EyouSoft.Model.PlanStructure.MPlanCar();
            baseinfo.PlanCar.VehicleType = (EyouSoft.Model.EnumType.PlanStructure.PlanCarType)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanCarType), useCarType);
            baseinfo.PlanCar.Models      = carType;
            baseinfo.PlanCar.CarId       = carTypeId;
            baseinfo.PlanCar.Driver      = driverName;
            baseinfo.PlanCar.DriverPhone = driverPhone;
            baseinfo.PlanCar.CarNumber   = carNumber;
            baseinfo.Remarks             = otherRemark;
            baseinfo.OperatorId          = this.SiteUserInfo.UserId;
            baseinfo.OperatorName        = this.SiteUserInfo.Name;
            #endregion

            #region 提交操作
            string editid = Utils.GetQueryStringValue("planId");
            EyouSoft.BLL.PlanStructure.BPlan bll = new EyouSoft.BLL.PlanStructure.BPlan();
            int result = 0;
            if (editid != "" && editid != null)
            {
                baseinfo.PlanId         = editid;
                baseinfo.PlanCar.PlanId = editid;
                result = bll.UpdPlan(baseinfo);
                if (result == 1)
                {
                    msg        += "修改成功!";
                    seterrorMsg = UtilsCommons.AjaxReturnJson("1", "" + msg + "");
                }
                else if (result == 0)
                {
                    msg        += "修改失败!";
                    seterrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                }
                else if (result == -2)
                {
                    msg        += "预控数量不足,修改失败!";
                    seterrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                }
            }
            else
            {
                result = bll.AddPlan(baseinfo);
                if (result == 1)
                {
                    msg        += "添加成功!";
                    seterrorMsg = UtilsCommons.AjaxReturnJson("1", "" + msg + "");
                }
                else if (result == 0)
                {
                    msg        += "添加失败!";
                    seterrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                }
                else if (result == -2)
                {
                    msg        += "预控数量不足,添加失败!";
                    seterrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + "");
                }
            }
            #endregion

            return(seterrorMsg);
        }