Exemplo n.º 1
0
        public void InitPage(List <Dal.Models.Expert> lstExpert = null)
        {
            OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);

            conn.Open();
            Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"];

            if (!IsPostBack)
            {
                List <SysConstant> userStatus = BLL.SysConstant.GetConstantList("07", conn);
                ddlStatus.DataSource     = userStatus;
                ddlStatus.DataTextField  = "ConstantValue";
                ddlStatus.DataValueField = "ConstantCode";
                ddlStatus.DataBind();
            }

            if (lstExpert == null)
            {
                try
                {
                    lstExpert = BLL.Expert.GetExpertList(conn, user);
                }
                catch
                {
                    lstExpert = null;
                }
            }

            conn.Close();
        }
Exemplo n.º 2
0
        //初始化上级专家组下拉列表
        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));
        }
Exemplo n.º 3
0
        public void GetRevoteGroupViews(HttpContext context, OleDbConnection conn)
        {
            Dal.Models.UserInfo user   = (Dal.Models.UserInfo)context.Session["UserInfo"];
            Dal.Models.Expert   expert = BLL.Expert.GetExpertByUserID(user.UserID.Value, conn);

            int iPrizeID = 0;

            if (!Int32.TryParse(context.Request["PrizeID"], out iPrizeID))
            {
                context.Response.Write("暂无奖项!");
                return;
            }

            Dal.Models.Prize prize = BLL.Prize.GetPrize(iPrizeID, conn);

            if (prize == null)
            {
                context.Response.Write("暂无奖项!");
                return;
            }

            var groupViews = BuildRevoteGroupViews(prize, expert, conn);

            context.Response.Write(JsonConvert.SerializeObject(groupViews.ToArray()));
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        public void GetMenu(HttpContext context, OleDbConnection conn)
        {
            Dal.Models.UserInfo user = (Dal.Models.UserInfo)context.Session["UserInfo"];

            StringBuilder             sbMenu  = new StringBuilder();
            List <Dal.Models.SysMenu> lstMenu = BLL.SysMenu.GetMenu(user.UserID.Value, conn);

            context.Response.Write(JsonConvert.SerializeObject(lstMenu));
        }
Exemplo n.º 6
0
        public void GetUser(HttpContext context, OleDbConnection conn)
        {
            Dal.Models.UserInfo user = null;
            int iUserID = 0;

            int.TryParse(context.Request["UserID"] ?? "0", out iUserID);
            user = BLL.User.GetUserInfo(iUserID, conn);

            context.Response.Write(JsonConvert.SerializeObject(user));
        }
Exemplo n.º 7
0
        private void RevotingVote(HttpContext context, OleDbConnection conn)
        {
            Dal.Models.UserInfo user   = (Dal.Models.UserInfo)context.Session["UserInfo"];
            Dal.Models.Expert   expert = BLL.Expert.GetExpertByUserID(user.UserID.Value, conn);
            OleDbTransaction    tran   = conn.BeginTransaction();

            try
            {
                int declarationId = 0;
                int revoteGroupId = 0;
                int recommended   = 0;
                int notRecommened = 0;
                int prizeId       = 0;
                if (!int.TryParse(context.Request["DeclarationID"], out declarationId) ||
                    !int.TryParse(context.Request["RevoteGroupId"], out revoteGroupId) ||
                    !int.TryParse(context.Request["RevoteRecommended"], out recommended) ||
                    !int.TryParse(context.Request["NotRevoteRecommended"], out notRecommened) ||
                    !int.TryParse(context.Request["PrizeId"], out prizeId))
                {
                    throw new Exception("参数错误!");
                }

                Dal.Models.Prize prize = BLL.Prize.GetPrize(prizeId, conn, tran);
                if (prize == null || prize.IsStopVote)
                {
                    throw new Exception("当前奖项及轮次已结束投票。");
                }

                Revote revote = new Revote();
                bool   saved  = revote.SaveRevotingVote(revoteGroupId, declarationId, recommended, notRecommened, expert.UserID.Value,
                                                        conn, tran);

                if (saved)
                {
                    tran.Commit();

                    var    revoteGroups = this.BuildRevoteGroupViews(prize, expert, conn);
                    string message      = "投票成功!";

                    var result = new { Views = revoteGroups, Message = message };

                    context.Response.Write(JsonConvert.SerializeObject(result));
                }
                else
                {
                    tran.Rollback();
                    context.Response.Write(JsonConvert.SerializeObject(new { Message = "投票错误" }));
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                context.Response.Write(JsonConvert.SerializeObject(new { Message = ex.Message }));
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"];
            if (user == null)
            {
                Response.Redirect("../Mutual/UserEntry.aspx");
            }

            if (!IsPostBack)
            {
                InitPage();
            }
        }
Exemplo n.º 9
0
        protected void lkbExport_Click(object sender, EventArgs e)
        {
            OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);

            conn.Open();

            string strQuery       = txtQueryString.Text;
            string strQueryStatus = hfStatus.Value;

            Dal.Models.UserInfo user     = (Dal.Models.UserInfo)Session["UserInfo"];
            DataTable           dtExpert = Dal.DataTableExtensions.ToDataTable(BLL.Expert.GetExpertList(conn, user, strQuery, strQueryStatus));

            ExportExpert(dtExpert);
            conn.Close();
            conn.Dispose();
        }
Exemplo n.º 10
0
        protected void btnCheckedExpert_Click(object sender, EventArgs e)
        {
            string expertIDs = checkedExpertID.Value;

            expertIDs = expertIDs.Substring(0, expertIDs.Length - 1);
            OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);

            conn.Open();
            Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"];
            string    strQueryStatus = hfStatus.Value;
            DataTable dtExpert       = Dal.DataTableExtensions.ToDataTable(BLL.Expert.GetExpertList(conn, user, null, strQueryStatus, expertIDs));

            ExportExpert(dtExpert);
            conn.Close();
            conn.Dispose();
        }
Exemplo n.º 11
0
        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;
            }
        }
