123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- 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.Operation;
- using Uninpho.DBOperation.Model;
- namespace Uninpho.Tools.components.TZFunc
- {
- public partial class DCInform : DevExpress.XtraEditors.XtraUserControl
- {
- public DCInform()
- {
- 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();
- e.Appearance.DrawString(e.Cache, " 序号", e.Bounds);
- }
- }
- public void data_binding()
- {
- //Console.WriteLine("lll");
- List<T_daocha_account> daochaList = SqlQueryable_QX.Search_DC();
- this.gridControl_DC.DataSource = daochaList;
- }
- private void panelControl2_Paint(object sender, PaintEventArgs e)
- {
- }
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void deletebtn_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_daocha_account> deletelist = new List<T_daocha_account>();
- foreach (var item in selectRowId)
- {
- deletelist.Add(new T_daocha_account() { Id = this.gridView1.GetRowCellValue(item, "Id").ToString() });
- }
- SqlQueryable_QX.DCDeleteRows(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_daocha_account rowdata = this.gridView1.GetRow(e.RowHandle) as T_daocha_account;
- SqlQueryable_QX.DCUpdataRowData(rowdata);
- }
- }
- }
|