Esempio n. 1
0
        public Order BuildOrderForQZ(TourMembership member, string assignName, string idcardno, Ticket currentTicket, int amount, string parnterName)
        {
            #region 开始出票
            //1 为身份证号创建一个用户名

            TicketAssign ta = new TicketAssign();
            ta.IdCard = idcardno;
            ta.IsUsed = false;
            ta.Name = assignName;

            OrderDetail orderdetail = new OrderDetail();
            orderdetail.Quantity = amount;
            orderdetail.Remark = "衢州新春门票派送活动自动创建订单,请票来源:" + parnterName;
            orderdetail.TicketAssignList.Add(ta);

            TicketPrice ticketPrice = currentTicket.GetTicketPrice(PriceType.PayOnline);
            orderdetail.TicketPrice = ticketPrice;

            Order order = new Order();
            order.BuyTime = DateTime.Now;
            order.IsPaid = true;
            order.TourMembership = member;
            order.OrderDetail.Add(orderdetail);
            order.PayTime = DateTime.Now;
            order.PriceType = PriceType.PayOnline;
            order.PayTime = DateTime.Now;
            order.TradeNo = "QZFREE";

            return order;

            #endregion
        }
Esempio n. 2
0
    private void bind()
    {
        if (!string.IsNullOrEmpty(Pageurl))
            LoginStatus1.LogoutPageUrl = Pageurl;
        MembershipUser mu = Membership.GetUser();
        BLLDJ_User blldj_user = new BLLDJ_User();
        Model.TourMembership tm = new Model.TourMembership();
        if (mu != null)
        {
            tm = new BLLMembership().GetMemberById((Guid)mu.ProviderUserKey);
            if (tm is DJ_User_TourEnterprise)
            {
                laETName.Text = (tm as DJ_User_TourEnterprise).Enterprise.Name;
                MasterCss.Href = "/theme/default/css/MasterPage.css";
            }
            if (tm is DJ_User_Gov)
            {
                laETName.Text = (tm as DJ_User_Gov).GovDpt.Name;
                MasterCss.Href = "/theme/default/css/MasterPage2.css";
            }
        }
        else
        {

        }
    }
Esempio n. 3
0
    public static string RedirectForUser(TourMembership member)
    {
        string redirectUrl = string.Empty;
        Type UserType = member.GetType();

        if (UserType == typeof(DJ_User_Gov))
        {
            redirectUrl = "/TourManagerDpt/";
        }
        else if (UserType == typeof(DJ_User_TourEnterprise))
        {
            DJ_User_TourEnterprise entUser = (DJ_User_TourEnterprise)member;
            if (entUser == null)
            { throw new Exception("企业管理员没有对应的企业" ); }
            DJ_TourEnterprise ent = entUser.Enterprise;
            if (ent.Type == EnterpriseType.旅行社)
            {
                redirectUrl = "/LocalTravelAgent/";
            }
            else
            {
                redirectUrl = "/TourEnterprise/";
            }

        }
        else if (member.Name == "admin")
        {
            redirectUrl = "/admin/";
        }
        return redirectUrl;
    }
Esempio n. 4
0
 protected override void OnLoad(EventArgs e)
 {
     CurrentUser = Membership.GetUser();
     if (CurrentUser != null)
     {
         CurrentMember = bllMember.GetMemberById((Guid)CurrentUser.ProviderUserKey);
     }
     base.OnLoad(e);
 }
