示例#1
0
        /// <summary>
        /// 保存
        /// </summary>
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (_currentCompanyTable == null)
                {
                    _currentCompanyTable = new BaseCompanyTable();
                }
                _currentCompanyTable.CODE             = txtCode.Text.Trim().PadLeft(2, '0');
                _currentCompanyTable.NAME             = txtName.Text;
                _currentCompanyTable.NAME_SHORT       = txtNameShort.Text;
                _currentCompanyTable.NAME_ENGLISH     = txtEnglishName.Text;
                _currentCompanyTable.ZIP_CODE         = txtZipCode.Text;
                _currentCompanyTable.ADDRESS_FIRST    = txtAddressFirst.Text;
                _currentCompanyTable.ADDRESS_MIDDLE   = txtAddressMiddle.Text;
                _currentCompanyTable.ADDRESS_LAST     = txtAddressLast.Text;
                _currentCompanyTable.PHONE_NUMBER     = txtPhone.Text;
                _currentCompanyTable.FAX_NUMBER       = txtFax.Text;
                _currentCompanyTable.EMAIL            = txtEmail.Text;
                _currentCompanyTable.URL              = txtURL.Text;
                _currentCompanyTable.MEMO             = txtMemo.Text;
                _currentCompanyTable.LAST_UPDATE_USER = _userInfo.CODE;

                try
                {
                    if (bCompany.Exists(txtCode.Text.Trim()))
                    {
                        bCompany.Update(_currentCompanyTable);
                    }
                    else
                    {
                        _currentCompanyTable.CREATE_USER = _userInfo.CODE;
                        bCompany.Add(_currentCompanyTable);
                    }
                }
                catch (Exception ex)
                {
                    //log.error
                    MessageBox.Show("");
                    return;
                }
                result = DialogResult.OK;
                this.Close();
                CCacheData.Company = null;
            }
        }
示例#2
0
        //#region SLIP_TYPE存在的Check
        //public string CheckSlipType(string typecode, string title)
        //{
        //    if (typecode == null || "".Equals(typecode))
        //    {
        //        return title + ERROR_NULL;
        //    }
        //    if (_slipTypeTable[typecode.ToString()] != null)
        //    {
        //        return "";
        //    }
        //    BSlipType bSlipType = new BSlipType();
        //    if (bSlipType.Exists("ORDER", typecode))
        //    {
        //        _slipTypeTable.Add(typecode, typecode);
        //        return "";
        //    }
        //    return title + ERROR_EXIST;
        //}
        //#endregion

        #region 公司存在的Check
        public string CheckCompany(string company, string title)
        {
            if (company == null || "".Equals(company))
            {
                return(title + ERROR_NULL);
            }
            if (_companyTable[company.ToString()] != null)
            {
                return("");
            }
            BCompany bCompany = new BCompany();

            if (bCompany.Exists(company))
            {
                _companyTable.Add(company, company);
                return("");
            }
            return(title + ERROR_EXIST);
        }
示例#3
0
 /// <summary>
 /// 保存
 /// </summary>
 private void btnSave_Click_1(object sender, EventArgs e)
 {
     if (CheckInput())
     {
         if (_currentCompanyTable == null)
         {
             _currentCompanyTable = new BaseCompanyTable();
         }
         _currentCompanyTable.CODE             = txtCode.Text.Trim().PadLeft(2, '0');
         _currentCompanyTable.NAME             = txtName.Text.Trim();
         _currentCompanyTable.NAME_SHORT       = txtNameShort.Text.Trim();
         _currentCompanyTable.NAME_ENGLISH     = txtEnglishName.Text.Trim();
         _currentCompanyTable.ZIP_CODE         = txtZipCode.Text.Trim();
         _currentCompanyTable.ADDRESS_FIRST    = txtAddressFirst.Text.Trim();
         _currentCompanyTable.ADDRESS_MIDDLE   = txtAddressMiddle.Text.Trim();
         _currentCompanyTable.ADDRESS_LAST     = txtAddressLast.Text.Trim();
         _currentCompanyTable.PHONE_NUMBER     = txtPhone.Text.Trim();
         _currentCompanyTable.FAX_NUMBER       = txtFax.Text.Trim();
         _currentCompanyTable.EMAIL            = txtEmail.Text.Trim();
         _currentCompanyTable.URL              = txtURL.Text.Trim();
         _currentCompanyTable.MEMO             = txtMemo.Text.Trim();
         _currentCompanyTable.LAST_UPDATE_USER = _userInfo.CODE;
         if (txtLogo.Text.ToString() != "")
         {
             string[]             sArray = Regex.Split(txtLogo.Text.Trim(), @"\\", RegexOptions.IgnoreCase);
             System.IO.FileStream fs     = new System.IO.FileStream(txtLogo.Text.Trim(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
             byte[] imgByte = new byte[fs.Length];
             fs.Read(imgByte, 0, (int)fs.Length);
             _currentCompanyTable.LOGO = imgByte;
         }
         if (txtCompanyPicture.Text.ToString() != "")
         {
             string[]             sArray = Regex.Split(txtCompanyPicture.Text.Trim(), @"\\", RegexOptions.IgnoreCase);
             System.IO.FileStream fs     = new System.IO.FileStream(txtCompanyPicture.Text.Trim(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
             byte[] imgByte = new byte[fs.Length];
             fs.Read(imgByte, 0, (int)fs.Length);
             _currentCompanyTable.COMPANY_PICTURE = imgByte;
         }
         try
         {
             if (bCompany.Exists(txtCode.Text.Trim()))
             {
                 bCompany.Update(_currentCompanyTable);
             }
             else
             {
                 _currentCompanyTable.CREATE_USER = _userInfo.CODE;
                 bCompany.Add(_currentCompanyTable);
             }
         }
         catch (Exception ex)
         {
             //log.error
             MessageBox.Show("");
             return;
         }
         result = DialogResult.OK;
         this.Close();
         CCacheData.Company = null;
     }
 }