Example #1
0
 public SysAttachInfo GetSysAttachInfoById(string Id)
 {
     using (ISysAttachInfoBLL SysAttachInfoBLL = BLLContainer.Resolve <ISysAttachInfoBLL>())
     {
         SysAttachInfo model = SysAttachInfoBLL.GetFirstOrDefault(Id);
         return(model);
     }
 }
Example #2
0
 public bool AddSysAttachInfo(SysAttachInfo mSysAttachInfo)
 {
     if (mSysAttachInfo == null)
     {
         return(false);
     }
     using (ISysAttachInfoBLL SysAttachInfoBLL = BLLContainer.Resolve <ISysAttachInfoBLL>())
     {
         return(SysAttachInfoBLL.Add(mSysAttachInfo));
     }
 }
Example #3
0
        //删除
        private void delAttach_Click(object sender, RoutedEventArgs e)
        {
            if (DEVDialog.ConfirmDelete() == DialogResult.Cancel)
            {
                return;
            }
            SysAttachInfo sysAttach = (SysAttachInfo)gridView.GetFocusedRow();

            _wsClient.UseService(s => s.DelSysAttachInfo(sysAttach.PKNO));
            BindGridView();
        }
Example #4
0
 public bool DelSysAttachInfo(string Id)
 {
     using (ISysAttachInfoBLL SysAttachInfoBLL = BLLContainer.Resolve <ISysAttachInfoBLL>())
     {
         try
         {
             SysAttachInfo item = SysAttachInfoBLL.GetFirstOrDefault(Id);
             return(SysAttachInfoBLL.Delete(item));
         }
         catch { return(false); }
     }
 }
Example #5
0
 public bool DelSysAttachInfos(string[] Ids)
 {
     using (ISysAttachInfoBLL SysAttachInfoBLL = BLLContainer.Resolve <ISysAttachInfoBLL>())
     {
         try
         {
             List <SysAttachInfo> entitys = new List <SysAttachInfo>();
             foreach (string id in Ids)
             {
                 SysAttachInfo item = SysAttachInfoBLL.GetFirstOrDefault(id);
                 entitys.Add(item);
             }
             return(SysAttachInfoBLL.Delete(entitys));
         }
         catch { return(false); }
     }
 }
Example #6
0
        //上传至数据库
        private void UploadIMG(string path)
        {
            try
            {
                // byte[] img = File.ReadAllBytes(path);
                SysAttachInfo sysAttach = new SysAttachInfo();
                {
                    sysAttach.PKNO             = Guid.NewGuid().ToString();
                    sysAttach.BELONGFUNCTION   = BelongFunction;
                    sysAttach.FUNCTIONPKNO     = FunctionPKNO;
                    sysAttach.GROUPNO          = GroupNo;
                    sysAttach.ATTACHNAME       = Path.GetFileNameWithoutExtension(path);
                    sysAttach.ATTACHMANAGEMODE = 0;
                    sysAttach.ATTACHFORMATE    = Path.GetExtension(path);
                    sysAttach.ATTACHSTORETYPE  = 1;
                    //sysAttach.ATTACHINTROD = "111";
                    sysAttach.ATTACHINFO = FileHelper.FileToBytes(path);
                    //sysAttach.ISEQ = 0;
                    sysAttach.CREATED_BY       = CBaseData.LoginName;
                    sysAttach.CREATION_DATE    = DateTime.Now;
                    sysAttach.UPDATED_BY       = CBaseData.LoginName;
                    sysAttach.LAST_UPDATE_DATE = DateTime.Now;
                    //sysAttach.UPDATED_INTROD = "无修改";
                    sysAttach.ISTATE = Istate;
                    //sysAttach.REMARK = "ooo";
                }
                if (_wsClient.UseService(s => s.AddSysAttachInfo(sysAttach)))
                {
                    NotificationInvoke.NewNotification("提示", "文件上传成功!");
                    BindGridView();
                }

                else
                {
                    NotificationInvoke.NewNotification("提示", "文件上传失败!");
                }
            }

            catch (Exception ex)
            {
                NotificationInvoke.NewNotification("异常提示", ex.ToString());
            }
        }
Example #7
0
        private void btnDownLoad_Click_1(object sender, RoutedEventArgs e)
        {
            SysAttachInfo tempAttachInfo = (SysAttachInfo)gridView.GetFocusedRow();

            if (tempAttachInfo == null)
            {
                return;
            }

            Microsoft.Win32.SaveFileDialog dlg0 = new Microsoft.Win32.SaveFileDialog();
            dlg0.FileName   = tempAttachInfo.ATTACHNAME;
            dlg0.DefaultExt = tempAttachInfo.ATTACHFORMATE;

            if (dlg0.ShowDialog() != true)
            {
                return;
            }

            this.Cursor = System.Windows.Input.Cursors.Wait;

            string filename = dlg0.FileName;

            try
            {
                SysAttachInfo sysAttachInfo = _wsClient.UseService(s => s.GetSysAttachInfoById(tempAttachInfo.PKNO));
                if (sysAttachInfo == null)
                {
                    this.Cursor = System.Windows.Input.Cursors.Arrow;
                    return;
                }

                FileHelper.BytesToFile(sysAttachInfo.ATTACHINFO, filename);
                this.Cursor = System.Windows.Input.Cursors.Arrow;

                NotificationInvoke.NewNotification("提示", "文件成功下载到:" + filename);
            }
            catch (Exception)
            {
                this.Cursor = System.Windows.Input.Cursors.Arrow;
                DEVDialog.ShowError("下载失败");
            }
        }
Example #8
0
        //查看明细
        private void SimpleButton_Click(object sender, RoutedEventArgs e)
        {
            this.Cursor = System.Windows.Input.Cursors.Wait;
            try
            {
                SysAttachInfo tempAttachInfo = (SysAttachInfo)gridView.GetFocusedRow();

                SysAttachInfo sysAttach = _wsClient.UseService(s => s.GetSysAttachInfoById(tempAttachInfo.PKNO));

                string tempFile = FileHelper.GetTempFile();
                string fileName = tempFile + sysAttach.ATTACHNAME + sysAttach.ATTACHFORMATE;
                FileHelper.BytesToFile(sysAttach.ATTACHINFO, fileName);

                System.Diagnostics.Process.Start(fileName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("查看文件失败,原因为:" + ex.Message);
            }
            this.Cursor = System.Windows.Input.Cursors.Arrow;

            // DEVDialog.ShowMessage(sysAttach.ATTACHNAME);
        }