Esempio n. 1
0
        /// <summary>
        /// 保存
        /// </summary>
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (_currentCustomerTable == null)
                {
                    _currentCustomerTable = new BaseCustomerTable();
                }
                _currentCustomerTable.CODE             = txtCode.Text.Trim();
                _currentCustomerTable.NAME             = txtName.Text.Trim();
                _currentCustomerTable.CURRENCE_CODE    = CConstant.EXCHANGE_CHIAN;
                _currentCustomerTable.LAST_UPDATE_USER = _userInfo.CODE;

                try
                {
                    if (bmaterial.Exists(txtCode.Text.Trim()))
                    {
                        bmaterial.Update(_currentCustomerTable);
                    }
                    else
                    {
                        _currentCustomerTable.CREATE_USER = _userInfo.CODE;
                        bmaterial.Add(_currentCustomerTable);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                result = DialogResult.OK;
                this.Close();
            }
        }
Esempio n. 2
0
 private void txtCustomerCode_Leave(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.txtCustomerCode.Text.Trim()))
     {
         BaseCustomerTable Customer  = new BaseCustomerTable();
         BCustomer         bCustomer = new BCustomer();
         Customer = bCustomer.GetModel(txtCustomerCode.Text);
         if (Customer == null)
         {
             txtCustomerCode.Focus();
             txtCustomerCode.Text = "";
             txtCustomerName.Text = "";
             MessageBox.Show("客户编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             txtCustomerCode.Text = Customer.CODE;
             txtCustomerName.Text = Customer.NAME;
         }
     }
     else
     {
         txtCustomerName.Text = "";
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 导出审查表
        /// </summary>
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (dgvData.SelectedRows.Count > 0)
            {
                DataGridViewRow   row              = dgvData.SelectedRows[0];
                Hashtable         ht               = new Hashtable();
                BaseCustomerTable customerTable    = new BCustomer().GetModel(CConvert.ToString(row.Cells["CUSTOMER_CODE"].Value));
                BaseCustomerTable endcustomerTable = new BCustomer().GetModel(CConvert.ToString(row.Cells["ENDER_CUSTOMER_CODE"].Value));
                if (customerTable == null)
                {
                    customerTable = new BaseCustomerTable();
                }
                if (endcustomerTable == null)
                {
                    endcustomerTable = new BaseCustomerTable();
                }
                ht.Add("&CUSTOMER_NAME", customerTable.NAME);
                ht.Add("&NAME_ENGLSIH", customerTable.NAME_ENGLISH);
                ht.Add("&CONTACT_NAME", customerTable.CONTACT_NAME);
                ht.Add("&A", customerTable.MEMO2);
                ht.Add("&MEMO", customerTable.MEMO);
                ht.Add("&ORDER_MEMO", row.Cells["MEMO"].Value);
                ht.Add("&END_CUSTOMER_NAME", endcustomerTable.NAME);
                ht.Add("&END_NAME_ENGLISH", endcustomerTable.NAME_ENGLISH);
                ht.Add("&END_CONTACT_NAME", endcustomerTable.CONTACT_NAME);
                ht.Add("&END_MEMO2", endcustomerTable.MEMO2);
                ht.Add("&END_MEMO", endcustomerTable.MEMO);
                ht.Add("&SLIP_NUMBER", row.Cells["SLIP_NUMBER"].Value);

                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "LZ_ORDER_REVIEW_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    int ret = CommonExport.ExportReView(@"rpt\review.xls", sf.FileName, ht);
                    if (CConstant.EXPORT_FAILURE.Equals(ret))
                    {
                        MessageBox.Show("导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_SUCCESS.Equals(ret))
                    {
                        MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (CConstant.EXPORT_RUNNING.Equals(ret))
                    {
                        MessageBox.Show("文件正在运行,重新生成文件失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (CConstant.EXPORT_TEMPLETE_FILE_NOT_EXIST.Equals(ret))
                    {
                        MessageBox.Show("模版文件不存在。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            else
            {
                MessageBox.Show("请先选择一行。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 保存
        /// </summary>
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (_currentCustomerTable == null)
                {
                    _currentCustomerTable = new BaseCustomerTable();
                }
                _currentCustomerTable.CODE             = txtCode.Text.Trim();
                _currentCustomerTable.NAME             = txtName.Text.Trim();
                _currentCustomerTable.NAME_SHORT       = txtNameShort.Text.Trim();
                _currentCustomerTable.NAME_ENGLISH     = txtEnglishName.Text.Trim();
                _currentCustomerTable.ZIP_CODE         = txtZipCode.Text.Trim();
                _currentCustomerTable.ADDRESS_FIRST    = txtAddressFirst.Text.Trim();
                _currentCustomerTable.ADDRESS_MIDDLE   = txtAddressMiddle.Text.Trim();
                _currentCustomerTable.ADDRESS_LAST     = txtAddressLast.Text.Trim();
                _currentCustomerTable.PHONE_NUMBER     = txtPhone.Text.Trim();
                _currentCustomerTable.FAX_NUMBER       = txtFax.Text.Trim();
                _currentCustomerTable.MOBIL_NUMBER     = txtMobilNumber.Text.Trim();
                _currentCustomerTable.CONTACT_NAME     = txtContactName.Text.Trim();
                _currentCustomerTable.EMAIL            = txtEmail.Text.Trim();
                _currentCustomerTable.URL              = txtURL.Text.Trim();
                _currentCustomerTable.MEMO             = txtMemo.Text.Trim();
                _currentCustomerTable.CURRENCE_CODE    = CConstant.EXCHANGE_CHIAN;
                _currentCustomerTable.LAST_UPDATE_USER = _userInfo.CODE;
                _currentCustomerTable.CODE1            = txtCode1.Text.Trim();
                _currentCustomerTable.COUNTRY          = txtCountry.Text.Trim();
                _currentCustomerTable.PARENT_NAME      = txtName1.Text.Trim();

                try
                {
                    if (bCustomer.Exists(txtCode.Text.Trim()))
                    {
                        bCustomer.Update(_currentCustomerTable);
                    }
                    else
                    {
                        _currentCustomerTable.CREATE_USER = _userInfo.CODE;
                        bCustomer.Add(_currentCustomerTable);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                result = DialogResult.OK;
                this.Close();
            }
        }
Esempio n. 5
0
 private void txtCode_Leave(object sender, EventArgs e)
 {
     //判断编号是否已存在
     if (!string.IsNullOrEmpty(txtCode.Text.Trim()))
     {
         BaseCustomerTable CustomerCode = new BaseCustomerTable();
         CustomerCode = bCustomer.GetModel(txtCode.Text);
         if (CustomerCode != null)
         {
             txtCode.Focus();
             txtCode.Text = "";
             MessageBox.Show("编号已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string code = dgvData.SelectedRows[0].Cells[0].Value.ToString();
                if (code != "")
                {
                    _currentCustomerTable = bCustomer.GetModel(code);
                }
            }
            catch (Exception ex) { }

            if (_currentCustomerTable == null || _currentCustomerTable.CODE == null || "".Equals(_currentCustomerTable.CODE))
            {
                _currentCustomerTable = null;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 打开新窗口
        /// </summary>
        private void OpenDialogFrm(int mode)
        {
            if (mode == CConstant.MODE_NEW || _currentCustomerTable != null)
            {
                FrmCustomerDialog frm = new FrmCustomerDialog();
                frm.UserInfo             = _userInfo;
                frm.CurrentCustomerTable = _currentCustomerTable;
                frm.Mode = mode;
                DialogResult resule = frm.ShowDialog(this);
                if (resule == DialogResult.OK && isSearch)
                {
                    Search(this.pgControl.GetCurrentPage());
                }
                frm.Dispose();
            }
            else
            {
                //MessageBox.Show("请选择正确的行!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            _currentCustomerTable = null;
        }
Esempio n. 8
0
 /// <summary>
 /// 删除
 /// </summary>
 private void MasterToolBar_DoDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("确定要删除吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.OK)
     {
         try
         {
             GetCurrentSelectedTable();
             if (_currentCustomerTable != null)
             {
                 bCustomer.Delete(_currentCustomerTable.CODE);
                 Search(this.pgControl.GetCurrentPage());
             }
             else
             {
                 MessageBox.Show("请选择正确的行!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("删除失败,请重试或与系统管理员联系。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         _currentCustomerTable = null;
     }
 }
Esempio n. 9
0
        public override string[] doUpdateDB()
        {
            BaseCustomerTable CustomerTable = null;
            BCustomer         bCustomer     = new BCustomer();
            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, "CODE"))))
                {
                    str.Append(CheckString(GetValue(dr, "CODE"), 20, "编号"));
                }
                else
                {
                    str.Append("编号不能为空!");
                }
                str.Append(CheckLenght(GetValue(dr, "NAME"), 100, "名称"));
                //简称
                str.Append(CheckLenght(GetValue(dr, "NAME_SHORT"), 50, "简称"));
                //英文名称
                str.Append(CheckLenght(GetValue(dr, "NAME_ENGLISH"), 100, "英文名称"));
                //邮编
                str.Append(CheckLenght(GetValue(dr, "ZIP_CODE"), 8, "邮编"));
                //地址1
                str.Append(CheckLenght(GetValue(dr, "ADDRESS_FIRST"), 100, "地址1"));
                //地址2
                str.Append(CheckLenght(GetValue(dr, "ADDRESS_MIDDLE"), 100, "地址2"));
                //地址3
                str.Append(CheckLenght(GetValue(dr, "ADDRESS_LAST"), 100, "地址3"));
                //电话
                str.Append(CheckLenght(GetValue(dr, "PHONE_NUMBER"), 20, "电话"));
                //传真
                str.Append(CheckLenght(GetValue(dr, "FAX_NUMBER"), 20, "传真"));
                //联系人名称
                str.Append(CheckLenght(GetValue(dr, "CONTACT_NAME"), 50, "联系人名称"));
                //联系人电话
                str.Append(CheckLenght(GetValue(dr, "MOBIL_NUMBER"), 20, "联系人电话"));
                //邮箱
                str.Append(CheckLenght(GetValue(dr, "EMIAL"), 50, "邮箱"));
                //网址
                str.Append(CheckLenght(GetValue(dr, "URL"), 50, "网址"));
                //备注
                str.Append(CheckLenght(GetValue(dr, "MEMO"), 255, "备注"));
                //类型
                if (CConvert.ToInt32(GetValue(dr, "TYPE", 1)) != 1 && CConvert.ToInt32(GetValue(dr, "TYPE", 1)) != 2 && CConvert.ToString(GetValue(dr, "TYPE", 1)) != "")
                {
                    str.Append("类型只能为1或2!");
                }
                else
                {
                    str.Append(CheckInt(GetValue(dr, "TYPE", 1), 2, "类型"));
                }
                //是否请款公司
                if (CConvert.ToInt32(GetValue(dr, "CLAIM_FLAG", 1)) != 1 && CConvert.ToInt32(GetValue(dr, "CLAIM_FLAG", 1)) != 2 && CConvert.ToString(GetValue(dr, "CLAIM_FLAG", 1)) != "")
                {
                    str.Append("是否请款公司只能为1或2!");
                }
                else
                {
                    str.Append(CheckInt(GetValue(dr, "CLAIM_FLAG", 1), 2, "是否请款公司"));
                }
                //请款公司编号
                str.Append(CheckLenght(GetValue(dr, "CLAIM_CODE"), 20, "请款公司编号"));
                //货币
                if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "CURRENCE_CODE"))))
                {
                    str.Append(CheckCurrency(CConvert.ToString(GetValue(dr, "CURRENCE_CODE")), "货币"));
                }
                //状态
                str.Append(CheckInt(GetValue(dr, "STATUS_FLAG", 1), 9, "状态"));
                //备考2
                str.Append(CheckLenght(GetValue(dr, "MEMO2"), 100, "备考2"));
                //日文名称
                str.Append(CheckLenght(GetValue(dr, "NAME_JP"), 100, "日文名称"));

                if (str.ToString().Trim().Length > 0)
                {
                    strError.Append(GetStringBuilder(dr, str.ToString().Trim()));
                    failureData++;
                    continue;
                }
                try
                {
                    CustomerTable                  = new BaseCustomerTable();
                    CustomerTable.CODE             = CConvert.ToString(GetValue(dr, "CODE"));
                    CustomerTable.NAME             = CConvert.ToString(GetValue(dr, "NAME"));
                    CustomerTable.NAME_SHORT       = CConvert.ToString(GetValue(dr, "NAME_SHORT"));
                    CustomerTable.NAME_ENGLISH     = CConvert.ToString(GetValue(dr, "NAME_ENGLISH"));
                    CustomerTable.ZIP_CODE         = CConvert.ToString(GetValue(dr, "ZIP_CODE"));
                    CustomerTable.ADDRESS_FIRST    = CConvert.ToString(GetValue(dr, "ADDRESS_FIRST"));
                    CustomerTable.ADDRESS_MIDDLE   = CConvert.ToString(GetValue(dr, "ADDRESS_MIDDLE"));
                    CustomerTable.ADDRESS_LAST     = CConvert.ToString(GetValue(dr, "ADDRESS_LAST"));
                    CustomerTable.PHONE_NUMBER     = CConvert.ToString(GetValue(dr, "PHONE_NUMBER"));
                    CustomerTable.FAX_NUMBER       = CConvert.ToString(GetValue(dr, "FAX_NUMBER"));
                    CustomerTable.CONTACT_NAME     = CConvert.ToString(GetValue(dr, "CONTACT_NAME"));
                    CustomerTable.MOBIL_NUMBER     = CConvert.ToString(GetValue(dr, "MOBIL_NUMBER"));
                    CustomerTable.EMAIL            = CConvert.ToString(GetValue(dr, "EMIAL"));
                    CustomerTable.URL              = CConvert.ToString(GetValue(dr, "URL"));
                    CustomerTable.MEMO             = CConvert.ToString(GetValue(dr, "MEMO"));
                    CustomerTable.TYPE             = CConvert.ToInt32(GetValue(dr, "TYPE", 1));
                    CustomerTable.CLAIM_FLAG       = CConvert.ToInt32(GetValue(dr, "CLAIM_FLAG", 1));
                    CustomerTable.CLAIM_CODE       = CConvert.ToString(GetValue(dr, "CLAIM_CODE"));
                    CustomerTable.CURRENCE_CODE    = CConvert.ToString(GetValue(dr, "CURRENCE_CODE"));
                    CustomerTable.STATUS_FLAG      = CConvert.ToInt32(GetValue(dr, "STATUS_FLAG", CConstant.NORMAL));
                    CustomerTable.MEMO2            = CConvert.ToString(GetValue(dr, "MEMO2"));
                    CustomerTable.NAME_JP          = CConvert.ToString(GetValue(dr, "NAME_JP"));
                    CustomerTable.CREATE_USER      = _userInfo.CODE;
                    CustomerTable.LAST_UPDATE_USER = _userInfo.CODE;

                    if (!bCustomer.Exists(CustomerTable.CODE))
                    {
                        bCustomer.Add(CustomerTable);
                    }
                    else
                    {
                        bCustomer.Update(CustomerTable);
                    }
                    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 });
        }
Esempio n. 10
0
        /// <summary>
        /// 导出
        /// </summary>
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtCompanyCode.Text))
            {
                MessageBox.Show("请选择公司。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(txtFilePath.Text))
            {
                MessageBox.Show("请选择保存路径。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            BaseCompanyTable    companyTable  = bCompany.GetModel(txtCompanyCode.Text.Trim());
            BllOrderHeaderTable orderTable    = bOrderH.GetModel(_slipNumber);
            BaseCustomerTable   customerTable = bCustomer.GetModel(orderTable.ENDER_CUSTOMER_CODE);

            report.Preview = previewControl1;
            DataTable dt = new DataTable();

            dt.TableName = "ds";
            dt.Columns.Add("i", System.Type.GetType("System.Decimal"));
            dt.Columns.Add("SPEC", System.Type.GetType("System.String"));
            dt.Columns.Add("QUANTITY", System.Type.GetType("System.Decimal"));
            dt.Columns.Add("PRICE", System.Type.GetType("System.Decimal"));
            dt.Columns.Add("DISCOUNT", System.Type.GetType("System.Decimal"));
            dt.Columns.Add("AMOUNT", System.Type.GetType("System.Decimal"));
            dt.Columns.Add("MATERIAL", System.Type.GetType("System.String"));
            dt.Columns.Add("MEMO", System.Type.GetType("System.String"));
            dt.Columns.Add("DESCRIPTION", System.Type.GetType("System.String"));
            dt.Columns.Add("DESCRIPTION1", System.Type.GetType("System.String"));
            int j = 1;

            foreach (BllOrderLineTable lineModel in orderTable.Items)
            {
                if (lineModel.PRICE_DISCOUNT.ToString().Equals("0.00"))
                {
                    object[] rows = { j++, lineModel.SPEC, lineModel.QUANTITY, lineModel.PRICE, null, lineModel.AMOUNT, lineModel.METERIAL, lineModel.MEMO, lineModel.DESCRIPTION, lineModel.DESCRIPTION1 };

                    dt.Rows.Add(rows);
                }
                else
                {
                    object[] rows = { j++, lineModel.SPEC, lineModel.QUANTITY, lineModel.PRICE, 0 - lineModel.PRICE_DISCOUNT, lineModel.AMOUNT, lineModel.METERIAL, lineModel.MEMO, lineModel.DESCRIPTION, lineModel.DESCRIPTION1 };
                    dt.Rows.Add(rows);
                }
            }

            DataSet ds = new DataSet();

            ds.Tables.Add(dt);

            string fileName   = "";
            string amountName = "";

            if (CConstant.LANGUAGE_CN.Equals(cboLanguage.SelectedValue))
            {
                fileName   = @"Reports\Proforma_Invoice.frx";
                amountName = NumberConvert.NumberToEnglish(CConvert.ToString(orderTable.AMOUNT_INCLUDED_TAX), false);
            }
            else if (CConstant.LANGUAGE_EN.Equals(cboLanguage.SelectedValue))
            {
                fileName   = @"Reports\Order_EN.frx";
                amountName = NumberConvert.NumberToEnglish(CConvert.ToString(orderTable.AMOUNT_INCLUDED_TAX), false);
            }

            try
            {
                if (File.Exists(fileName))
                {
                    report.Load(fileName);
                    report.SetParameterValue("CompanyName", companyTable.NAME);
                    report.SetParameterValue("EnglishCompanyName", companyTable.NAME_ENGLISH);
                    report.SetParameterValue("CompanyTel", companyTable.PHONE_NUMBER);
                    report.SetParameterValue("CompanyFax", companyTable.FAX_NUMBER);
                    report.SetParameterValue("CompanyAddress", companyTable.ADDRESS_MIDDLE);
                    report.SetParameterValue("CompanyUrl", companyTable.URL);
                    report.SetParameterValue("CompanyEmail", companyTable.EMAIL);
                    report.SetParameterValue("SlipNumber", _slipNumber);
                    report.SetParameterValue("SlipDate", CConvert.ToDateTime(orderTable.SLIP_DATE).ToString("yyyy/MM/dd"));
                    report.SetParameterValue("Currency", orderTable.CURRENCY_NAME);
                    report.SetParameterValue("CustomerName", customerTable.NAME);
                    int COUNT = 0;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (dr["DISCOUNT"].ToString() != "")
                        {
                            COUNT++;
                        }
                    }
                    if (COUNT > 0)
                    {
                        report.SetParameterValue("DISCOUNT", "Discount");
                    }

                    if (customerTable.PHONE_NUMBER.ToString() != "")
                    {
                        report.SetParameterValue("CustomerTel", "Tel:" + customerTable.PHONE_NUMBER);
                    }
                    if (customerTable.FAX_NUMBER.ToString() != "")
                    {
                        report.SetParameterValue("CustomerFax", "Fax:" + customerTable.FAX_NUMBER);
                    }
                    if (customerTable.ADDRESS_FIRST.ToString() != "")
                    {
                        report.SetParameterValue("CustomerAddress", "Address:" + customerTable.ADDRESS_FIRST);
                    }
                    report.SetParameterValue("CustomerMessage", txtMessage.Text);
                    report.SetParameterValue("DeliveryTerms", orderTable.DELIVERY_TERMS);
                    report.SetParameterValue("PaymentTerms", orderTable.PAYMENT_TERMS);
                    if (orderTable.DISCOUNT_RATE > 0)
                    {
                        report.SetParameterValue("DiscountRate", "-" + orderTable.DISCOUNT_RATE + "%");
                        report.SetParameterValue("DiscountAmount", orderTable.AMOUNT_INCLUDED_TAX);
                    }
                    report.SetParameterValue("AmountName", amountName);

                    report.SetParameterValue("FullNameEn", txtBankEn.Text);
                    report.SetParameterValue("DetailEn", rtxtDetail.Text);
                    if (companyTable.COMPANY_PICTURE != null)
                    {
                        MemoryStream ms    = new MemoryStream((byte[])companyTable.COMPANY_PICTURE);
                        Image        image = Image.FromStream(ms);
                        ((FastReport.PictureObject)report.FindObject("CompanyPicture")).Image = image;
                    }
                    if (companyTable.LOGO != null)
                    {
                        MemoryStream ms1    = new MemoryStream((byte[])companyTable.LOGO);
                        Image        image1 = Image.FromStream(ms1);
                        ((FastReport.PictureObject)report.FindObject("Logo")).Image = image1;
                    }
                    report.RegisterData(ds);
                    report.Prepare();
                    if (fileName.Equals(@"Reports\Proforma_Invoice.frx"))
                    {
                        report.Export(new FastReport.Export.Pdf.PDFExport(), this.txtFilePath.Text + "\\Proforma_Invoice" + _slipNumber + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf");
                    }
                    else
                    {
                        report.Export(new FastReport.Export.Pdf.PDFExport(), this.txtFilePath.Text + "\\Order_" + _slipNumber + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf");
                    }
                    MessageBox.Show("导出成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }

            catch (Exception ex)
            {
                Logger.Error("", ex);
            }
        }
Esempio n. 11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BaseCustomerTable model)
 {
     return(dal.Update(model));
 }
Esempio n. 12
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(BaseCustomerTable model)
 {
     return(dal.Add(model));
 }
Esempio n. 13
0
 private void FrmCustomerDialog_Load(object sender, EventArgs e)
 {
     if (_currentCustomerTable != null)
     {
         txtCode.Text          = _currentCustomerTable.CODE;
         txtName.Text          = _currentCustomerTable.NAME;
         txtNameShort.Text     = _currentCustomerTable.NAME_SHORT;
         txtEnglishName.Text   = _currentCustomerTable.NAME_ENGLISH;
         txtZipCode.Text       = _currentCustomerTable.ZIP_CODE;
         txtAddressFirst.Text  = _currentCustomerTable.ADDRESS_FIRST;
         txtAddressMiddle.Text = _currentCustomerTable.ADDRESS_MIDDLE;
         txtAddressLast.Text   = _currentCustomerTable.ADDRESS_LAST;
         txtPhone.Text         = _currentCustomerTable.PHONE_NUMBER;
         txtFax.Text           = _currentCustomerTable.FAX_NUMBER;
         txtMobilNumber.Text   = _currentCustomerTable.MOBIL_NUMBER;
         txtContactName.Text   = _currentCustomerTable.CONTACT_NAME;
         txtEmail.Text         = _currentCustomerTable.EMAIL;
         txtURL.Text           = _currentCustomerTable.URL;
         txtMemo.Text          = _currentCustomerTable.MEMO;
         txtMemo2.Text         = _currentCustomerTable.MEMO2;
         txtClaimCode.Text     = _currentCustomerTable.CLAIM_CODE;
         BaseCustomerTable customerTable = bCustomer.GetModel(txtClaimCode.Text);
         txtClaimName.Text    = customerTable.NAME;
         txtCurrencyCode.Text = _currentCustomerTable.CURRENCE_CODE;
         txtCurrencyName.Text = _currentCustomerTable.CURRENCE_NAME;
         txtName_Japan.Text   = _currentCustomerTable.NAME_JP;
         if (_currentCustomerTable.TYPE == 1)
         {
             rType1.Checked = true;
         }
         else
         {
             rType2.Checked = true;
         }
         if (_currentCustomerTable.CLAIM_FLAG == 1)
         {
             rClaim1.Checked = true;
         }
         else
         {
             rClaim2.Checked      = true;
             txtClaimCode.Enabled = true;
         }
     }
     if (_mode == CConstant.MODE_NEW)
     {
         this.Text            = "新建";
         btnClaim.Enabled     = false;
         txtClaimCode.Enabled = false;
         txtClaimName.Enabled = false;
     }
     else if (_mode == CConstant.MODE_MODIFY)
     {
         this.Text         = "编辑";
         txtCode.BackColor = Color.WhiteSmoke;
         txtCode.Enabled   = false;
     }
     else if (_mode == CConstant.MODE_COPY)
     {
         this.Text    = "新建";
         txtCode.Text = "";
     }
 }
Esempio n. 14
0
        /// <summary>
        /// 保存
        /// </summary>
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                if (_currentCustomerTable == null)
                {
                    _currentCustomerTable = new BaseCustomerTable();
                }
                _currentCustomerTable.CODE             = txtCode.Text;
                _currentCustomerTable.NAME             = txtName.Text;
                _currentCustomerTable.NAME_SHORT       = txtNameShort.Text;
                _currentCustomerTable.NAME_ENGLISH     = txtEnglishName.Text;
                _currentCustomerTable.ZIP_CODE         = txtZipCode.Text;
                _currentCustomerTable.ADDRESS_FIRST    = txtAddressFirst.Text;
                _currentCustomerTable.ADDRESS_MIDDLE   = txtAddressMiddle.Text;
                _currentCustomerTable.ADDRESS_LAST     = txtAddressLast.Text;
                _currentCustomerTable.PHONE_NUMBER     = txtPhone.Text;
                _currentCustomerTable.FAX_NUMBER       = txtFax.Text;
                _currentCustomerTable.MOBIL_NUMBER     = txtMobilNumber.Text;
                _currentCustomerTable.CONTACT_NAME     = txtContactName.Text;
                _currentCustomerTable.EMAIL            = txtEmail.Text;
                _currentCustomerTable.URL              = txtURL.Text;
                _currentCustomerTable.MEMO             = txtMemo.Text;
                _currentCustomerTable.MEMO2            = txtMemo2.Text;
                _currentCustomerTable.CLAIM_CODE       = txtClaimCode.Text;
                _currentCustomerTable.CURRENCE_CODE    = txtCurrencyCode.Text;
                _currentCustomerTable.LAST_UPDATE_USER = _userInfo.CODE;
                _currentCustomerTable.NAME_JP          = txtName_Japan.Text.Trim();
                if (rType1.Checked)
                {
                    _currentCustomerTable.TYPE = 1;
                }
                else
                {
                    _currentCustomerTable.TYPE = 2;
                }

                if (rClaim1.Checked)
                {
                    _currentCustomerTable.CLAIM_FLAG = 1;
                    btnClaim.Enabled     = false;
                    txtClaimCode.Enabled = false;
                    txtClaimName.Enabled = false;
                }
                else
                {
                    _currentCustomerTable.CLAIM_FLAG = 2;
                    btnClaim.Enabled     = true;
                    txtClaimCode.Enabled = false;
                }

                try
                {
                    if (bCustomer.Exists(txtCode.Text.Trim()))
                    {
                        bCustomer.Update(_currentCustomerTable);
                    }
                    else
                    {
                        _currentCustomerTable.CREATE_USER = _userInfo.CODE;
                        bCustomer.Add(_currentCustomerTable);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                result = DialogResult.OK;
                this.Close();
            }
        }