private void lbMILightGroupInfoAdd_Click(object sender, RoutedEventArgs e) { TreeHostInfo thi = (TreeHostInfo)tvHostLightInfo.SelectedItem; LightGroupInfo lgi = new LightGroupInfo(); LightGroupInfoEditDlg lgie = new LightGroupInfoEditDlg("增加单灯分组", lgi); if (lgie.ShowDialog() == true) { lgie.LightGroupInfo.GUID = Guid.NewGuid().ToString(); lgie.LightGroupInfo.CreateTime = DateTime.Now; lgie.LightGroupInfo.UpdateTime = lgie.LightGroupInfo.CreateTime; lgie.LightGroupInfo.HostGUID = thi.HostInfo.GUID; if (new AdminBLL.LightGroupInfoBLL().Add(lgie.LightGroupInfo)) { thi.TreeLightGroupInfos.Add(new TreeLightGroupInfo() { LightGroupInfo = lgie.LightGroupInfo }); } else { ModernDialog.ShowMessage("加入数据库失败!", "提示", MessageBoxButton.OK); } } }
public bool Update(LightGroupInfo lgi) { if (lgi != null) { return(new BLL.tLightGroupInfoes().Update(lgi.T)); } return(false); }
public LightGroupInfoEditDlg(string title, LightGroupInfo lgi) : this() { this.Title = title; this.LightGroupInfo = lgi; txtLightGroupInfoID.Text = lgi.ID.Trim(); txtLightGroupInfoName.Text = lgi.Name.Trim(); }
private void lbMILightGroupInfoEdit_Click(object sender, RoutedEventArgs e) { TreeLightGroupInfo tlgi = (TreeLightGroupInfo)tvHostLightInfo.SelectedItem; LightGroupInfo lgi = new LightGroupInfo(); lgi.Name = tlgi.LightGroupInfo.Name; lgi.ID = tlgi.LightGroupInfo.ID; LightGroupInfoEditDlg gie = new LightGroupInfoEditDlg("修改单灯分组 - " + tlgi.LightGroupInfo.Name, lgi); if (gie.ShowDialog() == true) { tlgi.LightGroupInfo.Name = gie.LightGroupInfo.Name; tlgi.LightGroupInfo.ID = gie.LightGroupInfo.ID; tlgi.LightGroupInfo.UpdateTime = DateTime.Now; if (new AdminBLL.LightGroupInfoBLL().Update(tlgi.LightGroupInfo)) { } else { ModernDialog.ShowMessage("加入数据库失败!", "提示", MessageBoxButton.OK); } } }