예제 #1
0
 private void buttonRegister_Click(object sender, EventArgs e)
 {
     if (_isUsernameValid && _isRealNameValid && _isPasswordValid && _isPhoneNumberValid && _isEmailAddressValid)
     {
         try
         {
             if (SupplierDataAccess.IsUsernameExisted(_username))
             {
                 MessageBox.Show("用户名已存在");
                 return;
             }
             SupplierDataAccess.InsertSupplier(_username, _realName, _password, _phoneNumber, _emailAddress);
             MessageBox.Show("注册成功!");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             return;
         }
         Close();
     }
     else
     {
         MessageBox.Show("请检查字符串是否匹配");
     }
 }
예제 #2
0
        private void InsertSupplier(Model.Supplier.Supplier supplier)
        {
            if (supplier == null)
            {
                throw new ArgumentNullException("supplier", "Supplier");
            }

            //Insert Supplier
            _supplierDataAccess.InsertSupplier(supplier);

            //Updating Supplier code
            supplier.SupplierCode =
                StringHelper.Right("00" + DateTime.Now.Year, 2) + "-" +
                StringHelper.Right("00" + DateTime.Now.Month, 2) + "-" +
                supplier.SupplierId;
            UpdateSupplier(supplier);
        }