Exemplo n.º 12
0
        public void SubmitVote(HttpContext context, OleDbConnection conn)
        {
            int iPrizeID = 0;

            Int32.TryParse(context.Request["PrizeID"], out iPrizeID);
            Dal.Models.Prize    prize  = BLL.Prize.GetPrize(iPrizeID, conn);
            Dal.Models.UserInfo user   = (Dal.Models.UserInfo)context.Session["UserInfo"];
            Dal.Models.Expert   expert = BLL.Expert.GetExpertByUserID(user.UserID.Value, conn);

            if (prize == null || prize.IsStopVote)
            {
                context.Response.Write("当前奖项及轮次已结束投票。");
                return;
            }

            OleDbTransaction tran = conn.BeginTransaction();

            try
            {
                //根据专家和奖项获评奖项目
                List <Dal.Models.Vote> lstVote = BLL.Vote.GetVoteDeclarationList(expert, prize, conn, tran);

                //获取每个奖项的已评奖数量
                Dictionary <string, int> dicVote = new Dictionary <string, int>();

                //获取每个奖项未评奖数量
                Dictionary <string, int> dicRemain = new Dictionary <string, int>();

                GetLimit(prize, lstVote, ref dicVote, ref dicRemain);

                if (dicVote["Voted"] < lstVote.Count)
                {
                    throw new Exception("尚未完成投票,提交失败!");
                }

                BLL.Vote.SubmitVote(expert, prize, conn, tran);

                tran.Commit();
                context.Response.Write("提交成功!");
            }
            catch (Exception ex)
            {
                tran.Rollback();
                context.Response.Write(ex.Message);
            }
        }
