/// <summary> /// 增加人员信息 /// </summary> /// <param name="user">人员实体</param> public static void AddUser(Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; string newKeyID = SQLHelper.GetNewID(typeof(Model.Sys_User)); Model.Sys_User newUser = new Model.Sys_User { UserId = newKeyID, Account = user.Account, UserName = user.UserName, UserCode = user.UserCode, Password = user.Password, UnitId = user.UnitId, RoleId = user.RoleId, IsPost = user.IsPost, IdentityCard = user.IdentityCard, IsPosts = true, IsReplies = true, IsDeletePosts = true, PageSize = 10, IsOffice = user.IsOffice, Telephone = user.Telephone, DataSources = user.DataSources, SignatureUrl = user.SignatureUrl, DepartId = user.DepartId, }; db.Sys_User.InsertOnSubmit(newUser); db.SubmitChanges(); }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.PunishNoticeId = Request.Params["PunishNoticeId"]; this.txtCurrency.Text = "人民币"; if (!string.IsNullOrEmpty(this.PunishNoticeId)) { Model.Check_PunishNotice punishNotice = BLL.PunishNoticeService.GetPunishNoticeById(this.PunishNoticeId); if (punishNotice != null) { this.txtPunishNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.PunishNoticeId); if (punishNotice.PunishNoticeDate != null) { this.txtPunishNoticeDate.Text = string.Format("{0:yyyy-MM-dd}", punishNotice.PunishNoticeDate); } if (!string.IsNullOrEmpty(punishNotice.UnitId)) { var unit = BLL.UnitService.GetUnitByUnitId(punishNotice.UnitId); if (unit != null) { this.txtUnitName.Text = unit.UnitName; } } Model.Sys_User user1 = BLL.UserService.GetUserByUserId(punishNotice.SignMan); if (user1 != null) { this.txtSignMan.Text = user1.UserName; } Model.Sys_User user2 = BLL.UserService.GetUserByUserId(punishNotice.ApproveMan); if (user2 != null) { this.txtApproveMan.Text = user2.UserName; } this.txtContractNum.Text = punishNotice.ContractNum; this.txtIncentiveReason.Text = punishNotice.IncentiveReason; this.txtBasicItem.Text = punishNotice.BasicItem; if (punishNotice.PunishMoney != null) { this.txtPunishMoney.Text = Convert.ToString(punishNotice.PunishMoney); this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPunishMoney.Text));//转换大写 } this.AttchUrl = punishNotice.AttachUrl; //this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttchUrl); this.txtFileContents.Text = HttpUtility.HtmlDecode(punishNotice.FileContents); if (!string.IsNullOrEmpty(punishNotice.Currency)) { this.txtCurrency.Text = punishNotice.Currency; } this.txtPunishName.Text = punishNotice.PunishName; } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectPunishNoticeMenuId; this.ctlAuditFlow.DataId = this.PunishNoticeId; } }
public ActionResult LoginIn(string LoginID, string Password) { String erro = ""; JsonObject json = new JsonObject(); if (String.IsNullOrEmpty(LoginID)) { erro += ",用户名不能为空"; } else { LoginID = LoginID.Trim(); } if (String.IsNullOrEmpty(Password)) { erro += ",密码不能为空"; } else { Password = Password.Trim(); } //如果参数错误,则返回错误信息 if (!String.IsNullOrEmpty(erro)) { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = erro.Substring(1); return(Json(json)); } List <Model.Sys_User> userList = new BLL.Sys_User().GetModelList("LoginID='" + LoginID + "'"); //如果用户为空,则返回错误信息 if (userList == null || userList.Count == 0) { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = "用户名不存在"; return(Json(json)); } Model.Sys_User user = userList[0]; //如果密码错误 if (!String.Equals("1", user.IsValid)) { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = "用户已停用"; return(Json(json)); } //如果密码错误 if (!String.Equals(Password, user.Password)) { json.Status = JsonObject.STATUS_FAIL; json.ErroMessage = "用户名密码错误"; return(Json(json)); } //登陆成功 存储session信息 new UserService().UserLogin(user); json.Status = JsonObject.STATUS_SUCCESS; return(Json(json)); }
/// <summary> /// 修改密码 /// </summary> /// <param name="userId"></param> /// <param name="password"></param> public static void UpdatePassword(string userId, string password) { Model.SUBHSSEDB db = Funs.DB; Model.Sys_User m = db.Sys_User.FirstOrDefault(e => e.UserId == userId); if (m != null) { m.Password = Funs.EncryptionPassword(password); db.SubmitChanges(); } }
/// <summary> /// 根据用户获取用户名称 /// </summary> /// <param name="userId"></param> /// <returns></returns> public static string GetUserNameByUserId(string userId) { string userName = string.Empty; Model.Sys_User user = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId); if (user != null) { userName = user.UserName; } return(userName); }
/// <summary> /// 根据人员Id删除一个人员信息 /// </summary> /// <param name="userId"></param> public static void DeleteUser(string userId) { Model.SUBHSSEDB db = Funs.DB; Model.Sys_User user = db.Sys_User.FirstOrDefault(e => e.UserId == userId); if (user != null) { var logs = from x in db.Sys_Log where x.UserId == userId select x; if (logs.Count() > 0) { db.Sys_Log.DeleteAllOnSubmit(logs); } db.Sys_User.DeleteOnSubmit(user); db.SubmitChanges(); } }
/// <summary> /// 根据用户获取用户名称 /// </summary> /// <param name="userId"></param> /// <returns></returns> public static string GetUserNameAndTelByUserId(string userId) { string userName = string.Empty; Model.Sys_User user = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId); if (user != null) { userName = user.UserName; if (!string.IsNullOrEmpty(user.Telephone)) { userName += ";" + user.Telephone; } } return(userName); }
/// <summary> /// 页面加载时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //if (!string.IsNullOrEmpty(Request.Params["type"])) //{ // this.btnSave.Hidden = true; //} LoadData(); var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.RegistrationRecordMenuId); if (buttonList.Count() > 0) { if (buttonList.Contains(BLL.Const.BtnSave)) { this.btnSave.Hidden = false; } } string registrationRecordId = Request.Params["RegistrationRecordId"]; Model.Inspection_RegistrationRecord record = BLL.RegistrationRecordService.GetRegisterRecordByRegisterRecordId(registrationRecordId); if (record != null) { if (record.CheckDate != null) { this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", record.CheckDate); } if (!string.IsNullOrEmpty(record.CheckPerson)) { Model.Sys_User user = BLL.UserService.GetUserByUserId(record.CheckPerson); if (user != null) { this.txtCheckMan.Text = user.UserName; } } BindGrid(record.CheckPerson, record.CheckDate.Value.Date); } else { this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); } } }
/// <summary> /// 修改人员信息 /// </summary> /// <param name="user">人员实体</param> public static void UpdateUser(Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; Model.Sys_User newUser = db.Sys_User.FirstOrDefault(e => e.UserId == user.UserId); if (newUser != null) { newUser.Account = user.Account; newUser.UserName = user.UserName; newUser.UserCode = user.UserCode; if (!string.IsNullOrEmpty(user.Password)) { newUser.Password = user.Password; } newUser.IdentityCard = user.IdentityCard; newUser.UnitId = user.UnitId; newUser.RoleId = user.RoleId; newUser.IsPost = user.IsPost; newUser.IsOffice = user.IsOffice; newUser.Telephone = user.Telephone; newUser.SignatureUrl = user.SignatureUrl; newUser.DepartId = user.DepartId; db.SubmitChanges(); } }
/// <summary> /// 插入人员培训记录 5 /// </summary> /// <param name="projectId"></param> /// <param name="arr"></param> public static bool AddPersonTrainRecord(string projectId, JArray arr, Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; bool isOk = true; try { foreach (var item in arr) { string id = item["ID"].ToString(); if (!string.IsNullOrEmpty(id)) { bool isPass = false; if (item["IsPass"].ToString() == "1") { isPass = true; } Model.EduTrain_TrainPersonRecord newTrainPersonRecord = new Model.EduTrain_TrainPersonRecord { ID = id, ProjectId = projectId, EmpName = item["EmpName"].ToString(), IdentifyId = item["IdentifyId"].ToString(), CategoryName = item["CategoryName"].ToString(), RecordId = item["RecordId"].ToString(), DepartId = item["DepartId"].ToString(), DepartName = item["DepartName"].ToString(), TrainPeriod = item["TrainPeriod"].ToString(), TotalScore = item["TotalScore"].ToString(), PassScore = item["PassScore"].ToString(), Score = item["Score"].ToString(), IsPass = isPass, GroupNo = item["GroupNo"].ToString(), ExamNo = item["ExamNo"].ToString(), ExamCount = item["ExamCount"].ToString(), DeviceNo = item["DeviceNo"].ToString(), OwnerDepartId = item["OwnerDepartId"].ToString(), Answers = item["Answers"].ToString(), RecordName = item["RecordName"].ToString(), TrainType = item["TrainType"].ToString(), PaperMode = item["PaperMode"].ToString(), TrainMode = item["TrainMode"].ToString(), TrainPrincipal = item["TrainPrincipal"].ToString(), TrainStartDate = Funs.GetNewDateTime(item["TrainStartDate"].ToString()), TrainEndDate = Funs.GetNewDateTime(item["TrainEndDate"].ToString()), TrainContent = item["TrainContent"].ToString(), TrainDescript = item["TrainDescript"].ToString(), }; var getnewTrainPersonRecord = db.EduTrain_TrainPersonRecord.FirstOrDefault(x => x.ID == id); if (getnewTrainPersonRecord == null) { db.EduTrain_TrainPersonRecord.InsertOnSubmit(newTrainPersonRecord); db.SubmitChanges(); } else { db.SubmitChanges(); } } else { isOk = false; } } } catch (Exception ex) { isOk = false; ErrLogInfo.WriteLog(string.Empty, ex); } return(isOk); }
/// <summary> /// 插入人员信息 0 /// </summary> /// <param name="projectId"></param> /// <param name="arr"></param> public static bool AddPerson(string projectId, JArray arr, Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; bool isOk = true; try { foreach (var item in arr) { ////单位 string unitId = null; var getUnit = db.Base_Unit.FirstOrDefault(x => x.FromUnitId == item["DepartId"].ToString()); if (getUnit != null) { unitId = getUnit.UnitId; } ///区域 string workAreaId = null; var getWorkArea = db.ProjectData_WorkArea.FirstOrDefault(x => x.ProjectId == projectId && x.WorkAreaName == item["BuildArea"].ToString()); if (getWorkArea != null) { workAreaId = getWorkArea.WorkAreaId; } ///岗位 string workPostId = null; var getWorkPost = db.Base_WorkPost.FirstOrDefault(x => x.WorkPostName == item["Station"].ToString()); if (getWorkPost != null) { workPostId = getWorkPost.WorkPostId; } DateTime?inTime = Funs.GetNewDateTime(item["EntranceDate"].ToString()); DateTime?outTime = Funs.GetNewDateTime(item["LeaveDate"].ToString()); if (outTime < inTime) { outTime = null; } string IdentifyID = item["IdentifyID"].ToString(); if (!string.IsNullOrEmpty(IdentifyID)) { Model.SitePerson_Person newPerson = new Model.SitePerson_Person { FromPersonId = item["ID"].ToString(), CardNo = item["JobNumber"].ToString(), PersonName = item["Name"].ToString(), Sex = item["Sex"].ToString(), IdentityCard = IdentifyID, Address = item["Address"].ToString(), ProjectId = projectId, UnitId = unitId, /////映射取值 //TeamGroupId = person.TeamGroupId, WorkAreaId = workAreaId, /////关联映射取值 WorkPostId = workPostId, /////关联映射取值 InTime = inTime, OutTime = outTime, Telephone = item["ContactTel"].ToString(), IsUsed = true, IsCardUsed = true, }; var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == projectId && x.IdentityCard == IdentifyID); if (getPerson == null) { newPerson.PersonId = SQLHelper.GetNewID(typeof(Model.SitePerson_Person)); PersonService.AddPerson(newPerson); BLL.LogService.AddSys_Log(user, newPerson.PersonName, newPerson.PersonId, BLL.Const.PersonListMenuId, BLL.Const.BtnAdd); } else { getPerson.FromPersonId = newPerson.FromPersonId; getPerson.InTime = newPerson.InTime; getPerson.OutTime = newPerson.OutTime; getPerson.Telephone = newPerson.Telephone; if (!string.IsNullOrEmpty(unitId)) { getPerson.UnitId = unitId; } if (!string.IsNullOrEmpty(workAreaId)) { getPerson.WorkAreaId = workAreaId; } if (!string.IsNullOrEmpty(workPostId)) { getPerson.WorkPostId = workPostId; } PersonService.UpdatePerson(getPerson); BLL.LogService.AddSys_Log(user, getPerson.PersonName, getPerson.PersonId, BLL.Const.PersonListMenuId, BLL.Const.BtnModify); } } } } catch (Exception ex) { isOk = false; ErrLogInfo.WriteLog(string.Empty, ex); } return(isOk); }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { hdAttachUrl.Text = string.Empty; hdId.Text = string.Empty; btnClose.OnClientClick = ActiveWindow.GetHideReference(); List <Model.Base_Unit> thisUnit = BLL.UnitService.GetThisUnitDropDownList(); string thisUnitId = string.Empty; string thisUnitName = string.Empty; if (thisUnit.Count > 0) { thisUnitId = thisUnit[0].UnitId; this.txtThisUnit.Text = thisUnit[0].UnitName; this.txtMainUnitDeputy.Label = thisUnit[0].UnitName; } checkWorkDetails.Clear(); this.CheckWorkId = Request.Params["CheckWorkId"]; var checkWork = BLL.Check_CheckWorkService.GetCheckWorkByCheckWorkId(this.CheckWorkId); if (checkWork != null) { this.txtCheckWorkCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.CheckWorkId); if (checkWork.CheckTime != null) { this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", checkWork.CheckTime); } this.txtArea.Text = checkWork.Area; if (!string.IsNullOrEmpty(checkWork.MainUnitPerson)) { string personNames = string.Empty; string[] unitIds = checkWork.MainUnitPerson.Split(','); foreach (var item in unitIds) { Model.Sys_User user = BLL.UserService.GetUserByUserId(item); if (user != null) { personNames += user.UserName + ","; } } if (!string.IsNullOrEmpty(personNames)) { personNames = personNames.Substring(0, personNames.LastIndexOf(",")); } this.txtMainUnitPerson.Text = personNames; } if (!string.IsNullOrEmpty(checkWork.SubUnits)) { string unitNames = string.Empty; foreach (var item in checkWork.SubUnits.Split(',')) { unitNames += BLL.UnitService.GetUnitNameByUnitId(item) + ","; } if (!string.IsNullOrEmpty(unitNames)) { this.txtSubUnits.Text = unitNames.Substring(0, unitNames.LastIndexOf(',')); } if (!string.IsNullOrEmpty(checkWork.SubUnitPerson)) { string personNames = string.Empty; foreach (var item in checkWork.SubUnitPerson.Split(',')) { personNames += BLL.UserService.GetUserNameByUserId(item) + ","; } if (!string.IsNullOrEmpty(personNames)) { this.txtSubUnitPerson.Text = personNames.Substring(0, personNames.LastIndexOf(",")); } } } this.txtPartInPersonNames.Text = checkWork.PartInPersonNames; if (checkWork.IsCompleted == true) { this.lbIsCompleted.Text = "已闭环"; } else { this.lbIsCompleted.Text = "未闭环"; } this.txtMainUnitDeputy.Text = checkWork.MainUnitDeputy; if (checkWork.MainUnitDeputyDate != null) { this.txtMainUnitDeputyDate.Text = string.Format("{0:yyyy-MM-dd}", checkWork.MainUnitDeputyDate); } this.txtSubUnitDeputy.Text = checkWork.SubUnitDeputy; if (checkWork.SubUnitDeputyDate != null) { this.txtSubUnitDeputyDate.Text = string.Format("{0:yyyy-MM-dd}", checkWork.SubUnitDeputyDate); } checkWorkDetails = (from x in Funs.DB.View_Check_CheckWorkDetail where x.CheckWorkId == this.CheckWorkId orderby x.CheckItem select x).ToList(); } Grid1.DataSource = checkWorkDetails; Grid1.DataBind(); ChangeGridColor(); ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectCheckWorkMenuId; this.ctlAuditFlow.DataId = this.CheckWorkId; } }
/// <summary> /// 插入信息-单位信息 1 /// </summary> /// <param name="projectId"></param> /// <param name="arr"></param> public static bool AddUnit(string projectId, JArray arr, Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; bool isOk = true; try { foreach (var item in arr) { string fromUnitId = item["ID"].ToString(); string departName = item["DepartName"].ToString(); ///单位名称 string departSir = item["DepartSir"].ToString(); ///单位级别 0:非项目部 1:项目部级 2:项目部下级单位 ////单位类型 string unitTypeId = null; var getUnitType = db.Base_UnitType.FirstOrDefault(x => x.UnitTypeName == item["DepartType"].ToString()); if (getUnitType != null) { unitTypeId = getUnitType.UnitTypeId; } if (!string.IsNullOrEmpty(fromUnitId) && !string.IsNullOrEmpty(departName) && departSir != "1") { if (!string.IsNullOrEmpty(projectId)) { Model.Base_Unit newUnit = new Model.Base_Unit { FromUnitId = fromUnitId, UnitCode = item["DepartCode"].ToString(), UnitName = departName, UnitTypeId = unitTypeId, Corporate = item["Charge"].ToString(), Telephone = item["Phone"].ToString(), IsHide = false, DataSources = projectId, }; var getUnit = db.Base_Unit.FirstOrDefault(x => x.FromUnitId == fromUnitId); if (getUnit == null) { var getUnitByName = db.Base_Unit.FirstOrDefault(x => x.UnitName == departName); if (getUnitByName != null) { newUnit.UnitId = getUnitByName.UnitId; getUnitByName.FromUnitId = fromUnitId; db.SubmitChanges(); } else { newUnit.UnitId = SQLHelper.GetNewID(typeof(Model.Base_Unit)); UnitService.AddUnit(newUnit); } } else { newUnit.UnitId = getUnit.UnitId; } var pUnit = db.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == projectId && x.UnitId == newUnit.UnitId); if (pUnit == null) { Model.Project_ProjectUnit newProjectUnit = new Model.Project_ProjectUnit { ProjectId = projectId, UnitId = newUnit.UnitId, UnitType = Const.ProjectUnitType_2, }; ProjectUnitService.AddProjectUnit(newProjectUnit); BLL.LogService.AddSys_Log(user, null, newProjectUnit.ProjectUnitId, BLL.Const.ProjectUnitMenuId, BLL.Const.BtnModify); } } } } } catch (Exception ex) { isOk = false; ErrLogInfo.WriteLog(string.Empty, ex); } return(isOk); }
/// <summary> /// 添加操作日志 /// </summary> /// <param name="projectId">项目ID</param> /// <param name="userId">操作人ID</param> /// <param name="opLog">操作内容</param> /// <param name="code">编号</param> /// <param name="dataId">主键ID</param> /// <param name="strMenuId">菜单ID</param> /// <param name="strOperationName">操作名称</param> public static void AddSys_Log(Model.Sys_User CurrUser, string code, string dataId, string strMenuId, string strOperationName) { if (CurrUser != null) { Model.SUBHSSEDB db = Funs.DB; Model.Sys_Log syslog = new Model.Sys_Log { LogId = SQLHelper.GetNewID(typeof(Model.Sys_Log)), HostName = Dns.GetHostName(), OperationTime = DateTime.Now, UserId = CurrUser.UserId, MenuId = strMenuId, OperationName = strOperationName, UpState = Const.UpState_2, LogSource = 1, }; IPAddress[] ips = Dns.GetHostAddresses(syslog.HostName); if (ips.Length > 0) { foreach (IPAddress ip in ips) { if (ip.ToString().IndexOf('.') != -1) { syslog.Ip = ip.ToString(); } } } string opLog = string.Empty; var menu = BLL.SysMenuService.GetSysMenuByMenuId(strMenuId); if (menu != null) { opLog = menu.MenuName + ":"; } if (!string.IsNullOrEmpty(strOperationName)) { opLog += strOperationName; } if (!string.IsNullOrEmpty(code)) { syslog.OperationLog = opLog + ";" + code + "。"; } else { var returnCode = BLL.CodeRecordsService.ReturnCodeByDataId(dataId); if (!string.IsNullOrEmpty(returnCode)) { syslog.OperationLog = opLog + ";" + returnCode + "。"; } else { syslog.OperationLog = opLog; } } var project = BLL.ProjectService.GetProjectByProjectId(CurrUser.LoginProjectId); if (project != null) { syslog.ProjectId = project.ProjectId; } db.Sys_Log.InsertOnSubmit(syslog); db.SubmitChanges(); } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var thisUnit = BLL.CommonService.GetIsThisUnit(); if (thisUnit != null) { this.Label8.Text = thisUnit.UnitName + this.Label8.Text; this.Label18.Text = thisUnit.UnitName + this.Label18.Text; this.Label19.Text = thisUnit.UnitName + this.Label19.Text; } this.RectifyNoticeId = Request.Params["RectifyNoticeId"]; var rectifyNotice = BLL.RectifyNoticesService.GetRectifyNoticesById(this.RectifyNoticeId); if (rectifyNotice != null) { this.txtRectifyNoticeCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.RectifyNoticeId); Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(rectifyNotice.UnitId); if (unit != null) { this.txtUnitName.Text = unit.UnitName; this.txtUnitNameProject.Text = unit.UnitName + "项目部:"; } this.txtDutyPerson1.Text = rectifyNotice.DutyPerson; if (rectifyNotice.CheckedDate != null) { this.txtCheckedDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.CheckedDate); this.txtCheckedDate2.Text = rectifyNotice.CheckedDate.Value.Year + "年" + rectifyNotice.CheckedDate.Value.Month + "月" + rectifyNotice.CheckedDate.Value.Day + "日"; } if (!string.IsNullOrEmpty(rectifyNotice.WrongContent)) { this.txtWrongContent.Text = rectifyNotice.WrongContent; } Model.Sys_User user = BLL.UserService.GetUserByUserId(rectifyNotice.SignPerson); if (user != null) { this.txtSignPerson.Text = user.UserName; } if (rectifyNotice.SignDate != null) { this.txtSignDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.SignDate); } if (!string.IsNullOrEmpty(rectifyNotice.CompleteStatus)) { this.txtCompleteStatus.Text = rectifyNotice.CompleteStatus; } this.txtDutyPerson2.Text = rectifyNotice.DutyPerson; if (rectifyNotice.CompleteDate != null) { this.txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.CompleteDate); } Model.AttachFile attachFile = BLL.AttachFileService.GetAttachFile(this.RectifyNoticeId, BLL.Const.ProjectRectifyNoticeMenuId); if (attachFile != null) { List <string> urls = new List <string>(); string[] lists = attachFile.AttachUrl.Split(','); foreach (var list in lists) { if (!string.IsNullOrEmpty(list)) { urls.Add(list); } } string str = string.Empty; str = "<table id='Table3' runat='server' width='100%' cellpadding='0' cellspacing='0' border='0' bordercolor='#000000'>"; if (urls.Count > 1) //两个附件 { string photo1 = "<img alt='' runat='server' id='img111' width='280' height='280' src='" + "../" + urls[0] + "' />"; string photo2 = "<img alt='' runat='server' id='img111' width='280' height='280' src='" + "../" + urls[1] + "' />"; str += "<tr><td align='center' colspan='2'>" + photo1 + "</td>"; str += "<td align='center' colspan='2'>" + photo2 + "</td></tr>"; } else if (urls.Count == 1) { string photo1 = "<img alt='' runat='server' id='img111' width='250' height='250' src='" + "../" + urls[0] + "' />"; str += "<td align='center' colspan='4'>" + photo1 + "</td></tr>"; } str += "</table>"; this.div3.InnerHtml = str; } } } }
/// <summary> /// 根据用户获取密码 /// </summary> /// <param name="userId"></param> /// <returns></returns> public static string GetPasswordByUserId(string userId) { Model.Sys_User m = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId); return(m.Password); }
/// <summary> /// 插入试卷 4 /// </summary> /// <param name="projectId"></param> /// <param name="arr"></param> public static bool AddEduTrain_TrainTest(string projectId, JArray arr, Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; bool isOk = true; try { foreach (var item in arr) { string trainingId = null; ////培训记录ID var getTrainRecord = db.EduTrain_TrainRecord.FirstOrDefault(x => x.FromRecordId == item["RecordId"].ToString()); if (getTrainRecord != null) { trainingId = getTrainRecord.TrainingId; } string trainTestId = item["ID"].ToString(); if (!string.IsNullOrEmpty(trainingId) && !string.IsNullOrEmpty(trainTestId)) { Model.EduTrain_TrainTest newTrainTest = new Model.EduTrain_TrainTest { TrainTestId = trainTestId, TrainingId = trainingId, ExamNo = item["ExamNo"].ToString(), GroupNo = item["GroupNo"].ToString(), CourseID = item["CourseID"].ToString(), COrder = Funs.GetNewInt(item["COrder"].ToString()), QsnCode = item["QsnCode"].ToString(), QsnId = item["QsnId"].ToString(), QsnContent = item["QsnContent"].ToString(), QsnFileName = item["QsnFileName"].ToString(), QsnAnswer = item["QsnAnswer"].ToString(), QsnCategory = item["QsnCategory"].ToString(), QsnKind = item["QsnKind"].ToString(), Description = item["Description"].ToString(), QsnImportant = item["QsnImportant"].ToString(), Analysis = item["Analysis"].ToString(), UploadTime = Funs.GetNewDateTime(item["UploadTime"].ToString()), }; var getTrainRecordDetail = db.EduTrain_TrainTest.FirstOrDefault(x => x.TrainTestId == trainTestId); if (getTrainRecordDetail == null) { EduTrain_TrainTestService.AddTrainTest(newTrainTest); } else { newTrainTest.ExamNo = newTrainTest.ExamNo; newTrainTest.GroupNo = newTrainTest.GroupNo; newTrainTest.CourseID = newTrainTest.CourseID; newTrainTest.COrder = newTrainTest.COrder; newTrainTest.QsnCode = newTrainTest.QsnCode; newTrainTest.QsnId = newTrainTest.QsnId; newTrainTest.QsnContent = newTrainTest.QsnContent; newTrainTest.QsnFileName = newTrainTest.QsnFileName; newTrainTest.QsnAnswer = newTrainTest.QsnAnswer; newTrainTest.QsnCategory = newTrainTest.QsnCategory; newTrainTest.QsnKind = newTrainTest.QsnKind; newTrainTest.Description = newTrainTest.Description; newTrainTest.QsnImportant = newTrainTest.QsnImportant; newTrainTest.Analysis = newTrainTest.Analysis; newTrainTest.UploadTime = newTrainTest.UploadTime; db.SubmitChanges(); } } else { isOk = false; } } } catch (Exception ex) { isOk = false; ErrLogInfo.WriteLog(string.Empty, ex); } return(isOk); }
/// <summary> /// 插入培训人员 3 /// </summary> /// <param name="projectId"></param> /// <param name="arr"></param> public static bool AddTrainRecordPerson(string projectId, JArray arr, Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; bool isOk = true; try { foreach (var item in arr) { string trainingId = null; ////培训记录ID var getTrainRecord = db.EduTrain_TrainRecord.FirstOrDefault(x => x.FromRecordId == item["RecordId"].ToString()); if (getTrainRecord != null) { trainingId = getTrainRecord.TrainingId; } string personId = null; ///人员信息ID var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == item["IdentifyId"].ToString()); if (getPerson != null) { personId = getPerson.PersonId; } bool checkResult = false; if (item["IsPass"].ToString() == "1") { checkResult = true; } if (!string.IsNullOrEmpty(trainingId) && !string.IsNullOrEmpty(personId)) { Model.EduTrain_TrainRecordDetail newTrainRecordDetail = new Model.EduTrain_TrainRecordDetail { TrainingId = trainingId, PersonId = personId, CheckScore = Funs.GetNewDecimal(item["Score"].ToString()), CheckResult = checkResult, }; var getTrainRecordDetail = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.TrainingId == trainingId && x.PersonId == personId); if (getTrainRecordDetail == null) { EduTrain_TrainRecordDetailService.AddTrainDetail(newTrainRecordDetail); } else { getTrainRecordDetail.CheckScore = newTrainRecordDetail.CheckScore; getTrainRecordDetail.CheckResult = newTrainRecordDetail.CheckResult; EduTrain_TrainRecordDetailService.UpdateTrainDetail(getTrainRecordDetail); } } else { isOk = false; } } } catch (Exception ex) { isOk = false; ErrLogInfo.WriteLog(string.Empty, ex); } return(isOk); }
/// <summary> /// 插入培训记录 2 /// </summary> /// <param name="projectId"></param> /// <param name="arr"></param> public static bool AddTrainRecord(string projectId, JArray arr, Model.Sys_User user) { Model.SUBHSSEDB db = Funs.DB; bool isOk = true; try { foreach (var item in arr) { string fromRecordId = item["ID"].ToString(); string trainTypeId = null; ////培训类型 var getTrainType = db.Base_TrainType.FirstOrDefault(x => x.TrainTypeName == item["TrainType"].ToString()); if (getTrainType != null) { trainTypeId = getTrainType.TrainTypeId; } string unitId = null; if (!string.IsNullOrEmpty(item["TrainDepart"].ToString())) { var lists = Funs.GetStrListByStr(item["TrainDepart"].ToString(), ','); if (lists.Count() > 0) { foreach (var itemList in lists) { var getUnit = db.Base_Unit.FirstOrDefault(x => x.UnitName == itemList); if (getUnit != null) { if (string.IsNullOrEmpty(unitId)) { unitId = getUnit.UnitId; } else { unitId += ("," + getUnit.UnitId); } } } } } if (!string.IsNullOrEmpty(unitId) && !string.IsNullOrEmpty(fromRecordId)) { Model.EduTrain_TrainRecord newTrainRecord = new Model.EduTrain_TrainRecord { FromRecordId = fromRecordId, ProjectId = projectId, TrainTitle = item["RecordName"].ToString(), TrainContent = item["TrainContent"].ToString(), TrainStartDate = Funs.GetNewDateTime(item["TrainStartDate"].ToString()), TrainEndDate = Funs.GetNewDateTime(item["TrainEndDate"].ToString()), TeachHour = Funs.GetNewDecimalOrZero(item["TrainPeriod"].ToString()), TeachMan = item["TrainPrincipal"].ToString(), Remark = item["TrainDescript"].ToString(), TrainTypeId = trainTypeId, UnitIds = unitId, States = Const.State_0, CompileMan = item["CreateUser"].ToString(), TrainPersonNum = Funs.GetNewInt(item["PersonCount"].ToString()), }; newTrainRecord.TrainingCode = Funs.GetNewFileName(newTrainRecord.TrainStartDate); var getTrainRecord = Funs.DB.EduTrain_TrainRecord.FirstOrDefault(x => x.FromRecordId == fromRecordId); if (getTrainRecord == null) { newTrainRecord.TrainingId = SQLHelper.GetNewID(typeof(Model.EduTrain_TrainRecord)); EduTrain_TrainRecordService.AddTraining(newTrainRecord); BLL.LogService.AddSys_Log(user, newTrainRecord.TrainingCode, newTrainRecord.TrainingId, BLL.Const.ProjectTrainRecordMenuId, BLL.Const.BtnAdd); } else { getTrainRecord.TrainingCode = newTrainRecord.TrainingCode; getTrainRecord.TrainTitle = newTrainRecord.TrainTitle; getTrainRecord.TrainContent = newTrainRecord.TrainContent; getTrainRecord.UnitIds = newTrainRecord.UnitIds; getTrainRecord.TrainStartDate = newTrainRecord.TrainStartDate; if (newTrainRecord.TrainEndDate.HasValue) { getTrainRecord.TrainEndDate = newTrainRecord.TrainEndDate; } else { getTrainRecord.TrainEndDate = newTrainRecord.TrainStartDate; } getTrainRecord.TeachHour = newTrainRecord.TeachHour; getTrainRecord.TeachMan = newTrainRecord.TeachMan; getTrainRecord.TeachAddress = newTrainRecord.TeachAddress; getTrainRecord.Remark = newTrainRecord.Remark; EduTrain_TrainRecordService.UpdateTraining(getTrainRecord); BLL.LogService.AddSys_Log(user, getTrainRecord.TrainingCode, getTrainRecord.TrainingId, BLL.Const.ProjectTrainRecordMenuId, BLL.Const.BtnModify); } } else { isOk = false; } } } catch (Exception ex) { isOk = false; ErrLogInfo.WriteLog(string.Empty, ex); } return(isOk); }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { hdAttachUrl.Text = string.Empty; hdId.Text = string.Empty; this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.ProjectId = this.CurrUser.LoginProjectId; this.CheckDayId = Request.Params["CheckDayId"]; var checkDay = BLL.Check_CheckDayXAService.GetCheckDayByCheckDayId(this.CheckDayId); if (checkDay != null) { this.ProjectId = checkDay.ProjectId; this.txtCheckDayCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.CheckDayId); if (checkDay.CheckDate != null) { this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", checkDay.CheckDate); } Model.Sys_User checkMan = BLL.UserService.GetUserByUserId(checkDay.CompileMan); if (checkMan != null) { this.txtCheckMan.Text = checkMan.UserName; } if (checkDay.NotOKNum != null) { this.txtNotOKNum.Text = checkDay.NotOKNum.ToString(); } if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, checkDay.CompileUnit)) //施工单位 { this.trTeamGroup.Hidden = false; if (!string.IsNullOrEmpty(checkDay.DutyTeamGroupIds)) { string names = string.Empty; string[] ids = checkDay.DutyTeamGroupIds.Split(','); foreach (var item in ids) { Model.ProjectData_TeamGroup teamGroup = BLL.TeamGroupService.GetTeamGroupById(item); if (teamGroup != null) { names += teamGroup.TeamGroupName + ","; } } if (!string.IsNullOrEmpty(names)) { names = names.Substring(0, names.LastIndexOf(",")); } this.drpDutyTeamGroupIds.Text = names; } } else { this.trUnit.Hidden = false; if (!string.IsNullOrEmpty(checkDay.DutyUnitIds)) { string names = string.Empty; string[] ids = checkDay.DutyUnitIds.Split(','); foreach (var item in ids) { Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(item); if (unit != null) { names += unit.UnitName + ","; } } if (!string.IsNullOrEmpty(names)) { names = names.Substring(0, names.LastIndexOf(",")); } this.drpDutyUnitIds.Text = names; } } if (!string.IsNullOrEmpty(checkDay.WorkAreaIds)) { string names = string.Empty; string[] ids = checkDay.WorkAreaIds.Split(','); foreach (var item in ids) { Model.ProjectData_WorkArea workArea = BLL.WorkAreaService.GetWorkAreaByWorkAreaId(item); if (workArea != null) { names += workArea.WorkAreaName + ","; } } if (!string.IsNullOrEmpty(names)) { names = names.Substring(0, names.LastIndexOf(",")); } this.drpWorkAreaIds.Text = names; } this.txtUnqualified.Text = checkDay.Unqualified; this.txtHandleStation.Text = checkDay.HandleStation; if (checkDay.IsOK == true) { this.txtIsOK.Text = "是"; } else { this.txtIsOK.Text = "否"; } } } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.CheckColligationId = Request.Params["CheckColligationId"]; var checkColligation = BLL.Check_CheckColligationService.GetCheckColligationByCheckColligationId(this.CheckColligationId); if (checkColligation != null) { this.txtCheckTime.Text = "检查时间:"; if (checkColligation.CheckTime != null) { this.txtCheckTime.Text += string.Format("{0:yyyy-MM-dd}", checkColligation.CheckTime); } string personStr = "检查人:"; Model.Sys_User user = BLL.UserService.GetUserByUserId(checkColligation.CheckPerson); if (user != null) { personStr += user.UserName + "、"; } if (!string.IsNullOrEmpty(checkColligation.PartInPersonIds)) { string[] strs = checkColligation.PartInPersonIds.Split(','); foreach (var s in strs) { Model.Sys_User checkPerson = BLL.UserService.GetUserByUserId(s); if (checkPerson != null) { personStr += checkPerson.UserName + "、"; } } } if (!string.IsNullOrEmpty(personStr)) { personStr = personStr.Substring(0, personStr.LastIndexOf("、")); } if (!string.IsNullOrEmpty(checkColligation.PartInPersonNames)) { if (personStr != "检查人:") { personStr += "、" + checkColligation.PartInPersonNames; } else { personStr += checkColligation.PartInPersonNames; } } this.txtCheckPerson.Text = personStr; this.txtCheckType.Text = "检查项目:"; if (checkColligation.CheckType == "0") { this.txtCheckType.Text += "周检"; } else if (checkColligation.CheckType == "1") { this.txtCheckType.Text += "月检"; } else if (checkColligation.CheckType == "2") { this.txtCheckType.Text += "其它"; } var checkColligationDetails = BLL.Check_CheckColligationDetailService.GetCheckColligationDetailByCheckColligationId(this.CheckColligationId); int i = 1; string str = "<table id='Table3' runat='server' width='100%' cellpadding='0' cellspacing='0' border='0' frame='vsides' bordercolor='#000000'>" + "<tr><td align='center' style='width:5%; border: 1px solid #000000; font-size:15px; border-right: none;'>序号</td>" + "<td align='center' style='width:15%; border: 1px solid #000000; font-size:15px; border-right: none;'>隐患内容</td>" + "<td align='center' style='width:10%; border: 1px solid #000000; font-size:15px; border-right: none;'>检查区域</td>" + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>隐患类型</td>" + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>隐患级别</td>" + "<td align='center' style='width:12%; border: 1px solid #000000; font-size:15px; border-right: none;'>责任单位</td>" + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>责任人</td>" + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改限时</td>" + "<td align='center' style='width:12%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改要求</td>" + "<td align='center' style='width:14%; border: 1px solid #000000; font-size:15px; '>处理措施</td></tr>"; foreach (var checkColligationDetail in checkColligationDetails) { string photo1 = string.Empty; string photo2 = string.Empty; Model.AttachFile attachFile = BLL.AttachFileService.GetAttachFile(checkColligationDetail.CheckColligationDetailId, BLL.Const.ProjectCheckColligationWHMenuId); if (attachFile != null) { List <string> urls = new List <string>(); string[] lists = attachFile.AttachUrl.Split(','); foreach (var list in lists) { if (!string.IsNullOrEmpty(list)) { urls.Add(list); } } if (urls.Count > 1) //两个附件 { photo1 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[0] + "' />"; photo2 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[1] + "' />"; } else { photo1 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[0] + "' />"; } } string unitName = string.Empty; string personName = string.Empty; string handleStepName = string.Empty; Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(checkColligationDetail.UnitId); if (unit != null) { unitName = unit.UnitName; } if (!string.IsNullOrEmpty(checkColligationDetail.PersonId)) { var person = BLL.PersonService.GetPersonById(checkColligationDetail.PersonId); if (person != null) { personName = person.PersonName; } } if (!string.IsNullOrEmpty(checkColligationDetail.HandleStep)) { List <string> lists = checkColligationDetail.HandleStep.Split('|').ToList(); if (lists.Count > 0) { foreach (var item in lists) { Model.Sys_Const con = BLL.ConstValue.GetConstByConstValueAndGroupId(item, BLL.ConstValue.Group_HandleStep); if (con != null) { handleStepName += con.ConstText + "|"; } } } if (!string.IsNullOrEmpty(handleStepName)) { handleStepName = handleStepName.Substring(0, handleStepName.LastIndexOf("|")); } } str += "<tr><td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;'>" + i + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.Unqualified + "<br/>" + photo1 + "<br/>" + photo2 + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.WorkArea + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.HiddenDangerType + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.HiddenDangerLevel + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + unitName + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + personName + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + string.Format("{0:yyyy-MM-dd}", checkColligationDetail.LimitedDate) + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkColligationDetail.Suggestions + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none;' >" + handleStepName + "</td></tr>"; i++; } str += "</table>"; this.div3.InnerHtml = str; } } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.CheckSpecialId = Request.Params["CheckSpecialId"]; var checkSpecial = BLL.Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(this.CheckSpecialId); if (checkSpecial != null) { this.txtCheckTime.Text = "检查时间:"; if (checkSpecial.CheckTime != null) { this.txtCheckTime.Text += string.Format("{0:yyyy-MM-dd}", checkSpecial.CheckTime); } string personStr = "检查人:"; Model.Sys_User user = BLL.UserService.GetUserByUserId(checkSpecial.CheckPerson); if (user != null) { personStr += user.UserName + "、"; } if (!string.IsNullOrEmpty(checkSpecial.PartInPersonIds)) { string[] strs = checkSpecial.PartInPersonIds.Split(','); foreach (var s in strs) { Model.Sys_User checkPerson = BLL.UserService.GetUserByUserId(s); if (checkPerson != null) { personStr += checkPerson.UserName + "、"; } } } if (!string.IsNullOrEmpty(personStr)) { personStr = personStr.Substring(0, personStr.LastIndexOf("、")); } if (!string.IsNullOrEmpty(checkSpecial.PartInPersonNames)) { if (personStr != "检查人:") { personStr += "、" + checkSpecial.PartInPersonNames; } else { personStr += checkSpecial.PartInPersonNames; } } this.txtCheckPerson.Text = personStr; this.txtCheckType.Text = "检查项目:"; if (checkSpecial.CheckType == "0") { this.txtCheckType.Text += "周检"; } else if (checkSpecial.CheckType == "1") { this.txtCheckType.Text += "月检"; } else if (checkSpecial.CheckType == "2") { this.txtCheckType.Text += "其它"; } var checkSpecialDetails = BLL.Check_CheckSpecialDetailService.GetCheckSpecialDetailByCheckSpecialId(this.CheckSpecialId); int i = 1; string str = "<table id='Table3' runat='server' width='100%' cellpadding='0' cellspacing='0' border='0' frame='vsides' bordercolor='#000000'>" + "<tr><td align='center' style='width:5%; border: 1px solid #000000; font-size:15px; border-right: none;'>序号</td>" + "<td align='center' style='width:30%; border: 1px solid #000000; font-size:15px; border-right: none;'>隐患照片或描述</td>" + "<td align='center' style='width:20%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改措施</td>" + "<td align='center' style='width:8%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改责任人</td>" + "<td align='center' style='width:7%; border: 1px solid #000000; font-size:15px; border-right: none;'>整改时间</td>" + "<td align='center' style='width:10%; border: 1px solid #000000; font-size:15px; border-right: none;'>责任单位</td>" + "<td align='center' style='width:7%; border: 1px solid #000000; font-size:15px; border-right: none;'>复检人</td>" + "<td align='center' style='width:7%; border: 1px solid #000000; font-size:15px; border-right: none;'>复检时间</td>" + "<td align='center' style='width:7%; border: 1px solid #000000; font-size:15px; '>复检结果</td></tr>"; foreach (var checkSpecialDetail in checkSpecialDetails) { string photo1 = string.Empty; string photo2 = string.Empty; Model.AttachFile attachFile = BLL.AttachFileService.GetAttachFile(checkSpecialDetail.CheckSpecialDetailId, BLL.Const.ProjectCheckSpecialMenuId); if (attachFile != null) { List <string> urls = new List <string>(); string[] lists = attachFile.AttachUrl.Split(','); foreach (var list in lists) { if (!string.IsNullOrEmpty(list)) { urls.Add(list); } } if (urls.Count > 1) //两个附件 { photo1 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[0] + "' />"; photo2 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[1] + "' />"; } else { photo1 = "<img alt='' runat='server' id='img111' width='180' height='180' src='" + "../" + urls[0] + "' />"; } } string unitName = string.Empty; string completedDate = string.Empty; Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(checkSpecialDetail.UnitId); if (unit != null) { unitName = unit.UnitName; } if (checkSpecialDetail.CompletedDate != null) { completedDate = string.Format("{0:yyyy-MM-dd}", checkSpecialDetail.CompletedDate); } str += "<tr><td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;'>" + i + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + checkSpecialDetail.Unqualified + "<br/>" + photo1 + "<br/>" + photo2 + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' ></td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' ></td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + completedDate + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' >" + unitName + "</td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' ></td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none; border-right: none;' ></td>" + "<td align='center' style='border: 1px solid #000000; font-size:15px; border-top: none;' ></td></tr>"; i++; } str += "</table>"; this.div3.InnerHtml = str; } } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.CheckColligationId = Request.Params["CheckColligationId"]; var checkColligation = BLL.Check_CheckColligationService.GetCheckColligationByCheckColligationId(this.CheckColligationId); if (checkColligation != null) { this.txtCheckColligationCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.CheckColligationId); if (checkColligation.CheckTime != null) { this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", checkColligation.CheckTime); } if (!string.IsNullOrEmpty(checkColligation.CheckType)) { if (checkColligation.CheckType == "0") { this.txtCheckType.Text = "周检"; } else if (checkColligation.CheckType == "1") { this.txtCheckType.Text = "月检"; } else if (checkColligation.CheckType == "2") { this.txtCheckType.Text = "其它"; } } if (!string.IsNullOrEmpty(checkColligation.PartInUnits)) { string unitNames = string.Empty; string[] unitIds = checkColligation.PartInUnits.Split(','); foreach (var item in unitIds) { string name = BLL.UnitService.GetUnitNameByUnitId(item); if (!string.IsNullOrEmpty(name)) { unitNames += name + ","; } } if (!string.IsNullOrEmpty(unitNames)) { unitNames = unitNames.Substring(0, unitNames.LastIndexOf(",")); } this.txtUnit.Text = unitNames; } this.txtCheckPerson.Text = BLL.UserService.GetUserNameByUserId(checkColligation.CheckPerson); if (!string.IsNullOrEmpty(checkColligation.PartInPersonIds)) { string personStr = string.Empty; string[] strs = checkColligation.PartInPersonIds.Split(','); foreach (var s in strs) { Model.Sys_User checkPerson = BLL.UserService.GetUserByUserId(s); if (checkPerson != null) { personStr += checkPerson.UserName + ","; } } if (!string.IsNullOrEmpty(personStr)) { personStr = personStr.Substring(0, personStr.LastIndexOf(",")); } this.txtPartInPersons.Text = personStr; } this.txtPartInPersonNames.Text = checkColligation.PartInPersonNames; //this.txtDaySummary.Text = HttpUtility.HtmlDecode(checkColligation.DaySummary); checkColligationDetails = (from x in Funs.DB.View_Check_CheckColligationDetail where x.CheckColligationId == this.CheckColligationId orderby x.CheckItem select x).ToList(); } Grid1.DataSource = checkColligationDetails; Grid1.DataBind(); this.ctlAuditFlow.MenuId = BLL.Const.ProjectCheckColligationWHMenuId; this.ctlAuditFlow.DataId = this.CheckColligationId; } }