protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_esoppicsFacade == null) { _esoppicsFacade = new EsopPicsFacade(base.DataProvider); } this._esoppicsFacade.DeleteEsoppics((Esoppics[])domainObjects.ToArray(typeof(Esoppics))); string filaPath = ""; if (_facade == null) { _facade = new SystemSettingFacade(this.DataProvider); } //object parameter = _facade.GetParameter("PICUPLOADPATH", "ESOPPICDIRPATHGROUP"); //if (parameter != null) //{ //服务器目录路径 filaPath = System.AppDomain.CurrentDomain.BaseDirectory + "ESFileUpload";//((Domain.BaseSetting.Parameter)parameter).ParameterAlias; //} DirectoryInfo dir = new DirectoryInfo(filaPath); foreach (FileInfo file in dir.GetFiles()) { foreach (Esoppics pic in domainObjects) { if (file.Name == pic.Picfullname + ".jpg") { file.Delete(); } } } }
protected override int GetRowCount() { if (_esoppicsFacade == null) { _esoppicsFacade = new EsopPicsFacade(this.DataProvider); } return(this._esoppicsFacade.QueryEsopPicsCount(FormatHelper.CleanString(this.txtItemlistQuery.Text), FormatHelper.CleanString(this.txtOplistQuery.Text))); }
public FCollectionEsopPicNGView() { InitializeComponent(); this.m_MOFacade = new MOFacade(this.DataProvider); this.m_ItemFacade = new ItemFacade(this.DataProvider); this.m_EsopPicsFacade = new EsopPicsFacade(this.DataProvider); this.m_DataCollectFacade = new DataCollectFacade(this.DataProvider); this._facade = new SystemSettingFacade(this.DataProvider); this.m_EsopPicsNGFacade = new EsopPicsNGFacade(this.DataProvider); this._tsFacade = new TSFacade(this.DataProvider); //this.InitPageLanguage(); }
protected override object[] LoadDataSource(int inclusive, int exclusive) { if (_esoppicsFacade == null) { _esoppicsFacade = new EsopPicsFacade(this.DataProvider); } return(this._esoppicsFacade.QueryEsopPics(FormatHelper.CleanString(this.txtItemlistQuery.Text), FormatHelper.CleanString(this.txtOplistQuery.Text), inclusive, exclusive )); }
protected override object GetEditObject(GridRecord row) { if (_esoppicsFacade == null) { _esoppicsFacade = new BaseModelFacadeFactory(base.DataProvider).CreateEsopPicsFacade(); } object obj = this._esoppicsFacade.GetEsoppics(row.Items.FindItemByKey("SERIAL").Text.ToString()); if (obj != null) { return((Esoppics)obj); } return(null); }
protected override object GetEditObject() { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); if (_esoppicsFacade == null) { _esoppicsFacade = new EsopPicsFacade(base.DataProvider); } Esoppics pic = this._esoppicsFacade.CreateNewEsoppics(); if (string.IsNullOrEmpty(this.HiddenPicSerial.Text)) { pic.Serial = ((Esoppics)_esoppicsFacade.GetEsoppicNextSerial()[0]).Serial; } else { pic.Serial = this.HiddenPicSerial.Text; } string picType = string.Empty; if (chkOInstruction.Checked) { picType = PicType.Operating_Instructions; } if (chkMInstruction.Checked) { picType += ("," + PicType.Maintenance_instructions); picType = picType.Trim(','); } pic.Itemcode = FormatHelper.CleanString(this.txtItemCode.Text, 40); pic.Picseq = Convert.ToInt32(this.txtPICOrderEdit.Text.Trim()); pic.Opcode = FormatHelper.CleanString(this.txtOplist.Text, 40); pic.Pictitle = FormatHelper.CleanString(this.txtPICTitleEdit.Text, 100); pic.Picmemo = FormatHelper.CleanString(this.txtPICMemoEdit.Text, 40); //pic.Pictype = FormatHelper.CleanString(this.DropdownlistPICType.SelectedValue); pic.Pictype = picType; pic.Picfullname = pic.Itemcode + "_" + pic.Opcode + "_" + pic.Serial; pic.Muser = this.GetUserCode(); pic.Mdate = dbDateTime.DBDate; pic.Mtime = dbDateTime.DBTime; return(pic); }
public FCollectionEsopPicNGEdit() { InitializeComponent(); this.m_MOFacade = new MOFacade(this.DataProvider); this.m_ItemFacade = new ItemFacade(this.DataProvider); this.m_EsopPicsFacade = new EsopPicsFacade(this.DataProvider); this.m_DataCollectFacade = new DataCollectFacade(this.DataProvider); this._facade = new SystemSettingFacade(this.DataProvider); this.m_EsopPicsNGFacade = new EsopPicsNGFacade(this.DataProvider); this._tsFacade = new TSFacade(this.DataProvider); imageListCache = new List <Image>(); ((Control)this).MouseWheel += new MouseEventHandler(FormDemo_MouseWheel); this.colorDialog = new System.Windows.Forms.ColorDialog(); this.btnColor.BackColor = Color.Red; //this.InitPageLanguage(); }
protected override void UpdateDomainObject(object domainObject) { if (_esoppicsFacade == null) { _esoppicsFacade = new EsopPicsFacade(base.DataProvider); } this.DataProvider.BeginTransaction(); Esoppics pic = (Esoppics)domainObject; object[] items = _esoppicsFacade.CheckEsoppicExist((Esoppics)domainObject); if (items != null && items.Length > 0) { if (items.Length == 1 && ((Esoppics)items[0]).Serial == this.HiddenPicSerial.Text) { this._esoppicsFacade.UpdateEsoppics((Esoppics)domainObject); if (UpLoadFile("EDIT", (Esoppics)domainObject)) { this.DataProvider.CommitTransaction(); WebInfoPublish.PublishInfo(this, "$ReportDesign_Save_Success", this.languageComponent1); } else { this.DataProvider.RollbackTransaction(); } } else { WebInfoPublish.PublishInfo(this, "$Error_Primary_Key_Overlap", this.languageComponent1); return; } } else { this._esoppicsFacade.UpdateEsoppics((Esoppics)domainObject); if (UpLoadFile("EDIT", (Esoppics)domainObject)) { this.DataProvider.CommitTransaction(); WebInfoPublish.PublishInfo(this, "$ReportDesign_Save_Success", this.languageComponent1); } else { this.DataProvider.RollbackTransaction(); } } }
protected override void AddDomainObject(object domainObject) { if (_esoppicsFacade == null) { _esoppicsFacade = new EsopPicsFacade(base.DataProvider); } this.DataProvider.BeginTransaction(); object[] items = _esoppicsFacade.CheckEsoppicExist((Esoppics)domainObject); if (items != null && items.Length > 0) { WebInfoPublish.PublishInfo(this, "$Error_Primary_Key_Overlap", this.languageComponent1); return; } this._esoppicsFacade.AddEsoppics((Esoppics)domainObject); if (UpLoadFile("ADD", (Esoppics)domainObject)) { this.DataProvider.CommitTransaction(); } else { this.DataProvider.RollbackTransaction(); } }
private void DoQuery(string ItemCode, string OpCode) { Messages msg = new Messages(); try { if (m_EsopPicsFacade == null) { m_EsopPicsFacade = new EsopPicsFacade(this.DataProvider); } object[] EsopPics = this.m_EsopPicsFacade.QueryEsopPics(ItemCode, OpCode); int imgnum = 0; if (EsopPics != null && EsopPics.Length > 0) { this.imageList1.Images.Clear(); string filaPath = ""; if (_facade == null) { _facade = new SystemSettingFacade(this.DataProvider); } object parameter = _facade.GetParameter("PUBLISHESOPPICSDIRPATH", "PUBLISHEOPSPICSDIRPATHGROUP"); if (parameter != null) { //服务器目录路径 filaPath = ((Domain.BaseSetting.Parameter)parameter).ParameterAlias; } foreach (Esoppics pic in EsopPics) { string fileName = filaPath + pic.Picfullname + ".jpg"; try { WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; // wc.DownloadData(fileName); Stream fs = wc.OpenRead(fileName); this.imageList1.Images.Add(Image.FromStream(fs)); ListViewItem lvi = new ListViewItem(); lvi.Text = pic.Picfullname; //图片名称 lvi.ImageIndex = imgnum; //这里是Listview每项显示的图片 lvi.Tag = pic; //这里绑定不显示的数据 this.listEsopPicsView.Items.Add(lvi); fs.Dispose(); fs.Flush(); fs.Close(); imgnum++; } catch (Exception ex) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_FileReadError")); ApplicationRun.GetInfoForm().Add(msg); return; } } if (this.imageList1.Images.Count > 0) { this.imageList1.ColorDepth = ColorDepth.Depth32Bit; Size size = new Size(); size.Width = 100; size.Height = 82; this.imageList1.ImageSize = size; this.listEsopPicsView.LargeImageList = this.imageList1; this.listEsopPicsView.MultiSelect = false; } } else { msg.Add(new UserControl.Message(MessageType.Success, "$File_Not_Exist")); ApplicationRun.GetInfoForm().Add(msg); } } catch (Exception ex) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_FileReadError")); ApplicationRun.GetInfoForm().Add(msg); clearAll(); return; } }
protected override void SetEditObject(object obj) { if (_esoppicsFacade == null) { _esoppicsFacade = new BaseModelFacadeFactory(base.DataProvider).CreateEsopPicsFacade(); } if (obj == null) { this.txtItemCode.Text = string.Empty; this.txtOplist.Text = string.Empty; this.txtPICMemoEdit.Text = string.Empty; this.txtPICOrderEdit.Text = string.Empty; this.txtPICTitleEdit.Text = string.Empty; this.HiddenPicFullName.Text = string.Empty; //this.imgPic.Visible = false; this.imgPic.ImageUrl = ""; imgPicLink.Attributes["target"] = "_self"; imgPicLink.Attributes["href"] = "#"; this.HiddenPicSerial.Text = string.Empty; this.chkOInstruction.Checked = false; this.chkMInstruction.Checked = false; return; } this.txtItemCode.Text = ((Esoppics)obj).Itemcode.ToString(); this.txtOplist.Text = ((Esoppics)obj).Opcode.ToString(); //try //{ // this.DropdownlistPICType.SelectedValue = ((Esoppics)obj).Pictype.ToString(); //} //catch //{ // this.DropdownlistPICType.SelectedIndex = 0; //} this.chkOInstruction.Checked = ((Esoppics)obj).Pictype.IndexOf(PicType.Operating_Instructions) >= 0; this.chkMInstruction.Checked = ((Esoppics)obj).Pictype.IndexOf(PicType.Maintenance_instructions) >= 0; this.txtPICOrderEdit.Text = ((Esoppics)obj).Picseq.ToString(); this.txtPICMemoEdit.Text = ((Esoppics)obj).Picmemo.ToString(); this.txtPICTitleEdit.Text = ((Esoppics)obj).Pictitle.ToString(); this.HiddenPicFullName.Text = ((Esoppics)obj).Picfullname.ToString(); this.HiddenPicSerial.Text = ((Esoppics)obj).Serial.ToString(); try { if (_facade == null) { _facade = new SystemSettingFacade(this.DataProvider); } //object parameter = _facade.GetParameter("PICUPLOADPATH", "ESOPPICDIRPATHGROUP"); //if (parameter != null) //{ //服务器目录路径 string fileFullName = System.AppDomain.CurrentDomain.BaseDirectory + "ESFileUpload//" + (obj as Esoppics).Picfullname + ".jpg"; if (File.Exists(fileFullName)) { Response.Cache.SetCacheability(HttpCacheability.NoCache); //this.imgPic.Visible = true; this.imgPic.ImageUrl = this.VirtualHostRoot + "ESFileUpload//" + ((Esoppics)obj).Picfullname + ".jpg?i=" + DateTime.Now.Ticks; imgPicLink.Attributes["target"] = "_blank"; imgPicLink.Attributes["href"] = this.imgPic.ImageUrl; //this.imgPic.ImageUrl = "ShowImg.aspx?PICFULLNAME=" + file.Name; } else { //this.imgPic.Visible = false; this.imgPic.ImageUrl = ""; imgPicLink.Attributes["target"] = "_self"; imgPicLink.Attributes["href"] = "#"; } //} } catch (Exception ex) { WebInfoPublish.PublishInfo(this, "$Error_PicDirPath_NotExist", this.languageComponent1); return; } }