Exemplo n.º 13
0
        public void GetExpertVoteList(HttpContext context, OleDbConnection conn)
        {
            Dal.Models.UserInfo user   = (Dal.Models.UserInfo)context.Session["UserInfo"];
            Dal.Models.Expert   expert = BLL.Expert.GetExpertByUserID(user.UserID.Value, conn);

            int iPrizeID = 0;

            if (!Int32.TryParse(context.Request["PrizeID"], out iPrizeID))
            {
                context.Response.Write("暂无奖项!");
                return;
            }

            Dal.Models.Prize prize = BLL.Prize.GetPrize(iPrizeID, conn);

            if (prize == null)
            {
                context.Response.Write("暂无奖项!");
                return;
            }

            Dal.Models.Schedule schedule = BLL.Schedule.GetSpecialtySchedule(prize.SpecialtyID.Value, conn);

            if (schedule.IsVoteStart == false)
            {
                context.Response.Write("投票未开始或已经结束!");
            }
            else
            {
                //根据专家和奖项获评奖项目
                List <Dal.Models.Vote> lstVote = BLL.Vote.GetVoteDeclarationList(expert, prize, conn);
                lstVote = lstVote.OrderBy(d => d.BigOrdinal).ToList();

                //获取每个奖项的已评奖数量
                Dictionary <string, int> dicVote = new Dictionary <string, int>();

                //获取每个奖项未评奖数量
                Dictionary <string, int> dicRemain = new Dictionary <string, int>();

                GetLimit(prize, lstVote, ref dicVote, ref dicRemain);

                object[] obj = { prize, lstVote, dicVote, dicRemain };
                context.Response.Write(JsonConvert.SerializeObject(obj));
            }
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserInfo"] == null)
            {
                Response.Redirect("../Mutual/UserEntry.aspx");
            }
            if (!IsPostBack)
            {
                InitSpecialty();
                int userId = Request.QueryString["id"] == null ? 0 : Convert.ToInt32(Request.QueryString["id"]);
                hdUserID.Value = userId.ToString();
                string type = Request.QueryString["operateType"] == null ? "" : Request.QueryString["operateType"].ToString();
                if (type == "update")
                {
                    Dal.Models.UserInfo userLogin = (Dal.Models.UserInfo)Session["UserInfo"];
                    if (userLogin.UserID.Value == userId)
                    {
                        hdIsSelf.Value = "true";
                    }

                    operateType.Value = type;
                    OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);
                    conn.Open();
                    UserInfo user = BLL.User.GetUserInfo(userId, conn);
                    //List<UserSpecialty> userSp = BLL.User.GetUserSpecialtyList(userId, conn);
                    checkeds.Value = BLL.User.GetUserSpecialtyIDs(userId, conn);
                    conn.Close();

                    txtUserName.Value = user.UserName;
                    txtEmail.Value    = user.Email;

                    //string temp = "";
                    //if (userSp.Count > 0)
                    //{
                    //    for (int i = 0; i < userSp.Count; i++)
                    //    {
                    //        temp += userSp[i].SpecialtyID.Value.ToString() + ",";
                    //    }
                    //    checkeds.Value = temp.Substring(0, temp.Length - 1);
                    //}
                    InitSpecialtyList();
                }
            }
        }
Exemplo n.º 15
0
        public void SubmitRevotingVote(HttpContext context, OleDbConnection conn)
        {
            int iPrizeID = 0;

            Int32.TryParse(context.Request["PrizeID"], out iPrizeID);
            Dal.Models.Prize    prize  = BLL.Prize.GetPrize(iPrizeID, conn);
            Dal.Models.UserInfo user   = (Dal.Models.UserInfo)context.Session["UserInfo"];
            Dal.Models.Expert   expert = BLL.Expert.GetExpertByUserID(user.UserID.Value, conn);

            if (prize == null || prize.IsStopVote)
            {
                context.Response.Write("当前奖项及轮次已结束投票。");
                return;
            }

            OleDbTransaction tran = conn.BeginTransaction();

            try
            {
                BLL.Revote revote = new Revote();

                RevotePrize last = revote.GetLastRevotePrize(prize, conn, tran);

                bool saved = revote.SubmitRevotingVote(expert.UserID.Value, last.RevotePrizeId, conn, tran);

                if (saved)
                {
                    tran.Commit();
                    context.Response.Write("提交成功!");
                }
                else
                {
                    tran.Commit();
                    context.Response.Write("提交错误!");
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                context.Response.Write(ex.Message);
            }
        }
Exemplo n.º 16
0
        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();
        }
Exemplo n.º 17
0
        //初始化加载专业下拉列表
        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();
        }
