private void SimpleButtonAddFile_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; if (ofd.ShowDialog(this) == DialogResult.OK) { foreach (string fn in ofd.FileNames) { FilesAccessoriesHelper fh = new FilesAccessoriesHelper(); fh.FileFullname = fn; fh.Filename = fn.Substring(fn.LastIndexOf("\\") + 1); FileInfo fi = new FileInfo(fn); fh.Filesize = fi.Length.ToString(); if (!this._FilesAccessoriesHelper.Contains(fh)) { this._FilesAccessoriesHelper.Add(fh); } } this.gridControl1.RefreshDataSource(); } }
//点击附件名称,打开附件 private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e) { FilesAccessoriesHelper fss = this.bindingSourceFiles.Current as FilesAccessoriesHelper; System.Diagnostics.Process.Start(fss.FileFullname); }
public override void Refresh() { if (this._ProductMouldTest == null) { this.AddNew(); this.action = "insert"; } //else //{ // if (this.action == "view") // this._ProductMouldTest = this._ProductMouldTestManager.Get(this._ProductMouldTest.ProductMouldTestId); //} this.TxtMouldTestId.Text = this._ProductMouldTest.ProductMouldTestId; this.TxtProductWeigth.Text = this._ProductMouldTest.MouldWeight.ToString(); this.LookPrductMaterial.EditValue = this._ProductMouldTest.ProductMaterialId; this.LookMould.EditValue = this._ProductMouldTest.MouldId; this.LookTestMouldMachine.EditValue = this._ProductMouldTest.PronoteMachineId; this.NccSupplier.EditValue = this._ProductMouldTest.Supplier; this.ComboxInstallType.EditValue = this._ProductMouldTest.InstallType == null ? "" : this._ProductMouldTest.InstallType.ToString(); this.CheckMouldInjectionType.Checked = this._ProductMouldTest.MouldInjectionType.HasValue ? this._ProductMouldTest.MouldInjectionType.Value : false; this.CheckMouldStrengthenType.Checked = this._ProductMouldTest.MouldStrengthenType.HasValue ? this._ProductMouldTest.MouldStrengthenType.Value : false; this.CheckClearType.Checked = this._ProductMouldTest.ClearType.HasValue ? this._ProductMouldTest.ClearType.Value : false; this.CheckOpticsType.Checked = this._ProductMouldTest.OpticsType.HasValue ? this._ProductMouldTest.OpticsType.Value : false; this.CheckLaserType.Checked = this._ProductMouldTest.LaserType.HasValue ? this._ProductMouldTest.LaserType.Value : false; this.CheckImpaceType.Checked = this._ProductMouldTest.ImpaceType.HasValue ? this._ProductMouldTest.ImpaceType.Value : false; this.CheckContentType.Checked = this._ProductMouldTest.Content.HasValue ? this._ProductMouldTest.Content.Value : false; this.CheckContentBool.Checked = this._ProductMouldTest.ContentType.HasValue ? this._ProductMouldTest.ContentType.Value : false; this.RadioClearBool.SelectedIndex = this._ProductMouldTest.ClearBool.HasValue ? (this._ProductMouldTest.ClearBool.HasValue ? 0 : 1) : 0; this.RadioOpticsBool.SelectedIndex = this._ProductMouldTest.OpticsBool.HasValue ? (this._ProductMouldTest.OpticsBool.HasValue ? 0 : 1) : 0; this.RadioLaserBool.SelectedIndex = this._ProductMouldTest.LaserBool.HasValue ? (this._ProductMouldTest.LaserBool.HasValue ? 0 : 1) : 0; this.RadioInstallBool.SelectedIndex = this._ProductMouldTest.InstallBool.HasValue ? (this._ProductMouldTest.InstallBool.HasValue ? 0 : 1) : 0; this.RadioImpactBool.SelectedIndex = this._ProductMouldTest.ImpactBool.HasValue ? (this._ProductMouldTest.ImpactBool.HasValue ? 0 : 1) : 0; this.ComboxMouldMount.Text = this._ProductMouldTest.MouldMount == null ? "" : this._ProductMouldTest.MouldMount.ToString(); if (!string.IsNullOrEmpty(this._ProductMouldTest.MouldSize)) { string[] ckg = new string[3]; ckg = this._ProductMouldTest.MouldSize.Split('*'); this.TxtMouldLength.Text = ckg[0]; this.TxtMouldWidth.Text = ckg[1]; this.TxtMouldHeight.Text = ckg[2]; } else { this.TxtMouldLength.Text = ""; this.TxtMouldWidth.Text = ""; this.TxtMouldHeight.Text = ""; } if (!string.IsNullOrEmpty(this._ProductMouldTest.ContentDetail)) { string[] cckd = new string[3]; cckd = this._ProductMouldTest.ContentDetail.Split('*'); this.TxtContentDetail1.Text = cckd[0]; this.TxtContentDetail2.Text = cckd[1]; this.TxtContentDetail3.Text = cckd[2]; } else { this.TxtContentDetail1.Text = ""; this.TxtContentDetail2.Text = ""; this.TxtContentDetail3.Text = ""; } this.TxtDevelopDetail.Text = this._ProductMouldTest.DevelopRemarks; this.DateMouldTest.EditValue = this._ProductMouldTest.ProductMouldTestDate; this.DateInTime.EditValue = this._ProductMouldTest.InFactoryDate; this.DateOutTime.EditValue = this._ProductMouldTest.OutFactoryDate; this.DateMouldInjection.EditValue = this._ProductMouldTest.MouldInjectionDate; this.DateMouldStrengthen.EditValue = this._ProductMouldTest.MouldStrengthenDate; this.DateFourWayDate.EditValue = this._ProductMouldTest.FourWayDate; this.DateImpact.EditValue = this._ProductMouldTest.ImpactDate; this.DateContent.EditValue = this._ProductMouldTest.ContentDate; this.DateDevelopDetail.EditValue = this._ProductMouldTest.DevelopRemarksDate; this.NccMouldInjectionPerson.EditValue = this._ProductMouldTest.Emp_Employee; this.NccMouldStrengthenPerson.EditValue = this._ProductMouldTest.Emp_Employee2; this.NccMouldTestPerson.EditValue = this._ProductMouldTest.Employee; this.NccDevelopDetailPerson.EditValue = this._ProductMouldTest.Emp_Employee6; this.NccFourWayPerson.EditValue = this._ProductMouldTest.Emp_Employee3; this.NccImpactPerson.EditValue = this._ProductMouldTest.Emp_Employee4; this.NccContent.EditValue = this._ProductMouldTest.Emp_Employee5; this.NccManagerOne.EditValue = this._ProductMouldTest.Emp_Employee7; this.NccManagerTwo.EditValue = this._ProductMouldTest.Emp_Employee8; this.meInjectionNote.EditValue = this._ProductMouldTest.InjectionNote; this.meStrengThenNote.EditValue = this._ProductMouldTest.StrengThenNote; this.meQualityControlNote.EditValue = this._ProductMouldTest.QualityControlNote; this.lookUpEditProductCategory.EditValue = this._ProductMouldTest.ProductCategoryId; this._FilesAccessoriesHelper.Clear(); //通过主键查看附件 if (Directory.Exists(this._Saveseverpath + "\\" + this._ProductMouldTest.ProductMouldTestId)) { string[] filenames = Directory.GetFiles(this._Saveseverpath + "\\" + this._ProductMouldTest.ProductMouldTestId); string[] eachDesc = null; if (this._ProductMouldTest.EachMouldDesc != null) { eachDesc = this._ProductMouldTest.EachMouldDesc.Split('|'); } foreach (string fn in filenames) { FilesAccessoriesHelper fss = new FilesAccessoriesHelper(); fss.Filename = fn.Substring(fn.LastIndexOf("\\") + 1); fss.FileFullname = fn; FileInfo fi = new FileInfo(fss.FileFullname); fss.Filesize = fi.Length.ToString(); if (eachDesc != null && eachDesc.Length > 0) { foreach (string desc in eachDesc) { if (desc.Substring(0, desc.LastIndexOf('\\')) == fss.Filename) { fss.Description = desc.Substring(desc.LastIndexOf('\\') + 1); } } } this._FilesAccessoriesHelper.Add(fss); } } this.bindingSourceFiles.DataSource = this._FilesAccessoriesHelper; this.gridControl1.RefreshDataSource(); base.Refresh(); this.TxtMouldTestId.Enabled = false; }