Exemplo n.º 1
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        bool   flag = false;
        string msg  = string.Empty;

        if (this.IsValid)
        {
            if (WMUsers.IsExitis(null, UserName.Text))
            {
                msg = "用户名已存在";
            }
            else
            {
                WMUsers user = new WMUsers();
                user.Id       = General.UniqueString(user.Id);
                user.UserName = UserName.Text;
                user.Password = UserPassword.Text;
                user.RoleId   = UserRole.SelectedValue.ToInt32();
                user.NickName = NickName.Text;
                user.Mobile   = UserMobile.Text;
                user.BankCard = UserBankCard.Text;
                user.StatusId = UserState.SelectedValue.ToInt32();

                if (UserImageUpload.HasFile)
                {
                    string fileName = string.Format("/share/upload/user/{0}/face.jpg", user.Id);
                    Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload("~" + fileName, 0, 0);
                    if (upload.Upload(UserImageUpload.PostedFile.InputStream))
                    {
                        user.Image         = fileName;
                        UserImage.ImageUrl = upload.FileName;
                    }
                    else
                    {
                        msg = upload.ErrorMessage;
                        Helper.MessageBox(flag, msg);
                        return;
                    }
                }

                flag = user.Add();

                if (flag)
                {
                    //后台手动添加用户积分
                    int integarl = UserInte.Text.ToInt32();
                    if (integarl > 0)
                    {
                        WMUserIntegrals inte = new WMUserIntegrals();
                        inte.UserId   = user.Id;
                        inte.Integral = integarl;
                        inte.SourceId = 452;
                        inte.Add();
                    }
                }
            }
        }

        Helper.MessageBox(flag, msg);
    }
Exemplo n.º 2
0
    protected void UploadButton_Click(object sender, EventArgs e)
    {
        bool flag = false;

        if (!ImageUpload.HasFile)
        {
            PicValid.CssClass = "alert alert-warning";
        }
        else
        {
            WMGoodImages gi = new WMGoodImages();
            gi.GoodId = Id;
            string fileName = string.Format("/share/upload/good/{0}/{1}.jpg", gi.GoodId, DateTime.Now.ToFileTime());
            Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload("~" + fileName, 0, 0);
            if (upload.Upload(ImageUpload.PostedFile.InputStream))
            {
                gi.URL = fileName;
                flag   = gi.Add();
            }
        }

        Bind();
        TabPlay("image");
        Helper.MessageBox(flag);
    }
Exemplo n.º 3
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        bool flag = false;
        string msg = string.Empty;

        if (this.IsValid)
        {
            WMGoodBrands brand = !General.IsNullable(Id) ? WMGoodBrands.Get(Id) : new WMGoodBrands();
            brand.Name = BrandName.Text;
            brand.URL = BrandUrl.Text;

            if (ImageUpload.HasFile)
            {
                string fileName = string.Format("/share/upload/good/brand/{0}.jpg", DateTime.Now.ToFileTime());
                Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload("~" + fileName, 0, 0);
                if (upload.Upload(ImageUpload.PostedFile.InputStream))
                {
                    brand.Logo = fileName;
                    BrandLogo.ImageUrl = upload.FileName;
                }
            }

            if (!General.IsNullable(brand.Id))
                flag = brand.Update();
            else
                flag = brand.Add();
        }

        Helper.MessageBox(flag);
    }
Exemplo n.º 4
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        bool flag = false;

        if (!ImageUpload.HasFile)
        {
            PicValid.CssClass = "alert alert-warning";
            Bind();
            return;
        }
        else
        {
            WMGoodImages gi = new WMGoodImages();
            gi.GoodId = GoodId;
            string fileName = string.Format("/share/upload/good/{0}/{1}.jpg", gi.GoodId, DateTime.Now.ToFileTime());
            Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload("~" + fileName, 0, 0);
            if (upload.Upload(ImageUpload.PostedFile.InputStream))
            {
                gi.URL = fileName;
                flag = gi.Add();
            }
        }

        if (flag)
            Bind();

        Helper.MessageBox(flag);
    }
