using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; namespace FineUIPro.Web.CQMS.Information { public partial class ContactFormEdit : PageBase { /// /// 主键 /// public string ContactSheetId { get { return (string)ViewState["ContactSheetId"]; } set { ViewState["ContactSheetId"] = value; } } /// /// 办理类型 /// public string State { get { return (string)ViewState["State"]; } set { ViewState["State"] = value; } } /// /// 附件 /// public int HandleImg { get { return Convert.ToInt32(ViewState["HandleImg"]); } set { ViewState["HandleImg"] = value; } } /// /// 表单只读 /// protected void EnableForm(string detail) { if (detail == "true" || detail == "next") { btnSubmit.Hidden = detail == "next" ? false : true; btnSave.Hidden = true; txtDName.Readonly = true; dpShipIds.Readonly = true; txtContactSheetCode.Readonly = true; IsPo.Readonly = true; txtOwnerCode.Readonly = true; txtDocCode.Readonly = true; drpDraftReasonType.Readonly = true; drpDraftReasonType1.Readonly = true; drpInstallation.Readonly = true; drpUnitWork.Readonly = true; drpCNProfessional.Readonly = true; txtContents.Readonly = true; txtArtificialInput.Readonly = true; txtAuditArtificialInput.Readonly = true; DropCompany.Readonly = true; DropReceiver.Readonly = true; dpCreatDate.Readonly = true; dpRealCompletDate.Readonly = true; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ContactSheetId = Request.Params["ContactSheetId"]; var detail = Request.Params["detail"]; EnableForm(detail); this.hdCreateMan.Text = CurrUser.UserId; BindDistribute(); if (!string.IsNullOrEmpty(ContactSheetId)) { BindGrid(); } HandleImg = 0; this.drpDraftReasonType.DataTextField = "Text"; this.drpDraftReasonType.DataValueField = "Value"; this.drpDraftReasonType.DataSource = BLL.ContactSheetService.DraftReason1List(); this.drpDraftReasonType.DataBind(); this.drpInstallation.DataTextField = "Text"; this.drpInstallation.DataValueField = "Value"; this.drpInstallation.DataSource = BLL.Project_InstallationService.GetInstallationList(this.CurrUser.LoginProjectId); this.drpInstallation.DataBind(); this.drpCNProfessional.DataTextField = "ProfessionalName"; this.drpCNProfessional.DataValueField = "CNProfessionalId"; this.drpCNProfessional.DataSource = BLL.CNProfessionalService.GetList(); this.drpCNProfessional.DataBind(); this.DropCompany.DataTextField = "UnitName"; this.DropCompany.DataValueField = "UnitId"; this.DropCompany.DataSource = BLL.UnitService.GetUnitDropDownList(); this.DropCompany.DataBind(); this.DropReceiver.DataTextField = "UnitName"; this.DropReceiver.DataValueField = "UnitId"; this.DropReceiver.DataSource = BLL.UnitService.GetUnitDropDownList(); this.DropReceiver.DataBind(); string strSql = @"SELECT a.ContactSheetId ,a.ContactSheetCode ,a.DocCode ,a.DName , a.CreatDate FROM dbo.CQMS_Information_ContactSheet a"; List listStr = new List(); strSql += " where a.ProjectId = @ProjectId and a.CIType = 'C' "; listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); SqlParameter[] parameter = listStr.ToArray(); DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter); this.dpShipIds.DataTextField = "ContactSheetCode"; this.dpShipIds.DataValueField = "ContactSheetId"; this.dpShipIds.DataSource = dt; this.dpShipIds.DataBind(); //Funs.FineUIPleaseSelect(drpDesignType);//变更类型 Funs.FineUIPleaseSelect(drpHandleMan); this.HideOptions.Hidden = true; this.rblIsAgree.Hidden = true; if (!string.IsNullOrEmpty(ContactSheetId)) { this.hdContactSheetId.Text = ContactSheetId; Model.CQMS_Information_ContactSheet design = BLL.ContactSheetService.GetConfirmFormById(ContactSheetId); string unitType = string.Empty; this.txtContactSheetCode.Text = design.ContactSheetCode; if (!string.IsNullOrEmpty(design.CreatMan)) { this.hdCreateMan.Text = design.CreatMan; } if (!string.IsNullOrEmpty(design.DraftReasonCode)) { this.drpDraftReasonType.SelectedValue = design.DraftReasonCode; } if (!string.IsNullOrEmpty(design.DraftReasonCode)) { this.drpDraftReasonType1.SelectedValue = design.DraftReasonCode; } if (!string.IsNullOrEmpty(design.DName)) { this.txtDName.Text = design.DName; } if (!string.IsNullOrEmpty(design.DocCode)) { this.txtDocCode.Text = design.DocCode; } if (!string.IsNullOrEmpty(design.OwnerCode)) { this.txtOwnerCode.Text = design.OwnerCode; } if (design.CreatDate != null) { this.dpCreatDate.Text = string.Format("{0:yyyy-MM-dd}", design.CreatDate); } if (design.RealCompletDate != null) { this.dpRealCompletDate.Text = string.Format("{0:yyyy-MM-dd}", design.RealCompletDate); } if (!string.IsNullOrEmpty(design.CompanyCode)) { this.DropCompany.SelectedValue = design.CompanyCode; } if (!string.IsNullOrEmpty(design.Receiver)) { this.DropReceiver.SelectedValue = design.Receiver; } if (design.ProfessionCode != null) { this.drpCNProfessional.SelectedValue = design.ProfessionCode; } if (design.InstallationCode != null) { this.drpInstallation.SelectedValue = design.InstallationCode; var unitWork = BLL.UnitWorkService.GetUnitWork(this.CurrUser.LoginProjectId, design.InstallationCode); this.drpUnitWork.DataTextField = "Text"; this.drpUnitWork.DataValueField = "Value"; this.drpUnitWork.DataSource = unitWork; this.drpUnitWork.DataBind(); this.drpUnitWork.SelectedValue = design.UnitWork; } if (!string.IsNullOrEmpty(design.IsPo)) { this.IsPo.SelectedValue = design.IsPo; } if (!string.IsNullOrEmpty(design.ShipIds)) { this.dpShipIds.SelectedValue = design.ShipIds; } if (!string.IsNullOrEmpty(design.DraftReasonCode)) { var data = BLL.ContactSheetService.DraftReason2ByCode(design.DraftReasonCode.Substring(0, 1)); this.drpDraftReasonType1.DataTextField = "DraftReason"; this.drpDraftReasonType1.DataValueField = "DraftReasonCode"; this.drpDraftReasonType1.DataSource = data; this.drpDraftReasonType1.DataBind(); this.drpDraftReasonType1.SelectedValue = design.DraftReasonCode; this.drpDraftReasonType.SelectedValue = data[0].DraftReasonType; } if (design.ArtificialInput.HasValue) { this.txtArtificialInput.Text = design.ArtificialInput + ""; } if (design.AuditArtificialInput.HasValue) { this.txtAuditArtificialInput.Text = design.AuditArtificialInput + ""; } this.txtContents.Text = design.Contents; if (!string.IsNullOrEmpty(design.States)) { State = design.States; } else { State = BLL.Const.ContactSheet_Compile; this.HideOptions.Hidden = true; this.rblIsAgree.Hidden = true; } if (State != BLL.Const.ContactForm_Compile.ToString()) { this.drpHandleType.DataTextField = "Text"; this.drpHandleType.DataValueField = "Value"; drpHandleType.DataSource = BLL.ContactSheetService.GetFHandleTypeByState(State, this.RadioButtonList1.SelectedValue); drpHandleType.DataBind(); } if (State == BLL.Const.ContactForm_Compile || State == BLL.Const.ContactForm_ReCompile) { this.HideOptions.Visible = false; this.rblIsAgree.Visible = false; this.drpHandleMan.Enabled = true; this.drpHandleMan.DataTextField = "UserName"; this.drpHandleMan.DataValueField = "UserId"; this.drpHandleMan.DataSource = BLL.UserService.GetProjectUserListByProjectId(this.CurrUser.LoginProjectId); this.drpHandleMan.DataBind(); } else { this.drpHandleMan.DataTextField = "UserName"; this.drpHandleMan.DataValueField = "UserId"; this.drpHandleMan.DataSource = BLL.UserService.GetProjectUserListByProjectId(this.CurrUser.LoginProjectId); this.drpHandleMan.DataBind(); this.HideOptions.Hidden = false; this.rblIsAgree.Hidden = false; } //if (State == BLL.Const.ContactSheet_Compile || !string.IsNullOrEmpty(Request.Params["see"])) //{ // this.btnSave.Visible = false; // this.btnSubmit.Visible = false; // this.next.Hidden = true; //} if (State == Const.ContactForm_AuditCompleted) { this.btnSave.Visible = false; this.btnSubmit.Visible = false; this.next.Hidden = true; } this.drpHandleType.DataTextField = "Text"; this.drpHandleType.DataValueField = "Value"; drpHandleType.DataSource = BLL.ContactSheetService.GetFHandleTypeByState(State, this.RadioButtonList1.SelectedValue); drpHandleType.DataBind(); } else { State = Const.ContactSheet_Compile; this.drpHandleType.DataTextField = "Text"; this.drpHandleType.DataValueField = "Value"; drpHandleType.DataSource = BLL.ContactSheetService.GetFHandleTypeByState(State, this.RadioButtonList1.SelectedValue); drpHandleType.DataBind(); this.drpHandleMan.DataTextField = "UserName"; this.drpHandleMan.DataValueField = "UserId"; this.drpHandleMan.DataSource = BLL.UserService.GetProjectUserListByProjectId(this.CurrUser.LoginProjectId); this.drpHandleMan.DataBind(); plApprove2.Hidden = true; } } } private void BindDistribute() { string strSql1 = @"SELECT a.[UserId],b.UserName ,a.[UnitId],c.UnitName ,a.[RoleId] ,d.RoleName FROM[dbo].[Project_ProjectUser] a left join dbo.Sys_User b on a.UserId = b.UserId left join dbo.Base_Unit c on a.UnitId = c.UnitId left join dbo.Sys_Role d on a.RoleId = d.RoleId where a.ProjectId = @ProjectId "; List listStr1 = new List(); //listStr1.Add(new SqlParameter("@UserId", this.CurrUser.UserId)); listStr1.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); SqlParameter[] parameter1 = listStr1.ToArray(); DataTable tb1 = SQLHelper.GetDataTableRunText(strSql1, parameter1); Distribute.RecordCount = tb1.Rows.Count; tb1 = GetFilteredTable(Distribute.FilteredData, tb1); var table1 = this.GetPagedDataTable(Distribute, tb1); Distribute.DataSource = table1; Distribute.DataBind(); if (!string.IsNullOrEmpty(ContactSheetId)) { var userIds = BLL.ContactSheetService.GetDistributesUserId(this.ContactSheetId); Distribute.SelectedRowIDArray = userIds.ToArray(); } } private void BindGrid() { string strSql = "select D.ContactSheetAuditId,ContactSheetId,U.UserName, AuditDate,Opinions,D.HandleStep,IsAgree from CQMS_Information_ContactSheetApprove D left join Sys_user U on D.AuditMan = U.UserId where ContactSheetId=@ContactSheetId and D.AuditDate is not null"; List listStr = new List(); listStr.Add(new SqlParameter("@ContactSheetId", ContactSheetId)); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); gvApprove.RecordCount = tb.Rows.Count; tb = GetFilteredTable(gvApprove.FilteredData, tb); var table = this.GetPagedDataTable(gvApprove, tb); gvApprove.DataSource = table; gvApprove.DataBind(); } protected void btnSubmit_Click(object sender, EventArgs e) { if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.DesignMenuId, BLL.Const.BtnSubmit)) { SavePauseNotice("submit"); } else { Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } protected void btnSave_Click(object sender, EventArgs e) { if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.DesignMenuId, BLL.Const.BtnSave)) { SavePauseNotice("save"); } else { Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } /// /// 保存开工报告 /// private void SavePauseNotice(string saveType) { Model.CQMS_Information_ContactSheet design = new Model.CQMS_Information_ContactSheet(); design.ContactSheetCode = this.txtContactSheetCode.Text.Trim(); design.ProjectId = this.CurrUser.LoginProjectId; if (this.drpDraftReasonType1.SelectedValue != BLL.Const._Null) { design.DraftReasonCode = this.drpDraftReasonType1.SelectedValue; } else { Alert.ShowInTop("变更原因不能为空!", MessageBoxIcon.Warning); return; } if (this.drpInstallation.SelectedValue != BLL.Const._Null) { design.InstallationCode = this.drpInstallation.SelectedValue; } else { Alert.ShowInTop("装置不能为空!", MessageBoxIcon.Warning); return; } if (this.drpUnitWork.SelectedValue != BLL.Const._Null) { design.UnitWork = this.drpUnitWork.SelectedValue; } else { Alert.ShowInTop("单位工程不能为空!", MessageBoxIcon.Warning); return; } if (this.drpCNProfessional.SelectedValue != BLL.Const._Null) { design.ProfessionCode = this.drpCNProfessional.SelectedValue; } else { Alert.ShowInTop("所属专业不能为空!", MessageBoxIcon.Warning); return; } if (!string.IsNullOrEmpty(this.dpCreatDate.Text.Trim())) { design.CreatDate = Convert.ToDateTime(this.dpCreatDate.Text.Trim()); } if (!string.IsNullOrEmpty(this.dpRealCompletDate.Text.Trim())) { design.RealCompletDate = Convert.ToDateTime(this.dpRealCompletDate.Text.Trim()); } if (this.DropCompany.SelectedValue != BLL.Const._Null) { design.CompanyCode = this.DropCompany.SelectedValue; } if (this.DropReceiver.SelectedValue != BLL.Const._Null) { design.Receiver = this.DropReceiver.SelectedValue; } if (this.IsPo.SelectedValue != BLL.Const._Null) { design.IsPo = this.IsPo.SelectedValue; } if (this.dpShipIds.SelectedValue != BLL.Const._Null) { design.ShipIds = this.dpShipIds.SelectedValue; } design.Contents = this.txtContents.Text.Trim(); design.DName = this.txtDName.Text.Trim(); design.OwnerCode = this.txtOwnerCode.Text.Trim(); design.DocCode = this.txtDocCode.Text.Trim(); design.CreatMan = this.hdCreateMan.Text.Trim(); design.ArtificialInput = decimal.Parse(this.txtArtificialInput.Text.Trim()); design.AuditArtificialInput = decimal.Parse(this.txtAuditArtificialInput.Text.Trim()); design.CIType = "F"; if (saveType == "submit") { design.States = drpHandleType.SelectedValue.Trim(); } else { Model.CQMS_Information_ContactSheet design1 = BLL.ContactSheetService.GetConfirmFormById(ContactSheetId); if (design1 != null) { if (string.IsNullOrEmpty(design1.States)) { design.States = BLL.Const.Design_Compile; } else { design.States = design1.States; } } else { design.States = BLL.Const.Design_Compile; } } if (saveType == "submit" && this.drpHandleType.SelectedValue == Const.ContactSheet_Audit2) //计算相似度 { var contactSheets = BLL.ContactSheetService.getCListByProjectId(CurrUser.LoginProjectId, this.ContactSheetId); decimal likeRate = 0; string likeContactSheetId = string.Empty; foreach (var c in contactSheets) { decimal rate = BLL.CommonService.GetLikeRate(c.Contents, design.Contents); if (string.IsNullOrEmpty(likeContactSheetId)) //首次计算 { likeRate = rate; if (likeRate > 0) { likeContactSheetId = c.ContactSheetId; } } else { if (rate > likeRate) { likeRate = rate; likeContactSheetId = c.ContactSheetId; } } } design.LikeRate = likeRate; design.LikeContactSheetId = likeContactSheetId; } if (!string.IsNullOrEmpty(ContactSheetId)) { Model.CQMS_Information_ContactSheet design1 = BLL.ContactSheetService.GetConfirmFormById(ContactSheetId); Model.CQMS_Information_ContactSheetApprove approve1 = BLL.ContactSheetApproveService.GetDesignApproveByContactSheetId(ContactSheetId); if (approve1 != null && saveType == "submit") { approve1.AuditDate = DateTime.Now; approve1.Opinions = this.txtOpinions.Text.Trim(); BLL.ContactSheetApproveService.UpdateContactSheetApprove(approve1); } if (saveType == "submit") { design.AuditUser = null; Model.CQMS_Information_ContactSheetApprove approve = new Model.CQMS_Information_ContactSheetApprove(); approve.ContactSheetId = design1.ContactSheetId; if (this.drpHandleMan.SelectedValue != BLL.Const._Null) { approve.AuditMan = this.drpHandleMan.SelectedValue; } approve.HandleStep = this.drpHandleType.SelectedValue; BLL.ContactSheetApproveService.AddContactSheetApprove(approve); APICommonService.SendSubscribeMessage(approve.AuditMan, "工程联络单待办理", this.CurrUser.UserName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now)); } if (saveType == "save") { design.AuditUser = this.drpHandleMan.SelectedValue; } design.ContactSheetId = ContactSheetId; BLL.ContactSheetService.UpdateConfirmForm(design); } else { if (!string.IsNullOrEmpty(this.hdContactSheetId.Text)) { design.ContactSheetId = this.hdContactSheetId.Text; } else { design.ContactSheetId = SQLHelper.GetNewID(typeof(Model.CQMS_Information_ContactSheet)); } if (saveType == "save") { design.AuditUser = this.drpHandleMan.SelectedValue; } design.CreatMan = this.CurrUser.UserId; design.CreatDate = DateTime.Now; BLL.ContactSheetService.AddConfirmForm(design); ContactSheetId = design.ContactSheetId; Model.CQMS_Information_ContactSheet design1 = BLL.ContactSheetService.GetConfirmFormById(ContactSheetId); if (saveType == "submit") { Model.CQMS_Information_ContactSheetApprove approve1 = new Model.CQMS_Information_ContactSheetApprove(); approve1.ContactSheetId = design.ContactSheetId; approve1.AuditDate = DateTime.Now; approve1.AuditMan = this.CurrUser.UserId; approve1.HandleStep = BLL.Const.Design_Compile; BLL.ContactSheetApproveService.AddContactSheetApprove(approve1); Model.CQMS_Information_ContactSheetApprove approve = new Model.CQMS_Information_ContactSheetApprove(); approve.ContactSheetId = design.ContactSheetId; if (this.drpHandleMan.SelectedValue != BLL.Const._Null) { approve.AuditMan = this.drpHandleMan.SelectedValue; } approve.HandleStep = this.drpHandleType.SelectedValue; if (this.drpHandleType.SelectedValue == BLL.Const.Design_Complete) { approve.AuditDate = DateTime.Now.AddMinutes(1); } BLL.ContactSheetApproveService.AddContactSheetApprove(approve); APICommonService.SendSubscribeMessage(approve.AuditMan, "工程联络单待办理", this.CurrUser.UserName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now)); } else { Model.CQMS_Information_ContactSheetApprove approve1 = new Model.CQMS_Information_ContactSheetApprove(); approve1.ContactSheetId = design.ContactSheetId; approve1.AuditMan = this.CurrUser.UserId; approve1.HandleStep = BLL.Const.Design_Compile; BLL.ContactSheetApproveService.AddContactSheetApprove(approve1); } } var selectIndex = this.Distribute.SelectedRowIndexArray; List dataIds = new List(); foreach (var index in selectIndex) { dataIds.Add(this.Distribute.DataKeys[index][0] + ""); } BLL.ContactSheetService.updateDistribute(dataIds, ContactSheetId); ShowNotify("提交成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } protected void dpShipIds_SelectedIndexChanged(object sender, EventArgs e) { var selectedValue = this.dpShipIds.SelectedValue; var contactSheet = Funs.DB.CQMS_Information_ContactSheet.Where(u => u.ContactSheetId == selectedValue).FirstOrDefault(); this.DropCompany.SelectedValue = contactSheet.CompanyCode; this.txtContents.Text = contactSheet.Contents; if (!string.IsNullOrEmpty(contactSheet.InstallationCode)) { var unitWork = BLL.UnitWorkService.GetUnitWork(this.CurrUser.LoginProjectId, contactSheet.InstallationCode); this.drpUnitWork.DataTextField = "Text"; this.drpUnitWork.DataValueField = "Value"; this.drpUnitWork.DataSource = unitWork; this.drpUnitWork.DataBind(); this.drpUnitWork.SelectedValue = contactSheet.UnitWork; } decimal d = 0, d1 = 0, d2 = 0; if (contactSheet.CIType == "F") //现场联系单带出审核费用 { if (contactSheet.AuditArtificialInput != null) { } } else if (contactSheet.CIType == "I") //现场指令单带出预算费用 { if (contactSheet.PriceType == "F") { if (contactSheet.MaterialInput != null) { d += Convert.ToDecimal(contactSheet.ArtificialInput); } if (contactSheet.MaterialInput != null) { d += Convert.ToDecimal(contactSheet.MaterialInput); } if (contactSheet.ToolInput != null) { d += Convert.ToDecimal(contactSheet.ToolInput); } } else { d1 = Convert.ToDecimal(contactSheet.UnitPrice); d2 = Convert.ToDecimal(contactSheet.Counts); d = d1 * d2; } } this.drpInstallation.SelectedValue = contactSheet.InstallationCode; this.drpCNProfessional.SelectedValue = contactSheet.ProfessionCode; //if (contactSheet.CreatDate != null) //{ // UIHelper.DatePicker("CreatDate").SelectedDate(Convert.ToDateTime(contactSheet.CreatDate)); //} if (!string.IsNullOrEmpty(contactSheet.DraftReasonCode)) { var data = BLL.ContactSheetService.DraftReason2ByCode(contactSheet.DraftReasonCode.Substring(0, 1)); this.drpDraftReasonType1.DataTextField = "DraftReason"; this.drpDraftReasonType1.DataValueField = "DraftReasonCode"; this.drpDraftReasonType1.DataSource = data; this.drpDraftReasonType1.DataBind(); this.drpDraftReasonType1.SelectedValue = contactSheet.DraftReasonCode; var draftReasonCode = Funs.DB.CQMS_Information_DraftReason.Where(u => u.DraftReasonCode == contactSheet.DraftReasonCode).FirstOrDefault(); if (draftReasonCode != null) { this.drpDraftReasonType.SelectedValue = draftReasonCode.DraftReasonType; } } } protected void dpShipIds_ItemDataBound(object sender, ListItemEventArgs e) { DataRowView row = e.DataItem as DataRowView; e.Item.Display = String.Format("
{0}//{1}//{2}//{3}
", row["ContactSheetCode"], row["DocCode"], row["DName"], string.Format("{0:yyyy-MM-dd}", row["CreatDate"])); } protected void drpDraftReasonType_SelectedIndexChanged(object sender, EventArgs e) { var selectedValue = this.drpDraftReasonType.SelectedValue; this.drpDraftReasonType1.DataTextField = "Text"; this.drpDraftReasonType1.DataValueField = "Value"; this.drpDraftReasonType1.DataSource = BLL.ContactSheetService.DraftReason2(selectedValue); this.drpDraftReasonType1.DataBind(); } protected void btnAttach_Click1(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdContactSheetId.Text)) //新增记录 { this.hdContactSheetId.Text = SQLHelper.GetNewID(typeof(Model.Check_Design)); } if (this.State == Const.ConfirmForm_Compile || this.State == Const.ConfirmForm_ReCompile) { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId=A{1}&path=FileUpload/Design&menuId={2}", 0, this.hdContactSheetId.Text, BLL.Const.ConfirmMenuId))); } else { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId=A{1}&path=FileUpload/Design&menuId={2}", -1, this.hdContactSheetId.Text, BLL.Const.ConfirmMenuId))); } } protected void btnAttach_Click2(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdContactSheetId.Text)) //新增记录 { this.hdContactSheetId.Text = SQLHelper.GetNewID(typeof(Model.Check_Design)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId=B{1}&path=FileUpload/Design&menuId={2}", HandleImg, this.hdContactSheetId.Text, BLL.Const.ConfirmMenuId))); } protected void btnAttach_Click3(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdContactSheetId.Text)) //新增记录 { this.hdContactSheetId.Text = SQLHelper.GetNewID(typeof(Model.Check_Design)); } if (this.State == Const.ConfirmForm_Compile || this.State == Const.ConfirmForm_ReCompile) { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId=C{1}&path=FileUpload/Design&menuId={2}", 0, this.hdContactSheetId.Text, BLL.Const.ConfirmMenuId))); } else { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId=C{1}&path=FileUpload/Design&menuId={2}", -1, this.hdContactSheetId.Text, BLL.Const.ConfirmMenuId))); } } /// /// 材料预计到齐时间文本框改变事件 /// /// /// protected void txtMaterialPlanReachDate_TextChanged(object sender, EventArgs e) { // this.txtPlanCompleteDate.Text = string.Empty; } /// /// 把状态转换代号为文字形式 /// /// /// protected string ConvertState(object state) { if (state != null) { if (state.ToString() == BLL.Const.ContactForm_ReCompile) { return "重新编制"; } else if (state.ToString() == BLL.Const.ContactForm_Compile) { return "变更录入"; } else if (state.ToString() == BLL.Const.ContactForm_Audit1) { return "分包技术负责人审核"; } else if (state.ToString() == BLL.Const.ContactForm_Audit2) { return "专业工程师审核"; } else if (state.ToString() == BLL.Const.ContactForm_Audit3) { return "施工经理审核"; } else if (state.ToString() == BLL.Const.ContactForm_Audit4) { return "项目费控工程师审核"; } else if (state.ToString() == BLL.Const.ContactForm_Audit5) { return "项目费控经理审核"; } else if (state.ToString() == BLL.Const.ContactForm_Audit6) { return "现场负责人/项目经理审核"; } else if (state.ToString() == BLL.Const.ContactForm_Audit7) { return "QA/QC经理审核"; } else if (state.ToString() == BLL.Const.ContactForm_Audit8) { return "文控分发审核"; } else if (state.ToString() == BLL.Const.ContactForm_AuditCompleted) { return "审批完成"; } else { return ""; } } else { return ""; } } /// /// 办理步骤下拉框改变事件 /// /// /// protected void drpHandleType_SelectedIndexChanged(object sender, EventArgs e) { this.drpHandleMan.Items.Clear(); Funs.FineUIPleaseSelect(this.drpHandleMan); if (this.drpHandleType.SelectedValue == BLL.Const.ContactSheet_Compile) { this.drpHandleMan.Enabled = false; } else if (this.drpHandleType.SelectedValue == BLL.Const.ContactSheet_ReCompile) { this.drpHandleMan.Enabled = true; string userId = (from x in Funs.DB.CQMS_Information_ContactSheetApprove where x.ContactSheetId == ContactSheetId && x.HandleStep == BLL.Const.ContactSheet_Compile select x.AuditMan).First(); ListItem lis = new ListItem(BLL.UserService.GetUserByUserId(userId).UserName, userId); this.drpHandleMan.Items.Add(lis); this.drpHandleMan.SelectedIndex = 0; } else { this.drpHandleMan.Enabled = true; this.drpHandleMan.DataTextField = "UserName"; this.drpHandleMan.DataValueField = "UserId"; this.drpHandleMan.DataSource = BLL.UserService.GetProjectUserListByProjectId(this.CurrUser.LoginProjectId); this.drpHandleMan.DataBind(); this.drpHandleMan.SelectedIndex = 1; } } protected void drpInstallation_SelectedIndexChanged(object sender, EventArgs e) { var installtionId = this.drpInstallation.SelectedValue; var unitWork = BLL.UnitWorkService.GetUnitWork(this.CurrUser.LoginProjectId, installtionId); this.drpUnitWork.DataTextField = "Text"; this.drpUnitWork.DataValueField = "Value"; this.drpUnitWork.DataSource = unitWork; this.drpUnitWork.DataBind(); } /// /// 同意审核单选框改变事件 /// /// /// protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { this.drpHandleMan.Enabled = true; string State = BLL.ContactSheetService.GetConfirmFormById(ContactSheetId).States; if (this.RadioButtonList1.SelectedValue.Equals("true")) { this.drpHandleType.DataTextField = "Text"; this.drpHandleType.DataValueField = "Value"; drpHandleType.DataSource = BLL.ContactSheetService.GetFHandleTypeByState(State, this.RadioButtonList1.SelectedValue); drpHandleType.DataBind(); this.drpHandleType.SelectedIndex = 0; this.drpHandleMan.Items.Clear(); this.drpHandleMan.DataTextField = "UserName"; this.drpHandleMan.DataValueField = "UserId"; this.drpHandleMan.DataSource = BLL.UserService.GetProjectUserListByProjectId(this.CurrUser.LoginProjectId); this.drpHandleMan.DataBind(); this.drpHandleMan.SelectedIndex = 0; } else { this.drpHandleType.DataTextField = "Text"; this.drpHandleType.DataValueField = "Value"; drpHandleType.DataSource = BLL.ContactSheetService.GetFHandleTypeByState(State, this.RadioButtonList1.SelectedValue); drpHandleType.DataBind(); this.drpHandleType.SelectedIndex = 0; this.drpHandleMan.Items.Clear(); ListItem item = new ListItem(); Model.Sys_User user = BLL.UserService.GetUserByUserId(BLL.ContactSheetApproveService.GetAuditMan(ContactSheetId, this.drpHandleType.SelectedValue == "0" ? "1" : this.drpHandleType.SelectedValue).AuditMan); item.Value = user.UserId; item.Text = user.UserName; this.drpHandleMan.Items.Add(item); this.drpHandleMan.SelectedIndex = 0; } } } }