Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Bind_basic();
         if (id != 0)//修改
         {
             Button3.Text    = "确认修改";
             Button4.Enabled = true;
             try
             {
                 GroupCommunicationWork gcw = GroupCommunicationWork.FindById(id);
                 ddl_CommunicationType.SelectedValue = gcw.CommunicationTypeId.ToString();
                 tb_GroupArea.Text               = gcw.GroupArea;
                 tb_GroupName.Text               = gcw.GroupName;
                 tb_GroupMonitor.Text            = gcw.GroupMonitor;
                 tb_GroupMembers.Value           = gcw.GroupMembers;
                 tb_CommunicationGenerate.Value  = gcw.CommunicationGenerate;
                 tb_CommunicationSummarize.Value = gcw.CommunicationSummarize;
                 tb_CommunicationReport.Value    = gcw.CommunicationReport;
                 tb_CommunicationPhotos.Value    = gcw.CommunicationPhotos;
             }
             catch (Exception ex)
             {
                 text(ex.ToString());
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('数据加载错误,请重新再试!')", true);
             }
         }
     }
 }
Esempio n. 2
0
 public static string DeleteGroupCommunication(int groupCommunicationId)
 {
     try
     {
         DbEntry.UsingTransaction(delegate
         {
             GroupCommunicationWork communication = GroupCommunicationWork.FindById(groupCommunicationId);
             communication.IsDelete = true;
             communication.Save();
         });
     }
     catch { return("false"); }
     return("ok");
 }
Esempio n. 3
0
 public static bool UpdateGroupCommunication(int groupCommunicationId, int communicationTypeId, string groupArea, string groupName, string groupMonitor, string groupMembers, string communicationGenerate, string communicationSummarize, string communicationReport, string communicationPhotos)
 {
     try
     {
         GroupCommunicationWork gcw = GroupCommunicationWork.FindById(groupCommunicationId);
         gcw.CommunicationTypeId    = communicationTypeId;
         gcw.GroupArea              = groupArea;
         gcw.GroupName              = groupName;
         gcw.GroupMonitor           = groupMonitor;
         gcw.GroupMembers           = groupMembers;
         gcw.CommunicationGenerate  = communicationGenerate;
         gcw.CommunicationSummarize = communicationSummarize;
         gcw.CommunicationReport    = communicationReport;
         gcw.CommunicationPhotos    = communicationPhotos;
         gcw.Save();
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Esempio n. 4
0
        public void Output_Word_zdts()
        {
            try
            {
                if (id == 0)
                {
                    //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('数据加载错误,请重新再试!')", true);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('数据加载错误,请重新再试!')", true);
                    return;
                }
                GroupCommunicationWork gcw = GroupCommunicationWork.FindById(id);

                string basePath = Server.MapPath("../../");
                object missing  = Type.Missing;
                object filePath = basePath + "Template/团组交流工作情况表.doc";
                var    docApp   = new Microsoft.Office.Interop.Word.Application();
                docApp.Visible = false;
                //打开Word文件
                var doc = docApp.Documents.Open(ref filePath,
                                                false, false, ref missing, ref missing, ref missing,
                                                ref missing, ref missing, ref missing, ref missing, ref missing,
                                                ref missing, ref missing, ref missing, ref missing, ref missing);
                object oFalse   = false;
                object oTrue    = true;
                object oMissing = System.Reflection.Missing.Value;

                //交流形式
                doc.Bookmarks["CommunicationTypeText"].Range.Text = CommunicationType.FindOne(CK.K["CommunicationTypeId"] == gcw.CommunicationTypeId).CommunicationTypeText;
                //组团地区
                doc.Bookmarks["GroupArea"].Range.Text = gcw.GroupArea == null ? "" : gcw.GroupArea;
                //交流团组名称
                doc.Bookmarks["GroupName"].Range.Text = gcw.GroupName == null ? "" : gcw.GroupName;
                //交流团团长
                doc.Bookmarks["GroupMonitor"].Range.Text = gcw.GroupMonitor == null ? "" : gcw.GroupMonitor;
                //团组成员名称
                if (gcw.GroupMembers != null)
                {
                    doc.Bookmarks["GroupMembers"].Range.InsertFile(GenerateHtml(gcw.GroupMembers), ref oMissing, ref oFalse, ref oTrue, ref oFalse);
                }
                //交流形成
                if (gcw.CommunicationGenerate != null)
                {
                    doc.Bookmarks["CommunicationGenerate"].Range.InsertFile(GenerateHtml(gcw.CommunicationGenerate), ref oMissing, ref oFalse, ref oTrue, ref oFalse);
                }
                //交流工作总结
                if (gcw.CommunicationSummarize != null)
                {
                    doc.Bookmarks["CommunicationSummarize"].Range.InsertFile(GenerateHtml(gcw.CommunicationSummarize), ref oMissing, ref oFalse, ref oTrue, ref oFalse);
                }
                //专项工作报告
                if (gcw.CommunicationReport != null)
                {
                    doc.Bookmarks["CommunicationReport"].Range.InsertFile(GenerateHtml(gcw.CommunicationReport), ref oMissing, ref oFalse, ref oTrue, ref oFalse);
                }
                //交流照片
                if (gcw.CommunicationPhotos != null)
                {
                    doc.Bookmarks["CommunicationPhotos"].Range.InsertFile(GenerateHtml(gcw.CommunicationPhotos), ref oMissing, ref oFalse, ref oTrue, ref oFalse);
                }
                string fileNameWithOutExtention = Guid.NewGuid().ToString();
                doc.SaveAs(basePath + "upload/word_tzjlgz/" + fileNameWithOutExtention + ".pdf", Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF);
                object f = false;
                doc.Close(ref f, ref missing, ref missing);
                FileStream fs   = new FileStream(basePath + "upload/word_tzjlgz/" + fileNameWithOutExtention + ".pdf", FileMode.Open);
                byte[]     file = new byte[fs.Length];
                fs.Read(file, 0, file.Length);
                fs.Close();
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("团组交流工作情况表-" + gcw.GroupName + ".pdf", System.Text.Encoding.UTF8));
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                Response.ContentType     = "application/octet-stream";
                Response.BinaryWrite(file);
                Response.End();
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "alert('数据加载错误,请重新再试!')", true);
                text(ex.ToString());
                //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "alert('数据加载失败,请重新再试!')", true);
                return;
            }
        }