Esempio n. 5
0
 private void bind()
 {
     MembershipUser mu = Membership.GetUser();
     BLLDJ_User blldj_user = new BLLDJ_User();
     Model.TourMembership tm = new Model.TourMembership();
     if (mu != null)
     {
         tm = new BLLMembership().GetMemberById((Guid)mu.ProviderUserKey);
         if (tm is DJ_User_TourEnterprise)
         {
             dptid = (tm as DJ_User_TourEnterprise).Enterprise.Id.ToString();
             //laETName.Text = (tm as DJ_User_TourEnterprise).Enterprise.Name;
         }
         if (tm is DJ_User_Gov)
         {
             dptid = (tm as DJ_User_Gov).GovDpt.Id.ToString();
             int perType=(int)(tm as DJ_User_Gov).PermissionType;
             if (perType == 1 || perType == 3 || perType == 5 || perType == 7)
             {
                 li_1.Visible = true;
                 li_2.Visible = true;
             }
             else
             {
                 li_1.Visible = false;
                 li_2.Visible = false;
             }
             if (perType == 2 || perType == 3 || perType == 6 || perType == 7)
             {
                 li_3.Visible = true;
             }
             else
             {
                 li_3.Visible = false;
             }
             if (perType == 4 || perType == 5 || perType == 6 || perType == 7)
             {
                 li_4.Visible = true;
             }
             else
             {
                 li_4.Visible = false;
             }
         }
     }
     else
     {
         Response.Redirect("/Login.aspx");
     }
     (Master.FindControl("changepwd") as HtmlAnchor).HRef = "/TourManagerDpt/ChangePwd.aspx";
     (Master.FindControl("changedetails") as HtmlAnchor).HRef = "/TourManagerDpt/ChangeDetails.aspx?dptId=" + dptid;
 }
Esempio n. 6
0
        public void BuildOrderForQZTest()
        {
            BLL.BLLQZTicketSeller seller = new BLLQZTicketSeller();

            TourMembership member = new TourMembership();
            member.IdCard = "idcard";

            Ticket currentTicket = new TicketNormal();
            TicketPrice tp = new TicketPrice();
            tp.Price = 1;
            tp.PriceType = PriceType.PreOrder;
            tp.Ticket = currentTicket;
            currentTicket.TicketPrice.Add(tp);
            Model.Order order = seller.BuildOrderForQZ(member,"yuanfei","",currentTicket, 1, "浙江旅游信息中心网站");

            Assert.AreEqual(order.TotalPrice, 1);
        }
Esempio n. 7
0
    protected override void OnLoad(EventArgs e)
    {
        MembershipUser CurrentUser = Membership.GetUser();
         if (CurrentUser != null)
         {
             CurrentMember = bllMember.GetMemberById((Guid)CurrentUser.ProviderUserKey);
         }
         else
         {
             HttpCookie cookie = new HttpCookie("ru", Server.UrlEncode(Request.RawUrl));

             cookie.Expires = DateTime.Now.AddMinutes(5);
             Response.Cookies.Add(cookie);
             Response.Redirect("/account/login.aspx");
         }
        base.OnLoad(e);
    }
Esempio n. 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string paramUserId = Request["userid"];
     if (!Guid.TryParse(paramUserId, out userId))
     {
         BLL.ErrHandler.Redirect(BLL.ErrType.ParamIllegal);
     }
     User = bllMembership.GetMemberById(userId);
     if (User == null)
     {
         BLL.ErrHandler.Redirect(BLL.ErrType.ParamIllegal);
     }
     if (!IsPostBack)
     {
         BindScenic();
     }
 }
Esempio n. 9
0
        /// <summary>
        /// 获取选票
        /// </summary>
        //[Test]
        public void EarnVotes()
        {
            long votesAmount1 = dalUserVoteAmount.GetTotalAmount(memberId);
            TourMembership u = new TourMembership();
            u.Id = memberId;

            //1 赢得选票
            UserVoteAmount uservote = new UserVoteAmount();
            uservote.Amount = 4;
            uservote.EarnDate = DateTime.Now;
            uservote.EarnWay = EarnWay.BuyDigitalCard;
            uservote.User = u;
            dalUserVoteAmount.EarnVote(uservote);

            //2 获得总票数
            long votesAmount2 = dalUserVoteAmount.GetTotalAmount(memberId);
            Assert.AreEqual(votesAmount1 + 4, votesAmount2);
        }
