lg
2024-09-22 c115ac388af5a6928716f0146a75a2a42fb27d8e
DevApp/Gs.DevApp/DevFrm/User/User.cs
@@ -1,13 +1,10 @@
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using Gs.DevApp.Models;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.User
@@ -23,10 +20,26 @@
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            this.toolBarMenu1.btnReportClick += ToolBarMenu1_btnReportClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            getPageList(1, UtilityHelper.GetPageSize());
            gridView1.IndicatorWidth = 50;
            gridView1.CustomDrawRowIndicator += (s, e) =>
            {
                if (e.Info.IsRowIndicator && e.RowHandle >= 0)
                {
                    e.Info.DisplayText = (e.RowHandle + 1).ToString();
                }
            };
        }
        private void ToolBarMenu1_btnReportClick(object sender, EventArgs e)
        {
            Rpt.RptPreview frm = new Rpt.RptPreview("001");
            frm.Show();
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
@@ -72,6 +85,27 @@
        {
            getPageList(curPage, pageSize);
        }
        /// <summary>
        /// 查询事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
        {
            Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns);
            frm.UpdateParent += Frm_UpdateParent;
            frm.ShowDialog();
        }
        /// <summary>
        /// 查询回调
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Frm_UpdateParent(object sender, UpdateParentEventArgs e)
        {
            string strWhere = e.Data;
            MessageBox.Show(strWhere);
        }
        /// <summary>
        /// 取消事件
@@ -80,7 +114,7 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
        {
            UtilityHelper.ChangeTab(xtraTabControl1, 0);
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
        }
        /// <summary>
@@ -90,26 +124,26 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            DataRow dr = gridView1.GetFocusedDataRow();
            if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString()))
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_userName, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + dr["userName"].ToString() + "】,确定删除吗?"))
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
                return;
            var _obj = new
            {
                guidList = dr["guid"].ToString(),//主建
                guidList = rowGuid,//主建
            };
            string strJson = "";
            try
            {
                strJson = UtilityHelper.HttpPost("", "User/DeleteModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
                string strJson = UtilityHelper.HttpPost("", "User/DeleteModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.ChangeTab(xtraTabControl1, 0);
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    getPageList(1, UtilityHelper.GetPageSize());
                }
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
@@ -127,7 +161,7 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            UtilityHelper.ChangeTab(xtraTabControl1, 0);
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            getPageList(1, UtilityHelper.GetPageSize());
        }
        /// <summary>
@@ -137,13 +171,14 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
        {
            DataRow dr = gridView1.GetFocusedDataRow();
            if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString()))
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_userName, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            getModel(dr["guid"].ToString(), true, 1);
            getModel(rowGuid, true, 1);
        }
        /// <summary>
        /// 新增事件
@@ -152,9 +187,9 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
        {
            UtilityHelper.ChangeTab(xtraTabControl1, 1);
            UtilityHelper.JumpToTab(xtraTabControl1, 1);
            lbGuid.Text = "";
            UtilityHelper.CleanValue(this.panel1.Controls, true);
            UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
            txt_password.Visible = lbPwd.Visible = true;
        }
        /// <summary>
@@ -183,10 +218,10 @@
                txt_userName.Focus();
                return;
            }
            if (txt_isLocked.SelectedIndex <= 0)
            if (txt_isStatus.SelectedIndex <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("状态不能为空!");
                txt_isLocked.Focus();
                txt_isStatus.Focus();
                return;
            }
            var _obj = new
@@ -198,7 +233,7 @@
                address = txt_address.Text.Trim(),
                tel = txt_tel.Text.Trim(),
                email = txt_email.Text.Trim(),
                isLocked = txt_isLocked.SelectedIndex,
                isStatus = txt_isStatus.SelectedIndex,
                flagAdmin = 0,
                flagOnline = 0,
                loginCounter = 0,
@@ -210,13 +245,13 @@
            try
            {
                string strJson = UtilityHelper.HttpPost("", "User/EditModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData;
                    toolBarMenu1.isSetBtn = true;
                    UtilityHelper.ChangeEnable(this.panel1.Controls, false);
                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
                }
            }
            catch (Exception ex)
@@ -232,12 +267,12 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage, int pageSize)
        {
            Models.PageQueryModel pgq = new Models.PageQueryModel(curPage, pageSize, "createTime", "asc", "", "");
            PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "edtTime", "asc", "", "");
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
                string strReturn = UtilityHelper.HttpPost("", "User/GetListPage", json);
                ReturnModel<PageListModel> dd = UtilityHelper.GetTableByJson(strReturn);
                ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
                DataTable dt = dd.rtnData.list;
                gcMain.BindingContext = new BindingContext();
                gcMain.DataSource = dt;
@@ -261,7 +296,7 @@
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            UtilityHelper.ChangeTab(xtraTabControl1, tabIdx);
            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
            var _obj = new
            {
                guid = strGuid,//主建
@@ -269,7 +304,7 @@
            try
            {
                string strJson = UtilityHelper.HttpPost("", "User/GetModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson);
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;