Exemplo n.º 1
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            if (validate())
            {
                User user = new User();
                user.id           = userId;
                user.cellPhone    = textBoxCellPhone.Text.Trim();
                user.mail         = textBoxMail.Text.Trim();
                user.name         = textBoxAdminName.Text.Trim();
                user.roleId       = 1;
                user.storeId      = 0;
                user.memo         = textBoxMemo.Text.Trim();
                user.passwordSalt = PasswordEncryption.generateSalt();
                user.password     = PasswordEncryption.generatePassword(textBoxPassword.Text.Trim(), user.passwordSalt);
                user.active       = true;

                Tenant tenant = new Tenant();
                tenant.id             = tenantId;
                tenant.enableWorkFlow = checkBoxEnableWorkFlow.Checked;
                tenant.createdDate    = dateTimePickerCreatedDate.Value;
                tenant.categoryId     = Convert.ToUInt16(comboBoxCategory.SelectedValue);
                tenant.statusId       = Convert.ToUInt16(comboBoxStatus.SelectedValue);
                tenant.shardName      = textBoxShardName.Text.Trim();
                tenant.name           = textBoxName.Text.Trim();

                if (isCreating)
                {
                    if (GlobalDb.createTenant(tenant, user))
                    {
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("新建失败! 请联系管理员!");
                    }
                }
                else
                {
                    //update
                    if (GlobalDb.updateTenant(tenant, user))
                    {
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("更新失败! 请联系管理员!");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            if (validate())
            {
                User user = new User();
                user.id           = userId;
                user.cellPhone    = textBoxCellPhone.Text.Trim();
                user.mail         = textBoxMail.Text.Trim();
                user.name         = textBoxName.Text.Trim();
                user.roleId       = Convert.ToInt16(comboBoxRole.SelectedValue);
                user.storeId      = Convert.ToInt16(comboBoxStore.SelectedValue);
                user.tenantId     = Sharevariables.TenantId;
                user.memo         = textBoxMemo.Text.Trim();
                user.passwordSalt = PasswordEncryption.generateSalt();
                user.password     = PasswordEncryption.generatePassword(textBoxPassword.Text.Trim(), user.passwordSalt);
                user.active       = checkBoxActive.Checked;

                if (isCreating)
                {
                    if (GlobalDb.createUser(user))
                    {
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("新建失败! 请联系管理员!");
                    }
                }
                else
                {
                    //update
                    if (GlobalDb.updateUser(user))
                    {
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("更新失败! 请联系管理员!");
                    }
                }
            }
        }