123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Text;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using DevExpress.XtraEditors;
- using Uninpho.DBOperation.Model;
- using Uninpho.DBOperation.Operation;
- namespace Uninpho.Tools.components.TZFunc
- {
- public partial class GJInform : DevExpress.XtraEditors.XtraUserControl
- {
- public GJInform()
- {
- InitializeComponent();
- //data_binding();
- }
- /// <summary>
- /// 显示序号。
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
- {
- if (e.Info.Kind == DevExpress.Utils.Drawing.IndicatorKind.Header)
- {
- e.Appearance.DrawBackground(e.Cache, e.Bounds);
- e.Appearance.DrawString(e.Cache, " 序号", e.Bounds);
- e.Handled = true;
- }
- if (e.Info.IsRowIndicator && e.RowHandle >= 0)
- {
- e.Info.DisplayText = (e.RowHandle + 1).ToString();
-
- }
- }
- public void data_binding()
- {
- List<T_guanjie_account> guanjieList = SqlQueryable_QX.Search_GJ();
- this.gridControl_GJ.DataSource = guanjieList;
- }
- private void deletebtngj_Click(object sender, EventArgs e)
- {
- if (UserInform.userinf.Pow == 0)
- {
- XtraMessageBox.Show("您无权删除数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- var selectRowId = this.gridView1.GetSelectedRows();
- if (selectRowId.Length == 0)
- {
- XtraMessageBox.Show("请选中删除的行", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- else
- {
- if (this.Confirm("是否删除") == DialogResult.OK)
- {
- List<T_guanjie_account> deletelist = new List<T_guanjie_account>();
- foreach (var item in selectRowId)
- {
- deletelist.Add(new T_guanjie_account() { Id = this.gridView1.GetRowCellValue(item, "Id").ToString() });
- }
- SqlQueryable_QX.GJDeleteRows(deletelist);
- XtraMessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.data_binding();
- }
- else
- {
- return;
- }
- }
- }
- }
- //弹出提示况
- public DialogResult Confirm(string strString)
- {
- return DevExpress.XtraEditors.XtraMessageBox.Show(strString, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- }
- private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
- {
- if (e.Value == null || e.Value == "")
- {
- XtraMessageBox.Show("请勿填写空值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- T_guanjie_account rowdata = this.gridView1.GetRow(e.RowHandle) as T_guanjie_account;
- SqlQueryable_QX.GJUpdataRowData(rowdata);
- }
- }
- }
|