using System; using System.Collections.Generic; using System.Linq; using System.Data; using System.Data.SqlClient; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; namespace FineUIPro.Web.FileManage { public partial class EditOffice : PageBase { public string docId, newofficetype, readURL, strOper, typeFlag; public string txtFileId, txtFileCode, txtFileName, drpBigType, drpSmallType;//定义表单数据 public string projectName, projectCode, projectCode1, projectCode2, projectCode3, fileCode, fileCode1, fileCode2, fileCode3, projectName1, projectName2, projectName3, bzr, shr, spr, fbdate; protected void Page_Load(object sender, EventArgs e) { docId = Request.QueryString["docId"]; newofficetype = Request.QueryString["newofficetype"]; drpBigType = Request.QueryString["drpBigType"]; drpSmallType = Request.QueryString["drpSmallType"]; strOper = Request.QueryString["oper"]; typeFlag = Request.QueryString["typeFlag"]; var p = BLL.Base_ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); if (p != null) { projectName = p.ProjectName; projectName1 = projectName; projectName2 = projectName; projectName3 = projectName; projectCode = p.ProjectCode; projectCode1 = projectCode; projectCode2 = projectCode; projectCode3 = projectCode; } if (docId != null && docId != "") { txtFileId = docId; //SqlDataReader dr = null; string strSql = string.Empty; readURL = "Read.aspx?typeFlag=" + typeFlag + "&docid=" + docId; try { if (typeFlag == "00") { //strSql = "select * from Office_File where FileId=" + docId; //dr = BLL.SQLHelper.RunSql(strSql); //var q = from x in Funs.DB.Common_FileManage where x.FileId.ToString() == docId select x; //if (q.Count()>0) //{ // txtFileCode =q.First().FileCode; // txtFileName = q.First().FileName.ToString(); // drpBigType = q.First().BigType.ToString(); // drpSmallType = q.First().SmallType.ToString(); //} } //if (typeFlag == Const.HSSE_ManagerRuleTemplate) //{ // //strSql = "select FileCode, FileName, CompileMan, IssueDate from HSSE_ActionPlan_ManagerRule where ManagerRuleId='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_ActionPlan_ManagerRule where x.ManagerRuleId == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().FileCode; // txtFileName = q.First().FileName.ToString(); // fileCode = q.First().FileCode; // fileCode1 = fileCode; // if (q.First().IssueDate != null) // { // fbdate = q.First().IssueDate.ToString(); // } // bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().CompileMan.ToString()); // //shr = BLL.HSSE_ActionPlan_ManagerRuleApproveService.GetUserName(txtFileCode, "3"); // //spr = BLL.HSSE_ActionPlan_ManagerRuleApproveService.GetUserName(txtFileCode, "4"); // } //} //if (typeFlag == Const.HSSE_ActionPlanTemplate) //{ // //strSql = "select ActionPlanCode,ActionPlanName,CompileMan from dbo.HSSE_ActionPlan_ActionPlan where ActionPlanCode='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_ActionPlan_ActionPlan where x.ActionPlanCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().ActionPlanCode.ToString(); // txtFileName = q.First().ActionPlanName.ToString(); // fileCode = q.First().ActionPlanCode.ToString(); // bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().CompileMan.ToString()); // shr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 2); // spr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 3); // //fbdate = BLL.AuditFlowApproveService.GetIssueDate(txtFileCode, "3"); // } //} //if (typeFlag == Const.HSSE_MeetingTemplate) //{ // //strSql = "select MeetingListCode, MeetingName, RecordMan from dbo.HSSE_Meeting_MeetingList where MeetingListCode='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_Meeting_MeetingList where x.MeetingListCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().MeetingListCode.ToString(); // txtFileName = q.First().MeetingName.ToString(); // fileCode = q.First().MeetingListCode.ToString(); // bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().RecordMan.ToString()); // shr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 2); // spr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 3); // fbdate = BLL.AuditFlowApproveService.GetIssueDate(txtFileCode, 3); // } //} //if (typeFlag == Const.HSSE_EmergencyTemplate) //{ // //strSql = "select EmergencyCode, FileName from HSSE_Emergency_EmergencyList where EmergencyCode='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_Emergency_EmergencyList where x.EmergencyCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().EmergencyCode.ToString(); // txtFileName = q.First().FileName.ToString(); // fileCode = q.First().EmergencyCode.ToString(); // } //} //if (typeFlag == Const.HSSE_EmergencyDrillTemplate) //{ // //strSql = "select DrillRecordCode, DrillName from HSSE_Emergency_DrillRecord where DrillRecordCode='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_Emergency_DrillRecord where x.DrillRecordCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().DrillRecordCode.ToString(); // if (q.First().DrillName != null) // { // txtFileName = q.First().DrillName.ToString(); // } // fileCode = q.First().DrillRecordCode.ToString(); // } //} //if (typeFlag == Const.HSSE_ManagerWeekTemplate) //{ // //strSql = "select ManagerWeekCode, FileName from HSSE_Manager_ManagerWeek where ManagerWeekCode='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_Manager_ManagerWeek where x.ManagerWeekCode == docId select x; // if (q.Count()>0) // { // txtFileCode = q.First().ManagerWeekCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = q.First().ManagerWeekCode.ToString(); // } //} //if (typeFlag == Const.HSSE_ManagerTotalTemplate) //{ // //strSql = "select ManagerTotalCode, FileName from HSSE_Manager_ManagerTotal where ManagerTotalCode='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_Manager_ManagerTotal where x.ManagerTotalCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().ManagerTotalCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = q.First().ManagerTotalCode.ToString(); // } //} //if (typeFlag == Const.HSSE_ManagerPerformanceTemplate) //{ // //strSql = "select ManagerPerformanceCode, FileName from HSSE_Manager_ManagerPerformance where ManagerPerformanceCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_Manager_ManagerPerformance where x.ManagerPerformanceCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().ManagerPerformanceCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = q.First().ManagerPerformanceCode.ToString(); // } //} //if (typeFlag == Const.HSSE_SecurityLicenseTemplate) // 新开项目 //{ // //strSql = "select LicenseManagerCode, LicenseName from HSSE_License_LicenseManager where LicenseManagerCode='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_License_SecurityLicense where x.SecurityLicenseId == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().LicenseCode.ToString(); // if (q.First().LicenseName != null) // { // txtFileName = q.First().LicenseName.ToString(); // } // fileCode = q.First().LicenseCode.ToString(); // } //} //if (typeFlag == Const.HSSE_AccidentTemplate) //{ // //strSql = "select AccidentRecordId from HSSE_Accident_AccidentRecord where AccidentRecordId='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_Accident_AccidentRecord where x.AccidentRecordId == docId select x; // if (q.Count() > 0) // { // txtFileCode = "001"; // if (q.First().AccidentRecordId != null) // { // txtFileName = "安全事故报告"; // } // } //} //if (typeFlag == Const.HSSE_Log) //{ // strSql = "select Code from dbo.HSSE_Log where LogId ='" + docId + "'"; // dr = BLL.SQLHelper.RunSql(strSql); // if (dr.Read()) // { // txtFileCode = dr["Code"].ToString(); // txtFileName = "HSSE管理日志"; // fileCode = dr["Code"].ToString(); // } //} if (typeFlag == "110") { //strSql = "select FinalFileCode, FinalFileName from View_FinalFile where FinalFileCode='" + docId + "'"; //dr = BLL.SQLHelper.RunSql(strSql); //var q = from x in Funs.DB.View_FinalFile where x.AccidentRecordId == docId select x; //if (q.Count() > 0) //{ // txtFileCode = dr["FinalFileCode"].ToString(); // if (dr["FinalFileName"] != null) // { // txtFileName = dr["FinalFileName"].ToString(); // } //} } ////////////////////////////////////////////////////////////////////////////////////////// //if (typeFlag == Const.TempFileTemplate) //{ // //strSql = "select * from CQMS_TempFile where o_pkid = '" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_TempFile where x.O_pkid.ToString() == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().O_pkid.ToString(); ; // if (q.First().O_name != null) // { // txtFileName = q.First().O_name.ToString(); // } // } //} //if (typeFlag == Const.HSSE_PauseNoticeTemplate) //{ // //strSql = "select PauseNoticeCode, FileName from dbo.HSSE_Check_PauseNotice where PauseNoticeCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.HSSE_Check_PauseNotice where x.PauseNoticeCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().PauseNoticeCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = q.First().PauseNoticeCode.ToString(); // } //} //////////////////////////////////////以下为质量//////////////////////////////////////////////// //if (typeFlag == Const.CQMS_ConstructSolutionTemplate) //{ // //strSql = "select ConstructSolutionCode,c.CnProfessionName as FileName from CQMS_Solution_ConstructSolutionModel m left join WBS_CnProfessionInit c on m.CNProfessionalCode=c.CnProfessionCode where ConstructSolutionId='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Solution_ConstructSolutionModel // join y in Funs.DB.WBS_CnProfessionInit on x.CNProfessionalCode equals y.CnProfessionCode // where x.ConstructSolutionId == docId // select new { x.ConstructSolutionCode, y.CnProfessionName }; // if (q.Count() > 0) // { // txtFileCode = q.First().ConstructSolutionCode.ToString(); // if (q.First().CnProfessionName != null) // { // txtFileName = q.First().CnProfessionName.ToString(); // } // } //} //if (typeFlag == Const.CQMS_ManagerRuleTemplate) //{ // //strSql = "select FileCode, FileName,CompileMan, IssueDate from CQMS_ActionPlan_ManagerRule where ManagerRuleId='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_ActionPlan_ManagerRule where x.ManagerRuleId == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().FileCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = projectCode + "-" + q.First().FileCode.ToString(); // if (q.First().IssueDate != null) // { // fbdate = q.First().IssueDate.ToString(); // } // bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().CompileMan.ToString()); // //shr = BLL.CQMS_ActionPlan_ManagerRuleApproveService.GetUserName(txtFileCode, "3"); // //spr = BLL.CQMS_ActionPlan_ManagerRuleApproveService.GetUserName(txtFileCode, "4"); // } //} //if (typeFlag == Const.CQMS_DrawingAuditTemplate) //{ // //strSql = "select DrawingAuditCode, FileName from dbo.CQMS_Drawing_DrawingAudit where DrawingAuditCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Drawing_DrawingAudit where x.DrawingAuditCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().DrawingAuditCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // } //} //if (typeFlag == Const.CQMS_NoFourLetoffTemplate) //{ // //strSql = "select NoFourLetoffCode, AccidentName from dbo.CQMS_Nonconformity_NoFourLetoff where NoFourLetoffCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Nonconformity_NoFourLetoff where x.NoFourLetoffCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().NoFourLetoffCode.ToString(); // if (q.First().AccidentName != null) // { // txtFileName = q.First().AccidentName.ToString(); // } // fileCode = q.First().NoFourLetoffCode.ToString(); // } //} //if (typeFlag == Const.CQMS_NonconformityNoticeTemplate) //{ // //strSql = "select NonconformityNoticeCode, FileName from dbo.CQMS_Nonconformity_NonconformityNotice where NonconformityNoticeCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Nonconformity_NonconformityNotice where x.NonconformityNoticeCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().NonconformityNoticeCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = q.First().NonconformityNoticeCode.ToString(); // } //} //if (typeFlag == Const.CQMS_NonconformityReviewTemplate) //{ // //strSql = "select NonconformityReviewCode, FileName from dbo.CQMS_Nonconformity_NonconformityReview where NonconformityReviewCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Nonconformity_NonconformityReview where x.NonconformityReviewCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().NonconformityReviewCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = q.First().NonconformityReviewCode.ToString(); // } //} //if (typeFlag == Const.CQMS_MeetingTemplate) //{ // //strSql = "select MeetingListCode, MeetingName, RecordMan from dbo.CQMS_Meeting_MeetingList where MeetingListCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Meeting_MeetingList where x.MeetingListCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().MeetingListCode.ToString(); // if (q.First().MeetingName != null) // { // txtFileName = q.First().MeetingName.ToString(); // } // fileCode = q.First().MeetingListCode.ToString(); // bzr = BLL.Sys_UserService.GetUserNameByUserId(q.First().RecordMan.ToString()); // shr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 2); // spr = BLL.AuditFlowApproveService.GetUserName(txtFileCode, 3); // fbdate = BLL.AuditFlowApproveService.GetIssueDate(txtFileCode, 3); // } //} //if (typeFlag == Const.CQMS_RectifyNoticeTemplate) //{ // //strSql = "select RectifyNoticeCode, FileName from dbo.CQMS_Unqualified_RectifyNotice where RectifyNoticeCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Unqualified_RectifyNotice where x.RectifyNoticeCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().RectifyNoticeCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = q.First().RectifyNoticeCode.ToString(); // } //} //if (typeFlag == Const.CQMS_PauseNoticeTemplate) //{ // //strSql = "select PauseNoticeCode, FileName from dbo.CQMS_Unqualified_PauseNotice where PauseNoticeCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Unqualified_PauseNotice where x.PauseNoticeCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().PauseNoticeCode.ToString(); // if (q.First().FileName != null) // { // txtFileName = q.First().FileName.ToString(); // } // fileCode = q.First().PauseNoticeCode.ToString(); // } //} //if (typeFlag == Const.CQMS_RepriseApplyTemplate) //{ // //strSql = "select RepriseApplyCode, RepriseApplyName from dbo.CQMS_Unqualified_RepriseApply where RepriseApplyCode ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Unqualified_RepriseApply where x.RepriseApplyCode == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().RepriseApplyCode; // if (q.First().RepriseApplyName != null) // { // txtFileName = q.First().RepriseApplyName.ToString(); // } // fileCode = q.First().RepriseApplyCode; // } //} //if (typeFlag == Const.CQMS_Log) //{ // //strSql = "select Code from dbo.CQMS_Log where LogId ='" + docId + "'"; // //dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.CQMS_Log where x.LogId == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().Code.ToString(); // txtFileName = "施工日志"; // fileCode = q.First().Code.ToString(); // } //} //if (typeFlag == Const.GJSX_RoleReplace) //{ // strSql = "select Code from dbo.GJSX_RoleEntrust where RoleEntrustId ='" + docId + "'"; // dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.GJSX_RoleEntrust where x.RoleEntrustId == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().Code.ToString(); // txtFileName = "角色替代委托书"; // fileCode = q.First().Code.ToString(); // } //} //if (typeFlag == Const.GJSX_Concert) //{ // strSql = "select Code from dbo.GJSX_CoordinationReport where CoordinationReportId ='" + docId + "'"; // dr = BLL.SQLHelper.RunSql(strSql); // var q = from x in Funs.DB.GJSX_CoordinationReport where x.CoordinationReportId == docId select x; // if (q.Count() > 0) // { // txtFileCode = q.First().Code.ToString(); // txtFileName = "沟通协调报告"; // fileCode = q.First().Code.ToString(); // } //} fileCode2 = fileCode; fileCode3 = fileCode; } catch (Exception err) { } } } } }