| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Judge.Commons;
- using Core.StlMes.Client.Judge.Models;
- using Core.StlMes.Client.Judge.ViewModels;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Diagnostics;
- using System.Drawing;
- using System.Drawing.Printing;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Judge.Forms
- {
- public partial class QcmJyEquipment : FrmBase
- {
- /// <summary>
- /// 登入的用户
- /// </summary>
- String username ="";
- public QcmJyEquipment()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- DoQuery();
- break;
- case "Update":
- DoUpdate();
- break;
- case "Delete":
- Delete();
- break;
- case "Add":
- DoAdd();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void DoQuery()
- {
- ultraGrid1.UpdateData();
- ArrayList param = new ArrayList();
- DataTable table = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmJyEquipment.FindEquipmentInfo", new Object[] { param }, ob);
- GridHelper.CopyDataToDatatable(table,this.dataTable1,true);
- //ultraGrid1.DataSource = table;
- }
- private void DoUpdate()
- {
- ultraGrid1.UpdateData();
- ArrayList list1 = new ArrayList();
- String items = "";
- String result = "";
- String eid = "";
- ArrayList pram1 = new ArrayList();
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择修改的数据!");
- return;
- }
- foreach (UltraGridRow ugr in uGrid)
- {
- items = ugr.Cells["ITEMS"].Value.ToString().Trim();
- result = ugr.Cells["RESULT"].Value.ToString().Trim();
- eid = ugr.Cells["EID"].Value.ToString();
- if (items == "") { MessageUtil.ShowTips("设备名称不能为空!"); return; }
- if (result == "") { MessageUtil.ShowTips("设备型号不能为空!"); return; }
- ArrayList list = new ArrayList();
- list.Add(items);
- list.Add(result);
- list.Add(UserInfo.GetUserName());
- list.Add(eid);
- pram1.Add(list);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmJyEquipment";
- ccp.MethodName = "UpdateEquipment";
- ccp.ServerParams = new object[] { pram1 };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- DoQuery();
- }
- }
- }
- private void Delete()
- {
- ultraGrid1.UpdateData();
- ArrayList pram1 = new ArrayList();
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择要删除的数据!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认删除信息?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- foreach (UltraGridRow ugr in uGrid)
- {
- ArrayList pram = new ArrayList();
- pram.Add(ugr.Cells["EID"].Value.ToString());
- pram1.Add(pram);
- }
- int countinsert = ServerHelper.SetData("com.steering.pss.judge.DAL.QcmJyEquipment.deleteEquipment", new Object[] { pram1 }, this.ob);
- if (countinsert > 0)
- {
- MessageUtil.ShowTips("删除成功!");
- }
- else
- {
- MessageUtil.ShowTips("删除失败!"); return;
- }
- DoQuery();
- }
- private void DoAdd()
- {
- ultraGrid1.UpdateData();
- ArrayList list1 = new ArrayList();
- String items = "";
- String result = "";
- String createname = "";
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择要新增的数据!");
- return;
- }
- foreach (UltraGridRow ugr in uGrid)
- {
- ArrayList list = new ArrayList();
- items = ugr.Cells["ITEMS"].Value.ToString().Trim();
- result = ugr.Cells["RESULT"].Value.ToString().Trim();
- if (items == "") { MessageUtil.ShowTips("设备名称不能为空!"); return; }
- if (result == "") { MessageUtil.ShowTips("设备型号不能为空!"); return; }
- list.Add(items);
- list.Add(result);
- createname = username;
- list.Add(createname);
- list1.Add(list);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.judge.DAL.QcmJyEquipment";
- ccp.MethodName = "AddEquipment";
- ccp.ServerParams = new object[] { list1 };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("新增成功!"))
- {
- DoQuery();
- }
- }
- }
- private void QcmJyEquipment_Load(object sender, EventArgs e)
- {
- username = UserInfo.GetUserName();//获取登录的用户名
- DoQuery();
- }
- private void ultraExpandableGroupBox1_ExpandedStateChanged(object sender, EventArgs e)
- {
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
-
- }
-
-
- }
- }
|