Exemple #1
0
        private void ImportFromRiasEvent(Organization arg1, List <Equipment> arg2)
        {
            ActivityOrganization importorg = new ActivityOrganization();

            importorg.CopyFrom(arg1);
            importorg.ActivityGuid = SystemLoginService.CurrentActivity.Guid;

            if (arg2 != null && arg2.Count > 0)
            {
                List <ActivityEquipment> actequs = new List <ActivityEquipment>();
                foreach (Equipment item in arg2)
                {
                    ActivityEquipment equ = new ActivityEquipment();
                    equ.CopyFrom(item);
                    equ.ActivityGuid = SystemLoginService.CurrentActivity.Guid;
                    equ.PlaceGuid    = SystemLoginService.CurrentActivityPlace.Guid;
                    equ.OrgInfo.Guid = importorg.Guid;
                    actequs.Add(equ);
                }

                this.ImportActivityEquipmentEvent(importorg, actequs);
            }
            else
            {
                MessageBox.Show("请选择要导入的设备");
            }
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEquAdd_Click(object sender, RoutedEventArgs e)
        {
            if (SelectActivityORG == null)
            {
                MessageBox.Show("请选择新增设备所属单位!", "提示", MessageBoxButton.OK);
                return;
            }
            Equipment newequ = new Equipment();

            newequ.OrgInfo.Guid = SelectActivityORG.Guid;
            newequ.OrgInfo.Name = SelectActivityORG.Name;
            newequ.Key          = System.Guid.NewGuid().ToString();
            newequ.EQUCount     = 1;
            EquipmentManageDialog addequdialog = new EquipmentManageDialog();

            addequdialog.AllowEdit    = true;
            addequdialog.DataContext  = newequ;
            addequdialog.OnSaveEvent += (equ) =>
            {
                ActivityEquipment actequ = new ActivityEquipment();
                actequ.ActivityGuid = this.CurrentActivity.Guid;
                actequ.PlaceGuid    = this.CurrentActivityPlace.Guid;
                actequ.CopyFrom(equ);

                bool result = this.SaveActivityEquipment(actequ);
                if (result)
                {
                    InitQueryCondition(eququerycondition);
                    GetActivityEquipments(eququerycondition);
                    MessageBox.Show("保存成功");
                }
                return(result);
            };
            addequdialog.ShowDialog();
        }
Exemple #3
0
        /// <summary>
        /// 打开设备详细信息
        /// </summary>
        /// <param name="equipment"></param>
        private void ShowEquipDetail(ActivityEquipment equipment)
        {
            if (equipment == null)
            {
                return;
            }
            EquipmentManageDialog addequdialog = new EquipmentManageDialog();

            addequdialog.AllowEdit    = !IsReadOnly;
            addequdialog.DataContext  = equipment;
            addequdialog.OnSaveEvent += (equ) =>
            {
                ActivityEquipment actequ = new ActivityEquipment();
                actequ.ActivityGuid = SystemLoginService.CurrentActivity.Guid;
                actequ.PlaceGuid    = SystemLoginService.CurrentActivityPlace.Guid;
                actequ.CopyFrom(equ);
                return(SaveEquipment(actequ));
            };
            addequdialog.ShowDialog();
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="obj"></param>
        private void equipmentListControl_DoubleClick(ActivityEquipment obj)
        {
            EquipmentManageDialog addequdialog = new EquipmentManageDialog();

            addequdialog.AllowEdit    = false;
            addequdialog.DataContext  = obj;
            addequdialog.OnSaveEvent += (equ) =>
            {
                ActivityEquipment actequ = new ActivityEquipment();
                actequ.ActivityGuid = this.CurrentActivity.Guid;
                actequ.PlaceGuid    = this.CurrentActivityPlaceID;
                actequ.CopyFrom(equ);
                bool result = SaveActivityEquipment(actequ);
                if (result)
                {
                    InitQueryCondition(eququerycondition);
                    GetActivityEquipments(eququerycondition);
                    MessageBox.Show("保存成功");
                }
                return(result);
            };
            addequdialog.ShowDialog();
        }