protected void btnSave_Click(object sender, EventArgs e)
 {
     string Id = Utils.GetFormValue("hidId");
     string ProductName = "";
     var Pmodel = BHotspot.GetEntertainmentModel(Id);
     if (Pmodel != null)
     {
         ProductName = Pmodel.hotspot_name;
     }
     string UserName = "";
     string MemberId = "";
     int num = Utils.GetInt(Utils.GetFormValue("num"));
     string name = Utils.GetFormValue("bookName");
     string time = Utils.GetFormValue("time");
     string remark = Utils.GetFormValue("remark");
     string contact = Utils.GetFormValue("contact");
     var UserModel = LoginCheck();
     if (UserModel != null) { MemberId = UserModel.id; UserName = UserModel.user_name; }
     float TotalMoney = 0;
     string OrderId = System.Guid.NewGuid().ToString();
     DsorderDTO model = new DsorderDTO();
     model.id = OrderId;
     model.code = DateTime.Now.ToString("yyyyMMddHHmmss");
     model.orderstatus = "1";
     model.member_id = MemberId;
     model.member_name = UserName;
     model.linkman = name;
     model.customerphone = contact;
     model.plandate = time;
     model.totalamount = TotalMoney;
     model.paytype = 0;
     model.ordertype = (int)订单类型.娱乐;
     model.totalquantity = num;
     //model.orderdate = time;
     model.datasource = Target;
     model.remark = remark;
     model.publishtarget = Target;
     model.is_valid = 1;
     model.create_date = DateTime.Now;
     List<DsorderdetailDTO> orderlist = new List<DsorderdetailDTO>();
     orderlist.Add(new DsorderdetailDTO
     {
         id = System.Guid.NewGuid().ToString(),
         ds_order_id = OrderId,
         productid = Id,
         productname = ProductName,
         price = 0,
         realprice = 0,
         num = num,
         childrennum = 0,
         amount = TotalMoney,
         realamount = TotalMoney,
         roomtype = ""
     });
     model.Items = orderlist;
     var result = BOrder.AddOrder(model);
     /*
     var result = BBooking.Add(new TywbookingDTO
     {
         id = System.Guid.NewGuid().ToString(),
         person_num = num,
         booking_date = DateTime.Now,
         remark = remark,
         booking_userid = MemberId,
         booking_username = UserName,
         bookingusercontacts = contact,
         objtype = (int)预约类型.娱乐,
         obj_id = Id,
         datasource = Target
     });
     */
     if (result)
     {
         MessageBox.ShowAndRedirect("预定成功!", "travel_entertainment.aspx");
         return;
     }
     else
     {
         MessageBox.ShowAndReturnBack("预定失败!");
         return;
     }
 }
