コード例 #1
0
ファイル: Order.aspx.cs プロジェクト: syunie/.NETandCloud
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string realName = tbRealName.Text.Trim();
        string phone    = tbPhone.Text.Trim();
        int    buyNum   = ddlBuyNum.SelectedValue.ToArrowInt();

        if (realName.ValidateIsNullOrEmpty("请输入联系人姓名!"))
        {
            return;
        }
        if (phone.ValidateIsNullOrEmpty("请输入联系电话!"))
        {
            return;
        }
        if ((buyNum == 0).ValidateSuccess("购买团位总数必须大于0"))
        {
            return;
        }

        SiteUserInfo ui              = SiteUserBLL.SelectUserByInviteNum(CurrentMember.InviteNum);
        string       inviteNum       = ui == null ? "0001" : ui.InviteNum;
        string       inviterRealName = ui == null ? "超级管理员" : ui.RealName;
        string       inviterUserName = ui == null ? "admin" : ui.Name;

        TravelOrderInfo model = new TravelOrderInfo();

        model.AddMemberMobile   = phone;
        model.AddMemberName     = CurrentMember.UserName;
        model.AddMemberRealName = realName;
        model.AddMemberRemarks  = "";
        model.AddTime           = DateTime.Now;
        model.BuyNum            = buyNum;
        model.CompanyRemarks    = "";
        model.InviteNum         = CurrentMember.InviteNum;
        model.InviterRealName   = inviterRealName;
        model.InviterUserName   = inviterUserName;
        model.MoneyPayed        = 0M;
        model.MoneyReturn       = 0M;
        model.OperatorRealName  = "";
        model.OperatorUserName  = "";
        model.OrderNum          = OrderNumFactory.NextNum();
        model.OrderStatus       = OrderStatus.Submited;
        model.OrderType         = "";
        model.PromotionID       = MyPromotion == null ? 0 : MyPromotion.ID;
        model.GroupID           = MyGroup.ID;
        model.LineID            = MyLine.ID;
        model.TotalMoney        = ltTotal.Text.ToArrowDecimal();
        model.CanChangeNum      = 1;
        model.OrderHistory      = "提交订单|";
        if (MyPromotion != null && MyPromotion.PromotionType == PromotionType.Bundle)
        {
            model.CanChangeNum = 0;
        }

        string msg     = "";
        bool   success = false;

        using (DbConnection conn = Db.Helper.CreateConnection())
        {
            conn.ConnectionString = Db.Helper.ConnectionString;
            conn.Open();
            using (DbTransaction tran = conn.BeginTransaction())
            {
                try
                {
                    OrderBLL.FastAddOrder(model, tran);
                    tran.Commit();
                    success = true;
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    msg = ex.Message;
                }
            }
        }

        if (success)
        {
            Response.Redirect("MemberOrderPeopleEdit.aspx?OrderNum=" + model.OrderNum + "&ReturnUrl=MemberOrder.aspx");
        }
        else
        {
            Arrow.Framework.MessageBox.Show(msg);
        }
    }
