//初始化上级专家组下拉列表 public void InitParentGroup(int specialtyID) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); OleDbTransaction tran = conn.BeginTransaction(); Dal.Models.UserInfo userinfo = (Dal.Models.UserInfo)Session["UserInfo"]; string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn, tran); if (activity == null) { Response.Redirect("../Mutual/HomePage.aspx"); return; } //string SpecialtyIDs = BLL.Specialty.GetSpecialtyByUserType(activity.ActivityID.Value, userinfo.UserID.Value, conn, tran); List <Dal.Models.ExpertGroup> profession = BLL.ExpertGroup.GetGroupList(activity.ActivityID.Value, specialtyID.ToString(), conn, tran); ddlParentGroup.DataSource = profession; ddlParentGroup.DataTextField = "GroupName"; ddlParentGroup.DataValueField = "GroupID"; ddlParentGroup.DataBind(); ddlParentGroup.Items.Remove(ddlParentGroup.Items.FindByText(txtExpertGroupName.Text)); }
public void GetBar(HttpContext context, OleDbConnection conn) { List <string> lstSpeciatlyName = new List <string>(); List <int> lstDecNum = new List <int>(); string strActivityType = context.Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { context.Response.Write(JsonConvert.SerializeObject("当前没有激活的活动!")); return; } else { List <Dal.Models.Specialty> lstSpec = BLL.Specialty.GetSpecialtyList(Convert.ToInt32(activity.ActivityID), true, conn); foreach (Dal.Models.Specialty spec in lstSpec) { lstSpeciatlyName.Add(spec.SpecialtyName); lstDecNum.Add(BLL.Declaration.GetWeeklyNewDeclarationCount(activity.ActivityID.Value, spec.SpecialtyID.Value, conn)); } } object[] objs = { lstSpeciatlyName, lstDecNum }; context.Response.Write(JsonConvert.SerializeObject(objs)); }
public void GetExpertRevotePrizeList(HttpContext context, OleDbConnection conn) { string specialtys = context.Request["Specialtys"]; string prizeType = context.Request["PrizeType"]; string prizeName = context.Request["PrizeName"]; Dal.Models.UserInfo user = (Dal.Models.UserInfo)context.Session["UserInfo"]; Dal.Models.Activity activity = BLL.Activity.GetActivity(context.Session["ActivityType"].ToString(), conn); if (activity == null) { context.Response.Write("活动未开始!"); } List <Dal.Models.RevotePrize> lstPrize = null; if (user.UserType == "0801" || user.UserType == "0802" || user.UserType == "0803") { //lstPrize = BLL.Prize.GetPrizeList(specialtys, prizeType, prizeName, conn); } else if (user.UserType == "0805") { // 专家所评审的项目对应的奖项 BLL.Revote bllRevote = new BLL.Revote(); lstPrize = bllRevote.GetExpertRevotePrize(user.UserID.Value, activity.ActivityID.Value, conn); } int iPageSize = 10; if (!Int32.TryParse(context.Request["PageSize"] ?? "50", out iPageSize)) { iPageSize = 10; } int iCuttentPage = 1; if (!Int32.TryParse(context.Request["CuttentPage"] ?? "0", out iCuttentPage)) { iCuttentPage = 1; } int iRecordNumber = lstPrize.Count; int iPagesCount = Convert.ToInt32(Math.Ceiling((float)iRecordNumber / (float)iPageSize)); lstPrize = lstPrize.Skip(iPageSize * (iCuttentPage - 1)).Take(iPageSize).ToList(); Dal.Models.PageInfo <Dal.Models.Declaration> pgif = new Dal.Models.PageInfo <Dal.Models.Declaration>(); pgif.CuttentPage = iCuttentPage; pgif.PerPage = iPageSize; pgif.RecordNumber = iRecordNumber; pgif.PagesCount = iPagesCount; pgif.Table = Dal.DataTableExtensions.ToDataTable(lstPrize); string strJson = JsonConvert.SerializeObject(pgif); context.Response.Write(strJson); conn.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserInfo"] == null) { Response.Redirect("../Mutual/UserEntry.aspx"); } if (!IsPostBack) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); // 获取当前活动 string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { Response.Redirect("../Mutual/HomePage.aspx"); return; } // 获取当前活动顶级专业 List <Dal.Models.Specialty> lstSpecial = BLL.Specialty.GetSpecialtyList(activity.ActivityID.Value, true, conn); ddlSpecialty.DataSource = lstSpecial; ddlSpecialty.DataTextField = "SpecialtyName"; ddlSpecialty.DataValueField = "SpecialtyID"; ddlSpecialty.DataBind(); listSpecialty.Enabled = false; if (!string.IsNullOrEmpty(Request["epid"])) { InitPage(conn); } else { listSpecialty.Visible = false; btnEditUser.Visible = false; } //Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"]; //if (user.UserType == "0805") { // trGender.Visible = false; // trIdType.Visible = false; // trId.Visible = false; // trIdMsg.Visible = false; //} conn.Close(); } }
protected void btnEditUser_Click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); // 获取当前活动 string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { Response.Redirect("../Mutual/HomePage.aspx"); return; } int iExpertId = 0; int.TryParse(Request["epid"], out iExpertId); Dal.Models.Expert expert = BLL.Expert.GetExpert(iExpertId, conn); expert.ExpertName = txtExpertName.Text; expert.AcademicTitle = txtAcademicTitle.Text; expert.Profession = txtProfession.Text; expert.Workplace = txtWorkplace.Text; expert.IDType = rbtnIDType.SelectedValue; expert.IDNumber = txtIDNumber.Text; expert.Gender = ddlGender.SelectedValue; expert.Email = txtEmail.Text; expert.SpecialtyIDs = checkeds.Value; OleDbTransaction tran = conn.BeginTransaction(); try { BLL.Expert.UpdateExpert(expert, conn, tran); BLL.User.SetUserSpecialty(expert.UserID.Value, activity.ActivityID.Value, expert.SpecialtyIDs, conn, tran); tran.Commit(); hdMsg.Value = "修改成功!"; } catch (Exception ex) { tran.Rollback(); conn.Close(); hdMsg.Value = ex.Message; return; } conn.Close(); }
protected void btnCreateUser_Click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); // 获取当前活动 string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { Response.Redirect("../Mutual/HomePage.aspx"); return; } OleDbTransaction tran = conn.BeginTransaction(); Dal.Models.Expert expert = new Dal.Models.Expert(); Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"]; expert.ExpertName = txtExpertName.Text; expert.AcademicTitle = txtAcademicTitle.Text; expert.Profession = txtProfession.Text; expert.Workplace = txtWorkplace.Text; expert.IDType = rbtnIDType.SelectedValue; expert.IDNumber = txtIDNumber.Text; expert.Gender = ddlGender.SelectedValue; expert.Email = txtEmail.Text; expert.SpecialtyIDs = checkeds.Value; //string strDefaultPassword = System.Configuration.ConfigurationManager.AppSettings["DefaultPassword"]; string strDefaultPassword = BLL.SysConstant.GetAppSettings("DefaultPassword", conn, tran); try { BLL.Expert.CreateExpert(expert, strDefaultPassword, user.UserID.Value, conn, tran); BLL.User.SetUserSpecialty(expert.UserID.Value, activity.ActivityID.Value, expert.SpecialtyIDs, conn, tran); tran.Commit(); hdMsg.Value = "添加成功!"; conn.Close(); } catch (Exception ex) { tran.Rollback(); conn.Close(); hdMsg.Value = ex.Message; return; } }
public void InitSpecialtyList() { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); Dal.Models.UserInfo user = ((Dal.Models.UserInfo)Session["UserInfo"]); string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { Response.Redirect("../Mutual/HomePage.aspx"); return; } listSpecialty.DataSource = BLL.Specialty.GetSpecialtyListByUserType(activity.ActivityID.Value, user.UserType, user.UserID.Value, true, conn); listSpecialty.DataTextField = "SpecialtyName"; listSpecialty.DataValueField = "SpecialtyID"; listSpecialty.DataBind(); conn.Close(); }
public void GetPie(HttpContext context, OleDbConnection conn) { List <KeyValuePair <string, int> > lstPie = new List <KeyValuePair <string, int> >(); string strActivityType = context.Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { context.Response.Write(JsonConvert.SerializeObject("当前没有激活的活动!")); return; } else { List <Dal.Models.Specialty> lstSpec = BLL.Specialty.GetSpecialtyList(Convert.ToInt32(activity.ActivityID), true, conn); foreach (Dal.Models.Specialty spec in lstSpec) { lstPie.Add(new KeyValuePair <string, int>(spec.SpecialtyName, BLL.Declaration.CountInSpecialty(spec.SpecialtyID.Value, "1803", conn))); } } object[] objs = { lstPie }; context.Response.Write(JsonConvert.SerializeObject(objs)); }
//初始化加载专业下拉列表 public void InitDdlProfession() { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); Dal.Models.UserInfo userinfo = (Dal.Models.UserInfo)Session["UserInfo"]; string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { Response.Redirect("../Mutual/HomePage.aspx"); return; } OleDbTransaction tran = conn.BeginTransaction(); List <Specialty> profession = BLL.Specialty.GetSpecialtyListByUserType(activity.ActivityID.Value, userinfo.UserType, userinfo.UserID.Value, false, conn, tran);//BLL.Specialty.GetSpecialtyList(activity.ActivityID.ToString(),conn, tran); ddlSpecialty.DataSource = profession; ddlSpecialty.DataTextField = "SpecialtyName"; ddlSpecialty.DataValueField = "SpecialtyID"; ddlSpecialty.DataBind(); }
public void InitPage() { Dal.Models.UserInfo userinfo = (Dal.Models.UserInfo)Session["UserInfo"]; OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { Response.Redirect("../Mutual/HomePage.aspx"); return; } else { //ddlSpecialtyUser.DataSource = BLL.Specialty.GetSpecialtyList(activity.ActivityID.Value, false, conn); //ddlSpecialtyUser.DataValueField = "SpecialtyID"; //ddlSpecialtyUser.DataTextField = "SpecialtyName"; //ddlSpecialtyUser.DataBind(); } }
protected void btnSaveExpertGroup_Click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { hdMsg.Value = "当前活动已关闭,请联系活动管理人员!"; return; } Dal.Models.ExpertGroup expertGroup = new Dal.Models.ExpertGroup(); string strGroupID = Request["GroupID"]; if (!string.IsNullOrEmpty(strGroupID)) { expertGroup.GroupID = Convert.ToInt32(strGroupID); } if (hfParentID.Value != "0" && hfParentID.Value != "") { expertGroup.ParentID = Convert.ToInt32(hfParentID.Value); } expertGroup.GroupName = txtExpertGroupName.Text; expertGroup.ActivityID = activity.ActivityID; expertGroup.SpecialtyID = Convert.ToInt32(ddlSpecialty.SelectedValue); // 组长 if (!string.IsNullOrEmpty(txtExpertGroupLeader.Text.Trim())) { expertGroup.GroupLeader = Convert.ToInt32(txtExpertGroupLeader.Text.Trim()); } else { hdMsg.Value = "专家组必须要有一个组长!"; return; } // 副组长 expertGroup.DeputyIDs = txtDeputyLeader.Text.Trim(); Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"]; OleDbTransaction tran = conn.BeginTransaction(); try { BLL.ExpertGroup.CreateExpertGroup(expertGroup, user, conn, tran); tran.Commit(); hdMsg.Value = "保存成功!"; } catch (Exception ex) { tran.Rollback(); hdMsg.Value = ex.Message; conn.Close(); return; } conn.Close(); }
private void InitPage(string strPrizeID, string strSpecialID) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); string strActivityType = Session["ActivityType"].ToString(); Dal.Models.Activity activity = BLL.Activity.GetActivity(strActivityType, conn); if (activity == null) { Response.Redirect("../Mutual/HomePage.aspx"); } else { divMultipleVoteRound.Visible = false; //设置控件只读,(前台设置时,会导致后台取不到值。) txtPrizeCode.Attributes.Add("readonly", "true"); // 所属专业绑值 List <Dal.Models.Specialty> lstSpeciatly = BLL.Specialty.GetSpecialtyList(activity.ActivityID.Value, conn); ddlSpecialty.DataSource = lstSpeciatly; ddlSpecialty.DataValueField = "SpecialtyID"; ddlSpecialty.DataTextField = "SpecialtyName"; ddlSpecialty.DataBind(); // 奖项的专业模版绑值 ddlTemplateCode.DataSource = BLL.SysConstant.GetConstantList("02", conn); ddlTemplateCode.DataTextField = "ConstantValue"; ddlTemplateCode.DataValueField = "ConstantCode"; ddlTemplateCode.DataBind(); //奖项类别选择绑定人员数量 List <Dal.Models.SysConstant> lstPrizeType = BLL.SysConstant.GetConstantList("03", conn); System.Web.UI.WebControls.ListItem option = null; foreach (Dal.Models.SysConstant item in lstPrizeType) { option = new System.Web.UI.WebControls.ListItem(item.ConstantValue, item.ConstantCode); option.Attributes.Add("data", item.CorrelationValue); ddlPrizeType.Items.Add(option); } // 综合奖投票类别 List <Dal.Models.SysConstant> lstMultipleVote = BLL.SysConstant.GetConstantList("22", conn); ddlVoteType.DataTextField = "ConstantValue"; ddlVoteType.DataValueField = "ConstantCode"; ddlVoteType.DataBind(); //判断是否存在奖项ID Dal.Models.Prize dprize = null; Dal.Models.Specialty dSpecialty = null; List <Dal.Models.Appendix> dAppendix = null; List <Dal.Models.Atlas> dAtlas = null; List <Dal.Models.Media> dMedia = null; int iPrizeID = 0; if (!string.IsNullOrEmpty(strPrizeID)) { ddlSpecialty.Attributes.Add("disabled", "disabled"); int.TryParse(strPrizeID, out iPrizeID); dprize = BLL.Prize.GetPrize(iPrizeID, conn); if (dprize != null) { dSpecialty = BLL.Specialty.GetSpecialty(dprize.SpecialtyID.Value, conn); dAppendix = BLL.Appendix.GetAppendixListSpecialty(dprize.SpecialtyID.Value, conn); dAtlas = BLL.Atlas.GetAtlasList(dprize.SpecialtyID.Value, AtlasType.Specialty, conn); dMedia = BLL.Media.GetMediaList(dprize.SpecialtyID.Value, MediaType.Specialty, conn); } } btnUpdatePrize.Visible = false; if (!string.IsNullOrEmpty(strSpecialID)) { ddlSpecialty.SelectedValue = strSpecialID; ddlSpecialty.Attributes.Add("disabled", "disabled"); btnUpdatePrize.Visible = false; dAppendix = BLL.Appendix.GetAppendixListSpecialty(Convert.ToInt32(strSpecialID), conn); dAtlas = BLL.Atlas.GetAtlasList(Convert.ToInt32(strSpecialID), AtlasType.Specialty, conn); dMedia = BLL.Media.GetMediaList(Convert.ToInt32(strSpecialID), MediaType.Specialty, conn); SetAppendix(dAppendix); SetAtlas(dAtlas); SetMedia(dMedia); } if (dprize != null) { if ((dprize.PrizeTypeCode == "0301" && dprize.IsMultipleVoting == true) || (dprize.PrizeTypeCode == "0304" && dprize.IsMultipleVoting == true)) { divMultipleVoteRound.Visible = true; } ddlSpecialty.SelectedValue = dprize.SpecialtyID.ToString(); ddlVoteType.SelectedValue = dprize.VoteType; txtPrizeName.Text = dprize.PrizeName; txtPrizeID.Text = dprize.PrizeID.ToString(); txtPrizeCode.Text = dprize.PrizeCode; ddlTemplateCode.SelectedValue = dprize.TemplateCode; txtOrdinal.Text = dprize.Ordinal.ToString(); ddlPrizeType.SelectedValue = dprize.PrizeTypeCode; txtParticipantLimit.Text = dprize.ParticipantLimit.ToString(); List <Dal.Models.PrizeLevel> pl = BLL.Prize.GetPrizeLimitNumList(dprize.PrizeID.Value, conn); if (pl.Count != 0) { if (pl.Count > 2) { txtFirstPrizeNum.Text = pl[0].LevelLimitNumber.ToString(); txtSecondPrizeNum.Text = pl[1].LevelLimitNumber.ToString(); txtThirdPrizeNum.Text = pl[2].LevelLimitNumber.ToString(); } else if (pl.Count > 1) { txtFirstPrizeNum.Text = pl[0].LevelLimitNumber.ToString(); txtSecondPrizeNum.Text = pl[1].LevelLimitNumber.ToString(); } else { txtPrizeNum.Text = pl[0].LevelLimitNumber.ToString(); } } SetAppendix(dAppendix); SetAtlas(dAtlas); SetMedia(dMedia); txtSpecialtyID.Text = dprize.SpecialtyID.ToString(); btnCreatePrize.Visible = false; btnUpdatePrize.Visible = true; ddlPrizeType.Attributes.Add("disabled", "disabled"); } } conn.Close(); }