Ejemplo n.º 2
0
        private void SaveOrder(bool IsPay)
        {
            string HotsPotId = "";
            string Id = Utils.GetQueryStringValue("Id");
            float ItemPrice = 0;
            string ProductlName = "";
            var UserModel = LoginCheck();
            if (UserModel == null)
            {
                MessageBox.ShowAndRedirect("用户未登陆,请登陆后下单!", "/Login.aspx");
                return;
            }
            else
            {
                if (!String.IsNullOrWhiteSpace(Id))
                {
                    var ItemModel = BHotspot.GetShopItemModel(Id);
                    if (ItemModel != null)
                    {
                        HotsPotId = ItemModel.hotspot_id;
                        ItemPrice = ItemModel.price;
                        var ProductModel = BHotspot.GetShopModel(HotsPotId);
                        if (ProductModel != null) { ProductlName = ProductModel.hotspot_name; }
                        else
                        {
                            MessageBox.ShowAndReturnBack("未找到您要查看的信息");
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.ShowAndReturnBack("未找到您要查看的信息");
                        return;
                    }
                }
                else
                {
                    MessageBox.ShowAndReturnBack("未找到您要查看的信息");
                    return;
                }
                string linkman = Utils.GetFormValue("linkman");
                string phone = Utils.GetFormValue("phone");
                string remark = Utils.GetFormValue("remark");
                int num = Utils.GetInt(Utils.GetFormValue("num"));
                if (String.IsNullOrEmpty(phone))
                {
                    MessageBox.ShowAndReturnBack("请填写手机号码!");
                    return;
                }
                decimal TotalMoney = num * Convert.ToDecimal(ItemPrice);
                string OrderId = System.Guid.NewGuid().ToString();
                DsorderDTO model = new DsorderDTO();
                model.id = OrderId;
                model.code = DateTime.Now.ToString("yyyyMMddHHmmss");
                model.orderstatus = "1";
                model.member_id = UserModel.id;
                model.member_name = UserModel.user_name;
                model.linkman = linkman;
                model.customerphone = phone;
                model.totalamount = (float)TotalMoney;
                model.paytype = 0;
                model.ordertype = (int)订单类型.购物订单;
                model.orderdate = DateTime.Now;
                model.datasource = Target;
                model.remark = remark;
                model.publishtarget = Target;
                model.is_valid = 1;
                model.create_date = DateTime.Now;
                List<DsorderdetailDTO> orderlist = new List<DsorderdetailDTO>();
                orderlist.Add(new DsorderdetailDTO
                {
                    id = System.Guid.NewGuid().ToString(),
                    ds_order_id = OrderId,
                    productid = HotsPotId,
                    productname = ProductlName,
                    price = ItemPrice,
                    realprice = ItemPrice,
                    num = num,
                    childrennum = 0,
                    amount = (float)TotalMoney,
                    realamount = (float)TotalMoney,
                    roomtype = Id
                });
                model.Items = orderlist;
                var result = BOrder.AddOrder(model);
                if (result)
                {
                    if (IsPay)
                    {
                        MessageBox.ResponseScript("window.open(\"/AliPay/AliTradeTourOrder.aspx?OrderId=" + OrderId + "&OrderType=" + model.ordertype + "&Pay=alipay\")");
                        MessageBox.ShowAndRedirect("预定成功!", "travel_shopping.aspx");
                        return;
                    }
                    else
                    {
                        MessageBox.ShowAndRedirect("预定成功!", "travel_shopping.aspx");
                        return;
                    }
                }
                else
                {
                    MessageBox.ShowAndReturnBack("订单添加失败!");
                    return;
                }
            }

        }        
Ejemplo n.º 3
0
 /// <summary>
 /// 修改主订单表
 /// </summary>
 public static bool Update(DsorderDTO model)
 {
     var result = APIOP<DsorderDTO>.Update(RemoteDomain + "/Dsorder/Update", model);
     return result.flag;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 保存到订单
 /// </summary>
 private void SaveToOrder() {
     string HotsPotId = "";
     string Id = Utils.GetQueryStringValue("Id");
     float ItemPrice = 0;
     string ProductlName = "";
     var UserModel = LoginCheck();
     if (UserModel == null)
     {
         MessageBox.ShowAndRedirect("用户未登陆,请登陆后下单!", "/Login.aspx");
         return;
     }
     else
     {
         decimal MemberIntegral = BMemberIntegral.GetMemberInteral(UserModel.id);
         if (!String.IsNullOrWhiteSpace(Id))
         {
             var ItemModel = BHotspot.GetIntegralModel(Id);
             if (ItemModel != null)
             {
                 HotsPotId = ItemModel.hotspot_id;
                 ItemPrice = ItemModel.price;
                 ProductlName = ItemModel.good_name;
             }
             else
             {
                 MessageBox.ShowAndReturnBack("未找到您要查看的信息");
                 return;
             }
         }
         else
         {
             MessageBox.ShowAndReturnBack("未找到您要查看的信息");
             return;
         }
         string linkman = UserModel.nickname;
         string phone = UserModel.phone;
         string remark = "积分商品兑换";
         int num = 1;
         decimal TotalMoney = num * Convert.ToDecimal(ItemPrice);
         if (TotalMoney > MemberIntegral) {
             MessageBox.ShowAndReturnBack("积分不足,不能兑换商品!");
             return;
         }
         string OrderId = System.Guid.NewGuid().ToString();
         DsorderDTO model = new DsorderDTO();
         model.id = OrderId;
         model.code = DateTime.Now.ToString("yyyyMMddHHmmss");
         model.orderstatus = Convert.ToString((int)订单状态.已支付);
         model.member_id = UserModel.id;
         model.member_name = UserModel.user_name;
         model.linkman = linkman;
         model.customerphone = phone;
         model.totalamount = (float)TotalMoney;
         model.paytype = (int)支付类型.会员积分;
         model.ordertype = (int)订单类型.积分兑换;
         model.orderdate = DateTime.Now;
         model.datasource = Target;
         model.remark = remark;
         model.publishtarget = Target;
         model.is_valid = 1;
         model.create_date = DateTime.Now;
         List<DsorderdetailDTO> orderlist = new List<DsorderdetailDTO>();
         orderlist.Add(new DsorderdetailDTO
         {
             id = System.Guid.NewGuid().ToString(),
             ds_order_id = OrderId,
             productid = HotsPotId,
             productname = ProductlName,
             price = ItemPrice,
             realprice = ItemPrice,
             num = num,
             childrennum = 0,
             amount = (float)TotalMoney,
             realamount = (float)TotalMoney,
             roomtype = Id
         });
         model.Items = orderlist;
         var result = BOrder.AddOrder(model);
         
         if (result)
         {
            //添加积分流水
             //写会员积分
             MbmemberintegralchangeDTO IntegralModel = new MbmemberintegralchangeDTO
             {
                 id = System.Guid.NewGuid().ToString(),
                 billtype = Convert.ToInt32(model.ordertype),
                 objid = OrderId,
                 memberid = UserModel.id,
                 outnum = (float)TotalMoney,
                 absract = "积分兑换,订单编号:" + model.code,
                 year_num = DateTime.Now.Year,
                 create_date = DateTime.Now,
                 currentdate = DateTime.Now
             };
             BMemberIntegral.Add(IntegralModel);
             MessageBox.ShowAndRedirect("兑换成功!", "IntegralShop.aspx");
             return;
         }
         else
         {
             MessageBox.ShowAndReturnBack("兑换失败!");
             return;
         }
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 新增
 /// </summary>
 public static bool AddOrder(DsorderDTO model)
 {
     var result = APIOP<DsorderDTO>.Add(RemoteDomain + "/Dsorder/AddOrder", model);
     return result.flag;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 提交订单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string HotsPotId = Utils.GetQueryStringValue("Hid");
     string Id = Utils.GetQueryStringValue("Id");
     float RoomPrice = 0;
     string HotelName = "";
     var UserModel = LoginCheck();
     if (UserModel == null)
     {
         MessageBox.ShowAndRedirect("用户未登陆,请登陆后下单!", "/Login.aspx");
         return;
     }
     else
     {
         if (!String.IsNullOrWhiteSpace(Id))
         {
             var RoomModel = BHotspot.GetRoomModel(Id);
             if (RoomModel != null)
             {
                 HotsPotId = RoomModel.hotspot_id;
                 RoomPrice = RoomModel.price;
                 var HotelModel = BHotspot.GetHotelModel(HotsPotId);
                 if (HotelModel != null) { HotelName = HotelModel.hotspot_name; }
                 else
                 {
                     MessageBox.ShowAndReturnBack("未找到您要查看的信息");
                     return;
                 }
             }
             else
             {
                 MessageBox.ShowAndReturnBack("未找到您要查看的信息");
                 return;
             }
         }
         else
         {
             MessageBox.ShowAndReturnBack("未找到您要查看的信息");
             return;
         }
         DateTime d1 = Utils.GetDateTime(Utils.GetFormValue("dpd1"));
         DateTime d2 = Utils.GetDateTime(Utils.GetFormValue("dpd2"));
         int CheckInDays = Utils.GetInt(Utils.GetFormValue("dpd3"));
         string linkman = Utils.GetFormValue("linkman");
         string phone = Utils.GetFormValue("phone");
         string address = Utils.GetFormValue("address");
         string remark = Utils.GetFormValue("remark");
         int peo1 = Utils.GetInt(Utils.GetFormValue("peo1"));
         int peo2 = Utils.GetInt(Utils.GetFormValue("peo2"));
         if (String.IsNullOrEmpty(phone))
         {
             MessageBox.ShowAndReturnBack("请填写手机号码!");
             return;
         }
         decimal TotalMoney = peo1 * Convert.ToDecimal(RoomPrice) * CheckInDays;
         string OrderId = System.Guid.NewGuid().ToString();
         DsorderDTO model = new DsorderDTO();
         model.id = OrderId;
         model.code = DateTime.Now.ToString("yyyyMMddHHmmss");
         model.orderstatus = "0";
         model.member_id = UserModel.id;
         model.member_name = UserModel.user_name;
         model.linkman = linkman;
         model.customerphone = phone;
         model.customeraddress = address;
         model.totalamount = (float)TotalMoney;
         model.paytype = 0;
         model.ordertype = (int)订单类型.酒店订单;
         model.orderdate = DateTime.Now;
         model.datasource = Target;
         model.remark = remark;
         model.publishtarget = Target;
         model.is_valid = 1;
         model.create_date = DateTime.Now;
         List<DsorderdetailDTO> orderlist = new List<DsorderdetailDTO>();
         orderlist.Add(new DsorderdetailDTO
         {
             id = System.Guid.NewGuid().ToString(),
             ds_order_id = OrderId,
             productid = HotsPotId,
             productname = HotelName,
             price = RoomPrice,
             realprice = RoomPrice,
             num = peo1,
             childrennum = peo2,
             amount = (float)TotalMoney,
             realamount = (float)TotalMoney,
             roomtype = Id,
             ctime = d1,
             dtime = d2
         });
         model.Items = orderlist;
         var result = BOrder.AddOrder(model);
         if (result)
         {
             //MessageBox.ShowAndRedirect("预定成功!", "travel_hotel_order.aspx?Id=" + OrderId);
             Response.Redirect("travel_hotel_order.aspx?Id=" + OrderId, true);
             return;
         }
         else
         {
             MessageBox.ShowAndReturnBack("订单添加失败!");
             return;
         }
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 提交保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string MemberId = "", UserName = "", LinkName = "", ContactSex = "";
            var LoginModel = LoginCheck();
            if (LoginModel == null)
            {
                MessageBox.ShowAndReturnBack("用户未登陆!");
            }
            else
            {
                MemberId = LoginModel.id;
            }
            var MemberModel = BMember.GetModel(MemberId);
            if (MemberModel != null)
            {
                UserName = MemberModel.user_name;
                LinkName = MemberModel.uname;
                if (MemberModel.sex.HasValue)
                {
                    ContactSex = MemberModel.sex.Value == 0 ? "女" : "男";
                }
            }
            string Id = Utils.GetQueryStringValue("Id");
            //取登记数据
            string PlanTime = Utils.GetFormValue("txtPlanTime");
            string MobilePhone = Utils.GetFormValue("txtMobilePhone");
            string Email = Utils.GetFormValue("txtEmail");
            string Address = Utils.GetFormValue("txtAddress");
            int JoinNumber = Utils.GetInt(Utils.GetFormValue("txtJoinNumber"));
            //份数
            int CountNumber = Utils.GetInt(Utils.GetFormValue("txtFenNumber"));
            int isneedtool = Utils.GetInt(Utils.GetFormValue("dj"));
            string Remark = Utils.GetFormValue("txtRemark");
            //string Remark = "";
            string[] arrName = Utils.GetFormValues("txtAName");
            string[] arrSex = Utils.GetFormValues("txtASex");
            string[] arrIdCard = Utils.GetFormValues("txtAIdCard");
            string[] arrPhone = Utils.GetFormValues("txtAMobile");
            if (arrName.Length < 1)
            {
                MessageBox.ShowAndReturnBack("请填写报名人信息!");
                return;
            }
            for (int j = 0; j < arrName.Length; j++)
            {
                if (j == 0)
                {
                    if (String.IsNullOrWhiteSpace(arrName[j]) || String.IsNullOrWhiteSpace(arrSex[j]) || String.IsNullOrWhiteSpace(arrIdCard[j]) || String.IsNullOrWhiteSpace(arrPhone[j]))
                    {
                        MessageBox.ShowAndReturnBack("第一个报名信息必须录入完整!");
                        return;
                    }
                }
                else
                {
                    if (!String.IsNullOrWhiteSpace(arrName[j]))
                    {
                        if (String.IsNullOrWhiteSpace(arrIdCard[j]))
                        {
                            MessageBox.ShowAndReturnBack("第" + (j + 1) + "个报名信息请录入姓名和证件号码!");
                            return;
                        }
                    }
                }
            }
            int TotalRows = 0, TotalPeoNumber = 0;
            PageInfo pi = new PageInfo();
            pi.PageIndex = 1;
            pi.PageSize = int.MaxValue;
            pi.AddCondition<ViewOrderDTO>(o => o.ordertype, (int)订单类型.活动, QueryMethod.Equal);
            pi.AddCondition<ViewOrderDTO>(o => o.productid, Id, QueryMethod.Equal);
            pi.AddCondition<ViewOrderDTO>(o => o.is_delete, 0, QueryMethod.Equal);
            var Tlist = BOrder.GetViewList(pi, ref TotalRows);
            int TotalCount = 1;
            if (Tlist != null && Tlist.Count() > 0)
            {
                foreach (var m in Tlist)
                {
                    TotalPeoNumber += m.num;
                    TotalCount += m.childrennum;
                }
            }
            TotalCount = TotalCount + CountNumber;
            #region 写订单结构
            var Amodel = BActivities.GetModel(Id);
            if (Amodel != null)
            {
                if (Amodel.allowjointimelimit <= TotalCount)
                {
                    MessageBox.ShowAndReturnBack("报名份数超过最大可报名份数!");
                    return;
                }
                float TotalMoney = Amodel.price * CountNumber;
                string orderstatus = Convert.ToString((int)订单状态.待支付);
                if (TotalMoney == 0)
                    orderstatus = Convert.ToString((int)订单状态.已支付);
                string OrderId = System.Guid.NewGuid().ToString();
                DsorderDTO model = new DsorderDTO();
                model.id = OrderId;
                model.code = DateTime.Now.ToString("yyyyMMddHHmmss");
                model.orderstatus = orderstatus;
                model.member_id = MemberId;
                model.member_name = UserName;
                model.linkman = LinkName;
                model.customerphone = MobilePhone;
                model.customeraddress = Address;
                model.totalamount = TotalMoney;
                model.paytype = (int)支付类型.支付宝;
                model.ordertype = (int)订单类型.活动;
                model.orderdate = DateTime.Now;
                model.datasource = Target;
                model.remark = Remark;
                model.publishtarget = Target;
                model.is_valid = 1;
                model.create_date = DateTime.Now;
                List<DsorderdetailDTO> orderlist = new List<DsorderdetailDTO>();
                orderlist.Add(new DsorderdetailDTO
                {
                    id = System.Guid.NewGuid().ToString(),
                    ds_order_id = OrderId,
                    productid = Id,
                    productname = Amodel.act_name,
                    price = Amodel.price,
                    realprice = Amodel.price,
                    num = JoinNumber,
                    childrennum = CountNumber,
                    amount = (float)TotalMoney,
                    realamount = (float)TotalMoney,
                    roomtype = Id
                });
                model.Items = orderlist;
                List<Dsorderactivitiyperson> ActList = new List<Dsorderactivitiyperson>();
                for (int i = 0; i < arrName.Length; i++)
                {

                    ActList.Add(new Dsorderactivitiyperson
                    {
                        id = System.Guid.NewGuid().ToString(),
                        ds_order_id = OrderId,
                        name = arrName[i],
                        sex = arrSex[i],
                        idcard = arrIdCard[i],
                        phone = arrPhone[i]
                    });
                }
                model.Items2 = ActList;
                var result = BOrder.AddOrder(model);
                if (result)
                {
                    //if (TotalMoney > 0)
                    //MessageBox.ResponseScript("window.open(\"/AliPay/AliTradeTourOrder.aspx?OrderId=" + OrderId + "&OrderType=" + (int)订单类型.活动 + "&Pay=alipay\")");
                    //MessageBox.ResponseScript("window.open('/Alipay/default.aspx?OrderId=" + OrderId + "');alert('报名成功!');window.location.href='bandao-huodong.aspx';");
                    //MessageBox.ShowAndRedirect("报名成功!", "bandao-huodong.aspx");
                    MessageBox.ShowAndRedirect("报名成功!\\n进入订单中心进行支付。", "user-dd2.aspx?Type=" + (int)订单类型.活动);
                    return;
                }
                else
                {
                    MessageBox.ShowAndReturnBack("订单添加失败!");
                    return;
                }
            }
            else
            {
                MessageBox.ShowAndReturnBack("未找到报名的活动!");
                return;
            }
            #endregion
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 参与活动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnJoin_Click(object sender, EventArgs e)
        {
            string MemberId = "",UserName = "",LinkName = "",ContactTel = "",ContactSex="男";
            var LoginModel = LoginCheck();
            if (LoginModel == null)
            {
                UserName = Utils.GetFormValue("username");
                string Password = Utils.GetFormValue("userpwd");
                if (string.IsNullOrWhiteSpace(UserName) || string.IsNullOrWhiteSpace(Password))
                {
                    MessageBox.ShowAndReturnBack("请输入用户名和密码!");
                    return;
                }
                var result = BMember.Login(UserName, Password);
                if (result != null)
                {
                    HttpCookie Hc = new HttpCookie(_AuthorName);
                    Hc.Values.Add("Id", result.id);
                    Hc.Values.Add("UserName", result.user_name);
                    Hc.Values.Add("nickname", result.nickname);
                    HttpContext.Current.Response.Cookies.Add(Hc);
                    MemberId = result.id;
                }
                else
                {
                    MessageBox.ShowAndReturnBack("用户名或密码不正确!");
                    return;
                }
            }
            else {
                MemberId = LoginModel.id;
            }
            var MemberModel = BMember.GetModel(MemberId);
            if (MemberModel != null)
            {
                UserName = MemberModel.user_name;
                LinkName = MemberModel.uname;
                if(MemberModel.sex.HasValue){
                    ContactSex = MemberModel.sex.Value==0?"女":"男";
                }
            }
            string Id = Utils.GetQueryStringValue("Id");
            //取登记数据
            string PlanTime = Utils.GetFormValue("txtPlanTime");
            string MobilePhone = Utils.GetFormValue("txtMobilePhone");
            string Email = Utils.GetFormValue("txtEmail");
            string Address = Utils.GetFormValue("txtAddress");
            //人数
            int JoinNumber = Utils.GetInt(Utils.GetFormValue("txtJoinNumber"));
            //份数
            int CountNumber = Utils.GetInt(Utils.GetFormValue("txtFenNumber"));
            int isneedtool = Utils.GetInt(Utils.GetFormValue("dj"));
            string Remark = Utils.GetFormValue("txtRemark");
            string[] arrName = Utils.GetFormValues("txtAName");
            string[] arrSex = Utils.GetFormValues("txtASex");
            string[] arrIdCard = Utils.GetFormValues("txtAIdCard");
            string[] arrPhone = Utils.GetFormValues("txtAMobile");
            if (arrName.Length < 1) {
                MessageBox.ShowAndReturnBack("请填写报名人信息!");
                return;
            }
            for (int j = 0; j < arrName.Length; j++) {
                if (j == 0) {
                    if (String.IsNullOrWhiteSpace(arrName[j]) || String.IsNullOrWhiteSpace(arrSex[j]) || String.IsNullOrWhiteSpace(arrIdCard[j]) || String.IsNullOrWhiteSpace(arrPhone[j])) {
                        MessageBox.ShowAndReturnBack("第一个报名信息必须录入完整!");
                        return;
                    }
                } else {
                    if (!String.IsNullOrWhiteSpace(arrName[j]))
                    {
                        if (String.IsNullOrWhiteSpace(arrIdCard[j]))
                        {
                            MessageBox.ShowAndReturnBack("第" + (j + 1) + "个报名信息请录入姓名和证件号码!");
                            return;
                        }
                    }
                }
            }
            int TotalRows = 0,TotalPeoNumber = 0;
                    PageInfo pi = new PageInfo();
                    pi.PageIndex = 1;
                    pi.PageSize = int.MaxValue;
                    pi.AddCondition<ViewOrderDTO>(o => o.ordertype, (int)订单类型.活动, QueryMethod.Equal);
                    pi.AddCondition<ViewOrderDTO>(o => o.productid, Id, QueryMethod.Equal);
                    pi.AddCondition<ViewOrderDTO>(o => o.is_delete, 0, QueryMethod.Equal);
                    var Tlist = BOrder.GetViewList(pi, ref TotalRows);
                    int TotalCount = 1;
                    if (Tlist!=null && Tlist.Count() > 0)
                    {
                        foreach (var m in Tlist)
                        {
                            TotalPeoNumber += m.num;
                            TotalCount += m.childrennum;
                        }
                    }
                    TotalCount = TotalCount + CountNumber;
            #region 写订单结构
             var Amodel = BActivities.GetModel(Id);
             if (Amodel != null)
             {
                 if (Amodel.allowjointimelimit <= TotalCount) {
                     MessageBox.ShowAndReturnBack("报名份数超过最大可报名份数!");
                     return;
                 }
                 float TotalMoney = Amodel.price * CountNumber;
                 string orderstatus = Convert.ToString((int)订单状态.待支付);
                 if(TotalMoney==0)
                     orderstatus = Convert.ToString((int)订单状态.已支付);
                 string OrderId = System.Guid.NewGuid().ToString();
                 DsorderDTO model = new DsorderDTO();
                 model.id = OrderId;
                 model.code = DateTime.Now.ToString("yyyyMMddHHmmss");
                 model.orderstatus = orderstatus;
                 model.member_id = MemberId;
                 model.member_name = UserName;
                 model.linkman = LinkName;
                 model.customerphone = MobilePhone;
                 model.customeraddress = Address;
                 model.totalamount = TotalMoney;
                 model.paytype = (int)支付类型.支付宝;
                 model.ordertype = (int)订单类型.活动;
                 model.orderdate = DateTime.Now;
                 model.datasource = Target;
                 model.remark = Remark;
                 model.publishtarget = Target;
                 model.is_valid = 1;
                 model.create_date = DateTime.Now;
                 List<DsorderdetailDTO> orderlist = new List<DsorderdetailDTO>();
                 orderlist.Add(new DsorderdetailDTO
                 {
                     id = System.Guid.NewGuid().ToString(),
                     ds_order_id = OrderId,
                     productid = Id,
                     productname = Amodel.act_name,
                     price = Amodel.price,
                     realprice = Amodel.price,
                     num = JoinNumber,
                     childrennum = CountNumber,
                     amount = (float)TotalMoney,
                     realamount = (float)TotalMoney,
                     roomtype = Id
                 });
                 model.Items = orderlist;                          
                 List<Dsorderactivitiyperson> ActList = new List<Dsorderactivitiyperson>();
                 for (int i = 0; i < arrName.Length; i++)
                 {

                     ActList.Add(new Dsorderactivitiyperson
                     {
                         id = System.Guid.NewGuid().ToString(),
                         ds_order_id = OrderId,
                         name = arrName[i],
                         sex = arrSex[i],
                         idcard = arrIdCard[i],
                         phone = arrPhone[i]
                     });
                 }
                 model.Items2 = ActList;
                 var result = BOrder.AddOrder(model);
                 if (result)
                 {
                     MessageBox.ShowAndRedirect("报名成功!", "../member/member_order_list.aspx?Type="+(int)订单类型.活动);
                     return;
                 }
                 else
                 {
                     MessageBox.ShowAndReturnBack("订单添加失败!");
                     return;
                 }
             }
             else {
                 MessageBox.ShowAndReturnBack("未找到报名的活动!");
                 return;
             }
            #endregion
            /*
            var Result = BMyActivities.Add(new MbmyactivitiesDTO{
            id=System.Guid.NewGuid().ToString(),
            memberid = MemberId,
            activitiesid = Id,
                //PlanTime = PlanTime,
            moblie = MobilePhone,
            email = Email,
            comm_address = Address,
            joinnum = JoinNumber,
            isneedtool = isneedtool,
            memo = Remark,
            datasource = Target
            });
            if (Result)
            {
                MessageBox.ShowAndRedirect("报名成功!", "news_event.aspx");
                return;
            }
            else
            {
                MessageBox.ShowAndReturnBack("报名失败!");
                return;
            }
             * */
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 保存订单
 /// </summary>
 private void SaveOrder(bool IsPay)
 {
     float PPrice = 0, CPrice = 0;
     string Id = Utils.GetFormValue("hidId");
     string ProductName = "";
     var Pmodel = BTravelline.GetModel(Id);
     if (Pmodel != null)
     {
         ProductName = Pmodel.title;
         PPrice = Pmodel.adultprice;
         CPrice = Pmodel.childprice;
     }
     else
     {
         MessageBox.ShowAndReturnBack("未找到您要预定的线路");
         return;
     }
     string UserName = "";
     string MemberId = "";
     int pnum = Utils.GetInt(Utils.GetFormValue("num"));
     int cnum = Utils.GetInt(Utils.GetFormValue("num2"));
     string name = Utils.GetFormValue("bookName");
     string time = Utils.GetFormValue("time");
     string remark = Utils.GetFormValue("remark");
     string contact = Utils.GetFormValue("contact");
     var UserModel = LoginCheck();
     if (UserModel != null) { MemberId = UserModel.id; UserName = UserModel.user_name; }
     float TotalMoney = pnum * PPrice + cnum * CPrice;
     string OrderId = System.Guid.NewGuid().ToString();
     DsorderDTO model = new DsorderDTO();
     model.id = OrderId;
     model.code = DateTime.Now.ToString("yyyyMMddHHmmss");
     model.orderstatus = "1";
     model.member_id = MemberId;
     model.member_name = UserName;
     model.linkman = name;
     model.customerphone = contact;
     model.totalamount = TotalMoney;
     model.paytype = 0;
     model.ordertype = (int)订单类型.线路;
     model.totalquantity = pnum + cnum;
     model.plandate = time;
     //model.orderdate = time;
     model.datasource = Target;
     model.remark = remark;
     model.publishtarget = Target;
     model.is_valid = 1;
     model.create_date = DateTime.Now;
     List<DsorderdetailDTO> orderlist = new List<DsorderdetailDTO>();
     orderlist.Add(new DsorderdetailDTO
     {
         id = System.Guid.NewGuid().ToString(),
         ds_order_id = OrderId,
         productid = Id,
         productname = ProductName,
         price = 0,
         realprice = 0,
         num = pnum,
         childrennum = cnum,
         amount = TotalMoney,
         realamount = TotalMoney,
         roomtype = Id
     });
     model.Items = orderlist;
     var result = BOrder.AddOrder(model);
     if (result)
     {
         if (IsPay)
         {
             MessageBox.ResponseScript("window.open(\"/AliPay/AliTradeTourOrder.aspx?OrderId=" + Id + "&OrderType=" + model.ordertype + "&Pay=alipay\")");
             MessageBox.ShowAndRedirect("预定成功!", "trip_line.aspx");
             return;
         }
         else
         {
             MessageBox.ShowAndRedirect("预定成功!", "trip_line.aspx");
             return;
         }
     }
     else
     {
         MessageBox.ShowAndReturnBack("预定失败!");
         return;
     }
 }