Esempio n. 10
0
 /// <summary>
 /// 申请开通某个功能
 /// </summary>
 /// <param name="scenic"></param>
 /// <param name="module"></param>
 public void Apply(Scenic scenic, TourMembership applier, ScenicModule module)
 {
     ScenicCheckProgress scp = new ScenicCheckProgress();
     var cplist = scenic.CheckProgress.ToList();
     if (cplist.Count != 0)
     {
         foreach (ScenicCheckProgress item in cplist)
         {
             if (item.Module == module)
             {
                 scp = item;
                 continue;
             }
         }
     }
     scp.Applier = applier;
     scp.CheckStatus = CheckStatus.Applied;
     scp.CheckTime = DateTime.Now;
     scp.Module = module;
     scp.Scenic = scenic;
     IScenic.SaveCheckProgress(scp);
 }
Esempio n. 11
0
 /// <summary>
 /// 批准某个功能的申请.
 /// </summary>
 /// <param name="scenic"></param>
 /// <param name="checker"></param>
 /// <param name="module"></param>
 public void ChangeCheckStatus(Scenic scenic, TourMembership checker, ScenicModule module, CheckStatus cs)
 {
     ScenicCheckProgress scp = GetStatus(scenic.Id, module);
     if (scp.CheckStatus != CheckStatus.Applied)
     {
         ErrHandler.Redirect(ErrType.UnknownError,"187行");
     }
     scp.CheckStatus = cs;
     IScenic.SaveCheckProgress(scp);
     if (module == ScenicModule.SellOnLine)
     {
         IList<Ticket> tickets = ITicket.GetTicketByscId(scenic.Id);
         foreach (var item in tickets)
         {
             item.Lock = false;
         }
         ITicket.SaveOrUpdateTicket(tickets);
     }
 }
Esempio n. 12
0
        public string buyProduct(bool needValidation, string activityCode, TourMembership member
            , string PartnerCode, string CardNumber, string RealName, string Phone, string ticketCode, int Number, DateTime buyTime,bool IsUsedAdo)
        {
            Guid requestGUID = Guid.NewGuid();
            TourLog.ErrorLog.Debug(string.Format("*********Begin********{5}出票请求:{6}_{0}_{1}_{2}_{3}_{4}", PartnerCode, CardNumber, ticketCode, Number, Phone, requestGUID, activityCode));
            string returnMsg = "T";
            TourActivity activity = bllActivity.GetOneByActivityCode(activityCode);//get from activitycode
            ActivityPartner currentPartner = activity.Partners.Where(x => x.PartnerCode == PartnerCode).First();//get from partnercode and actrivityCode

            string connString = System.Configuration.ConfigurationManager.ConnectionStrings["TourOnline"].ConnectionString;
            DAL.ado.NativeSqlUtiliity nativeSql = new DAL.ado.NativeSqlUtiliity(connString);

            if (IsUsedAdo)//如果使用存储过程)
            {
                nativeSql.ExecuteDataSetProc("usp_TicketRequest", new string[] {
                    CardNumber,RealName,Phone,activity.Id.ToString(),  currentPartner.Id.ToString(),ticketCode,"1",""
                    }, out returnMsg);
            }
            TourLog.ErrorLog.Info(returnMsg);
            TourLog.ErrorLog.Info(requestGUID + "*********END********" + requestGUID);
            return returnMsg;
        }
Esempio n. 13
0
 public void updateinfo(TourMembership tm)
 {
     dal.ChangeInfo(tm);
 }
Esempio n. 14
0
 public TourMembership CreateUser2(string realname, string phone, string address, string idcard,
    string loginname, string password, string email)
 {
     string encryptedPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
     Model.TourMembership user = new Model.TourMembership()
     {
         RealName = realname,
         Phone = phone,
         Address = address,
         IdCard = idcard,
         Name = loginname,
         Password = encryptedPwd,
         Email = email,
         RegistDate=DateTime.Now,
         loginCount=1,
         lastLogin=DateTime.Now
     };
     CreateUpdateMember(user);
     return user;
 }
Esempio n. 15
0
 public BLLRefund(TourMembership member,string  orderid)
 {
     this.Member = member;
     this.OrderIdstring = orderid;
 }