Exemplo n.º 5
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        bool   flag = false;
        string msg  = string.Empty;

        if (this.IsValid)
        {
            WMGoodBrands brand = !General.IsNullable(Id) ? WMGoodBrands.Get(Id) : new WMGoodBrands();
            brand.Name = BrandName.Text;
            brand.URL  = BrandUrl.Text;

            if (ImageUpload.HasFile)
            {
                string fileName = string.Format("/share/upload/good/brand/{0}.jpg", DateTime.Now.ToFileTime());
                Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload("~" + fileName, 0, 0);
                if (upload.Upload(ImageUpload.PostedFile.InputStream))
                {
                    brand.Logo         = fileName;
                    BrandLogo.ImageUrl = upload.FileName;
                }
            }

            if (!General.IsNullable(brand.Id))
            {
                flag = brand.Update();
            }
            else
            {
                flag = brand.Add();
            }
        }

        Helper.MessageBox(flag);
    }
Exemplo n.º 6
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        bool   flag = false;
        string msg  = string.Empty;

        if (this.IsValid)
        {
            WMUsers user = WMUsers.Get(UserId);
            user.RoleId   = UserRole.SelectedValue.ToInt32();
            user.NickName = NickName.Text;
            user.Mobile   = UserMobile.Text;
            user.BankCard = UserBankCard.Text;
            user.StatusId = UserState.SelectedValue.ToInt32();

            if (UserImageUpload.HasFile)
            {
                string fileName = string.Format("~/share/upload/user/{0}/face.jpg", user.Id);
                Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload(fileName, 0, 0);
                if (upload.Upload(UserImageUpload.PostedFile.InputStream))
                {
                    user.Image = fileName;
                }
                else
                {
                    msg = upload.ErrorMessage;
                    Helper.MessageBox(flag, msg);
                    return;
                }
            }

            flag = user.Update();
        }

        Helper.MessageBox(flag);
    }
Exemplo n.º 7
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        bool flag = false;
        string msg = string.Empty;

        if (this.IsValid)
        {
            WMUsers user = WMUsers.Get(UserId);
            user.RoleId = UserRole.SelectedValue.ToInt32();
            user.NickName = NickName.Text;
            user.Mobile = UserMobile.Text;
            user.Identity = UserIdentity.Text;
            user.BankAccount = UserBankAccount.Text;
            user.BankName = UserBankName.Text;
            user.BankCard = UserBankCard.Text;
            user.StatusId = UserState.SelectedValue.ToInt32();

            if (UserImageUpload.HasFile)
            {
                string fileName = string.Format("~/share/upload/user/{0}/face.jpg", user.Id);
                Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload(fileName, 0, 0);
                if (upload.Upload(UserImageUpload.PostedFile.InputStream))
                {
                    user.Image = fileName;
                }
                else
                {
                    msg = upload.ErrorMessage;
                    Helper.MessageBox(flag, msg);
                    return;
                }
            }

            flag = user.Update();

            if (flag)
                UserImage.ImageUrl = user.Image;
        }

        Helper.MessageBox(flag);
    }
Exemplo n.º 8
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        bool flag = false;
        string msg = string.Empty;

        if (this.IsValid)
        {
            if (WMUsers.IsExitis(null, UserName.Text))
            {
                msg = "用户名已存在";
            }
            else
            {
                WMUsers user = new WMUsers();
                user.Id = General.UniqueString(user.Id);
                user.UserName = UserName.Text;
                user.Password = UserPassword.Text;
                user.RoleId = UserRole.SelectedValue.ToInt32();
                user.NickName = NickName.Text;
                user.Mobile = UserMobile.Text;
                user.Identity = UserIdentity.Text;
                user.BankAccount = UserBankAccount.Text;
                user.BankName = UserBankName.Text;
                user.BankCard = UserBankCard.Text;
                user.StatusId = UserState.SelectedValue.ToInt32();

                if (UserImageUpload.HasFile)
                {
                    string fileName = string.Format("/share/upload/user/{0}/face.jpg", user.Id);
                    Jumpcity.IO.FileUpload upload = new Jumpcity.IO.FileUpload("~" + fileName, 0, 0);
                    if (upload.Upload(UserImageUpload.PostedFile.InputStream))
                    {
                        user.Image = fileName;
                        UserImage.ImageUrl = upload.FileName;
                    }
                    else
                    {
                        msg = upload.ErrorMessage;
                        Helper.MessageBox(flag, msg);
                        return;
                    }
                }

                flag = user.Add();

                if (flag)
                {
                    //后台手动添加用户积分
                    int integarl = UserInte.Text.ToInt32();
                    if (integarl > 0)
                    {
                        WMUserIntegrals inte = new WMUserIntegrals();
                        inte.UserId = user.Id;
                        inte.Integral = integarl;
                        inte.SourceId = 452;
                        inte.Add();
                    }
                }
            }
        }

        Helper.MessageBox(flag, msg);
    }