コード例 #1
0
        //点击附件名称,打开附件
        private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e)
        {
            MailAccessoriesHelper mah = this.bindingSource1.Current as MailAccessoriesHelper;

            System.Diagnostics.Process.Start(mah.FileFullName);
        }
コード例 #2
0
        public override void Refresh()
        {
            if (this._pcExpANSIDetail == null)
            {
                this.AddNew();
                this.action = "insert";
            }

            this.txtPCExportReportANSIDetailId.Text = this._pcExpANSIDetail.PCExportReportANSIDetailId;
            this.txtInvoiceCusXOId.Text             = this._pcExpANSIDetail.InvoiceCusXOId;
            this.dateEditCheckDate.EditValue        = this._pcExpANSIDetail.CheckDate.HasValue ? this._pcExpANSIDetail.CheckDate.Value : DateTime.Now;
            this.calcMustCheckSum.EditValue         = this._pcExpANSIDetail.MustCheckSum.HasValue ? this._pcExpANSIDetail.MustCheckSum.Value : 0;
            this.calcInvoiceQuantity.EditValue      = this._pcExpANSIDetail.InvoiceQuantity.HasValue ? this._pcExpANSIDetail.InvoiceQuantity.Value : 0;
            this.calcPassSum.EditValue     = this._pcExpANSIDetail.PassSum.HasValue ? this._pcExpANSIDetail.PassSum.Value : 0;
            this.calcHasCheckSum.EditValue = this._pcExpANSIDetail.HasCheckSum.HasValue ? this._pcExpANSIDetail.HasCheckSum.Value : 0;
            this.calcFaildSum.EditValue    = this.calcHasCheckSum.Value - this.calcPassSum.Value;
            this.btnEditProduct.EditValue  = this._pcExpANSIDetail.Product;
            this.nccEmployee.EditValue     = this._pcExpANSIDetail.Employee;
            this.nccCustomer.EditValue     = this._pcExpANSIDetail.Customer;
            this.txtRemark.Text            = this._pcExpANSIDetail.Remark;
            this.lookUpEditUnit.EditValue  = this._pcExpANSIDetail.ProductUnitId;
            //组合附件源 附件记录形式:FileName|FileName *文件名=>'\FilePath\FileName'
            //if (!string.IsNullOrEmpty(this._pcExpANSIDetail.accessoriesList))
            //{
            //    string[] accessories = this._pcExpANSIDetail.accessoriesList.Split('|');
            //    foreach (string acc in accessories)
            //    {
            //        MailAccessoriesHelper mah = new MailAccessoriesHelper();
            //        //mah.FileName = this._ServerSavePath + acc;
            //        mah.FileFullName = acc;
            //        FileInfo fi = new FileInfo(this._ServerSavePath + acc);
            //        mah.FileSize = fi.Length.ToString();
            //        this._mailAccessorList.Add(mah);
            //    }
            //}

            this._mailAccessorList.Clear();     //清除所有项目

            //查看附件,通过主键路径查找,如果没有则数据为空
            if (Directory.Exists(this._ServerSavePath + "\\" + this._pcExpANSIDetail.PCExportReportANSIDetailId))
            {
                string[] filenames = Directory.GetFiles(this._ServerSavePath + "\\" + this._pcExpANSIDetail.PCExportReportANSIDetailId);
                foreach (string fn in filenames)
                {
                    MailAccessoriesHelper mah = new MailAccessoriesHelper();
                    mah.FileName     = fn.Substring(fn.LastIndexOf("\\") + 1); //这里直接使用文件名.不包含路径
                    mah.FileFullName = fn;
                    FileInfo fi = new FileInfo(mah.FileFullName);
                    mah.FileSize = fi.Length.ToString();
                    this._mailAccessorList.Add(mah);
                }
            }

            this.bindingSource1.DataSource = this._mailAccessorList;
            base.Refresh();

            switch (this.action)
            {
            case "insert":
                this.barBtnSearch.Enabled          = false;
                this.barBtnChooseInvoiceXO.Enabled = true;
                break;

            case "update":
                this.barBtnSearch.Enabled          = false;
                this.barBtnChooseInvoiceXO.Enabled = true;
                break;

            case "view":
                this.barBtnSearch.Enabled          = true;
                this.barBtnChooseInvoiceXO.Enabled = false;
                break;
            }

            this.txtPCExportReportANSIDetailId.Properties.ReadOnly = true;
            this.calcMustCheckSum.Enabled    = false;       //受测数量不能修改,计算带出
            this.calcFaildSum.Enabled        = false;       //不合格数量通过合格数量算出,不需要修改,不需要存储
            this.calcInvoiceQuantity.Enabled = false;
            this.txtInvoiceCusXOId.Enabled   = false;
            this.nccCustomer.Enabled         = false;
            this.btnEditProduct.Enabled      = false;
            //this.barManager1.Items["barButtonitemAllAttachment"].Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            //this.bar1.ItemLinks[11].Visible = false;
        }