Esempio n. 16
0
        /// <summary>
        /// 重载基方法.
        /// </summary>
        /// <param name="ismedia"></param>
        /// <param name="clientFriendlyId"></param>
        /// <param name="member"></param>
        /// <param name="assignName"></param>
        /// <param name="idcardno"></param>
        /// <param name="phone"></param>
        /// <param name="ticketCode"></param>
        /// <param name="amount"></param>
        /// <returns></returns>
        public string SellTicket(bool ismedia, string clientFriendlyId, TourMembership member, string assignName, string idcardno, string phone, string ticketCode, int amount)
        {
            amount = 1;
            int nowHour = DateTime.Now.Hour;
            if (!ismedia)
            {
                if (nowHour < 10)
                {
                    return "F|亲,十点以后才可以抢票哦~";
                }

            }
            string returnMsg = "T";
            //身份证号码验证
            string checkIdCardNoErrMsg;
            bool idcardnoValid = CommonLibrary.StringHelper.CheckIDCard(idcardno, out checkIdCardNoErrMsg);
            if (!idcardnoValid)
            {
                return "F|" + checkIdCardNoErrMsg;
            }
            DateTime nowDay = DateTime.Now.Date;
            //获取当天合作商某景区的门票分配情况
            QZPartnerTicketAsign partnerAsign = bllQZPartnerTicketAsign.GetOne(nowDay, clientFriendlyId, ticketCode);//todo: 获取 某日期 某个门票 的票数分配情况
            if (partnerAsign == null)
            {
                return "F|没有查到对应的门票";
            }
            Guid requestGUID = Guid.NewGuid();
            TourLog.ErrorLog.Info(string.Format("*********Begin********{5}出票请求:{0}_{1}_{2}_{3}_{4}", clientFriendlyId, idcardno, ticketCode, amount, phone, requestGUID));
            string validErrMsg;
            ///规则验证
            bool isValid = ValidateRequst(ismedia, partnerAsign, amount, idcardno, ticketCode, out validErrMsg);
            if (!isValid)
            {
                return "F|" + validErrMsg;
            }
            if (member == null)
            {
                member = bllMembership.GetMember(idcardno);

                if (member == null)
                {
                    //创建用户
                    member = bllMembership.CreateUser2("衢州门票派送参与者", phone, string.Empty, idcardno, idcardno, "123456", string.Empty);
                }
            }
            //自动创建订单
            Ticket currentTicket =  bllTicket.GetByProductCode(ticketCode);
            string partnername = partnerAsign.Partner.Name;
            //将媒体设置成合作者,
            //if (ismedia)
            //{
            //    partnerAsign.Partner.Name = "媒体";
            //}
            Order order = BuildOrderForQZ(member, assignName, idcardno, currentTicket, amount, partnername);
            bllOrder.SaveOrUpdateOrder(order);

            //3 该接入商该景区的已售门票+1
            //if (!ismedia)
            //{
            partnerAsign.SoldAmount += amount;
            // }
            bllQZPartnerTicketAsign.SaveOrUpdate(partnerAsign);
            TourLog.ErrorLog.Info(returnMsg);
            TourLog.ErrorLog.Info(requestGUID + "*********END********");
            return returnMsg;
        }
Esempio n. 17
0
 public string buyProduct(string activityCode, TourMembership member
     , string PartnerCode, string CardNumber, string RealName, string Phone, string ticketCode, int Number)
 {
     return  buyProduct(true, activityCode, member, PartnerCode,
         CardNumber, RealName, Phone, ticketCode, Number,DateTime.Now.Date);
 }
Esempio n. 18
0
 public void CreateUpdateMember(TourMembership member)
 {
     dal.CreateUpdateMember(member);
 }
