public void TopUserInfoUserControl_Load(object sender, EventArgs e)
 {
     if (!this.DesignMode)
     {
         m_yhzlModel             = LoginAccountManager.Instance.getLoginUserModel();
         this.labelUserName.Text = m_yhzlModel.v_yh_name;
         this.labelUserName.Text = string.Format("{0},你好!", m_yhzlModel.v_yh_name);
         // 转换图片格式
         this.loadPhoto();
     }
 }
        private void uploadSavePhoto(string strAllPhotoPath)
        {
            jt_yh_zl yhzlModel = LoginAccountManager.Instance.getLoginUserModel();

            if (yhzlModel == null)
            {
                return;
            }
            bool isUpload = UserInfoManager.Instance.UploadPhotoToDataBase(yhzlModel, strAllPhotoPath);

            if (isUpload == false)
            {
                MessageBox.Show("头像信息保存未完成!头像更换失败", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            // 头像图片加载
            m_topUserInfoUserControl.loadPhoto();
            base.Close();
        }
        private void tzxRoundedButtonRegister_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.textBoxAccount.Text.Trim()))
            {
                MessageBox.Show("账号不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (string.IsNullOrEmpty(this.textBoxName.Text.Trim()))
            {
                MessageBox.Show("姓名不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (string.IsNullOrEmpty(this.textBoxName.Text.Trim()))
            {
                MessageBox.Show("密码不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (MessageBox.Show("确定已填写好信息并注册?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
            {
                return;
            }

            jt_yh_zl yhzlModel = new jt_yh_zl();

            yhzlModel.v_yh_no   = this.textBoxAccount.Text;
            yhzlModel.v_yh_name = this.textBoxName.Text;
            yhzlModel.v_yh_pwd  = this.textBoxPwd.Text;
            yhzlModel.v_phone   = this.textBoxPhone.Text;
            yhzlModel.i_yh_type = this.radioButtonUser.Checked ? 1 : 2;
            bool isAddSuccess = UserInfoManager.Instance.Add(yhzlModel);

            if (isAddSuccess == true)
            {
                MessageBox.Show("注册成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("注册失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        /// <summary>
        /// 上传图片到数据库
        /// </summary>
        public bool UploadPhotoToDataBase(jt_yh_zl yhzlModel, string strPath)
        {
            // 以文件流读取文件内容
            FileStream fileStream = new FileStream(strPath, FileMode.Open, FileAccess.Read);

            byte[] byteFile = new byte[fileStream.Length];
            fileStream.Read(byteFile, 0, (int)fileStream.Length);
            fileStream.Close();
            // 更改用户头像
            yhzlModel.v_photo_path = strPath;
            yhzlModel.v_photo      = byteFile;
            bool updateSuccess = this.Update(yhzlModel);

            if (updateSuccess == false)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #5
0
 private void ChangePasswordForm_Load(object sender, EventArgs e)
 {
     m_yhzlModel = LoginAccountManager.Instance.getLoginUserModel();
 }