Пример #1
0
        /// <summary>
        /// 点击撤销按钮触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button_revoke_onclick(object sender, EventArgs e)
        {
            int num  = 0;
            int rows = GridView1.Rows.Count;

            if (rows > 0)
            {
                for (int i = 0; i < rows; i++)
                {
                    CheckBox cb = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox_choose");
                    if (cb.Checked)
                    {
                        num = num + 1;
                    }
                }

                if (num == 0)
                {
                    tag.Text = "撤销时最少选择一条数据!";
                }
                else
                {
                    tag.Text = "";
                    for (int j = 0; j < rows; j++)
                    {
                        CheckBox    cb1 = (CheckBox)GridView1.Rows[j].Cells[0].FindControl("CheckBox_choose");
                        HiddenField hid = (HiddenField)GridView1.Rows[j].Cells[0].FindControl("Hid_ID");

                        if (cb1.Checked && cb1.Enabled)
                        {
                            //获取业务的基本信息
                            apply_model = apply_bll.GetModel(int.Parse(hid.Value.ToString()));
                            //将删除标记设为1
                            //apply_model.DELFLAG = 1;

                            //将状态调为不通过
                            apply_model.Status = 2;

                            //申请类型
                            string applytype = apply_model.AppType;

                            string tablename = "";
                            string typeflag  = "";

                            if (applytype.Equals("orderFood"))
                            {
                                tablename = "Project_Apply_orderFood";
                                typeflag  = "订饭申请";
                            }
                            else if (applytype.Equals("orderCar"))
                            {
                                tablename = "Project_Apply_orderCar";
                                typeflag  = "订车申请";
                            }
                            else if (applytype.Equals("orderRoom"))
                            {
                                tablename = "Project_Apply_orderRoom";
                                typeflag  = "订会议室申请";
                            }
                            else if (applytype.Equals("orderSignet"))
                            {
                                tablename = "Project_Apply_signet";
                                typeflag  = "印章申请";
                            }

                            // string sql = " DELETE FROM " + tablename + " WHERE ApplyID = " + hid.Value.ToString();

                            apply_bll.Update(apply_model);

                            // pageControl.doSql(sql);


                            //添加操作日志
                            Model.USER_Users              user_model    = (Model.USER_Users)Session["USER_Users"];
                            Dianda.BLL.SYS_LogsExt        bsyslog       = new Dianda.BLL.SYS_LogsExt();
                            Dianda.Model.Project_Projects project_model = new Dianda.Model.Project_Projects();
                            Dianda.BLL.Project_Projects   project_bll   = new Dianda.BLL.Project_Projects();

                            project_model = project_bll.GetModel(Convert.ToInt16(Session["Work_ProjectId"]));
                            bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "业务申请撤销", project_model.NAMES + "项目" + typeflag + "撤销:成功!");
                            //添加操作日志
                        }
                    }

                    //string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manage.aspx?pageindex=" + pageindexHidden.Value.ToString() + "&status=" + DDL_status.SelectedValue.ToString() + "\";</script>";
                    //Response.Write(coutws);

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?pageindex=" + pageindexHidden.Value.ToString() + "&type=" + DDL_type.SelectedValue + "&status=" + DDL_status.SelectedValue.ToString() + "';</script>", false);
                }
            }
        }