Esempio n. 19
0
        /// <summary>
        /// 合作伙伴请求门票
        /// </summary>
        /// <param name="activityCode">活动代码</param>
        /// <param name="needValidatePerDay">是否每天验证</param>
        /// <param name="needCheckTime">是否限制购买时间</param>
        /// <param name="PartnerCode"></param>
        /// <param name="CardNumber"></param>
        /// <param name="RealName"></param>
        /// <param name="Phone"></param>
        /// <param name="ticketCodes"></param>
        /// <param name="Number"></param>
        /// <returns></returns>
        public string buyProduct(bool needValidation, string activityCode, TourMembership member
            , string PartnerCode, string CardNumber, string RealName, string Phone, string ticketCode, int Number,DateTime buyTime)
        {
            Guid requestGUID = Guid.NewGuid();
            TourLog.ErrorLog.Debug(string.Format("*********Begin********{5}出票请求:{6}_{0}_{1}_{2}_{3}_{4}", PartnerCode, CardNumber, ticketCode, Number, Phone, requestGUID,activityCode));
            string returnMsg = "T";
            TourActivity activity = bllActivity.GetOneByActivityCode(activityCode);//get from activitycode
            ActivityPartner currentPartner = activity.Partners.Where(x => x.PartnerCode == PartnerCode).First();//get from partnercode and actrivityCode

            string connString=System.Configuration.ConfigurationManager.ConnectionStrings["TourOnline"].ConnectionString;
            DAL.ado.NativeSqlUtiliity nativeSql = new DAL.ado.NativeSqlUtiliity(connString);

            if (false)//如果使用存储过程)
            {
                nativeSql.ExecuteDataSetProc("usp_TicketRequest", new string[] {
                    CardNumber,RealName,Phone,activity.Id.ToString(),  currentPartner.Id.ToString(),ticketCode,"1",""
                    }, out returnMsg);
            }

               //todo

            // 下单前的验证 与用户无关
            int nowHour = DateTime.Now.Hour;
            string checkErrMsg;

                if (needValidation&& !activity.CheckBeforeOrder(currentPartner,ticketCode,Number, out checkErrMsg))
                {
                    returnMsg = string.Format("F|{0}", checkErrMsg);
                    goto LblReturn;
                }
            ///身份证号码格式验证
            string checkIdCardNoErrMsg;
            bool idcardnoValid = CommonLibrary.StringHelper.CheckIDCard(CardNumber, out checkIdCardNoErrMsg);
            if (!idcardnoValid)
            {
                returnMsg = "F|" + checkIdCardNoErrMsg;
                goto LblReturn;
            }

            if (string.IsNullOrEmpty(RealName))
            {
                RealName = activity.Name + "参与者";
            }
            ///开始生成订单,订单详情,门票分配
            //创建用户
            if (member == null)
            {
                member = bllMembership.GetMember(CardNumber);

                if (member == null)
                {
                    //创建用户
                    member = bllMembership.CreateUser2(RealName, Phone, string.Empty, CardNumber, CardNumber, "123456", string.Empty);
                }
            }
            ////自动创建订单(如果是联票, 则要为联票门票创建三个订单

            string createOrderErrMsg;

            Ticket ticket = bllTicket.GetByProductCode(ticketCode);

            bllOrder.CreateOrder( PartnerCode, member, ticket, CardNumber, RealName, Number,PriceType.PreOrder,buyTime, out createOrderErrMsg);
            if (!string.IsNullOrEmpty(createOrderErrMsg))
            {
                returnMsg = "F|"+createOrderErrMsg;
                goto LblReturn;
            }

            ////3 该接入商该景区的已售门票+1

                //ticketAssign.SoldAmount += Number;
                //bllActivityTicketAssign.SaveOrUpdate(ticketAssign);

            LblReturn:
            TourLog.ErrorLog.Info(returnMsg);
            TourLog.ErrorLog.Info(requestGUID + "*********END********" + requestGUID);
            return returnMsg;
        }
Esempio n. 20
0
 /// <summary>
 /// 创建第三方登录普通用户
 /// </summary>
 /// <param name="nickname"></param>
 /// <param name="openid"></param>
 /// <param name="opentype"></param>
 public void CreateUser(string nickname, string openid, Model.Opentype opentype)
 {
     string encryptedPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(
         new Random().Next(100000, 999999999).ToString(), "MD5");
     TourMembership tm = GetMember(nickname);
     while (tm != null)
     {
         nickname += nickname + "0";
         tm = GetMember(nickname);
     }
     Model.TourMembership user = new Model.TourMembership()
     {
         RealName = "",
         Phone = "",
         Address = "",
         IdCard = "",
         Name = nickname,
         Password = encryptedPwd,
         Openid = openid,
         Opentype = opentype
     };
     CreateUpdateMember(user);
 }