コード例 #2
0
    protected void btnReg_Click(object sender, EventArgs e)
    {
        string userName  = tbUserName.Value.Trim();
        string pwd1      = tbPwd1.Value.Trim();
        string pwd2      = tbPwd2.Value.Trim();
        string sex       = "";
        string inviteNum = tbInviteNum.Value.Trim();
        string qq        = "";
        string weChat    = "";
        string mobile    = "";
        string realName  = "";

        if (userName.IsNullOrEmpty())
        {
            JsBox.Show("请输入用户名!");
            return;
        }

        if (pwd1.IsNullOrEmpty())
        {
            JsBox.Show("请输入密码!");
            return;
        }

        if (pwd2.IsNullOrEmpty())
        {
            JsBox.Show("请输入重复密码!");
            return;
        }

        if (inviteNum.IsNullOrEmpty())
        {
            JsBox.Show("请输入邀请码!");
            return;
        }

        if (pwd1 != pwd2)
        {
            JsBox.Show("两次输入的密码不一致!");
            return;
        }


        var member = MemberBLL.Select(userName);

        if (member != null)
        {
            JsBox.Show("该用户名已存在!请选择其他用户名!");
            return;
        }

        var admin = SiteUserBLL.SelectUserByInviteNum(inviteNum);

        if (admin == null)
        {
            JsBox.Show("邀请码不存在!");
            return;
        }

        string pwd = MemberBLL.Encrypt(pwd1);

        var model = new SiteMemberInfo();

        model.AddTime         = DateTime.Now;
        model.Email           = "";
        model.HeadPicPath     = "";
        model.IDNum           = "";
        model.InviteNum       = inviteNum;
        model.InviterRealName = admin.RealName;
        model.InviterUserName = admin.Name;
        model.MobileNum       = mobile;
        model.QQ          = qq;
        model.RealName    = realName;
        model.Remarks     = "";
        model.Sex         = sex;
        model.TotalCost   = 0M;
        model.TotalPoints = 0;
        model.UsedPoints  = 0;
        model.UserName    = userName;
        model.UserPwd     = pwd;
        model.WeChat      = weChat;

        MemberBLL.AddMember(model);
        MemberInfo mi = new MemberInfo();

        mi.InviteNum = inviteNum;
        mi.RealName  = "";
        mi.UserName  = userName;
        MemberBLL.SetLoginInfo(mi);
        MessageBox.Show("注册成功!", "MemberIndex.aspx");
    }
コード例 #3
0
ファイル: Reg.aspx.cs プロジェクト: syunie/.NETandCloud
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string userName  = tbUserName.Text.Trim();
        string pwd1      = tbPwd1.Text.Trim();
        string pwd2      = tbPwd2.Text.Trim();
        string sex       = ddlSex.SelectedValue;
        string inviteNum = tbInviteNum.Text.Trim();
        string qq        = tbQQ.Text.Trim();
        string weChat    = tbWeChat.Text.Trim();
        string mobile    = tbMobile.Text.Trim();
        string realName  = tbRealName.Text.Trim();

        string[] fields = { userName, pwd1, pwd2, inviteNum, realName, mobile };
        string[] names  = { "用户名", "密码", "重复密码", "邀请码", "真实姓名", "联系电话" };
        if (fields.ValidateHasNullOrEmptyString(names))
        {
            return;
        }
        if (pwd1.ValidateIsNotEqualTo(pwd2, "两次输入的密码不一致!"))
        {
            return;
        }

        var member = MemberBLL.Select(userName);

        if (member.ValidateIsNotNull("该用户名已存在!请选择其他用户名!"))
        {
            return;
        }

        var admin = SiteUserBLL.SelectUserByInviteNum(inviteNum);

        if (admin.ValidateIsNull("邀请码不存在!"))
        {
            return;
        }

        string pwd = MemberBLL.Encrypt(pwd1);

        var model = new SiteMemberInfo();

        model.AddTime         = DateTime.Now;
        model.Email           = "";
        model.HeadPicPath     = "";
        model.IDNum           = "";
        model.InviteNum       = inviteNum;
        model.InviterRealName = admin.RealName;
        model.InviterUserName = admin.Name;
        model.MobileNum       = mobile;
        model.QQ          = qq;
        model.RealName    = realName;
        model.Remarks     = "";
        model.Sex         = sex;
        model.TotalCost   = 0M;
        model.TotalPoints = 0;
        model.UsedPoints  = 0;
        model.UserName    = userName;
        model.UserPwd     = pwd;
        model.WeChat      = weChat;

        MemberBLL.AddMember(model);
        MemberInfo mi = new MemberInfo();

        mi.InviteNum = inviteNum;
        mi.RealName  = "";
        mi.UserName  = userName;
        MemberBLL.SetLoginInfo(mi);
        MessageBox.Show("注册成功!", "default.aspx");
    }