Exemplo n.º 1
0
        /// <summary>
        /// 数据行操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int  rowIndex            = NDConvert.ToInt32(e.CommandArgument);
            long ID                  = NDConvert.ToInt64(grid.DataKeys[rowIndex]["SID"].ToString());
            SurveyTableEntity entity = new SurveyTableEntity(ID);
            int count                = 0;

            switch (e.CommandName)
            {
            case "SurveyName":
                string urlAnswer = string.Format("ClientPs.aspx?SID={0}&AnswerGUID={1}", ID, ConvertString(grid.DataKeys[rowIndex]["AnswerGUID"]));
                PageHelper.WriteScript(string.Format("window.open('{0}');", urlAnswer));
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                break;

            case "TempPage":

                BindGridView();
                break;

            case "Statistics":

                BindGridView();
                break;

            case "Options":

                BindGridView();
                break;

            case "Editer":

                BindGridView();
                break;

            case "DeleteAnswer":
                //int count = 0;
                string AnswerGuid = ConvertString(grid.DataKeys[rowIndex]["AnswerGUID"]);
                //new AnswerManager_Layer().DeleteAnswer(AnswerGuid); //彻底删除答卷
                int ReturnNum = new AnswerManager_Layer().SetApprovalStaus("3", AnswerGuid);
                new AnswerManager_Layer().UpdateAnswerNum(ReturnNum, ID.ToString());
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                break;
            }
        }
 /// <summary>
 /// 删除业务过程
 /// </summary>
 /// <param name = "entity">实体类</param>
 public void Delete(SurveyTableEntity entity)
 {
     NDEntityCtl.Delete(entity);
 }
 /// <summary>
 /// 修改业务过程
 /// </summary>
 /// <param name = "entity">实体类</param>
 public void Update(SurveyTableEntity entity)
 {
     NDEntityCtl.Update(entity);
 }
 /// <summary>
 /// 新增业务过程
 /// </summary>
 /// <param name = "entity">实体类</param>
 public void Add(SurveyTableEntity entity)
 {
     NDEntityCtl.Insert(entity);
 }
