Ejemplo n.º 1
0
        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);
                }
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }