public void Create(ESOP_Publish ESOP_Publish) { ESOP_Publish.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ESOP_Publish.CreateUser = tempUser.UserName; ESOP_Publish.Validate(); this.publishRepository.Add(ESOP_Publish); this.runtimeService.Commit(); }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { eSOPPublishBindingSource.AddNew(); ESOP_Publish temp = eSOPPublishBindingSource.Current as ESOP_Publish; EditForm("产品资料新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { EditForm("产品资料修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { ESOP_Publish temp = eSOPPublishBindingSource.Current as ESOP_Publish; publishService.Delete(temp.Id); eSOPPublishViewModelBindingSource.RemoveCurrent(); } } else if (e.Item.Caption == BtnCommandEnum.PublishTask) { if (gridView1.SelectedRowsCount <= 0) { throw new ApplicationException("请先选择需要发送的文件"); } var publishTasks = this.eSOPPublishBindingSource.DataSource as List <ESOP_Publish>; if (!tcpClient.Connected) { INIFile inifile = new INIFile(ERPHelper.IniFilePath); string serverIP = inifile.IniReadValue("TCPSetting", "ServerIP"); int port = Int32.Parse(inifile.IniReadValue("TCPSetting", "Port")); //string serverIP = app.AppConfigGet("ServerIP"); //int port = Int32.Parse(app.AppConfigGet("Port")); tcpClient = new TcpClient(); tcpClient.Connect(serverIP, port); //tcpClient = new TcpClient(); netStream = tcpClient.GetStream();//取得网络流 //Thread thread = new Thread(new ThreadStart(receiveData));//创建接收线程 // thread.Start();//启动接收线程,死循环接收数据 } foreach (var publishTask in publishTasks) { byte[] msg = new byte[256]; string message = "send:" + publishTask.Id + "," + publishTask.DevId + "\r\n"; msg = System.Text.Encoding.UTF8.GetBytes(message); netStream.Write(msg, 0, msg.Length); } XtraMessageBox.Show("发送成功"); } }
public void Update(ESOP_Publish ESOP_Product) { ESOP_Product.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ESOP_Product.ModifyUser = tempUser.UserName; ESOP_Product.Validate(); var existstb_Sys_Menu = this.GetById(ESOP_Product.Id); this.publishRepository.SetValues(ESOP_Product, existstb_Sys_Menu); this.runtimeService.Commit(); }
private void EditForm(string formText, string btnCommand) { ESOP_Publish temp = this.eSOPPublishBindingSource.Current as ESOP_Publish; ESOPPublishEditForm edit = new ESOPPublishEditForm(temp); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { eSOPPublishBindingSource.CancelEdit(); } else { OnAttachEvent(); } }
public void Save(ESOP_Publish product) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existsdevice = this.GetById(product.Id); if (existsdevice == null) { product.CompCode = tempUser.CompCode; product.CreateDt = DateTime.Now; product.CreateUser = tempUser.UserName; product.Validate(); this.publishRepository.Add(product); } else { product.ModifyDt = DateTime.Now; product.ModifyUser = tempUser.UserName; product.Validate(); this.publishRepository.SetValues(product, existsdevice); } this.runtimeService.Commit(); }
public ESOPPublishEditForm(ESOP_Publish tempData) { InitializeComponent(); this.tempData = tempData; }