Example #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;
            }
        }
Example #2
0
        /// <summary>
        /// 获得调查问卷信息
        /// </summary>
        private DataSet GetData(string SID)
        {
            DataSet ds = new AnswerManager_Layer().GetAnswerInfoBySID(SID, AnswerName, MinAnswerRecord, MaxAnswerRecord, MinUseTime, MaxUseTime, ApprovalStaus, BeginDate, viewpage1.CurrentPageIndex, viewpage1.PageSize, EndDate);

            return(ds);
        }
Example #3
0
        /// <summary>
        /// toolbar事件
        /// 作者:姚东
        /// 时间:20100919
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void toolbar_MenuItemClick(object sender, MenuEventArgs e)
        {
            int    count         = 0;
            int    num           = 0;
            string AnswerGuid    = "";
            string ApprovalStaus = "0";
            string par           = "";
            string SID;
            string UID            = "";
            string AnswerUserKind = "";

            SID = (Request.QueryString["SID"]).ToString();
            switch (e.Item.Value)
            {
            case "Delete":
                for (int i = 0; i < grid.Rows.Count; i++)
                {
                    CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                    if (chkItem != null && chkItem.Checked == true)
                    {
                        count++;
                        AnswerGuid = ConvertString(grid.DataKeys[i]["AnswerGUID"]);
                        //new AnswerManager_Layer().DeleteAnswer(AnswerGuid);
                        int ReturnNum = new AnswerManager_Layer().SetApprovalStaus("3", AnswerGuid);
                        new AnswerManager_Layer().UpdateAnswerNum(ReturnNum, ID.ToString());

                        num++;
                    }
                }
                new AnswerManager_Layer().UpdateAnswerNum(num, SID);
                if (count == this.grid.Rows.Count)
                {
                    viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                }
                BindGridView();
                PageHelper.ShowMessage("删除成功!");
                break;

            case "Pass":
                num = 0;
                try
                {
                    par = ConvertString(new AnswerManager_Layer().GetSparBySID(SID).Rows[0]["Par"]);
                }
                catch (Exception ex)
                {
                }

                if (par.IndexOf("|NeedConfirm:1") > 0)
                {
                    for (int i = 0; i < grid.Rows.Count; i++)
                    {
                        UID            = ConvertString(grid.DataKeys[i]["UID"]);
                        AnswerUserKind = ConvertString(grid.DataKeys[i]["AnswerUserKind"]);
                        CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                        if (chkItem != null && chkItem.Checked == true)
                        {
                            count++;
                            AnswerGuid    = ConvertString(grid.DataKeys[i]["AnswerGUID"]);
                            ApprovalStaus = ConvertString(grid.DataKeys[i]["ApprovalStaus"]);
                            if (ApprovalStaus == "0")
                            {
                                new AnswerManager_Layer().SetApprovalStaus("1", AnswerGuid);
                                if (AnswerUserKind != "1" && AnswerUserKind != "2")
                                {
                                    string TabelName = null;
                                    string UserGuid  = null; //会员GUID
                                    string prefix    = new Survey_ss_Layer().prefix;
                                    int    integral  = 0;    //积分
                                    UserGuid = ConvertString(new Survey_ss_Layer().GetUserGUID(UID.ToString()).Rows[0]["id"]);
                                    integral = int.Parse(ConvertString(new Survey_ss_Layer().GetSIntegral(SID).Rows[0]["Point"]));
                                    string        sqlUpdatePoint = "";
                                    SqlDataReader dr             = new Survey_ss_Layer().GetHuiYuan_Point(UserGuid);


                                    TabelName = " " + prefix + "HuiYuan_Point ";

                                    if (!dr.Read())
                                    {
                                        sqlUpdatePoint = "Insert into" + TabelName + "(HuiYuanGuid,TotalPoint,RemainPoint,Status) values(@HuiYuanGuid,@integral,@integral,1)";
                                    }
                                    else
                                    {
                                        sqlUpdatePoint = "Update" + TabelName + "set TotalPoint=TotalPoint+@integral,RemainPoint=RemainPoint+@integral where HuiYuanGuid=@HuiYuanGuid";
                                    }

                                    SqlParameter[] parameters = new SqlParameter[2];
                                    parameters[0] = new SqlParameter("@integral", integral);
                                    parameters[1] = new SqlParameter("@HuiYuanGuid", UserGuid);

                                    new AnswerManager_Layer().ExcuteSql(sqlUpdatePoint, parameters);
                                }
                                num++;
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }
                    if (count == this.grid.Rows.Count)
                    {
                        viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                    }
                    BindGridView();
                    if (num == 0)
                    {
                        PageHelper.ShowMessage("所选项目不可审核!");
                    }
                    else
                    {
                        PageHelper.ShowMessage("审批通过成功!");
                    }
                }
                else
                {
                    if (count == this.grid.Rows.Count)
                    {
                        viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                    }
                    BindGridView();

                    PageHelper.ShowMessage("此份问卷答卷无需审批!");
                }

                break;

            case "Invalid":
                num        = 0;
                AnswerGuid = "";
                try
                {
                    par = ConvertString(new AnswerManager_Layer().GetSparBySID(SID).Rows[0]["Par"]);
                }
                catch (Exception ex)
                {
                }

                if (par.IndexOf("|NeedConfirm:1") > 0)
                {
                    for (int i = 0; i < grid.Rows.Count; i++)
                    {
                        CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                        if (chkItem != null && chkItem.Checked == true)
                        {
                            count++;
                            AnswerGuid    = ConvertString(grid.DataKeys[i]["AnswerGUID"]);
                            ApprovalStaus = ConvertString(grid.DataKeys[i]["ApprovalStaus"]);

                            if (ApprovalStaus == "0")
                            {
                                int ReturnNum = new AnswerManager_Layer().SetApprovalStaus("2", AnswerGuid);
                                new AnswerManager_Layer().UpdateAnswerNum(ReturnNum, ID.ToString());
                                num++;
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }
                    if (count == this.grid.Rows.Count)
                    {
                        viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                    }
                    BindGridView();

                    if (num == 0)
                    {
                        PageHelper.ShowMessage("所选项目不可审核!");
                    }
                    else
                    {
                        PageHelper.ShowMessage("审批作废成功!");
                    }
                }
                else
                {
                    if (count == this.grid.Rows.Count)
                    {
                        viewpage1.CurrentPageIndex = viewpage1.CurrentPageIndex == 1 ? 1 : viewpage1.CurrentPageIndex - 1;
                    }
                    BindGridView();

                    PageHelper.ShowMessage("此份问卷答卷无需审批!");
                }
                break;
            }
        }