Exemplo n.º 18
0
        private void BatchRevotingVote(HttpContext context, OleDbConnection conn)
        {
            Dal.Models.UserInfo user   = (Dal.Models.UserInfo)context.Session["UserInfo"];
            Dal.Models.Expert   expert = BLL.Expert.GetExpertByUserID(user.UserID.Value, conn);

            int prizeId = 0;
            int recommended, notRecommended;

            int.TryParse(context.Request["PrizeID"], out prizeId);
            int.TryParse(context.Request["Recommended"], out recommended);
            int.TryParse(context.Request["NotRecommended"], out notRecommended);

            Dal.Models.Prize prize = BLL.Prize.GetPrize(prizeId, conn);

            if (prize == null || prize.IsStopVote)
            {
                context.Response.Write("当前奖项及轮次已结束投票。");
                return;
            }
            BLL.Revote  revote      = new Revote();
            RevotePrize revotePrize = revote.GetLastRevotePrize(prize, conn);

            OleDbTransaction tran = conn.BeginTransaction();

            try
            {
                bool saved = revote.SaveBatchRevotingVotes(revotePrize.RevotePrizeId, expert.UserID.Value, recommended, notRecommended, conn, tran);

                tran.Commit();
                context.Response.Write(JsonConvert.SerializeObject("投票成功!"));
            }
            catch (Exception ex)
            {
                tran.Rollback();
                context.Response.Write(JsonConvert.SerializeObject(ex.Message));
            }
        }
Exemplo n.º 19
0
        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();
            }
        }
