Example #1
0
        void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            DataRow dr = gridView1.GetDataRow(e.RowHandle);

            drDel = dr;
            //EventArgs
            //DXMessageBox.btnCancelClick = (object sender,EventArgs e) => { };
            if (e.Column.Name == "del")
            {
                if (dr["del"].ToString() == "---")
                {
                    return;
                }
                DXMessageBox.btnOKClick += DXMessageBox_btnOKClick;
                DXMessageBox.ShowQuestion("确定要删除吗?");
            }
            else if (e.Column.Name == "look_report")
            {
                FrmNewRepor frmReport = new FrmNewRepor();
                frmReport.inidata();

                frmReport.initPersonData(dr);

                frmReport.ShowDialog();
                frmReport.Dispose();
            }
            else if (e.Column.Name == "user_times")
            {
                GetItemData(dr);
            }
            else if (e.Column.Name == "lookImg")
            {
                //if(filename)
                FrmUp frmUpImg = new FrmUp(dr);
                frmUpImg.Enabled = true;
                frmUpImg.ShowDialog();
                frmUpImg.Dispose();
            }
            else if (e.Column.Name == "lookold")
            {
                FrmUpImg frmUpImg = new FrmUpImg(dr, true);
                frmUpImg.Enabled = true;
                frmUpImg.ShowDialog();
                frmUpImg.Dispose();

                //if(filename)
            }
        }
        void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            DataRow dr = gridView1.GetDataRow(e.RowHandle);

            if (e.Column.Name == "del")
            {
                string isRisk = dr["isrisk"].ToString();
                if (isRisk == "已评估")
                {
                    DXMessageBox.Show("已评估问卷不能删除!", MessageIcon.Info, MessageButton.OK);
                }
                else
                {
                    DialogResult dgResult = DXMessageBox.ShowQuestion("确定要删除吗?");
                    if (dgResult == DialogResult.OK)
                    {
                        ////此处写你的删除方法
                        string user_idstr = dr.GetDataRowStringValue("user_id");
                        int    user_times = dr.GetDataRowIntValue("user_times");
                        bool   isdel      = TmoServiceClient.InvokeServerMethodT <bool>(funCode.DeleteQuestionnaires, user_idstr, user_times);
                        if (isdel)
                        {
                            DXMessageBox.Show("删除成功!", true);
                            GetData();
                        }
                        else
                        {
                            DXMessageBox.ShowError("删除失败!", this);
                        }
                    }
                }
            }
            else if (e.Column.Name == "look_report")
            {
                //浏览问卷
                Userinfo user = new Userinfo();
                user.user_times = dr.GetDataRowIntValue("user_times");
                user.user_id    = dr.GetDataRowStringValue("user_id");
                user.name       = dr.GetDataRowStringValue("name");
                user.gender     = dr.GetDataRowStringValue("gender") == "男" ? 1 : 2;
                UCQuestionnaire questionnaire = new UCQuestionnaire(user);
                questionnaire.ShowDialog(this);
                questionnaire.Dispose();
                GetData();
            }
            else if (e.Column.Name == "lookImg")
            {
                //if(filename)
                FrmUp frmUpImg = new FrmUp(dr);
                frmUpImg.Enabled = true;
                frmUpImg.ShowDialog();
                frmUpImg.Dispose();
            }
            else if (e.Column.Name == "lookold")
            {
                FrmUpImg frmUpImg = new FrmUpImg(dr, true);
                frmUpImg.Enabled = true;
                frmUpImg.ShowDialog();
                frmUpImg.Dispose();


                //if(filename)
            }
        }