//初始化 public void InitData() { try { if (Session["PlatformID"].ToString() != "") { Common.Entities.Platform platform = new Common.Entities.Platform(); platform = BLLPlatform.FindByPlatformID(Convert.ToInt32(Session["PlatformID"])); txtPlatformName.Text = platform.PlatformName; DropDownListPlatformRank.SelectedValue = platform.PlatformRank; DropDownListAgreeUnit.SelectedValue = platform.AgreeUnit; DropDownListPlatformType.SelectedValue = platform.PlatformType; DatePicker_AgreeTime.SelectedDate = platform.AgreeTime; DropDownList_SecrecyLevel.SelectedValue = platform.SecrecyLevel.ToString(); //lby↓ txtAgreeNumber.Text = platform.AgreeNumber; txtAgreeExpenditure.Text = platform.AgreeExpenditure; txtPlatformPrincipal.Text = platform.PlatformPrincipal; txtPlatformMember.Text = platform.PlatformMember; txtPlatformManagement.Text = platform.PlatformManagement; } else { return; } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int attachId = BLLPlatform.FindAttachmentID(id); string srcPath = BLLAttachment.FindPath(attachId); if (attachId == 0 || srcPath == "") { Alert.Show("该成果应用不存在相关文档"); } else { publicMethod.DeleteFile(attachId, srcPath); Common.Entities.Platform platform = BLLPlatform.FindByPlatformID(id); platform.AttachmentID = null; BLLPlatform.Update(platform); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { publicMethod.SaveError(ex, this.Request); } }
//初始化 public void InitData() { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); Common.Entities.Platform platform = BLLPlatform.FindByPlatformID(id); PlatformName.Text = platform.PlatformName; PlatformRank.Text = platform.PlatformRank; AgreeUnit.Text = platform.AgreeUnit; } catch (Exception ex) { publicMethod.SaveError(ex, this.Request); } }
//保存 protected void btnSave_Click(object sender, EventArgs e) { try { //lby↓ int AttachmentID = BLLPlatform.FindAttachmentID(Convert.ToInt32(Session["PlatformID"])); string path = at.FindPath(AttachmentID); Common.Entities.Platform platform = new Common.Entities.Platform(); string PlatformName = BLLPlatform.FindByPlatformID(Convert.ToInt32(Session["PlatformID"])).PlatformName;//原平台名称 if (txtPlatformName.Text.Trim() == "") { Alert.ShowInTop("平台名称不能为空!"); txtPlatformName.Reset(); return; } //新更新的数据是否与原数据的平台名称相同 if (txtPlatformName.Text.Trim() != PlatformName)//不同 { if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()) == null) { platform.PlatformName = txtPlatformName.Text.Trim(); } else { if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == false) { Alert.ShowInTop("该平台名称正在审核中,请等待!"); txtPlatformName.Text = ""; return; } if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == true) { Alert.ShowInTop("平台名称已存在!"); txtPlatformName.Text = ""; return; } } } else//相同 { if (txtPlatformName.Text.Trim() == PlatformName)//新更新的数据与原数据的平台名称相同 { platform.PlatformName = txtPlatformName.Text.Trim(); } else { if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == false) { Alert.ShowInTop("该平台名称正在审核中,请等待!"); txtPlatformName.Text = ""; return; } if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == true) { Alert.ShowInTop("平台名称已存在!"); txtPlatformName.Text = ""; return; } } } // platform.PlatformName = txtPlatformName.Text.Trim(); platform.PlatformRank = DropDownListPlatformRank.SelectedText; platform.AgreeUnit = DropDownListAgreeUnit.SelectedText; platform.AgreeTime = DatePicker_AgreeTime.SelectedDate; platform.PlatformType = DropDownListPlatformType.SelectedText; platform.SecrecyLevel = DropDownList_SecrecyLevel.SelectedIndex + 1; platform.EntryPerson = BLLPlatform.FindByPlatformID(Convert.ToInt32(Session["PlatformID"])).EntryPerson; //lby↓ platform.PlatformManagement = txtPlatformManagement.Text.Trim(); platform.AgreeNumber = txtAgreeNumber.Text.Trim(); platform.AgreeExpenditure = txtAgreeExpenditure.Text.Trim(); platform.PlatformPrincipal = txtPlatformPrincipal.Text.Trim(); platform.PlatformMember = txtPlatformMember.Text.Trim(); //向操作日志表中 if (Convert.ToInt32(Session["SecrecyLevel"]) != 5) { platform.IsPass = false; operationLog.LoginIP = " "; operationLog.LoginName = platform.EntryPerson; operationLog.OperationType = "更新"; operationLog.OperationContent = "Platform"; operationLog.OperationTime = DateTime.Now; //operationLog.OperationDataID = Convert.ToInt32(Session["PlatformID"]); //operationLog.Remark = platform.PlatformID.ToString(); //PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已提交审核!")); //lby↓ int attachid = pm.UpLoadFile(fileupload).Attachid; if (attachid != -3)//有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } platform.AttachmentID = attachid;//附件为新插入的附件ID } else//上传控件没有值 { if (AttachmentID != 0)//原来有附件 { platform.AttachmentID = AttachmentID; } } BLLPlatform.insert(platform);//插入 operationLog.OperationDataID = Convert.ToInt32(Session["PlatformID"]); operationLog.Remark = platform.PlatformID.ToString(); BLLOp.Insert(operationLog);//将成果更新插入操作表 BLLPlatform.UpdateIsPass(Convert.ToInt32(Session["PlatformID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已提交,正在等待审核!")); } else { platform.IsPass = true; platform.PlatformID = Convert.ToInt32(Session["PlatformID"]); //lby↓ int attachid = pm.UpLoadFile(fileupload).Attachid; if (attachid != -3)//上传控件是否有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } platform.AttachmentID = attachid;//附件为新插入的附件ID pm.DeleteFile(AttachmentID, path); } else //上传空间没有值 { if (AttachmentID != 0) { platform.AttachmentID = AttachmentID; } } BLLPlatform.Update(platform);//5级直接更新平台表 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已更新完成!")); } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//保存 protected void btnSave_Click(object sender, EventArgs e) { try { Common.Entities.Platform platform = new Common.Entities.Platform(); if (txtPlatformName.Text.Trim() == "") { Alert.ShowInTop("平台名称不能为空!"); txtPlatformName.Reset(); return; } if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()) == null) { platform.PlatformName = txtPlatformName.Text.Trim(); platform.PlatformRank = DropDownListPlatformRank.SelectedText; platform.AgreeUnit = DropDownListAgreeUnit.SelectedText; platform.AgreeTime = DatePicker_AgreeTime.SelectedDate; platform.PlatformType = DropDownListPlatformType.SelectedText; platform.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue) + 1; //Lby↓ platform.AgreeNumber = txtAgreeNumber.Text.Trim(); platform.AgreeExpenditure = txtAgreeExpenditure.Text.Trim(); platform.PlatformMember = txtPlatformMember.Text.Trim(); platform.PlatformManagement = txtPlatformManagement.Text.Trim(); platform.PlatformPrincipal = txtPlatformPrincipal.Text.Trim(); platform.EntryPerson = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; int attachid = pm.UpLoadFile(fileupload).Attachid; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { platform.IsPass = true; //lby↓ switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (attachid != -3) { platform.AttachmentID = attachid; } else { platform.AttachmentID = null; } PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已添加完成!")); } else { platform.IsPass = false; //lby ↓ switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (attachid != -3) { platform.AttachmentID = attachid; } else { platform.AttachmentID = null; } operationLog.LoginName = Session["LoginName"].ToString(); operationLog.OperationTime = DateTime.Now; operationLog.LoginIP = " "; operationLog.OperationContent = "Platform"; operationLog.OperationType = "添加"; operationLog.OperationDataID = platform.PlatformID; BLLOp.Insert(operationLog); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已提交审核")); } //向平台表中插入数据 BLLPlatform.insert(platform); } else { if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == false) { Alert.ShowInTop("该平台名称正在审核中,请等待!"); txtPlatformName.Text = ""; return; } if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == true) { Alert.ShowInTop("平台名称已存在!"); txtPlatformName.Text = ""; return; } } } catch (Exception ex) { int attachid = Convert.ToInt32(pm.UpLoadFile(fileupload).Attachid); string path = at.FindPath(attachid); pm.DeleteFile(attachid, path); pm.SaveError(ex, this.Request); } }