/// <summary> /// 新增档案 /// </summary> /// <param name="model">实体</param> /// <returns></returns> public bool AddNew(Models.ys_JobFiles model) { string sqlText = @"INSERT INTO [RightingSys].[dbo].[ys_JobFiles] ([Id] ,[JobFileName] ,[JobFileCategoryId] ,[JobFileCategoryName] ,[JobFileStaffId] ,[JobFileStaffName] ,[FileImage] ,[OperatorId] ,[OperatorName] ,[AuditorId] ,[AuditorName] ,[Auditorday] ,[Description] ,[CreateTime] ,[IsRemoved]) VALUES (@Id ,@JobFileName ,@JobFileCategoryId ,@JobFileCategoryName ,@JobFileStaffId ,@JobFileStaffName ,@FileImage ,@OperatorId ,@OperatorName ,@AuditorId ,@AuditorName ,@Auditorday ,@Description ,@CreateTime ,@IsRemoved)"; SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@Id", model.Id), new SqlParameter("@JobFileName", model.JobFileName), new SqlParameter("@JobFileCategoryId", model.JobFileCategoryId), new SqlParameter("@JobFileCategoryName", model.JobFileCategoryName), new SqlParameter("@JobFileStaffId", model.JobFileStaffId), new SqlParameter("@JobFileStaffName", model.JobFileStaffName), new SqlParameter("@FileImage", model.FileImage), new SqlParameter("@OperatorId", model.OperatorId), new SqlParameter("@OperatorName", model.OperatorName), new SqlParameter("@AuditorId", model.AuditorId), new SqlParameter("@AuditorName", model.AuditorName), new SqlParameter("@Auditorday", model.Auditorday), new SqlParameter("@Description", model.Description), new SqlParameter("@CreateTime", model.CreateTime), new SqlParameter("@IsRemoved", model.IsRemoved) }; return(Models.SqlHelper.ExecuteNoQuery(sqlText, Params) > 0); }
/// <summary> /// 打印 /// </summary> public override void Print() { if (gvData.FocusedRowHandle >= 0) { Guid Id = clsPublic.GetObjGUID(gvData.GetFocusedRowCellValue("Id")); Models.ys_JobFiles md = manager.GetOneById(Id); PdfViewer pdfView = new PdfViewer(); pdfView.LoadDocument(new MemoryStream(md.FileImage)); pdfView.ZoomMode = PdfZoomMode.FitToWidth; pdfView.Print(); } }
/// <summary> /// 更改构造函数 /// </summary> /// <param name="md">实体</param> public JobFilesEditForm(Models.ys_JobFiles md) : this() { model = md; txtFileName.Text = model.JobFileName; txtDescription.Text = model.Description; dAuditorday.EditValue = model.Auditorday; tlCategory.EditValue = model.JobFileCategoryId; lkpAuditor.EditValue = model.AuditorId; lkpStaff.EditValue = model.JobFileStaffId; panelEdit.Enabled = false; btnFileSelect.Enabled = false; pdfView.LoadDocument(new MemoryStream(model.FileImage)); pdfView.Focus(); }
/// <summary> /// 预览 /// </summary> public override void Preview() { if (gvData.FocusedRowHandle >= 0) { Guid Id = clsPublic.GetObjGUID(gvData.GetFocusedRowCellValue("Id")); Models.ys_JobFiles md = manager.GetOneById(Id); if (md != null) { JobFilesEditForm sub = new JobFilesEditForm(md); sub.ShowDialog(); } } else { clsPublic.ShowMessage("没有可供预览的记录", Text); } }
/// <summary> /// 新增档案 /// </summary> /// <param name="model">实体</param> /// <returns></returns> public bool AddNew(Models.ys_JobFiles model) { return(sev.AddNew(model)); }