1407 lines
57 KiB
C#
1407 lines
57 KiB
C#
using Aspose.Words;
|
|
using BLL;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FineUIPro.Web.CQMS.Check
|
|
{
|
|
public partial class SpecialCheckList : PageBase
|
|
{
|
|
/// <summary>
|
|
/// 项目id
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
public int TotalNum
|
|
{
|
|
get
|
|
{
|
|
return (int)ViewState["TotalNum"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["TotalNum"] = value;
|
|
}
|
|
}
|
|
public string code
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["code"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["code"] = value;
|
|
}
|
|
}
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
// 表头过滤
|
|
//FilterDataRowItem = FilterDataRowItemImplement;
|
|
if (!IsPostBack)
|
|
{
|
|
code = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectCode + "-QC-TCC-XJ-";
|
|
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
GetButtonPower();
|
|
//if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.ProjectId)
|
|
//{
|
|
// this.ProjectId = Request.Params["projectId"];
|
|
//}
|
|
//权限按钮方法
|
|
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpSponsorUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
|
|
UnitWorkService.InitUnitWorkDownList(drpUnitWork, this.CurrUser.LoginProjectId, true);
|
|
CNProfessionalService.InitCNProfessionalDownList(drpCNProfessional, true);
|
|
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
|
|
// 绑定表格
|
|
BindGrid();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
#endregion
|
|
//public System.Web.UI.WebControls.ListItem[] GetHandelStatus()
|
|
//{
|
|
// var list = Handelstatus();
|
|
// System.Web.UI.WebControls.ListItem[] litem = new System.Web.UI.WebControls.ListItem[list.Count];
|
|
|
|
// for (int i = 0; i < list.Count; i++)
|
|
// {
|
|
|
|
// litem[i]= new System.Web.UI.WebControls.ListItem(list.Keys.ToString(),list.Values.ToString());
|
|
|
|
// }
|
|
// return litem;
|
|
//}
|
|
/// <summary>
|
|
/// 整改状态
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected IDictionary<int, string> Handelstatus()
|
|
{
|
|
Dictionary<int, string> dic = new Dictionary<int, string>();
|
|
dic.Add(1, "未确认");
|
|
dic.Add(2, "已闭环");
|
|
dic.Add(3, "超期未整改");
|
|
dic.Add(4, "未整改");
|
|
return dic;
|
|
}
|
|
public Task<DataTable> data()
|
|
{
|
|
Task<DataTable> task = new Task<DataTable>(() =>
|
|
{
|
|
return ChecklistData();
|
|
});
|
|
task.Start();
|
|
return task;
|
|
}
|
|
protected DataTable ChecklistData()
|
|
{
|
|
string strSql = @"SELECT * from Check_CheckSpecialDataIn chec
|
|
where chec.ProjectId=@ProjectId";
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
strSql += " AND (chec.CheckTime>=@startTime or @startTime='') and (chec.CheckTime<=@endTime or @endTime='') ";
|
|
listStr.Add(new SqlParameter("@startTime", !string.IsNullOrEmpty(txtStartTime.Text.Trim()) ? txtStartTime.Text.Trim() + " 00:00:00" : ""));
|
|
listStr.Add(new SqlParameter("@endTime", !string.IsNullOrEmpty(txtEndTime.Text.Trim()) ? txtEndTime.Text.Trim() + " 23:59:59" : ""));
|
|
if (drpSponsorUnit.SelectedValue != BLL.Const._Null)
|
|
{
|
|
strSql += " AND chec.UnitId=@unitId";
|
|
listStr.Add(new SqlParameter("@unitId", drpSponsorUnit.SelectedValue));
|
|
}
|
|
if (drpUnitWork.SelectedValue != Const._Null)
|
|
{
|
|
strSql += " AND chec.WorkAreaId=@unitworkId";
|
|
listStr.Add(new SqlParameter("@unitworkId", drpUnitWork.SelectedValue));
|
|
}
|
|
if (drpCNProfessional.SelectedValue != Const._Null)
|
|
{
|
|
strSql += " AND chec.CNProfessionalCode=@CNProfessionalCode";
|
|
listStr.Add(new SqlParameter("@CNProfessionalCode", drpCNProfessional.SelectedValue));
|
|
}
|
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
return tb;
|
|
}
|
|
protected string ConvertUnit(object unitId)
|
|
{
|
|
if (unitId != null)
|
|
{
|
|
var unit = UnitService.GetUnitByUnitId(unitId.ToString());
|
|
if (unit != null)
|
|
{
|
|
return unit.UnitName;
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
protected string ConvertUser(object userId)
|
|
{
|
|
if (userId != null)
|
|
{
|
|
var type = UserService.GetUserNameByUserId(userId.ToString());
|
|
return type;
|
|
}
|
|
return "";
|
|
}
|
|
protected string ConvertWorkArea(object WorkAreaId)
|
|
{
|
|
if (WorkAreaId != null)
|
|
{
|
|
var type = UnitWorkService.getUnitWorkByUnitWorkId(WorkAreaId.ToString());
|
|
if (type != null)
|
|
{
|
|
return type.UnitWorkName;
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
protected string ConvertCNProfessional(object WorkAreaId)
|
|
{
|
|
if (WorkAreaId != null)
|
|
{
|
|
var type = CNProfessionalService.GetCNProfessional(WorkAreaId.ToString());
|
|
if (type != null)
|
|
{
|
|
return type.ProfessionalName;
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
protected void btnIn_Click(object sender, EventArgs e)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SpecialCheckIn.aspx", "导入 - ")));
|
|
}
|
|
protected string ConvertImageUrlByImage(object registrationId)
|
|
{
|
|
string url = string.Empty;
|
|
if (registrationId != null)
|
|
{
|
|
IList<Model.AttachFile> sourlist = AttachFileService.GetBeforeFileList(registrationId.ToString(), BLL.Const.CheckListMenuId);
|
|
|
|
if (sourlist != null&& sourlist.Count>0)
|
|
{
|
|
string AttachUrl = "";
|
|
foreach(var item in sourlist)
|
|
{ if(!string.IsNullOrEmpty(item.AttachUrl)&& item.AttachUrl.ToLower().EndsWith(".jpg")|| item.AttachUrl.ToLower().EndsWith(".jpeg")|| item.AttachUrl.ToLower().EndsWith(".png"))
|
|
AttachUrl += item.AttachUrl.TrimEnd(',')+",";
|
|
}
|
|
url = BLL.UploadAttachmentService.ShowImage("../../", AttachUrl.TrimEnd(','));
|
|
}
|
|
}
|
|
return url;
|
|
}
|
|
protected string ConvertImgUrlByImage(object registrationId)
|
|
{
|
|
string url = string.Empty;
|
|
if (registrationId != null)
|
|
{
|
|
IList<Model.AttachFile> sourlist = AttachFileService.Getfilelist(registrationId.ToString()+"r", BLL.Const.CheckListMenuId);
|
|
|
|
if (sourlist != null && sourlist.Count > 0)
|
|
{
|
|
string AttachUrl = "";
|
|
foreach (var item in sourlist)
|
|
{
|
|
if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
|
|
AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
|
|
}
|
|
url = BLL.UploadAttachmentService.ShowImage("../../", AttachUrl.TrimEnd(','));
|
|
}
|
|
}
|
|
return url;
|
|
}
|
|
|
|
public string Convertstatus(Object code)
|
|
{
|
|
Model.Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControl(code.ToString());
|
|
if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
|
{
|
|
return "未确认";
|
|
}
|
|
else if (checkControl.State == Const.CheckControl_Complete)
|
|
{ //闭环
|
|
return "已闭环";
|
|
}
|
|
//else if( checkControl.LimitDate> )
|
|
else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1) < DateTime.Now) //延期未整改
|
|
{
|
|
return "超期未整改";
|
|
|
|
}
|
|
else //期内未整改
|
|
{
|
|
return "未整改";
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
|
|
public void BindGrid()
|
|
{
|
|
DataTable tb = ChecklistData();
|
|
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 过滤表头、排序、分页、关闭窗口
|
|
/// <summary>
|
|
/// 过滤表头
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
//Grid1.SortDirection = e.SortDirection;
|
|
//Grid1.SortField = e.SortField;
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页显示条数下拉框
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭弹出窗
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region Grid双击事件
|
|
/// <summary>
|
|
/// Grid行双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
btnMenuModify_Click(null, null);
|
|
}
|
|
#endregion
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 编辑按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuModify_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
|
|
if (checks != null)
|
|
{
|
|
if (checks.State.Equals(Const.CheckControl_Complete))
|
|
{
|
|
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
Model.Check_CheckControlApprove approve = BLL.CheckControlApproveService.GetCheckControlApproveByCheckControlId(codes);
|
|
if (approve != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(approve.ApproveMan))
|
|
{
|
|
if (this.CurrUser.UserId == approve.ApproveMan || CurrUser.UserId == Const.sysglyId)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListEdit.aspx?CheckControlCode={0}", codes, "编辑 - ")));
|
|
return;
|
|
}
|
|
else if (checks.State == BLL.Const.CheckControl_Complete)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
}
|
|
//if (this.btnMenuModify.Hidden || checks.State == BLL.Const.State_2) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
|
//{
|
|
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
|
// return;
|
|
//}
|
|
//else
|
|
//{
|
|
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListEdit.aspx?CheckControlCode={0}", codes, "编辑 - ")));
|
|
// return;
|
|
//}
|
|
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您不是当前办理人,无法编辑,请右键查看!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 删除
|
|
/// <summary>
|
|
/// 批量删除
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDel_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
//var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
var spec= Funs.DB.Check_CheckSpecialDataIn.FirstOrDefault(x => x.CheckSpecialId == codes);
|
|
Funs.DB.Check_CheckSpecialDataIn.DeleteOnSubmit(spec);
|
|
Funs.DB.SubmitChanges();
|
|
//BLL.CheckControlApproveService.DeleteCheckControlApprovesByCheckControlCode(codes);
|
|
// BLL.CheckControlService.DeleteCheckControl(codes);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, codes, codes, BLL.Const.CheckSpecialListMenuId, "删除质量专项巡检记录");
|
|
Grid1.DataBind();
|
|
BindGrid();
|
|
Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success);
|
|
}
|
|
#endregion
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
if (Request.Params["value"] == "0")
|
|
{
|
|
return;
|
|
}
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.CheckListMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
{
|
|
// this.btnMenuModify.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
{
|
|
this.btnMenuDel.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
/// <summary>
|
|
/// 把状态转换代号为文字形式
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
protected string ConvertState(object state)
|
|
{
|
|
if (state != null)
|
|
{
|
|
if (state.ToString() == BLL.Const.CheckControl_ReCompile)
|
|
{
|
|
return "重新编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Compile)
|
|
{
|
|
return "编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit1)
|
|
{
|
|
return "总包负责人审批";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit2)
|
|
{
|
|
return "分包专业工程师回复";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit3)
|
|
{
|
|
return "分包负责人审批";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit4)
|
|
{
|
|
return "总包专业工程师确认";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Audit5)
|
|
{
|
|
return "总包负责人确认";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_Complete)
|
|
{
|
|
return "审批完成";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CheckControl_ReCompile2)
|
|
{
|
|
return "分包专业工程师重新回复";
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
//<summary>
|
|
//获取办理人姓名
|
|
//</summary>
|
|
//<param name="state"></param>
|
|
//<returns></returns>
|
|
protected string ConvertMan(object CheckControlCode)
|
|
{
|
|
if (CheckControlCode != null)
|
|
{
|
|
Model.Check_CheckControlApprove a = BLL.CheckControlApproveService.GetCheckControlApproveByCheckControlId(CheckControlCode.ToString());
|
|
if (a != null)
|
|
{
|
|
if (a.ApproveMan != null)
|
|
{
|
|
return BLL.UserService.GetUserByUserId(a.ApproveMan).UserName;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
|
{
|
|
//if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
|
//{
|
|
// Grid1.Rows[i].RowCssClass = "lightgreen";//未确认
|
|
//}
|
|
//else if (checkControl.State == Const.CheckControl_Complete)
|
|
//{ //闭环
|
|
// Grid1.Rows[i].RowCssClass = "green";
|
|
//}
|
|
////else if( checkControl.LimitDate> )
|
|
//else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1).Date < DateTime.Now && checkControl.State != BLL.Const.CheckControl_Complete) //延期未整改
|
|
//{
|
|
// Grid1.Rows[i].RowCssClass = "orange";
|
|
//}
|
|
//else //期内未整改
|
|
//{
|
|
// Grid1.Rows[i].RowCssClass = "red";
|
|
//}
|
|
}
|
|
|
|
public void btnMenuFine_Click(object sender, EventArgs e)
|
|
{
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("CheckFineListEdit.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
|
}
|
|
|
|
protected void btnMenuView_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
|
|
if (checks != null)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
|
}
|
|
}
|
|
protected void btnMenuNotice_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
|
|
if (checks != null)
|
|
{
|
|
string rootPath = Server.MapPath("~/");
|
|
string initTemplatePath = string.Empty;
|
|
string uploadfilepath = string.Empty;
|
|
string newUrl = string.Empty;
|
|
|
|
initTemplatePath = Const.CheckNoticeTemplateUrl;
|
|
uploadfilepath = rootPath + initTemplatePath;
|
|
newUrl = uploadfilepath.Replace(".doc", string.Format("{0}-{1:D4}", code, Grid1.RecordCount - Grid1.PageIndex * Grid1.PageSize - Grid1.SelectedRowIndex) + ".doc");
|
|
if (File.Exists(newUrl))
|
|
{
|
|
File.Delete(newUrl);
|
|
}
|
|
File.Copy(uploadfilepath, newUrl);
|
|
Document doc = new Aspose.Words.Document(newUrl);
|
|
Bookmark bookmarkProjectCode = doc.Range.Bookmarks["ProjectCode"];
|
|
|
|
|
|
if (bookmarkProjectCode != null)
|
|
{
|
|
var project = ProjectService.GetProjectByProjectId(checks.ProjectId);
|
|
if (project != null)
|
|
{
|
|
bookmarkProjectCode.Text = project.ProjectCode;
|
|
|
|
}
|
|
}
|
|
Bookmark bookmarkCheckCode = doc.Range.Bookmarks["CheckCode"];
|
|
if (bookmarkCheckCode != null)
|
|
{
|
|
bookmarkCheckCode.Text = string.Format("{0}-{1:D4}", code, Grid1.RecordCount - Grid1.PageIndex * Grid1.PageSize - Grid1.SelectedRowIndex);// checks.DocCode;
|
|
}
|
|
|
|
Bookmark bookmarkSendDate = doc.Range.Bookmarks["SendDate"];
|
|
if (bookmarkSendDate != null)
|
|
{
|
|
if (checks.CheckDate.HasValue)
|
|
{
|
|
bookmarkSendDate.Text = checks.CheckDate.Value.ToString("yyyy年MM月dd日");
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkUnit = doc.Range.Bookmarks["Unit"];
|
|
if (bookmarkUnit != null)
|
|
{
|
|
var unit = UnitService.GetUnitByUnitId(checks.UnitId);
|
|
if (unit != null)
|
|
{
|
|
bookmarkUnit.Text = unit.UnitName;
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkWorkArea = doc.Range.Bookmarks["WorkArea"];
|
|
if (bookmarkWorkArea != null)
|
|
{
|
|
string option = "";
|
|
var unitWork = UnitWorkService.GetUnitWorkByUnitWorkId(checks.UnitWorkId);
|
|
if (unitWork != null)
|
|
{
|
|
bookmarkWorkArea.Text = unitWork.UnitWorkCode + "-" + unitWork.UnitWorkName;
|
|
}
|
|
}
|
|
Bookmark bookmarkProblemType = doc.Range.Bookmarks["ProblemType"];
|
|
if (bookmarkProblemType != null)
|
|
{
|
|
string option = "";
|
|
var questionType = QualityQuestionTypeService.GetQualityQuestionType(checks.QuestionType);
|
|
if (questionType != null)
|
|
{
|
|
bookmarkProblemType.Text = questionType.QualityQuestionType;
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkLimitDate = doc.Range.Bookmarks["LimitDate"];
|
|
if (bookmarkLimitDate != null)
|
|
{
|
|
if (checks.LimitDate.HasValue)
|
|
{
|
|
bookmarkLimitDate.Text = checks.LimitDate.Value.ToString("yyyy年MM月dd日");
|
|
}
|
|
}
|
|
Bookmark bookmarkProblemDes = doc.Range.Bookmarks["ProblemDes"];
|
|
if (bookmarkProblemDes != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(checks.QuestionDef))
|
|
{
|
|
bookmarkProblemDes.Text = checks.QuestionDef;
|
|
}
|
|
}
|
|
Bookmark bookmarkSuggest = doc.Range.Bookmarks["Suggest"];
|
|
if (bookmarkSuggest != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(checks.RectifyOpinion))
|
|
bookmarkSuggest.Text = checks.RectifyOpinion;
|
|
}
|
|
Bookmark bookmarkCheckMan = doc.Range.Bookmarks["CheckMan"];
|
|
if (bookmarkCheckMan != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(checks.CheckMan))
|
|
{
|
|
var sysUser = UserService.GetUserByUserId(checks.CheckMan);
|
|
|
|
bookmarkCheckMan.Text = sysUser.UserName;
|
|
}
|
|
}
|
|
Bookmark bookmarkCheckDate = doc.Range.Bookmarks["CheckDate"];
|
|
if (bookmarkCheckDate != null)
|
|
{
|
|
if (checks.CheckDate.HasValue)
|
|
{
|
|
|
|
bookmarkCheckDate.Text = checks.CheckDate.Value.ToString("yyyy-MM-dd");
|
|
}
|
|
}
|
|
Bookmark bookmarkResponseMan = doc.Range.Bookmarks["ResponseMan"];
|
|
Bookmark bookmarkResponseDate = doc.Range.Bookmarks["ResponseDate"];
|
|
if (bookmarkResponseMan != null)
|
|
{
|
|
var approve = Funs.DB.Check_CheckControlApprove.Where(x => x.CheckControlCode == checks.CheckControlCode && x.ApproveType == BLL.Const.CheckControl_Audit2).FirstOrDefault();
|
|
|
|
if (approve != null)
|
|
{
|
|
var sysUser = UserService.GetUserByUserId(approve.ApproveMan);
|
|
if (sysUser != null)
|
|
{
|
|
bookmarkResponseMan.Text = sysUser.UserName;
|
|
}
|
|
|
|
if (approve.ApproveDate.HasValue)
|
|
{
|
|
|
|
bookmarkResponseDate.Text = approve.ApproveDate.Value.ToString("yyyy年MM月dd日");
|
|
}
|
|
}
|
|
}
|
|
IList<Model.AttachFile> sourlist = AttachFileService.GetBeforeFileList(checks.CheckControlCode, BLL.Const.CheckListMenuId);
|
|
|
|
if (sourlist != null && sourlist.Count > 0)
|
|
{
|
|
int indexPic = 1;
|
|
string AttachUrl = "";
|
|
foreach (var item in sourlist)
|
|
{
|
|
if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
|
|
{
|
|
AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
|
|
|
|
}
|
|
|
|
}
|
|
string []pics = AttachUrl.Split(',');
|
|
foreach(string item in pics)
|
|
{ switch (indexPic)
|
|
{
|
|
case 1:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("Pic1");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 2:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("Pic2");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 3:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("Pic3");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 4:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("Pic4");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
doc.Save(newUrl);
|
|
|
|
|
|
|
|
|
|
Document doc1 = new Aspose.Words.Document(newUrl);
|
|
//验证参数
|
|
if (doc1 == null) { throw new Exception("Word文件无效"); }
|
|
string fileName = Path.GetFileName(newUrl);
|
|
FileInfo info = new FileInfo(newUrl);
|
|
long fileSize = info.Length;
|
|
Response.Clear();
|
|
Response.ContentType = "application/x-zip-compressed";
|
|
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
Response.AddHeader("Content-Length", fileSize.ToString());
|
|
Response.TransmitFile(newUrl, 0, fileSize);
|
|
Response.Flush();
|
|
Response.Close();
|
|
File.Delete(newUrl);
|
|
|
|
}
|
|
}
|
|
protected void btnMenuReNotice_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
|
|
if (checks != null)
|
|
{
|
|
string rootPath = Server.MapPath("~/");
|
|
string initTemplatePath = string.Empty;
|
|
string uploadfilepath = string.Empty;
|
|
string newUrl = string.Empty;
|
|
|
|
initTemplatePath = Const.CheckReNoticeTemplateUrl;
|
|
uploadfilepath = rootPath + initTemplatePath;
|
|
newUrl = uploadfilepath.Replace(".doc", string.Format("{0}-{1:D4}", code, Grid1.RecordCount - Grid1.PageIndex * Grid1.PageSize - Grid1.SelectedRowIndex) + ".doc");
|
|
if (File.Exists(newUrl))
|
|
{
|
|
File.Delete(newUrl);
|
|
}
|
|
File.Copy(uploadfilepath, newUrl);
|
|
Document doc = new Aspose.Words.Document(newUrl);
|
|
|
|
|
|
Bookmark bookmarkProjectCode = doc.Range.Bookmarks["ProjectNum"];
|
|
|
|
|
|
if (bookmarkProjectCode != null)
|
|
{
|
|
var project = ProjectService.GetProjectByProjectId(checks.ProjectId);
|
|
if (project != null)
|
|
{
|
|
bookmarkProjectCode.Text = project.ProjectCode;
|
|
|
|
}
|
|
}
|
|
Bookmark bookmarkSendDate = doc.Range.Bookmarks["SendDate"];
|
|
|
|
|
|
if (bookmarkSendDate != null)
|
|
{
|
|
|
|
if (checks.CheckDate.HasValue != null)
|
|
{
|
|
bookmarkSendDate.Text = checks.CheckDate.Value.ToString("yyyy年MM月dd日");
|
|
|
|
}
|
|
}
|
|
Bookmark bookmarkNoticeNum = doc.Range.Bookmarks["NoticeNum"];
|
|
if (bookmarkNoticeNum != null)
|
|
{
|
|
//bookmarkNoticeNum.Text = checks.DocCode;
|
|
bookmarkNoticeNum.Text = string.Format("{0}-{1:D4}", code, Grid1.RecordCount - Grid1.PageIndex * Grid1.PageSize - Grid1.SelectedRowIndex);// checks.DocCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bookmark bookmarkUnit = doc.Range.Bookmarks["Unit"];
|
|
if (bookmarkUnit != null)
|
|
{
|
|
var unit = UnitService.GetUnitByUnitId(checks.UnitId);
|
|
if (unit != null)
|
|
{
|
|
bookmarkUnit.Text = unit.UnitName;
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkWorkArea = doc.Range.Bookmarks["UnitWork"];
|
|
if (bookmarkWorkArea != null)
|
|
{
|
|
string option = "";
|
|
var unitWork = UnitWorkService.GetUnitWorkByUnitWorkId(checks.UnitWorkId);
|
|
if (unitWork != null)
|
|
{
|
|
bookmarkWorkArea.Text = unitWork.UnitWorkCode + "-" + unitWork.UnitWorkName;
|
|
}
|
|
}
|
|
Bookmark bookmarkProblemType = doc.Range.Bookmarks["QuestionType"];
|
|
if (bookmarkProblemType != null)
|
|
{
|
|
string option = "";
|
|
var questionType = QualityQuestionTypeService.GetQualityQuestionType(checks.QuestionType);
|
|
if (questionType != null)
|
|
{
|
|
bookmarkProblemType.Text = questionType.QualityQuestionType;
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkChangeDate = doc.Range.Bookmarks["ChangeDate"];
|
|
if (bookmarkChangeDate != null)
|
|
{
|
|
if (checks.LimitDate.HasValue)
|
|
{
|
|
bookmarkChangeDate.Text = checks.LimitDate.Value.ToString("yyyy年MM月dd日");
|
|
}
|
|
}
|
|
Bookmark bookmarkProposeUnit = doc.Range.Bookmarks["ProposeUnit"];
|
|
if (bookmarkProposeUnit != null)
|
|
{
|
|
var unit = UnitService.GetUnitByUnitId(checks.ProposeUnitId);
|
|
if (unit != null)
|
|
{
|
|
bookmarkProposeUnit.Text = unit.UnitName;
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkCheckDate = doc.Range.Bookmarks["CheckDate"];
|
|
|
|
if (bookmarkCheckDate != null)
|
|
{
|
|
|
|
if (checks.CheckDate.HasValue != null)
|
|
{
|
|
bookmarkCheckDate.Text = checks.CheckDate.Value.ToString("yyyy年MM月dd日");
|
|
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkNoticeNum2 = doc.Range.Bookmarks["NoticeNum2"];
|
|
if (bookmarkNoticeNum2 != null)
|
|
{
|
|
bookmarkNoticeNum2.Text = string.Format("{0}-{1:D4}", code, Grid1.RecordCount - Grid1.PageIndex * Grid1.PageSize - Grid1.SelectedRowIndex);// checks.DocCode;
|
|
}
|
|
|
|
|
|
Bookmark bookmarkHandleWay = doc.Range.Bookmarks["HandleWay"];
|
|
if (bookmarkHandleWay != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(checks.HandleWay))
|
|
bookmarkHandleWay.Text = checks.HandleWay;
|
|
}
|
|
Bookmark bookmarkCheckMan = doc.Range.Bookmarks["CheckMan"];
|
|
if (bookmarkCheckMan != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(checks.CheckMan))
|
|
{
|
|
var sysUser = UserService.GetUserByUserId(checks.CheckMan);
|
|
|
|
bookmarkCheckMan.Text = sysUser.UserName;
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkResponseMan = doc.Range.Bookmarks["ResponseMan"];
|
|
Bookmark bookmarkResponseDate = doc.Range.Bookmarks["ResponseDate"];
|
|
if (bookmarkResponseMan != null)
|
|
{
|
|
var approve = Funs.DB.Check_CheckControlApprove.Where(x => x.CheckControlCode == checks.CheckControlCode && x.ApproveType == BLL.Const.CheckControl_Audit2).FirstOrDefault();
|
|
|
|
if (approve != null)
|
|
{
|
|
var sysUser = UserService.GetUserByUserId(approve.ApproveMan);
|
|
if (sysUser != null)
|
|
{
|
|
bookmarkResponseMan.Text = sysUser.UserName;
|
|
}
|
|
|
|
if (approve.ApproveDate.HasValue)
|
|
{
|
|
|
|
bookmarkResponseDate.Text = approve.ApproveDate.Value.ToString("yyyy年MM月dd日");
|
|
}
|
|
}
|
|
}
|
|
|
|
Bookmark bookmarkReCheckMan = doc.Range.Bookmarks["ReCheckMan"];
|
|
Bookmark bookmarkReCheckDate = doc.Range.Bookmarks["ReCheckDate"];
|
|
if (bookmarkResponseMan != null)
|
|
{
|
|
var approve = Funs.DB.Check_CheckControlApprove.Where(x => x.CheckControlCode == checks.CheckControlCode && x.ApproveType == BLL.Const.CheckControl_Audit4).FirstOrDefault();
|
|
|
|
if (approve != null)
|
|
{
|
|
var sysUser = UserService.GetUserByUserId(approve.ApproveMan);
|
|
if (sysUser != null)
|
|
{
|
|
bookmarkReCheckMan.Text = sysUser.UserName;
|
|
}
|
|
|
|
if (approve.ApproveDate.HasValue)
|
|
{
|
|
|
|
bookmarkReCheckDate.Text = approve.ApproveDate.Value.ToString("yyyy年MM月dd日");
|
|
}
|
|
}
|
|
}
|
|
|
|
IList<Model.AttachFile> sourlist = AttachFileService.GetBeforeFileList(checks.CheckControlCode, BLL.Const.CheckListMenuId);
|
|
|
|
if (sourlist != null && sourlist.Count > 0)
|
|
{
|
|
int indexPic = 1;
|
|
string AttachUrl = "";
|
|
foreach (var item in sourlist)
|
|
{
|
|
if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
|
|
{
|
|
AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
|
|
|
|
}
|
|
|
|
}
|
|
string[] pics = AttachUrl.Split(',');
|
|
foreach (string item in pics)
|
|
{
|
|
switch (indexPic)
|
|
{
|
|
case 1:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("Pic1");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 2:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("Pic2");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 3:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("Pic3");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 4:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("Pic4");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
IList<Model.AttachFile> reSourlist = AttachFileService.GetBeforeFileList(checks.CheckControlCode+"r", BLL.Const.CheckListMenuId);
|
|
|
|
if (reSourlist != null && reSourlist.Count > 0)
|
|
{
|
|
int indexPic = 1;
|
|
string AttachUrl = "";
|
|
foreach (var item in reSourlist)
|
|
{
|
|
if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
|
|
{
|
|
AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
|
|
|
|
}
|
|
|
|
}
|
|
string[] pics = AttachUrl.Split(',');
|
|
foreach (string item in pics)
|
|
{
|
|
switch (indexPic)
|
|
{
|
|
case 1:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("RPic1");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 2:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("RPic2");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 3:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("RPic3");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
case 4:
|
|
{
|
|
string url = rootPath + item.TrimEnd(',');
|
|
//查找书签
|
|
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
builder.MoveToBookmark("RPic4");
|
|
if (!string.IsNullOrEmpty(url))
|
|
{
|
|
System.Drawing.Size JpgSize;
|
|
float Wpx;
|
|
float Hpx;
|
|
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
|
double i = 1;
|
|
i = JpgSize.Width / 220.0;
|
|
if (File.Exists(url))
|
|
{
|
|
builder.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
indexPic++;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
doc.Save(newUrl);
|
|
|
|
|
|
|
|
|
|
Document doc1 = new Aspose.Words.Document(newUrl);
|
|
//验证参数
|
|
if (doc1 == null) { throw new Exception("Word文件无效"); }
|
|
string fileName = Path.GetFileName(newUrl);
|
|
FileInfo info = new FileInfo(newUrl);
|
|
long fileSize = info.Length;
|
|
Response.Clear();
|
|
Response.ContentType = "application/x-zip-compressed";
|
|
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
Response.AddHeader("Content-Length", fileSize.ToString());
|
|
Response.TransmitFile(newUrl, 0, fileSize);
|
|
Response.Flush();
|
|
Response.Close();
|
|
File.Delete(newUrl);
|
|
|
|
}
|
|
}
|
|
|
|
protected void btnMenuReplay_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string codes = Grid1.SelectedRowID.Split(',')[0];
|
|
var checks = BLL.CheckControlService.GetCheckControl(codes);
|
|
|
|
if (checks != null)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
|
}
|
|
}
|
|
|
|
protected void btnQuery_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
protected void btnRset_Click(object sender, EventArgs e)
|
|
{
|
|
drpSponsorUnit.SelectedIndex = 0;
|
|
drpCNProfessional.SelectedIndex = 0;
|
|
drpUnitWork.SelectedIndex = 0;
|
|
txtStartTime.Text = "";
|
|
txtEndTime.Text = "";
|
|
BindGrid();
|
|
}
|
|
}
|
|
} |