protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //根据当前模板状态显示部件 Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); //显示模板的当前编辑部分 //Page.Form.Controls[3].FindControl(tempInfo.Anchor).Visible = true; Dal.Models.Template_01_PublicBuilding tempPublicBuilding = BLL.Declaration.GetDeclarationData <Dal.Models.Template_01_PublicBuilding>(tempInfo.DeclarationID.Value, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); //SetDropDownList(DesignCategory, BLL.SysConstant.GetConstantList("14", conn)); //SetDropDownList(InvestSource, BLL.SysConstant.GetConstantList("15", conn)); //SetDropDownList(DeclarationLevel, BLL.SysConstant.GetConstantList("04", conn)); //List<Dal.Models.SysConstant> lstDomesticOrAbord = BLL.SysConstant.GetConstantList("19", conn); //SetDropDownList(DomesticOrAbord1, lstDomesticOrAbord); //SetDropDownList(DomesticOrAbord2, lstDomesticOrAbord); //SetDropDownList(DomesticOrAbord3, lstDomesticOrAbord); //SetDropDownList(DomesticOrAbord4, lstDomesticOrAbord); //List<Dal.Models.SysConstant> lstCollaborativePhase = BLL.SysConstant.GetConstantList("20", conn); //SetDropDownList(CollaborativePhase1, lstCollaborativePhase); //CollaborativePhase1.Items.Insert(0, new ListItem("")); //SetDropDownList(CollaborativePhase2, lstCollaborativePhase); //CollaborativePhase2.Items.Insert(0, new ListItem("")); //SetDropDownList(CollaborativePhase3, lstCollaborativePhase); //CollaborativePhase3.Items.Insert(0, new ListItem("")); //SetDropDownList(CollaborativePhase4, lstCollaborativePhase); //CollaborativePhase4.Items.Insert(0, new ListItem("")); //为控件赋值 BLL.Common.SetData <Dal.Models.Template_01_PublicBuilding>(tempPublicBuilding, Page); // 设置参与人员 //ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn); Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn); //DeclarationName.Text = decl.DeclarationName; DeclarationUnit.Text = org.OrganizationName; //PostalAddress.Text = org.OrganizationAddress; //Linkman.Text = org.Linkman; //TelephoneNumber.Text = org.TelephoneNumber; //FaxNumber.Text = org.FaxNumber; //MobileNumber.Text = org.MobileNumber; //Postcode.Text = org.Postcode; //EmailAddress.Text = Request.QueryString["id"];//org.EmailAddress conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(Convert.ToInt32(tempInfo.DeclarationID), conn); Dal.Models.Prize Prize = BLL.Prize.GetPrize(Convert.ToInt32(decl.PrizeID), conn); rdlPrize.Text = Prize.PrizeName; conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["ActivityType"] == null || Session["UserInfo"] == null) { Response.Redirect("../Mutual/UserEntry.aspx"); return; } if (!IsPostBack) { //根据当前模板状态显示部件 //Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; Dal.Models.TemplateInfo tempInfo = null; try { tempInfo = ((Declaration)Context.Handler).TempInfo; } catch { Response.Redirect("../Mutual/UserEntry.aspx"); } if (tempInfo == null) { Response.Redirect("../Mutual/UserEntry.aspx"); } OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); //显示模板的当前编辑部分 //divfather.FindControl(tempInfo.Anchor).Visible = true; Dal.Models.Template_10_CivilAirDefence tempCivilAirDefence = BLL.Declaration.GetDeclarationData <Dal.Models.Template_10_CivilAirDefence>(tempInfo.DeclarationID.Value, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); SetDropDownList(DesignCategory, BLL.SysConstant.GetConstantList("14", conn)); SetDropDownList(InvestSource, BLL.SysConstant.GetConstantList("15", conn)); SetDropDownList(ProfessionalCategories, BLL.SysConstant.GetConstantList("28", conn)); //SetDropDownList(DeclarationLevel, BLL.SysConstant.GetConstantList("04", conn)); List <Dal.Models.SysConstant> lstDomesticOrAbord = BLL.SysConstant.GetConstantList("19", conn); SetDropDownList(DomesticOrAbord1, lstDomesticOrAbord); SetDropDownList(DomesticOrAbord2, lstDomesticOrAbord); SetDropDownList(DomesticOrAbord3, lstDomesticOrAbord); SetDropDownList(DomesticOrAbord4, lstDomesticOrAbord); List <Dal.Models.SysConstant> lstCollaborativePhase = BLL.SysConstant.GetConstantList("20", conn); SetDropDownList(CollaborativePhase01, lstCollaborativePhase); CollaborativePhase01.Items.Insert(0, new ListItem("")); SetDropDownList(CollaborativePhase02, lstCollaborativePhase); CollaborativePhase02.Items.Insert(0, new ListItem("")); SetDropDownList(CollaborativePhase03, lstCollaborativePhase); CollaborativePhase03.Items.Insert(0, new ListItem("")); SetDropDownList(CollaborativePhase04, lstCollaborativePhase); CollaborativePhase04.Items.Insert(0, new ListItem("")); //为控件赋值 BLL.Common.SetData <Dal.Models.Template_10_CivilAirDefence>(tempCivilAirDefence, divfather); // 设置参与人员 ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn); Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn); DeclarationName.Text = decl.DeclarationName; DeclarationUnit.Text = org.OrganizationName; PostalAddress.Text = org.OrganizationAddress; Linkman.Text = org.Linkman; TelephoneNumber.Text = org.TelephoneNumber; FaxNumber.Text = org.FaxNumber; MobileNumber.Text = org.MobileNumber; Postcode.Text = org.Postcode; EmailAddress.Text = org.EmailAddress;;//org.EmailAddress txtDeclarationID.Text = decl.DeclarationID.ToString(); txtTemplate.Text = tempInfo.TemplateCode; ucLegalStates.Org = org; ucLegalStates.Decl = decl; ucCertificate.Org = org; ucCertificate.Decl = decl; ucParticipant.Org = org; ucParticipant.Decl = decl; ucComments.Org = org; ucComments.Decl = decl; //接受登录人员 Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"]; txtUser.Text = userInfo.UserType; //接受场景 if (!string.IsNullOrEmpty(tempInfo.Situation.ToString())) { txtSituation.Text = tempInfo.Situation.ToString(); } if (tempInfo.Situation.ToString() == "Declara") { string strActivityType = Session["ActivityType"].ToString(); // 获取指定活动类型的当前激活活动 Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); if (actActivated == null) { conn.Close(); Response.Redirect("../Mutual/UserEntry.aspx"); return; } int iActivity = actActivated.ActivityID.Value; string strSpecialty = decl.DeclarationCode.Substring(4, 6); Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn); conn.Close(); nav02.InnerText = dSpecialty.SpecialtyName; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["ActivityType"] == null || Session["UserInfo"] == null) { Response.Redirect("../Mutual/UserEntry.aspx"); return; } if (!IsPostBack) { //根据当前模板状态显示部件 // Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; Dal.Models.TemplateInfo tempInfo = null; try { tempInfo = ((Declaration)Context.Handler).TempInfo; } catch { Response.Redirect("../Mutual/UserEntry.aspx"); } if (tempInfo == null) { Response.Redirect("../Mutual/UserEntry.aspx"); } OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); //显示模板的当前编辑部分 //divfather.FindControl(tempInfo.Anchor).Visible = true; Dal.Models.Template_17_Standard tempStandard = BLL.Declaration.GetDeclarationData <Dal.Models.Template_17_Standard>(tempInfo.DeclarationID.Value, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); ListItem item = new ListItem(); item.Text = "行业"; item.Value = "2401"; ListItem item2 = new ListItem(); item2.Text = "地方"; item2.Value = "2402"; ListItem item3 = new ListItem(); item3.Text = "国家"; item3.Value = "2403"; ListItem item4 = new ListItem(); item4.Text = "其他"; item4.Value = "2404"; ProjectSource.Items.Add(item); ProjectSource.Items.Add(item2); ProjectSource.Items.Add(item3); ProjectSource.Items.Add(item4); //为控件赋值 BLL.Common.SetData <Dal.Models.Template_17_Standard>(tempStandard, divfather); if (FileCatalog.Text == "") { FileCatalog.Text = BLL.SysConstant.GetTemplateConstant(tempInfo.TemplateCode, "FileCatalogDefaultText", conn); } // 设置参与人员 ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn); Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn); StandardName.Text = decl.DeclarationName; ChiefEditorUnit.Text = org.OrganizationName; PostalAddress.Text = org.OrganizationAddress; Linkman.Text = org.Linkman; TelephoneNumber.Text = org.TelephoneNumber; FaxNumber.Text = org.FaxNumber; MobileNumber.Text = org.MobileNumber; Postcode.Text = org.Postcode; EmailAddress.Text = org.EmailAddress;;//org.EmailAddress txtDeclarationID.Text = decl.DeclarationID.ToString(); txtTemplate.Text = tempInfo.TemplateCode; ucLegalStates.Org = org; ucLegalStates.Decl = decl; ucCertificate.Org = org; ucCertificate.Decl = decl; ucParticipant.Org = org; ucParticipant.Decl = decl; ucComments.Org = org; ucComments.Decl = decl; //接受登录人员 Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"]; txtUser.Text = userInfo.UserType; //接受场景 if (!string.IsNullOrEmpty(tempInfo.Situation.ToString())) { txtSituation.Text = tempInfo.Situation.ToString(); } if (tempInfo.Situation.ToString() == "Declara") { string strActivityType = Session["ActivityType"].ToString(); // 获取指定活动类型的当前激活活动 Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); if (actActivated == null) { conn.Close(); Response.Redirect("../Mutual/UserEntry.aspx"); return; } int iActivity = actActivated.ActivityID.Value; string strSpecialty = decl.DeclarationCode.Substring(4, 6); Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn); conn.Close(); nav02.InnerText = dSpecialty.SpecialtyName; } //string sourceText = ProjectSource.SelectedItem.Text; //ProjectSource.Text = sourceText; } }
public void SetOrgInfo(Dal.Models.Organization org, Dal.Models.Declaration decl) { }
public void ExportAll(HttpContext context) { Dal.Models.UserInfo use = (Dal.Models.UserInfo)Session["UserInfo"]; OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); List <string> SavePath = new List <string>(); string strServerMapPath = context.Server.MapPath("/"); string strSavePath = strServerMapPath + "/Content/Temp/CompressFile"; string strSavePath2 = strServerMapPath + "/Content/Temp/DeclarationFile"; string[] strDeclarationID = null; try { if (!Directory.Exists(strSavePath)) { Directory.CreateDirectory(strSavePath); } if (!Directory.Exists(strSavePath2)) { Directory.CreateDirectory(strSavePath2); } if (!string.IsNullOrEmpty(context.Request["ExportDeclarationID"])) { strDeclarationID = context.Request["ExportDeclarationID"].Split(','); for (int i = 0; i < strDeclarationID.Count(); i++) { BLL.Declaration.ExportDeclaration(Convert.ToInt32(strDeclarationID[i]), strServerMapPath, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(Convert.ToInt32(strDeclarationID[i]), conn); string strPath = strServerMapPath + "/Content/Temp/DownLoad" + decl.DeclarationCode + ""; string strDestinationPath = strServerMapPath + "/Content/Temp/CompressFile/" + "[" + decl.PrizeName + "][" + decl.DeclarationName + "][" + decl.OrganizationName + "].zip"; BLL.Compression.ZipDirectory(strPath, strDestinationPath); SavePath.Add(strDestinationPath); } } System.String[] str = SavePath.ToArray(); if (str.Count() > 1) { //strServerMapPath + "Content\\Temp\\DeclarationFile\\[All" string strPaths = strServerMapPath + "Content\\Temp\\DeclarationFile\\[All" + use.UserID + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss") + "].zip"; BLL.ZipClass.Zip(str, strPaths); DownLoad(context, strPaths); conn.Close(); } if (str.Count() == 1) { string DeclarationID = string.Join(",", strDeclarationID); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(Convert.ToInt32(DeclarationID), conn); string strPaths = strServerMapPath + "Content\\Temp\\CompressFile\\" + "[" + decl.PrizeName + "][" + decl.DeclarationName + "][" + decl.OrganizationName + "].zip"; DownLoad(context, strPaths); conn.Close(); } } catch (Exception ex) { hdMsg.Value = ex.Message; } }
public void ImportExpertGroup(HttpContext context, OleDbConnection conn) { // 返回数据信息 List <object> lstResult = new List <object>(); if (context.Session["UserInfo"] == null) { lstResult.Add("-1"); lstResult.Add("当前会话已结束,请重新登录!"); context.Response.Write(JsonConvert.SerializeObject(lstResult)); return; } Dal.Models.UserInfo user = (Dal.Models.UserInfo)context.Session["UserInfo"]; string strActivityType = context.Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { lstResult.Add("-1"); lstResult.Add("当前活动已关闭,请联系活动管理人员!"); context.Response.Write(JsonConvert.SerializeObject(lstResult)); return; } if (context.Request.Files.Count <= 0) { lstResult.Add("-1"); lstResult.Add("请选择文件!"); context.Response.Write(JsonConvert.SerializeObject(lstResult)); return; } // 接收上传文件 string excelFile = UploadFile(context); // 读取文件中的数据 DataTable dtTemp = BLL.Common.ReadExcelByNPOI(excelFile, true, 0); if (dtTemp == null) { lstResult.Add("-1"); lstResult.Add("读取文件中的数据失败!"); context.Response.Write(JsonConvert.SerializeObject(lstResult)); return; } //判断上传文件内容格式是否完整 if (dtTemp.Columns[0].ColumnName != "项目信息" || dtTemp.Columns[15].ColumnName != "上级专家组3" || dtTemp.Columns[12].ColumnName != "上级专家组2" || dtTemp.Columns[9].ColumnName != "上级专家组1") { lstResult.Add("-1"); lstResult.Add("上传成功!由于上传文件内容与模版内容不符,数据添加失败!"); context.Response.Write(JsonConvert.SerializeObject(lstResult)); return; } Dal.Models.ExpertGroup group = null; Dal.Models.Declaration decl = null; Dal.Models.Expert expertReviewer = null; dtTemp.Columns.Add("Ordinal"); dtTemp.Columns.Add("ErrorMessage"); DataTable dtError = dtTemp.Clone(); DataTable dtAllocate = dtTemp.Clone(); OleDbTransaction tran = conn.BeginTransaction(); for (int i = 1; i < dtTemp.Rows.Count; i++) { try { // 如果没有填写项目评审专家组,略过 if (string.IsNullOrEmpty(dtTemp.Rows[i][4].ToString()) && string.IsNullOrEmpty(dtTemp.Rows[i][6].ToString())) { throw new NullReferenceException("项目评审专家组为空!"); } decl = BLL.Declaration.GetDeclaration(dtTemp.Rows[i][1].ToString(), conn, tran); //最上级专家组3 group = AddGroup(activity.ActivityID.Value, decl.SpecialtyID.Value, decl.SpecialtyName, user, dtTemp.Rows[i], 15, null, false, conn, tran); //上级专家组2 group = AddGroup(activity.ActivityID.Value, decl.SpecialtyID.Value, decl.SpecialtyName, user, dtTemp.Rows[i], 12, group == null ? null : group.GroupID, false, conn, tran); //上级专家组1 group = AddGroup(activity.ActivityID.Value, decl.SpecialtyID.Value, decl.SpecialtyName, user, dtTemp.Rows[i], 9, group == null ? null : group.GroupID, false, conn, tran); //评审小组 group = AddGroup(activity.ActivityID.Value, decl.SpecialtyID.Value, decl.SpecialtyName, user, dtTemp.Rows[i], 4, group == null ? null : group.GroupID, true, conn, tran); if (decl == null) { throw new Exception("项目:" + dtTemp.Rows[i][1].ToString() + "不存在!"); } // 设定项目评审专家组 BLL.Declaration.AllocateDeclaration(decl.DeclarationID.Value, group.GroupID, conn, tran); // 设定审批意见填写人 if (string.IsNullOrEmpty(dtTemp.Rows[i][5].ToString())) { // 审批意见填写人为空,则默认为专家组组长 BLL.Declaration.SetExpertReviewer(decl.DeclarationID.Value, group.GroupLeader, conn, tran); } else { expertReviewer = BLL.Expert.GetExpert(dtTemp.Rows[i][5].ToString(), conn, tran); if (expertReviewer == null) { throw new Exception("审批意见填写人:" + dtTemp.Rows[i][5].ToString() + "不存在!"); } if (!(expertReviewer.SpecialtyIDs ?? "").Contains(decl.SpecialtyID.ToString())) { throw new Exception("审批意见填写人:" + dtTemp.Rows[i][5].ToString() + "与项目专业不匹配!"); } if (!BLL.ExpertGroup.IsExpertInGroup(group.GroupID.Value, expertReviewer.ExpertID.Value, conn, tran)) { BLL.ExpertGroup.AddMember(new Dal.Models.GroupMember() { ExpertID = expertReviewer.ExpertID, GroupID = group.GroupID }, conn, tran); } BLL.Declaration.SetExpertReviewer(decl.DeclarationID.Value, expertReviewer.ExpertID, conn, tran); } dtAllocate.ImportRow(dtTemp.Rows[i]); } catch (Exception ex) { dtTemp.Rows[i]["ErrorMessage"] = ex.Message; dtError.ImportRow(dtTemp.Rows[i]); } } tran.Commit(); lstResult.Add(dtTemp.Rows.Count - 1); lstResult.Add(dtAllocate.Rows.Count); lstResult.Add(dtAllocate); lstResult.Add(dtError); context.Response.Write(JsonConvert.SerializeObject(lstResult)); }
protected void Page_Load(object sender, EventArgs e) { if (Session["ActivityType"] == null || Session["UserInfo"] == null) { Response.Redirect("../Common/Login.aspx"); return; } if (!IsPostBack) { //根据当前模板状态显示部件 //Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; Dal.Models.TemplateInfo tempInfo = null; try { tempInfo = ((Declaration)Context.Handler).TempInfo; } catch { Response.Redirect("../Mutual/UserEntry.aspx"); } if (tempInfo == null) { Response.Redirect("../Mutual/UserEntry.aspx"); } OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); //显示模板的当前编辑部分 Template_18_WaterSystem //divfather.FindControl(tempInfo.Anchor).Visible = true; Dal.Models.Template_18_WaterSystem tempTraditionalBuilding = BLL.Declaration.GetDeclarationData <Dal.Models.Template_18_WaterSystem>(tempInfo.DeclarationID.Value, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); SetDropDownList(DeclarationCategory, BLL.SysConstant.GetConstantList("33", conn)); //为控件赋值 BLL.Common.SetData <Dal.Models.Template_18_WaterSystem>(tempTraditionalBuilding, divfather); // 设置参与人员 ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn); Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn); DeclarationName.Text = decl.DeclarationName; UseDeclarationName.Text = decl.DeclarationName; ConstructionDeclarationName.Text = decl.DeclarationName; DeclarationUnit.Text = org.OrganizationName; PostalAddress.Text = org.OrganizationAddress; Linkman.Text = org.Linkman; TelephoneNumber.Text = org.TelephoneNumber; FaxNumber.Text = org.FaxNumber; MobileNumber.Text = org.MobileNumber; Postcode.Text = org.Postcode; EmailAddress.Text = org.EmailAddress;;//org.EmailAddress txtDeclarationID.Text = decl.DeclarationID.ToString(); txtTemplate.Text = tempInfo.TemplateCode; ucLegalStates.Org = org; ucLegalStates.Decl = decl; ucCertificate.Org = org; ucCertificate.Decl = decl; ucParticipant.Org = org; ucParticipant.Decl = decl; ucComments.Org = org; ucComments.Decl = decl; //接受登录人员 Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"]; txtUser.Text = userInfo.UserType; //接受场景 if (!string.IsNullOrEmpty(tempInfo.Situation.ToString())) { txtSituation.Text = tempInfo.Situation.ToString(); } if (tempInfo.Situation.ToString() == "Declara") { string strActivityType = Session["ActivityType"].ToString(); // 获取指定活动类型的当前激活活动 Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); if (actActivated == null) { conn.Close(); Response.Redirect("../Common/Login.aspx"); return; } int iActivity = actActivated.ActivityID.Value; string strSpecialty = decl.DeclarationCode.Substring(4, 6); Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn); conn.Close(); nav02.InnerText = dSpecialty.SpecialtyName; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); Dal.Models.UserInfo UserInfo = (Dal.Models.UserInfo)Session["UserInfo"]; Dal.Models.Activity act = (Dal.Models.Activity)Session["Activity"]; Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); txtGrade.Text = "Close"; DeclarationID.Text = tempInfo.DeclarationID.ToString(); if (UserInfo.UserType == "0805" && decl.ExpertReviewGroupID != null && decl.ExpertReviewer != 0) { // 获取专家ID Dal.Models.Expert expert = BLL.Expert.GetExpertByUserID(UserInfo.UserID.Value, conn); if (expert.ExpertID == decl.ExpertReviewer) { txtGrade.Text = "Open"; txtReviewWriter.Text = expert.ExpertName; FirstComment.Text = decl.ExpertReviewComment; // HtmlTableRow tr = new HtmlTableRow(); // HtmlTableCell td1 = new HtmlTableCell("td"); // td1.InnerHtml = "<p>评审意见填写人:" + expert.ExpertName + "</p>" // + "<textarea ID='ExpertReviewComment' class='CommentsDis' rows='3' cols='20' style='height:300px;width:90%;' data='Review'>" // + decl.ExpertReviewComment + "</textarea>"; // td1.ColSpan = 4; // td1.Style.Add("border-bottom", "none"); // td1.Style.Add("text-align", "center"); // tr.Cells.Add(td1); // HtmlTableRow tr2 = new HtmlTableRow(); // HtmlTableCell td2 = new HtmlTableCell("td"); // HtmlTableCell td3 = new HtmlTableCell("td"); // HtmlTableCell td4 = new HtmlTableCell("td"); // HtmlTableCell td5 = new HtmlTableCell("td"); // td2.InnerHtml = "组长(签名):"; // td2.Style.Add("width", "40%"); // td2.Style.Add("border-top", "none"); // td2.Style.Add("border-right", "none"); // td3.InnerHtml = ""; // td3.Style.Add("width", "10%"); // td3.Style.Add("border-top", "none"); // td3.Style.Add("border-right", "none"); // td3.Style.Add("border-left", "none"); // td4.InnerHtml = "评审日期:"; // td4.Style.Add("width", "40%"); // td4.Style.Add("border-top", "none"); // td4.Style.Add("border-right", "none"); // td4.Style.Add("border-left", "none"); // td5.InnerHtml = ""; // td5.Style.Add("width", "10%"); // td5.Style.Add("border-top", "none"); // td5.Style.Add("border-left", "none"); // tr2.Cells.Add(td2); // tr2.Cells.Add(td3); // tr2.Cells.Add(td4); // tr2.Cells.Add(td5); // tbReview.Rows.Add(tr); // tbReview.Rows.Add(tr2); } } conn.Close(); } }
protected void btnNext_Click(object sender, EventArgs e) { Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"]; // 创建申报项目 Dal.Models.Declaration decl = null; bool bChanged = false; string strTemplateCode = ""; DateTime dtm; if (!DateTime.TryParse(txtDeclarateDate.Text, out dtm)) { hdMsg.Value = "项目申报时间格式错误!"; return; } int iPrizeID = Convert.ToInt32(Request["rdlPrize"]); if (iPrizeID == 0 && rdlPrize.SelectedValue != "") { iPrizeID = Convert.ToInt32(rdlPrize.SelectedValue); } if (iPrizeID == 0) { hdMsg.Value = "请选择奖项!"; return; } OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); string strActivityType = Request.Cookies["ActivityType"].Value; Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); string strDeclarationCode = ""; if (ViewState["DeclarationID"] != null) { decl = BLL.Declaration.GetDeclaration(Convert.ToInt32(ViewState["DeclarationID"]), conn); strDeclarationCode = decl.DeclarationCode; } else { decl = new Dal.Models.Declaration(); decl.UserID = user.UserID; decl.ActivityID = actActivated.ActivityID; } if (decl.DeclareDate == null || decl.DeclareDate.Value != dtm) { bChanged = true; decl.DeclareDate = dtm; } if (string.IsNullOrEmpty(decl.RecommendFrom) || decl.RecommendFrom != ChooseAssociation.SelectedValue) { bChanged = true; decl.RecommendFrom = ChooseAssociation.SelectedValue; } if (decl.PrizeID == null || decl.PrizeID != iPrizeID) { bChanged = true; decl.PrizeID = iPrizeID; } if (string.IsNullOrEmpty(decl.DeclarationName) || decl.DeclarationName != txtProjectName.Text.Trim()) { bChanged = true; decl.DeclarationName = txtProjectName.Text.Trim(); } Dal.Models.Prize prize = BLL.Prize.GetPrize(decl.PrizeID.Value, conn); strTemplateCode = prize.TemplateCode; int iSpecilID = prize.SpecialtyID.Value; int actID = prize.ActivityID.Value; Dal.Models.Schedule dSchedule = BLL.Schedule.GetSpecialtySchedule(iSpecilID, conn); if (dSchedule == null || !dSchedule.IsDeclarationStart.Value) { hdMsg.Value = "未在专业申报时间内,不能创建!"; conn.Close(); return; } string strSituation = ""; if (!string.IsNullOrEmpty(Request["Situation"])) { strSituation = Request["Situation"].Replace("'", "").Replace("\"", ""); } if (bChanged == true && (strSituation == Dal.Models.EnumSituation.Declaration.ToString() || strSituation == "")) { OleDbTransaction trans = conn.BeginTransaction(); try { BLL.Declaration.Declarate(ref decl, conn, trans); string strImportDeclarationID = ImportDeclarationData.SelectedValue; if (strImportDeclarationID != "0" && strImportDeclarationID != "") { string strDeclarationCode2 = BLL.Declaration.GetDeclaration(Convert.ToInt32(strImportDeclarationID), conn, trans).DeclarationCode; BLL.Declaration.ImportDeclarate(decl.DeclarationID.Value, Convert.ToInt32(strImportDeclarationID), conn, trans); BLL.Declaration.ImportUploadFile(decl.DeclarationID.Value, Convert.ToInt32(strImportDeclarationID), decl.DeclarationCode, strDeclarationCode2, conn, trans); } trans.Commit(); ViewState["DeclarationID"] = decl.DeclarationID.Value; } catch (Exception ex) { ViewState.Remove("DeclarationID"); trans.Rollback(); hdMsg.Value = ex.Message; return; } } // 获取申报项目的模板首页 string strPartCode = strTemplateCode.Substring(2, 2) + "01"; // 根据首页获取模板 TempInfo = BLL.Declaration.GetTemplateInfo(strPartCode, conn); TempInfo.DeclarationID = (int)ViewState["DeclarationID"]; TempInfo.DeclarationCode = strDeclarationCode; if (!string.IsNullOrEmpty(strSituation)) { TempInfo.Situation = (Dal.Models.EnumSituation)Enum.Parse(typeof(Dal.Models.EnumSituation), strSituation, true); } else { TempInfo.Situation = (Dal.Models.EnumSituation)Enum.Parse(typeof(Dal.Models.EnumSituation), "Declara", true); } conn.Close(); if (TempInfo != null) { Session.Add("TemplateInfo", TempInfo); // 跳转到模板页 if (strSituation == "ExpertReview" || strSituation == "Delete" || strSituation == "Auditing") { Server.Transfer(TempInfo.NewTemplateUrl); } else { Server.Transfer(TempInfo.TemplateUrl); } } }
protected void Page_Load(object sender, EventArgs e) { Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"]; if (user == null) { Response.Redirect("~/View/Mutual/UserEntry.aspx"); } if (!IsPostBack) { btnNext.Attributes.Add("OnClick", "return UserAddVerify()"); // 设定专业 Dal.Models.Specialty spec = null; Dal.Models.Prize prize = null; OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); string strActivityType = Request.Cookies["ActivityType"].Value; Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); if (actActivated == null) { hdMsg.Value = "当前活动已关闭,请联系活动管理人员!"; return; } // 设置推荐协会 if (ConfigurationManager.AppSettings["ActivityType"] != "0102") { RecommendationAssociation.Visible = false; } else { List <Dal.Models.UserInfo> lstAssociation = BLL.User.GetlstAssociationUser(conn); ChooseAssociation.DataSource = lstAssociation; ChooseAssociation.DataTextField = "UserName"; ChooseAssociation.DataValueField = "UserID"; ChooseAssociation.DataBind(); } int iDeclarationID = 0; int.TryParse(Request["DeclarationID"], out iDeclarationID); hdDeclarationID.Value = iDeclarationID.ToString(); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(iDeclarationID, conn); if (decl == null) { // 获取菜单传递过来的参数 spec = BLL.Specialty.GetSpecialty(actActivated.ActivityID.Value, Request["SepcCode"], conn); if (spec == null) { List <Dal.Models.Specialty> lst = BLL.Specialty.GetSpecialtyList(actActivated.ActivityID.Value, true, conn); spec = lst[0]; } // 设定封页台头 litTitle.Text = BLL.SysConstant.GetConstant(spec.TemplateCode, conn).ConstantDiscription; // 设定奖项列表 List <Dal.Models.Specialty> lstSpecialty = BLL.Specialty.GetDirectlyChildList(spec.SpecialtyID.Value, conn); List <Dal.Models.Prize> lstPrize = null; if (lstSpecialty.Count == 0) { lblSpecil.Visible = false; ddlSpecialty.Visible = false; ddlChildSpecialty.Visible = false; // 设定奖项列表 lstPrize = BLL.Prize.GetPrizeList(spec.SpecialtyID.Value, conn); } else { ddlSpecialty.Visible = true; List <Dal.Models.Specialty> lstChildSpecialty = null; lstSpecialty = lstSpecialty.Where(s => BLL.Prize.Count(s.SpecialtyID.Value, conn) > 0 || BLL.Specialty.Count(actActivated.ActivityID.Value, s.SpecialtyID, conn) > 0 ).ToList(); ddlSpecialty.DataSource = lstSpecialty; ddlSpecialty.DataTextField = "SpecialtyName"; ddlSpecialty.DataValueField = "SpecialtyID"; ddlSpecialty.DataBind(); ddlSpecialty.SelectedIndex = 0; if (lstSpecialty.Count > 0) { lstChildSpecialty = BLL.Specialty.GetDirectlyChildList(lstSpecialty[0].SpecialtyID.Value, conn); if (lstChildSpecialty.Count == 0) { ddlChildSpecialty.Visible = false; // 设定奖项列表 lstPrize = BLL.Prize.GetPrizeList(lstSpecialty[0].SpecialtyID.Value, conn); } else { ddlChildSpecialty.Visible = true; ddlChildSpecialty.DataSource = lstChildSpecialty; ddlChildSpecialty.DataTextField = "SpecialtyName"; ddlChildSpecialty.DataValueField = "SpecialtyID"; ddlChildSpecialty.DataBind(); ddlSpecialty.SelectedIndex = 0; // 设定奖项列表 lstPrize = BLL.Prize.GetPrizeList(lstChildSpecialty[0].SpecialtyID.Value, conn); } } } if (lstPrize != null && lstPrize.Count > 0) { // 绑定奖项列表 rdlPrize.DataSource = lstPrize; rdlPrize.DataTextField = "PrizeName"; rdlPrize.DataValueField = "PrizeID"; rdlPrize.DataBind(); rdlPrize.SelectedIndex = 0; // 根据奖项获取模版 string strTempCode = lstPrize.Where(p => p.PrizeID.Value == Convert.ToInt32(rdlPrize.SelectedValue)).ToList()[0].TemplateCode; Dal.Models.Organization org = BLL.User.GetOrganization(user.UserID.Value, conn); // 绑定导入数据 List <Dal.Models.Declaration> lstDeclaration = BLL.Declaration.GetDeclarationList(user, actActivated.ActivityID.Value, conn); lstDeclaration = lstDeclaration.Where(d => d.PrizeID == lstPrize[0].PrizeID).ToList(); if (lstDeclaration.Count() > 0) { ImportDeclarationData.DataSource = lstDeclaration; ImportDeclarationData.DataTextField = "DeclarationName"; ImportDeclarationData.DataValueField = "DeclarationID"; ImportDeclarationData.DataBind(); ImportDeclarationData.Items.Insert(0, new ListItem("<-- 不导入 -->", "0")); ImportDeclarationData.SelectedIndex = 0; } else { ImportData.Visible = false; } if (org != null) { // 设定单位信息 txtOrganizationName.Text = org.OrganizationName; } txtDeclarateDate.Text = DateTime.Today.ToString("yyyy-MM-dd"); } else { hdMsg.Value = "该专业下暂无奖项,无法申报!"; return; } } else { // 隐藏控件 ddlSpecialty.Visible = false; ddlChildSpecialty.Visible = false; lblSpecil.Visible = false; prize = BLL.Prize.GetPrize(decl.PrizeID.Value, conn); spec = BLL.Specialty.GetSpecialty(prize.SpecialtyID.Value, conn); ViewState["DeclarationID"] = decl.DeclarationID.Value; // 设定封页台头 litTitle.Text = BLL.SysConstant.GetConstant(prize.TemplateCode, conn).ConstantDiscription; // 设定封页台头 txtProjectName.Text = decl.DeclarationName; txtDeclarateDate.Text = decl.DeclareDate.Value.ToString("yyyy-MM-dd"); Dal.Models.Organization org = BLL.User.GetOrganization(decl.UserID.Value, conn); if (org != null) { // 设定单位信息 txtOrganizationName.Text = org.OrganizationName; } // 设定奖项列表 List <Dal.Models.Prize> lstPrize = BLL.Prize.GetPrizeList(spec.SpecialtyID.Value, conn); foreach (Dal.Models.Prize item in lstPrize) { rdlPrize.Items.Add(new System.Web.UI.WebControls.ListItem( item.PrizeName, item.PrizeID.Value.ToString()) { Enabled = item.TemplateCode == prize.TemplateCode }); } rdlPrize.SelectedValue = prize.PrizeID.Value.ToString(); if (decl.RecommendFrom == null || decl.RecommendFrom == "0" || decl.RecommendFrom == "") { ChooseAssociation.SelectedValue = "0"; litChooseAssociation.Text = "未有推荐协会"; } else { ChooseAssociation.SelectedValue = decl.RecommendFrom.ToString(); litChooseAssociation.Text = BLL.User.GetUserInfo(Convert.ToInt32(decl.RecommendFrom), conn).UserName; } // 隐藏导入数据控件 ImportData.Visible = false; // 生成二维码 //string imgUrl = BLL.Declaration.CreatQRcode(decl.DeclarationCode, conn); //// 显示二维码 //HtmlTableRow tr = new HtmlTableRow(); //HtmlTableCell td1 = new HtmlTableCell("td"); //HtmlTableCell td2 = new HtmlTableCell("td"); //td1.InnerHtml = "<label style='margin-top: 20px;'>二维码:</label>"; //td1.Style.Add("width", "30%"); //td2.InnerHtml = "<img src='../../Content/Temp/" + decl.DeclarationCode + "/QRcode" + decl.DeclarationCode + ".jpg' style='width:150px;height:150px;' />"; //td2.ColSpan = 2; //tr.Cells.Add(td1); //tr.Cells.Add(td2); //tbInformation.Rows.Add(tr); } //接受场景 if (!string.IsNullOrEmpty(Request["Situation"])) { txtSituation.Text = Request["Situation"].Replace("'", ""); litProjectName.Text = decl.DeclarationName; litDeclarateDate.Text = decl.DeclareDate.Value.ToString("yyyy-MM-dd"); litrdlPrize.Text = prize.PrizeName; } conn.Close(); } }