Exemplo n.º 5
0
        /// <summary>
        /// 数据行操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int  rowIndex            = NDConvert.ToInt32(e.CommandArgument);
            long ID                  = NDConvert.ToInt64(grid.DataKeys[rowIndex]["SID"].ToString());
            SurveyTableEntity entity = new SurveyTableEntity(ID);

            switch (e.CommandName)
            {
            //case "State":   //编辑状态
            //    if (entity.State == (int)CommonEnum.SurveyState.NotCreate)
            //    {
            //        entity.State = (int)CommonEnum.SurveyState.HasCreated;

            //        new SurveyTableRule().Update(entity);

            //        PageHelper.ShowMessage("编辑状态更改成功!");
            //        BindGridView();
            //    }
            //    else
            //    {
            //        entity.State = (int)CommonEnum.SurveyState.NotCreate;

            //        new SurveyTableRule().Update(entity);

            //        PageHelper.ShowMessage("编辑状态更改成功!");
            //        BindGridView();
            //    }
            //    break;
            case "SurveyName":
                base.Response.Write(string.Format("<script language='javascript'>top.location.href = \"editsurvey.aspx?SID={0}\"</script>", ID));    // ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), string.Format("<script language='javascript'>window.parent.parent.alert(\"{0}\")</script>", "保存成功!"));
                BindGridView();
                break;

            case "AnswerAmount":
                //string urlAnswerAmount = string.Format("AnswerManager.aspx?SID={0}", ID);
                base.Response.Write(string.Format("<script language='javascript'>location.href = \"AnswerManager.aspx?SID={0}\"</script>", ID));
                BindGridView();
                break;

            case "TempPage":
                //TODO:PageHelper.WriteScript("window.open('../../Web/Gifts/ImagePhoto.aspx?ID=" + entity.GiftGuid + "');");
                break;

            case "Statistics":
                base.Response.Write(string.Format("<script language='javascript'>location.href = \"StatIndex.aspx?SID={0}\"</script>", ID));
                BindGridView();
                break;

            case "Options":
                string urlOptions = string.Format("SetPar.aspx?SID={0}", ID);
                //PageHelper.WriteScript(string.Format("window.open('{0}');", urlOptions));
                Response.Redirect(urlOptions);
                BindGridView();
                break;

            case "Editer":
                base.Response.Write(string.Format("<script language='javascript'>top.location.href = \"editsurvey.aspx?SID={0}\"</script>", ID));    // ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), string.Format("<script language='javascript'>window.parent.parent.alert(\"{0}\")</script>", "保存成功!"));
                BindGridView();
                break;
            }
        }
        /// <summary>
        /// toolbar事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void toolbar_MenuItemClick(object sender, MenuEventArgs e)
        {
            int count = 0;
            int num   = 0;

            switch (e.Item.Value)
            {
            case "Repeal":
                for (int i = 0; i < grid.Rows.Count; i++)
                {
                    CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                    long     SID     = Business.Helper.ConvertHelper.ConvertLong(grid.DataKeys[i]["SID"]);
                    if (chkItem != null && chkItem.Checked == true)
                    {
                        count++;
                        SurveyTableEntity entity = new SurveyTableEntity(SID);
                        if (entity.State == (int)CommonEnum.SurveyState.HasCreated)
                        {
                            entity.State = (int)CommonEnum.SurveyState.NotCreate;

                            new SurveyTableRule().Update(entity);
                            num++;
                        }

                        if (num > 0)
                        {
                            PageHelper.ShowMessage("所选问卷成功撤销发布!");
                        }
                        else
                        {
                            PageHelper.ShowMessage("选中问卷中都无需撤销发布问卷!");
                        }
                    }
                }
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                break;

            case "Pass":
                for (int i = 0; i < grid.Rows.Count; i++)
                {
                    CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                    long     SID     = Business.Helper.ConvertHelper.ConvertLong(grid.DataKeys[i]["SID"]);
                    if (chkItem != null && chkItem.Checked == true)
                    {
                        count++;
                        if (Business.Helper.ConvertHelper.ConvertInt(grid.DataKeys[i]["ApprovalStaus"]) == (int)CommonEnum.SurveyApprovalStaus.Waiting)
                        {
                            new SurveyManage_Layer().GetUserType(SID.ToString(), "1");
                            num++;
                        }

                        if (num > 0)
                        {
                            PageHelper.ShowMessage("所选问卷成功审批通过!");
                        }
                        else
                        {
                            PageHelper.ShowMessage("选中问卷中都无需审批!");
                        }
                    }
                }
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                break;

            case "Invalid":
                for (int i = 0; i < grid.Rows.Count; i++)
                {
                    CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                    long     SID     = Business.Helper.ConvertHelper.ConvertLong(grid.DataKeys[i]["SID"]);
                    if (chkItem != null && chkItem.Checked == true)
                    {
                        count++;
                        if (Business.Helper.ConvertHelper.ConvertInt(grid.DataKeys[i]["ApprovalStaus"]) == (int)CommonEnum.SurveyApprovalStaus.Waiting)
                        {
                            new SurveyManage_Layer().GetUserType(SID.ToString(), "2");
                            num++;
                        }

                        if (num > 0)
                        {
                            PageHelper.ShowMessage("所选问卷成功审批退回!");
                        }
                        else
                        {
                            PageHelper.ShowMessage("选中问卷中都无需审批!");
                        }
                    }
                }
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                break;

            case "ReInput":
                for (int i = 0; i < grid.Rows.Count; i++)
                {
                    CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                    long     SID     = Business.Helper.ConvertHelper.ConvertLong(grid.DataKeys[i]["SID"]);
                    if (chkItem != null && chkItem.Checked == true)
                    {
                        count++;
                        if (Business.Helper.ConvertHelper.ConvertInt(grid.DataKeys[i]["ApprovalStaus"]) == (int)CommonEnum.SurveyApprovalStaus.Back)
                        {
                            new SurveyManage_Layer().GetUserType(SID.ToString(), "0");
                            num++;
                        }

                        if (num > 0)
                        {
                            PageHelper.ShowMessage("所选问卷成功重新提交审批!");
                        }
                        else
                        {
                            PageHelper.ShowMessage("选中问卷中都无需重新提交审批!");
                        }
                    }
                }
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                break;
            }
        }