Exemplo n.º 20
0
        //public void FinishVote(HttpContext context, OleDbConnection conn)
        //{
        //    Dal.Models.UserInfo user = (Dal.Models.UserInfo)context.Session["UserInfo"];

        //    //Issubmit="1",是投票结果的状态为提交,专家不能再更改投票结果,投票时,此字段默认值为0
        //    string strIsSubmit = "1";

        //    //获取当前活动类型编码
        //    string strActivityType = context.Session["ActivityType"].ToString();

        //    //获取当前活动ID
        //    int iActivityID = BLL.Activity.GetActivity(strActivityType, conn).ActivityID.Value;

        //    //获取当前活动时间节点
        //    Dal.Models.Schedule schedule = BLL.Schedule.GetActivitySchedule(iActivityID, conn);

        //    //获取所有本次活动的奖项

        //    List<Dal.Models.Prize> lstPrize = BLL.Prize.GetPrizeList(user, strActivityType, "", conn);

        //    //修改Schedule的投票阶段
        //    BLL.Vote.UpdateScheduleVoteFinish(schedule.ScheduleID.Value, false, conn);

        //    foreach (var item in lstPrize)
        //    {
        //        List<Dal.Models.Vote> lstVote = BLL.Vote.GetActivityPrizeVoteList(item.PrizeID.Value, conn);
        //        foreach (var Vote in lstVote)
        //        {
        //            //修改Vote为已经提交
        //            BLL.Vote.SubmitVote(Vote.VoteID.Value, strIsSubmit, conn);
        //        }
        //    }
        //    context.Response.Write("投票已提交");
        //}

        private void Ballot(HttpContext context, OleDbConnection conn)
        {
            Dal.Models.UserInfo user   = (Dal.Models.UserInfo)context.Session["UserInfo"];
            Dal.Models.Expert   expert = BLL.Expert.GetExpertByUserID(user.UserID.Value, conn);
            OleDbTransaction    tran   = conn.BeginTransaction();

            try
            {
                int iDeclarationID     = 0;
                int iPrizeID           = 0;
                int iMultipleVoteRound = 0;
                if (!int.TryParse(context.Request["DeclarationID"], out iDeclarationID) ||
                    !int.TryParse(context.Request["PrizeID"], out iPrizeID) ||
                    !int.TryParse(context.Request["MultipleVoteRound"], out iMultipleVoteRound))
                {
                    throw new Exception("参数错误!");
                }

                Dal.Models.Prize prize = BLL.Prize.GetPrize(iPrizeID, conn, tran);
                if (prize == null || prize.IsStopVote)
                {
                    throw new Exception("当前奖项及轮次已结束投票。");
                }


                string strVoteCode  = context.Request["VoteCode"];
                string strLevelCode = context.Request["LevelCode"];
                if (strLevelCode == "0404")
                {
                    strLevelCode = "";
                }

                Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(iDeclarationID, conn, tran);
                if (decl.PrizeID != iPrizeID)
                {
                    throw new Exception("参数错误!");
                }

                prize = BLL.Prize.GetPrize(decl.AdjustedPrize.Value, conn, tran);
                if (prize.MultipleVoteRound != iMultipleVoteRound)
                {
                    throw new Exception("当前已进入新一轮投票,请重新进入本页面进行投票!");
                }

                Dal.Models.Vote vote = new Dal.Models.Vote()
                {
                    UserID            = user.UserID.Value,
                    Votor             = expert.ExpertID.Value,
                    DeclarationID     = iDeclarationID,
                    ActivityID        = decl.ActivityID.Value,
                    MultipleVoteRound = prize.MultipleVoteRound ?? 1,
                    RevoteCode        = prize.RevoteCode ?? "",
                    RevoteRound       = prize.RevoteRound ?? 0,
                    IsSubmit          = false,
                    PrizeID           = prize.PrizeID.Value,
                    VoteCode          = strVoteCode,
                    PrizeLevelCode    = strLevelCode,
                    VoteType          = "0502"
                };

                BLL.Vote.Ballot(vote, conn, tran);

                //根据专家和奖项获评奖项目
                List <Dal.Models.Vote> lstVote = BLL.Vote.GetVoteDeclarationList(expert, prize, conn, tran);

                //获取每个奖项的已评奖数量
                Dictionary <string, int> dicVote = new Dictionary <string, int>();

                //获取每个奖项未评奖数量
                Dictionary <string, int> dicRemain = new Dictionary <string, int>();

                GetLimit(prize, lstVote, ref dicVote, ref dicRemain);

                string Message = "";
                //if (strVoteCode == "0601" && (dicRemain["Recommended"] == 0
                //    || (strLevelCode == "0401" && dicRemain["FirstPrize"] == 0)
                //    || (strLevelCode == "0402" && dicRemain["SecondPrize"] == 0)
                //    || (strLevelCode == "0403" && dicRemain["ThirdPrize"] == 0)))
                //{
                //    Message = "所投选项名额已满,请注意!";
                //}
                //else
                //{
                Message = "投票成功!";
                //}

                tran.Commit();

                object[] obj = { prize, lstVote, dicVote, dicRemain, Message };

                context.Response.Write(JsonConvert.SerializeObject(obj));
            }
            catch (Exception ex)
            {
                tran.Rollback();
                context.Response.Write(JsonConvert.SerializeObject(new object[] { ex.Message }));
            }
        }
Exemplo n.º 21
0
        private void BatchBallot(HttpContext context, OleDbConnection conn)
        {
            Dal.Models.UserInfo user   = (Dal.Models.UserInfo)context.Session["UserInfo"];
            Dal.Models.Expert   expert = BLL.Expert.GetExpertByUserID(user.UserID.Value, conn);

            int iPrizeID = 0;

            int.TryParse(context.Request["PrizeID"], out iPrizeID);
            string strVoteCode  = context.Request["VoteCode"];
            string strLevelCode = context.Request["LevelCode"];

            if (strLevelCode == "0404")
            {
                strLevelCode = "";
            }

            Dal.Models.Prize prize = BLL.Prize.GetPrize(iPrizeID, conn);

            if (prize == null || prize.IsStopVote)
            {
                context.Response.Write("当前奖项及轮次已结束投票。");
                return;
            }

            OleDbTransaction tran = conn.BeginTransaction();

            try
            {
                //根据专家和奖项获评奖项目
                List <Dal.Models.Vote> lstVote = BLL.Vote.GetVoteDeclarationList(expert, prize, conn, tran);

                //获取每个奖项的已评奖数量
                Dictionary <string, int> dicVote = new Dictionary <string, int>();

                //获取每个奖项未评奖数量
                Dictionary <string, int> dicRemain = new Dictionary <string, int>();

                GetLimit(prize, lstVote, ref dicVote, ref dicRemain);

                //if (strVoteCode == "0601" && (dicRemain["Recommended"] == 0
                //    || (strLevelCode == "0401" && dicRemain["FirstPrize"] == 0)
                //    || (strLevelCode == "0402" && dicRemain["SecondPrize"] == 0)
                //    || (strLevelCode == "0403" && dicRemain["ThirdPrize"] == 0)))
                //{
                //    throw new Exception("所投选项名额已满,请重新投票!");
                //}

                Dal.Models.Vote vote = new Dal.Models.Vote()
                {
                    UserID            = user.UserID.Value,
                    Votor             = expert.ExpertID.Value,
                    ActivityID        = prize.ActivityID.Value,
                    MultipleVoteRound = prize.MultipleVoteRound ?? 1,
                    VoteRound         = prize.MultipleVoteRound ?? 1,
                    IsSubmit          = false,
                    PrizeID           = prize.PrizeID.Value,
                    VoteCode          = strVoteCode,
                    PrizeLevelCode    = strLevelCode,
                    VoteType          = "0502"
                };

                BLL.Vote.BatchBallot(vote, conn, tran);

                tran.Commit();
                context.Response.Write(JsonConvert.SerializeObject("投票成功!"));
            }
            catch (Exception ex)
            {
                tran.Rollback();
                context.Response.Write(JsonConvert.SerializeObject(ex.Message));
            }
        }
