예제 #1
0
        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(typecode))
            {
                _slipTypeTable.Add(typecode, typecode);
                return("");
            }
            return(title + ERROR_EXIST);
        }
예제 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (_currentSlipTypeTable == null)
                {
                    _currentSlipTypeTable = new BaseSlipTypeTable();
                }
                _currentSlipTypeTable.TYPE_CODE        = cboType.SelectedValue.ToString();
                _currentSlipTypeTable.CODE             = txtCode.Text;
                _currentSlipTypeTable.NAME             = txtName.Text;
                _currentSlipTypeTable.COMPANY_CODE     = txtCompanyCode.Text;
                _currentSlipTypeTable.LAST_UPDATE_USER = _userInfo.CODE;
                _currentSlipTypeTable.INDICATES_ORDER  = CConvert.ToInt32(txtIndicatesOrder.Text);

                try
                {
                    if (bSlipType.Exists(cboType.SelectedValue.ToString(), txtCode.Text.Trim()))
                    {
                        bSlipType.Update(_currentSlipTypeTable);
                    }
                    else
                    {
                        _currentSlipTypeTable.CREATE_USER = _userInfo.CODE;
                        bSlipType.Add(_currentSlipTypeTable);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("保存失败,请重新输入!");
                    Logger.Error("订单类型保存失败!", ex);
                    return;
                }
                result = DialogResult.OK;
                this.Close();
                CCacheData.SlipType         = null;
                CCacheData.PurchaseSlipType = null;
                CCacheData.OrderSlipType    = null;
            }
        }
예제 #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (CheckInput())
     {
         if (_currentSlipTypeTable == null)
         {
             _currentSlipTypeTable = new BaseSlipTypeTable();
         }
         _currentSlipTypeTable.CODE             = txtCode.Text.Trim();
         _currentSlipTypeTable.NAME             = txtName.Text.Trim();
         _currentSlipTypeTable.COMPANY_CODE     = "01";
         _currentSlipTypeTable.LAST_UPDATE_USER = _userInfo.CODE;
         _currentSlipTypeTable.ENGLISHNAME      = txtenglishname.Text.Trim();
         _currentSlipTypeTable.ATTRIBUTE1       = "";
         _currentSlipTypeTable.ATTRIBUTE2       = "";
         _currentSlipTypeTable.ATTRIBUTE3       = "";
         try
         {
             if (bSlipType.Exists(txtCode.Text.Trim()))
             {
                 bSlipType.Update(_currentSlipTypeTable);
             }
             else
             {
                 _currentSlipTypeTable.CREATE_USER = _userInfo.CODE;
                 bSlipType.Add(_currentSlipTypeTable);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("保存失败,请重新输入!");
             Logger.Error("订单类型保存失败!", ex);
             return;
         }
         result = DialogResult.OK;
         this.Close();
         CCacheData.SlipType = null;
     }
 }
예제 #4
0
        public override string[] doUpdateDB()
        {
            BaseSlipTypeTable SlipTypeTable = null;
            BSlipType         bSlipType     = new BSlipType();
            StringBuilder     strError      = new StringBuilder();
            int    successData    = 0;
            int    failureData    = 0;
            string errorFilePath  = "";
            string backupFilePath = "";

            //数据导入处理
            foreach (DataRow dr in _csvDataTable.Rows)
            {
                StringBuilder str = new StringBuilder();
                if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "TYPE_CODE"))))
                {
                    str.Append(CheckSlipType(CConvert.ToString(GetValue(dr, "TYPE_CODE")), "单据类型"));
                }
                else
                {
                    str.Append("单据类型不能为空!");
                }
                //订单类型编号
                if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "CODE"))))
                {
                    str.Append(CheckString(GetValue(dr, "CODE"), 20, "单据类型编号"));
                }
                else
                {
                    str.Append("订单类型编号不能为空!");
                }
                //订单类型名称
                str.Append(CheckLenght(GetValue(dr, "NAME"), 100, "单据类型名称"));
                //公司编号
                if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "COMPANY_CODE"))))
                {
                    str.Append(CheckCompany(CConvert.ToString(GetValue(dr, "COMPANY_CODE")), "公司"));
                }
                //表示顺序
                str.Append(CheckInt(GetValue(dr, "INDICATES_ORDER", 0), 100000, "表示顺序"));
                //状态
                str.Append(CheckInt(GetValue(dr, "STATUS_FLAG", CConstant.NORMAL_STATUS), 9, "状态"));
                if (str.ToString().Trim().Length > 0)
                {
                    strError.Append(GetStringBuilder(dr, str.ToString().Trim()));
                    failureData++;
                    continue;
                }
                try
                {
                    SlipTypeTable                  = new BaseSlipTypeTable();
                    SlipTypeTable.TYPE_CODE        = CConvert.ToString(GetValue(dr, "TYPE_CODE"));
                    SlipTypeTable.CODE             = CConvert.ToString(GetValue(dr, "CODE"));
                    SlipTypeTable.NAME             = CConvert.ToString(GetValue(dr, "NAME"));
                    SlipTypeTable.COMPANY_CODE     = CConvert.ToString(GetValue(dr, "COMPANY_CODE"));
                    SlipTypeTable.INDICATES_ORDER  = CConvert.ToInt32(GetValue(dr, "INDICATES_ORDER", 0));
                    SlipTypeTable.STATUE           = CConvert.ToInt32(GetValue(dr, "STATUS_FLAG", CConstant.NORMAL_STATUS));
                    SlipTypeTable.CREATE_USER      = _userInfo.CODE;
                    SlipTypeTable.LAST_UPDATE_USER = _userInfo.CODE;

                    if (!bSlipType.Exists(SlipTypeTable.TYPE_CODE, SlipTypeTable.CODE))
                    {
                        bSlipType.Add(SlipTypeTable);
                    }
                    else
                    {
                        bSlipType.Update(SlipTypeTable);
                    }
                    successData++;
                }
                catch
                {
                    strError.Append(GetStringBuilder(dr, " 数据导入失败,请与系统管理员联系!").ToString());
                    failureData++;
                }
            }
            //错误记录处理
            if (strError.Length > 0)
            {
                errorFilePath = WriteFile(strError.ToString());
            }

            //备份处理
            backupFilePath = BackupFile();

            return(new string[] { successData.ToString(), failureData.ToString(), errorFilePath, backupFilePath });
        }