//删除 private void BtnDel_BtnClick(object sender, EventArgs e) { var result = FrmDialog.ShowDialog(this, "确定删除选择的记录?", "删除记录", true); if (result == DialogResult.OK) { var rows = DataGrid.SelectRows; if (rows != null) { var ids = string.Empty; rows.ForEach(p => ids += $"{((AssetsInformation)((UCDataGridViewRow)p).DataSource).id},"); ids = ids.TrimEnd(','); using (var db = new AssetsInformationDB(dbPath)) { db.Query <AssetsInformation>($"delete from assetsinformation where id in ({ids})"); } GetList(); //rows.ForEach(p => //{ // if (!string.IsNullOrWhiteSpace(((AssetsInformation)((UCDataGridViewRow)p).DataSource).QdPath)) // { // if (File.Exists(((AssetsInformation)((UCDataGridViewRow)p).DataSource).QdPath)) // { // FileHelper.FileDel(((AssetsInformation)((UCDataGridViewRow)p).DataSource).QdPath); // } // } //}); FrmTips.ShowTips(this, $"删除成功!", 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(200, 80), TipsState.Success); } } }
//生成二维码 private void BtnCreateQr_BtnClick(object sender, EventArgs e) { var rows = DataGrid.SelectRows; if (rows != null) { var ids = string.Empty; rows.ForEach(p => ids += $"{((AssetsInformation)((UCDataGridViewRow)p).DataSource).id},"); ids = ids.TrimEnd(','); using (var db = new AssetsInformationDB(dbPath)) { var list = db.Query <AssetsInformation>($"select * from assetsinformation where id in ({ids})"); if (list != null && list.Any()) { foreach (var item in list) { item.QdPath = QRCodeHelper.CreateQRCodeImage(new QRCodeMsg() { Content = $"资产编码:{item.AssetCode}\r\n资产名称:{item.AssetName}\r\n资产类型:{item.AssetModel}\r\n管理部门:{item.ManagementDepartment}\r\n使用部门:{item.UseDepartment}\r\n使用状态:{item.UseState}\r\n使用年限:{item.UseDate}\r\n使用地点:{item.UsePlace}\r\n安装日期:{item.InstallationDate}", ImageName = $"{item.AssetCode}{DateTime.Now.ToLongDateString()}{DateTime.Now.Hour}{DateTime.Now.Minute}{DateTime.Now.Second}", FilePath = $"{Environment.CurrentDirectory}" }); } db.UpdateAll(list); } } FrmTips.ShowTips(this, $"二维码生成成功!", 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(200, 80), TipsState.Success); GetList(); } }
private void btnSearch_Click(object sender, EventArgs e) { List <Role> list = null; ControlHelper.ThreadRunExt(AppHelper.MainForm, () => { var succ = true; var msg = ""; try { ResponseModel responseModel = new ResponseModel(); RbacApi rbac = new RbacApi(); responseModel = rbac.GetRoles(); if (responseModel.Code == 1) { if (responseModel.DataCount > 0) { list = JsonConvert.DeserializeObject <List <Role> >(responseModel?.Data?.ToString()); ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { if (list != null) { CGridHelper.ClearGrid(dgv); CGridHelper.FillGrid <Role>(dgv, list); } }); } else { succ = false; msg = "查询数据为空!"; } } else { succ = false; msg = responseModel?.Message; } } catch (Exception ex) { succ = false; msg = ex.Message; } if (!succ) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { FrmTips.ShowTips(AppHelper.MainForm, msg, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error); }); } }, null, AppHelper.MainForm, true, "正在查询……", 200); }
private void btnSave_Click(object sender, EventArgs e) { settingFiller.FillEntity(AppHelper.DbSetting); File.WriteAllText(AppHelper.DbConfigFile, JsonConvert.SerializeObject(AppHelper.DbSetting, Formatting.Indented)); FrmTips.ShowTips(AppHelper.MainForm, "保存成功", 1000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 50), TipsState.Success); MssqlHelper.GetInstance().Init(AppHelper.DbSetting.DataBaseServer, AppHelper.DbSetting.DataBaseName, AppHelper.DbSetting.DataBaseUser, AppHelper.DbSetting.DataBasePwd); }
//导入 private void BtnImport_BtnClick(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Filter = "Excel表格|*.xlsx"; fileDialog.CheckFileExists = true; if (fileDialog.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(fileDialog.FileName)) { //获取excel文件 var file = new System.IO.FileInfo(fileDialog.FileName); System.Data.DataTable dt = null; using (var package = new ExcelPackage(file)) { //获取workbook ExcelWorkbook workbook = package.Workbook; if (workbook != null) { if (workbook.Worksheets.Count > 0) { //获取workbook的第一个worksheet ExcelWorksheet worksheet = workbook.Worksheets[1]; //将worksheet转成datatable dt = Common.ExcelHelper.WorksheetToTable(worksheet); if (dt != null && dt.Rows.Count > 0) { List <AssetsInformation> list = new List <AssetsInformation>(); foreach (DataRow row in dt.Rows) { AssetsInformation entity = new AssetsInformation(); entity.AssetName = row["资产名称"]?.ToString(); entity.AssetCode = row["资产编码"]?.ToString(); entity.AssetModel = row["资产型号"]?.ToString(); entity.ManagementDepartment = row["管理部门"]?.ToString(); entity.UseDepartment = row["使用部门"]?.ToString(); entity.UseState = row["使用状态"]?.ToString(); entity.UseDate = row["使用年限"]?.ToString(); entity.UsePlace = row["使用地点"]?.ToString(); entity.InstallationDate = Convert.ToDateTime(row["安装日期"]?.ToString()).ToLongDateString(); entity.QdPath = $"{Environment.CurrentDirectory}\\NoBackPic.png"; list.Add(entity); } using (var db = new AssetsInformationDB(dbPath)) { int count = db.InsertAll(list); var source = db.Query <AssetsInformation>("select * from assetsinformation"); FrmTips.ShowTips(this, $"导入{count}条记录", 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(300, 100), TipsState.Success); } GetList(); } } } } } }
public static void Error(string msg) { _logHelper.Error(msg); if (AppHelper.MainForm != null) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { //Size size = new Size(300,900); FrmTips.ShowTips(AppHelper.MainForm, msg, 5 * 1000, true, System.Drawing.ContentAlignment.BottomRight, null, TipsSizeMode.Large, null, TipsState.Error); }); } }
private void UcSwitch1_CheckedChanged(object sender, EventArgs e) { uint k = Convert.ToUInt32(ucSwitch1.Checked); int i = NGIDevice.WriteUint(2, k); if (k == 1) { if (i != 1) { FrmTips.ShowTips(this.ParentForm, "输出失败", 3000, false, ContentAlignment.BottomCenter, null, TipsSizeMode.Large, null, TipsState.Error); ucSwitch1.Checked = false; } } }
private void UcSwitch2_CheckedChanged(object sender, EventArgs e) { if (ucSwitch2.Checked) { if (!OpenLink()) { FrmTips.ShowTips(this.ParentForm, "连接失败", 3000, false, ContentAlignment.BottomCenter, null, TipsSizeMode.Large, null, TipsState.Error); ucSwitch2.Checked = false; } } else { NGIDevice.close(); } }
//查看日志 private void BtnLog_BtnClick(object sender, EventArgs e) { var row = DataGrid.SelectRows; if (row == null || row.Count == 0 || row.Count > 1) { FrmTips.ShowTips(this, "请选择单条记录!", 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(150, 80), TipsState.Warning); } else { FormLog fLog = new FormLog(); var source = (AssetsInformation)((UCDataGridViewRow)row[0]).DataSource; fLog.Code = source.AssetCode; fLog.ShowDialog(); } }
//修改 private void BtnEdit_BtnClick(object sender, EventArgs e) { var row = DataGrid.SelectRows; if (row == null || row.Count == 0 || row.Count > 1) { FrmTips.ShowTips(this, "请选择单条记录进行修改!", 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(150, 80), TipsState.Warning); } else { FormEdit formEdit = new FormEdit(); var source = (AssetsInformation)((UCDataGridViewRow)row[0]).DataSource; formEdit.Item = source; formEdit.RefreshActionn = () => { GetList(); }; formEdit.ShowDialog(); } }
private static void ShowBalloonTipText(string str) { //使用 HZHControls 插件弹出气泡 FrmTips.ShowTips(Form.ActiveForm, str, 4000, true, ContentAlignment.BottomRight, null, TipsSizeMode.Medium, null, TipsState.Success); //声音提示 soundMessage.Play(); //Windows 系统提示音 //SystemSounds.Asterisk.Play(); //SystemSounds.Beep.Play(); //SystemSounds.Exclamation.Play(); //SystemSounds.Hand.Play(); //SystemSounds.Question.Play(); // Windows 自带的消息气泡显示方法一 //notifyIcon_360.BalloonTipText = str; //notifyIcon_360.ShowBalloonTip(2000); // Windows 自带的消息气泡显示方法二 //notifyIcon_360.ShowBalloonTip(2000, "提示", str, ToolTipIcon.Warning); //notifyIcon_360bug.ShowBalloonTip(2000, "提示", str, new ToolTipIcon()); }
private void btnPrint_Click(object sender, EventArgs e) { ControlHelper.ThreadRunExt(AppHelper.MainForm, () => { try { ChargeRecord chargeRecord = new ChargeRecord(); chargeFiller.FillEntity(chargeRecord); chargeRecord.DateOfCharge = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); chargeRecord.ChagreUser = AppHelper.UserName; List <ChargeDetail> details = GetChargeDetails(chargeRecord.PlateNo, chargeRecord.TestNo, out string testItem); PrintTickets printTickets = new PrintTickets(chargeRecord, details); printTickets.Print(); } catch (Exception ex) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { FrmTips.ShowTips(AppHelper.MainForm, $"打印异常{ex.Message}", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error); }); } }, null, AppHelper.MainForm, true, "正在打印……", 200); }
private void btnSearch_Click(object sender, EventArgs e) { List <ConstantDefine> list = null; ControlHelper.ThreadRunExt(this, () => { try { Hashtable hashtable = null; string sql = "SELECT * FROM NetTypeDefine WHERE 1=1 "; if (!string.IsNullOrEmpty(txtSeachPlateNo.Text.Trim())) { hashtable = new Hashtable(); hashtable.Add("DefineType", "%" + txtSeachPlateNo.Text.Trim() + "%"); sql += " AND DefineType like @DefineType"; } list = _mssqlHelper.QueryList <ConstantDefine>(sql, hashtable).ToList(); ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { if (list != null) { CGridHelper.ClearGrid(dgv); CGridHelper.FillGrid <ConstantDefine>(dgv, list); } }); } catch (Exception ex) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { FrmTips.ShowTips(AppHelper.MainForm, ex.Message, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error); }); } }, null, AppHelper.MainForm, true, "正在查询……", 200); }
private void tvMenu_AfterSelect(object sender, TreeViewEventArgs e) { panControl.Controls.Clear(); string strName = e.Node.Text.Trim(); this.Title = "HZHControls控件库DEMO--" + strName; switch (strName) { case "关于授权": AddControl(new UCShouQuan()); break; #region 窗体 English:forms case "提示窗体": if (FrmDialog.ShowDialog(this, "是否再显示一个没有取消按钮的提示框?", "模式窗体测试", true) == System.Windows.Forms.DialogResult.OK) { FrmDialog.ShowDialog(this, "这是一个没有取消按钮的提示框", "模式窗体测试"); } break; case "多输入窗体": FrmInputs frm = new FrmInputs("动态多输入窗体测试", new string[] { "姓名", "电话", "身份证号", "住址" }, new Dictionary <string, HZH_Controls.TextInputType>() { { "电话", HZH_Controls.TextInputType.Regex }, { "身份证号", HZH_Controls.TextInputType.Regex } }, new Dictionary <string, string>() { { "电话", "^1\\d{0,10}$" }, { "身份证号", "^\\d{0,18}$" } }, new Dictionary <string, KeyBoardType>() { { "电话", KeyBoardType.UCKeyBorderNum }, { "身份证号", KeyBoardType.UCKeyBorderNum } }, new List <string>() { "姓名", "电话", "身份证号" }); frm.ShowDialog(this); break; case "气泡提示窗体": FrmTips.ShowTipsError(this, "Error提示信息"); FrmTips.ShowTipsInfo(this, "Info提示信息"); FrmTips.ShowTipsSuccess(this, "Success提示信息"); FrmTips.ShowTipsWarning(this, "Warning提示信息"); FrmTips.ShowTips(this, "自定义提示信息", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 50), TipsState.Success); break; case "有返回的窗体": new FrmTestFrmBack().ShowDialog(this); break; case "等待窗体": ControlHelper.ThreadRunExt(this, () => { Thread.Sleep(5000); ControlHelper.ThreadInvokerControl(this, () => { FrmTips.ShowTipsSuccess(this, "FrmWaiting测试"); }); }, null, this); break; case "仅有标题的窗体": new FrmWithTitleTest().ShowDialog(this); break; case "确定取消窗体1": new FrmOKCancel1Test().ShowDialog(this); break; case "确定取消窗体2": new FrmOKCancel2Test().ShowDialog(this); break; case "资源加载窗体": FrmTestLoading frmLoading = new FrmTestLoading(); frmLoading.BackgroundWorkAction = delegate() { try { frmLoading.CurrentMsg = new KeyValuePair <int, string>(1, "正在初始化配置..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(10, "正在加载第一个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(20, "正在加载第二个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(30, "正在加载第三个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(40, "正在加载第四个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(50, "正在加载第五个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(60, "正在加载第六个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(70, "正在加载第七个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(80, "正在加载第八个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(90, "正在加载第九个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(1000, "数据加载完成..."); Thread.Sleep(1000); } catch (Exception ex) { MessageBox.Show("加载资源时出现错误"); } }; frmLoading.ShowDialog(); break; #endregion #region 控件 English:control case "表单控件": AddControl(new UC.UCTestForms()); break; case "按钮": AddControl(new UC.UCTestBtns()); break; case "选项卡": AddControl(new UC.UCTestTab()); break; case "树": AddControl(new UC.UCTestTreeview() { Dock = DockStyle.Left }); break; case "列表": AddControl(new UC.UCTestList() { Dock = DockStyle.Left }); break; case "平铺列表": AddControl(new UC.UCTestListView() { Dock = DockStyle.Fill }); break; case "垂直导航": AddControl(new UC.UCTestMenu() { Dock = DockStyle.Left }); break; case "横向列表": AddControl(new UC.UCTestHorizontalList()); break; case "分页控件": AddControl(new UC.UCTestPage()); break; case "表格": AddControl(new UC.UCTestGridTable()); break; case "表格-自定义单元格": AddControl(new UC.UCTestGridTableCustom()); break; case "树表格": AddControl(new UC.UCTestTreeGridTable()); break; case "进度条": AddControl(new UC.UCTestProcess() { Dock = DockStyle.Fill }); break; case "步骤控件": AddControl(new UC.UCTestStep() { Dock = DockStyle.Fill }); break; case "面包屑导航": AddControl(new UC.UCTestNavigation() { Dock = DockStyle.Fill }); break; case "文字提示": AddControl(new UC.UCTestTips() { Dock = DockStyle.Fill }); break; case "滚动文字": AddControl(new UC.UCTestRollText() { Dock = DockStyle.Fill }); break; case "滑块": AddControl(new UC.UCTestTrackbar() { Dock = DockStyle.Fill }); break; case "水波": AddControl(new UC.UCTestWave() { Dock = DockStyle.Fill }); break; case "有标题的面板": AddControl(new UC.UCTestPanelTitle() { Dock = DockStyle.Left }); break; case "图标": AddControl(new UC.UCTestIcon() { Dock = DockStyle.Fill }); break; case "滚动条": AddControl(new UC.UCTestScrollbar() { Dock = DockStyle.Fill }); break; case "控件水印": AddControl(new UC.UCTestGraphicalOverlay()); break; case "表单验证": AddControl(new UC.UCTestVerification() { Dock = DockStyle.Fill }); break; case "图片采样控件": AddControl(new UC.UCTestSampling()); break; case "倒影": AddControl(new UC.UCTestShadow()); break; case "内置颜色": AddControl(new UC.UCTestColors()); break; case "导航菜单": AddControl(new UC.UCTestNavigationMenu()); break; case "扩展导航菜单": AddControl(new UC.UCTestNavigationMenuExt()); break; case "类Office导航菜单": AddControl(new UC.UCTestNavigationMenuOffice()); break; case "分割线标签": AddControl(new UC.UCTestSplitLabel()); break; case "时间轴": AddControl(new UC.UCTestTimeLine() { Dock = DockStyle.Fill }); break; case "穿梭框": AddControl(new UC.UCTestTransfer()); break; case "引用区块": AddControl(new UC.UCTestPanelQuote()); break; case "右键菜单": AddControl(new UC.UCTestContextMenu()); break; #endregion #region 图表 English:Chart case "组织结构图": AddControl(new UC.UCTestMindMapping() { Dock = DockStyle.Fill }); break; case "滚动图表": AddControl(new UC.UCTestWaveChart() { Dock = DockStyle.Fill }); break; case "雷达图": AddControl(new UC.UCTestRadarChart() { Dock = DockStyle.Fill }); break; case "金字塔图": AddControl(new UC.UCTestFunnelChart()); break; case "Live Charts": AddControl(new UC.UCTestLiveCharts()); break; #endregion #region 工业 English:Industry case "LED文字": AddControl(new UC.UCTestLED() { Dock = DockStyle.Fill }); break; case "仪表": AddControl(new UC.UCTestMeter()); break; case "管道": AddControl(new UC.UCTestConduit()); break; case "阀门": AddControl(new UC.UCTestValve()); break; case "鼓风机": AddControl(new UC.UCTestBlower()); break; case "传送带": AddControl(new UC.UCTestConveyor()); break; case "警示灯": AddControl(new UC.UCTestSignalLamp()); break; case "箭头": AddControl(new UC.UCTestArrow()); break; case "温度计": AddControl(new UC.UCTestThermometer()); break; case "转子": AddControl(new UC.UCTestRotor()); break; case "多通道转盘": AddControl(new UC.UCTestDialAisle()); break; case "转盘": AddControl(new UC.UCTestTurntable()); break; #endregion } }
private void tvMenu_AfterSelect(object sender, TreeViewEventArgs e) { panControl.Controls.Clear(); string strName = e.Node.Text.Trim(); switch (strName) { #region 窗体 English:forms case "提示窗体": if (FrmDialog.ShowDialog(this, "是否再显示一个没有取消按钮的提示框?", "模式窗体测试", true) == System.Windows.Forms.DialogResult.OK) { FrmDialog.ShowDialog(this, "这是一个没有取消按钮的提示框", "模式窗体测试"); } break; case "多输入窗体": FrmInputs frm = new FrmInputs("动态多输入窗体测试", new string[] { "姓名", "电话", "身份证号", "住址" }, new Dictionary <string, HZH_Controls.TextInputType>() { { "电话", HZH_Controls.TextInputType.Regex }, { "身份证号", HZH_Controls.TextInputType.Regex } }, new Dictionary <string, string>() { { "电话", "^1\\d{0,10}$" }, { "身份证号", "^\\d{0,18}$" } }, new Dictionary <string, KeyBoardType>() { { "电话", KeyBoardType.UCKeyBorderNum }, { "身份证号", KeyBoardType.UCKeyBorderNum } }, new List <string>() { "姓名", "电话", "身份证号" }); frm.ShowDialog(this); break; case "气泡提示窗体": FrmTips.ShowTipsError(this, "Error提示信息"); FrmTips.ShowTipsInfo(this, "Info提示信息"); FrmTips.ShowTipsSuccess(this, "Success提示信息"); FrmTips.ShowTipsWarning(this, "Warning提示信息"); FrmTips.ShowTips(this, "自定义提示信息", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 50), TipsState.Success); break; case "有返回的窗体": new FrmTestFrmBack().ShowDialog(this); break; case "等待窗体": ControlHelper.ThreadRunExt(this, () => { Thread.Sleep(5000); ControlHelper.ThreadInvokerControl(this, () => { FrmTips.ShowTipsSuccess(this, "FrmWaiting测试"); }); }, null, this); break; case "仅有标题的窗体": new FrmWithTitleTest().ShowDialog(this); break; case "确定取消窗体1": new FrmOKCancel1Test().ShowDialog(this); break; case "确定取消窗体2": new FrmOKCancel2Test().ShowDialog(this); break; #endregion #region 控件 English:control case "表单控件": AddControl(new UC.UCTestForms()); break; case "按钮": AddControl(new UC.UCTestBtns()); break; case "选项卡": AddControl(new UC.UCTestTab()); break; case "树": AddControl(new UC.UCTestTreeview() { Dock = DockStyle.Left }); break; case "列表": AddControl(new UC.UCTestList() { Dock = DockStyle.Left }); break; case "平铺列表": AddControl(new UC.UCTestListView() { Dock = DockStyle.Fill }); break; case "垂直导航": AddControl(new UC.UCTestMenu() { Dock = DockStyle.Left }); break; case "横向列表": AddControl(new UC.UCTestHorizontalList()); break; case "分页控件": AddControl(new UC.UCTestPage()); break; case "表格": AddControl(new UC.UCTestGridTable() { Dock = DockStyle.Fill }); break; case "树表格": AddControl(new UC.UCTestTreeGridTable() { Dock = DockStyle.Fill }); break; case "进度条": AddControl(new UC.UCTestProcess() { Dock = DockStyle.Fill }); break; case "步骤控件": AddControl(new UC.UCTestStep() { Dock = DockStyle.Fill }); break; case "面包屑导航": AddControl(new UC.UCTestNavigation() { Dock = DockStyle.Fill }); break; case "文字提示": AddControl(new UC.UCTestTips() { Dock = DockStyle.Fill }); break; case "滚动文字": AddControl(new UC.UCTestRollText() { Dock = DockStyle.Fill }); break; case "滑块": AddControl(new UC.UCTestTrackbar() { Dock = DockStyle.Fill }); break; case "水波": AddControl(new UC.UCTestWave() { Dock = DockStyle.Fill }); break; case "有标题的面板": AddControl(new UC.UCTestPanelTitle() { Dock = DockStyle.Left }); break; case "图标": AddControl(new UC.UCTestIcon() { Dock = DockStyle.Fill }); break; #endregion #region 图表 English:Chart case "组织结构图": AddControl(new UC.UCTestMindMapping() { Dock = DockStyle.Fill }); break; case "柱状图": AddControl(new UC.UCTestBarcharts()); break; case "滚动图表": AddControl(new UC.UCTestWaveChart() { Dock = DockStyle.Fill }); break; #endregion #region 工业 English:Industry case "LED文字": AddControl(new UC.UCTestLED() { Dock = DockStyle.Fill }); break; case "仪表": AddControl(new UC.UCTestMeter()); break; case "管道": AddControl(new UC.UCTestConduit()); break; case "阀门": AddControl(new UC.UCTestValve()); break; case "鼓风机": AddControl(new UC.UCTestBlower()); break; case "传送带": AddControl(new UC.UCTestConveyor()); break; case "警示灯": AddControl(new UC.UCTestSignalLamp()); break; case "箭头": AddControl(new UC.UCTestArrow()); break; case "温度计": AddControl(new UC.UCTestThermometer()); break; #endregion } }
private void btnSearch_Click(object sender, EventArgs e) { List <ConstantType> list = null; ControlHelper.ThreadRunExt(AppHelper.MainForm, () => { var succ = true; var msg = ""; try { ResponseModel responseModel = new ResponseModel(); ConstantApi constantApi = new ConstantApi(); responseModel = constantApi.GetConstantTypes(); //Hashtable hashtable = null; //string sql = "SELECT * FROM ConstantType WHERE 1=1 "; //if (!string.IsNullOrEmpty(txtSeach.Text.Trim())) //{ // hashtable = new Hashtable(); // hashtable.Add("TypeName", "%" + txtSeach.Text.Trim() + "%"); // sql += " AND TypeName like @DefineType"; //} //list = _mssqlHelper.QueryList<ConstantType>(sql, hashtable).ToList(); if (responseModel.Code == 1) { if (responseModel.DataCount > 0) { list = JsonConvert.DeserializeObject <List <ConstantType> >(responseModel?.Data?.ToString()); ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { if (list != null) { CGridHelper.ClearGrid(dgv); CGridHelper.FillGrid <ConstantType>(dgv, list); } }); } else { succ = false; msg = "查询数据为空!"; } //FrmTips.ShowTips(AppHelper.MainForm, "查询数据为空!", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Success); } else { succ = false; msg = responseModel?.Message; } // FrmTips.ShowTips(AppHelper.MainForm,responseModel?.Message, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error); } catch (Exception ex) { succ = false; msg = ex.Message; } if (!succ) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { FrmTips.ShowTips(AppHelper.MainForm, msg, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error); }); } }, null, AppHelper.MainForm, true, "正在查询……", 200); }
protected override void DoEnter() { AssetsInformation model = new AssetsInformation(); var txtAssetName = panel3.Controls.Find("TxtAssetName", true).FirstOrDefault(); if (txtAssetName != null) { model.AssetName = txtAssetName.Text; } var txtAssetCode = panel3.Controls.Find("TxtAssetCode", true).FirstOrDefault(); if (txtAssetCode != null) { model.AssetCode = txtAssetCode.Text; } var txtAssetModel = panel3.Controls.Find("TxtAssetModel", true).FirstOrDefault(); if (txtAssetModel != null) { model.AssetModel = txtAssetModel.Text; } var txtManagementDepartment = panel3.Controls.Find("TxtManagementDepartment", true).FirstOrDefault(); if (txtManagementDepartment != null) { model.ManagementDepartment = txtManagementDepartment.Text; } var txtUseDepartment = panel3.Controls.Find("TxtUseDepartment", true).FirstOrDefault(); if (txtUseDepartment != null) { model.UseDepartment = txtUseDepartment.Text; } var comUseState = panel3.Controls.Find("ComUseState", true).FirstOrDefault(); if (comUseState != null) { model.UseState = ((UCCombox)comUseState).SelectedText; } var txtUseDate = panel3.Controls.Find("TxtUseDate", true).FirstOrDefault(); if (txtUseDate != null) { model.UseDate = txtUseDate.Text; } var txtUsePlace = panel3.Controls.Find("TxtUsePlace", true).FirstOrDefault(); if (txtUsePlace != null) { model.UsePlace = txtUsePlace.Text; } //panel3.Controls.Find("DPInstallationDate", false); using (var db = new AssetsInformationDB(dbPath)) { string msg = string.Empty; if (Item != null) { model.QdPath = $"{Environment.CurrentDirectory}\\NoBackPic.png"; db.Insert(model); msg = $" 新增成功!"; } else { db.Update(model); msg = $" 修改成功!"; } AddLog(model); RefreshActionn(); FrmTips.ShowTips(this, msg, 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(200, 80), TipsState.Success); } this.Close(); }