Exemplo n.º 22
0
        private void InitPage(OleDbConnection conn)
        {
            btnCreateUser.Visible = false;

            int iExpertId = 0;

            int.TryParse(Request["epid"], out iExpertId);
            if (iExpertId > 0)
            {
                try
                {
                    Dal.Models.UserInfo userinfo = (Dal.Models.UserInfo)Session["UserInfo"];
                    Dal.Models.Expert   expert   = BLL.Expert.GetExpert(iExpertId, conn);
                    if (userinfo.UserID == expert.UserID)
                    {
                        ddlSpecialty.Enabled  = false;
                        ddlSpecialty.Visible  = false;
                        listSpecialty.Visible = true;
                    }
                    else
                    {
                        userinfo = BLL.User.GetUserInfo(expert.UserID.Value, conn);
                    }
                    txtExpertName.Text       = expert.ExpertName;
                    txtUserName.Text         = userinfo.UserName;
                    txtAcademicTitle.Text    = expert.AcademicTitle;
                    txtProfession.Text       = expert.Profession;
                    txtWorkplace.Text        = expert.Workplace;
                    rbtnIDType.SelectedValue = expert.IDType;
                    txtIDNumber.Text         = expert.IDNumber;

                    //if (expert.IDType == "0901" && BLL.IDOperation.CheckIDCard18(expert.IDNumber))
                    //{
                    //    rbtnIDType.Enabled = false;
                    //    txtIDNumber.Enabled = false;
                    //}

                    txtEmail.Text           = userinfo.Email;
                    ddlGender.SelectedValue = expert.Gender;
                    if (expert.SpecialtyIDs != null && expert.SpecialtyIDs != "" && expert.SpecialtyNames != null && expert.SpecialtyNames != "")
                    {
                        string[] arrSpecialtyID = expert.SpecialtyIDs.Split(',');
                        expert.SpecialtyNames = expert.SpecialtyNames.Replace(",", ",");
                        string[] arrSpecialtyName = expert.SpecialtyNames.Split(',');
                        for (int i = 0; i < arrSpecialtyID.Length; i++)
                        {
                            listSpecialty.Items.Add(new System.Web.UI.WebControls.ListItem(arrSpecialtyName[i], arrSpecialtyID[i]));
                        }
                        checkeds.Value = string.Join(",", arrSpecialtyID);
                    }
                    hdMsg.Value = "";
                }
                catch (Exception ex)
                {
                    hdMsg.Value = ex.Message;
                }
            }
            Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"];
            if (user.UserType == "0805")
            {
                txtExpertName.Enabled = false;
                //ddlGender.Enabled = false;
                txtAcademicTitle.Enabled = false;
                txtProfession.Enabled    = false;
            }
        }
Exemplo n.º 23
0
        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();
        }