private void WriteRdlcIntoDb() { PharmacyFile ph = new PharmacyFile(); ph.CreateTime = DateTime.Now; //ph.CreateUserId=Common.AppClientContext.currentUser.Id; ph.Deleted = false; ph.Extension = "rdlc"; ph.FileName = "SalesOrderList"; ph.Id = Guid.NewGuid(); ph.StoreId = this.PharmacyDatabaseService.AllStores(out msg).FirstOrDefault().Id; ph.UpdateTime = DateTime.Now; //ph.UpdateUserId=Common.AppClientContext.currentUser.Id; //Microsoft.Reporting.WinForms.LocalReport lr = new Microsoft.Reporting.WinForms.LocalReport(); System.Reflection.Assembly dll = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream s = dll.GetManifestResourceStream("BugsBox.Pharmacy.AppClient.UI.Reports.RptSalesOrderListCS.rdlc"); System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); s.Position = 0; byte[] b = new byte[s.Length]; s.Read(b, 0, (int)s.Length); ph.FileStream = b; var i = this.PharmacyDatabaseService.AddPharmacyFile(out msg, ph); }
/// <summary> /// 从服务端获取证书 /// </summary> /// <returns></returns> private bool LoadPharmacyFile() { try { if (pharmacyFile != null && pharmacyFile.Id != Guid.Empty) { // string msg; ////pharmacyFile = service.GetPharmacyFile(out msg, pharmacyFile.Id); //if (pharmacyFile == null || !string.IsNullOrWhiteSpace(msg)) //{ // MessageBox.Show("该证书不存在" + msg, "文件上传", MessageBoxButtons.OK, MessageBoxIcon.Stop); //} return(true); } return(false); } catch (Exception ex) { pharmacyFile = null; LoggerHelper.Instance.Error(ex); MessageBox.Show("从服务器获取证书失败" + ex.Message, "上传", MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } }
private void buttonReset_Click(object sender, EventArgs e) { selectedFile = string.Empty; pharmacyFile = oldPharmacyFile; DeleteNotUsedFile(); PreviewPicture(false); }
/// <summary> /// 选择本地图片 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonSelect_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog(this) == DialogResult.OK && !string.IsNullOrWhiteSpace(openFileDialog1.FileName) && File.Exists(openFileDialog1.FileName) ) { DeleteNotUsedFile(); selectedFile = openFileDialog1.FileName; pharmacyFile = new PharmacyFile(); pharmacyFile.Id = Guid.NewGuid(); pharmacyFile.UpdateUserId = AppClientContext.CurrentUser == null ? Guid.Empty : AppClientContext.CurrentUser.Id; pharmacyFile.FileName = Path.GetFileName(selectedFile); pharmacyFile.UpdateTime = DateTime.Now; pharmacyFile.CreateTime = pharmacyFile.UpdateTime; pharmacyFile.CreateUserId = pharmacyFile.UpdateUserId; pharmacyFile.Extension = Path.GetExtension(selectedFile); PreviewPicture(true); this.buttonUpload.Enabled = true; this.buttonReset.Enabled = true; } }