Пример #1
0
 private void GridToolBar_Delete_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (CommonFunction.AskDelete(null))
     {
         OrderSource.Delete(this.orderEntity);
         this.Close();
     }
 }
Пример #2
0
        private void Delete()
        {
            if (currentTreeViewItem.HasItems)
            {
                CommonFunction.NotifySelection("当前记录有子结点,不能被删除");
                return;
            }

            Action action = () =>
            {
                if (this.CurrentOrderEntity.FBEntityState == FBEntityState.Added)
                {
                    OrderEntity orderEntity = this.EntityList.FirstOrDefault(item => { return(object.Equals(item, this.currentOrderEntity)); });
                    if (orderEntity != null)
                    {
                        this.EntityList.Remove(orderEntity);
                    }
                    else
                    {
                        FBEntity     fbEntity = this.CurrentOrderEntity.FBEntity;
                        T_FB_SUBJECT subject  = fbEntity.Entity as T_FB_SUBJECT;
                        this.dictTreeViewItem[subject.T_FB_SUBJECTTYPE].DeleteFBEntity(fbEntity);
                    }
                    this.CurrentOrderEntity = null;
                }
                else
                {
                    this.CurrentOrderEntity.FBEntityState = FBEntityState.Deleted;
                }

                Type           type  = this.currentTreeViewItem.Parent.GetType();
                PropertyInfo   p     = type.GetProperty("Items");
                ItemCollection items = (ItemCollection)p.GetValue(this.currentTreeViewItem.Parent, null);

                //beyond
                TreeViewItem tempcurrentTreeViewItem = currentTreeViewItem.Parent as TreeViewItem;

                items.Remove(this.currentTreeViewItem);

                //beyond this.currentTreeViewItem
                if (items.Count > 0)
                {
                    this.currentTreeViewItem = items[0] as TreeViewItem;
                }
                else
                {
                    this.currentTreeViewItem = tempcurrentTreeViewItem;
                }

                this.CurrentOrderEntity = currentTreeViewItem.DataContext as OrderEntity;

                //  this.CurrentEditForm.Save();
            };

            CommonFunction.AskDelete(string.Empty, action);
        }
Пример #3
0
        private void GridToolBar_Delete_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (CommonFunction.AskDelete(null))
            {
                this.OrderEntity.FBEntityState = EntityState.Deleted;

                IsNeedToRefresh |= this.EditForm.Save();
                this.IsClose     = true;
            }
        }
Пример #4
0
        private void GridToolBar_Delete_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (CommonFunction.AskDelete(null))
            {
                this.orderEntity.OrderStatus = EntityAdapter.EditStatus.Delete;

                if (Save())
                {
                    this.DialogResult = true;
                }
            }
        }
Пример #5
0
        protected override bool AuditCheck()
        {
            var details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_COMPANYBUDGETSUMDETAIL).Name);
            var finds   = details.FindAll(item => (item.Entity as T_FB_COMPANYBUDGETSUMDETAIL).CHECKSTATES.Equal(4));

            if (finds.Count > 0)
            {
                Action action = () =>
                {
                    if (details.Count == finds.Count)
                    {
                        CommonFunction.ShowErrorMessage("不存在可提交的明细单据,请确认!");
                        return;
                    }
                    base.InnerSubmit();
                };
                var msg = "系统将会自动从汇总明细单据中移除已打回明细单据并提交,请确认继续提交?";
                CommonFunction.AskDelete(msg, action);
                return(false);
            }

            return(true);
        }
Пример #6
0
        protected override void OnLoadControlComplete()
        {
            base.OnLoadControlComplete();
            DetailGrid grid = this.EditForm.FindControl("OrderGrid") as DetailGrid;

            if (grid != null)
            {
                grid.P1.Visibility = System.Windows.Visibility.Visible;
                List <ToolbarItem> list = new List <ToolbarItem>();
                ToolbarItem        item = new ToolbarItem
                {
                    DisplayType = ToolbarItemDisplayTypes.Image,
                    Key         = "S1",
                    Title       = "按科目查看",
                    ImageUrl    = "/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/18_addView.png",
                };
                list.Add(item);
                item = new ToolbarItem
                {
                    DisplayType = ToolbarItemDisplayTypes.Image,
                    Key         = "S2",
                    Title       = "按公司部门单据查看",
                    ImageUrl    = "/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/18_addView.png"
                };
                list.Add(item);

                grid.AddToolBarItems(list);
            }
            var dGrid = grid;

            dGrid.ADGrid.LoadingRow += (object sender, DataGridRowEventArgs e) =>
            {
                if ((this.EditForm.OperationType == OperationTypes.Add ||
                     this.EditForm.OperationType == OperationTypes.Edit ||
                     this.EditForm.OperationType == OperationTypes.ReSubmit) && SumType == 1)
                {
                    var    con = dGrid.ADGrid.Columns[7].GetCellContent(e.Row) as StackPanel;
                    Action a2  = () =>
                    {
                        Label label = new Label();
                        label.Content = "已打回";
                        con.Children.Clear();
                        con.Children.Add(label);
                    };

                    Action a1 = () =>
                    {
                        ImageButton myButton = new ImageButton();
                        myButton.Margin = new Thickness(0);
                        myButton.AddButtonAction("/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/ico_16_delete.png", "打回");
                        myButton.Tag    = e.Row.DataContext;
                        myButton.Click += (oo, ee) =>
                        {
                            Control c      = oo as Control;
                            var     entity = c.Tag as FBEntity;
                            Action  action = () =>
                            {
                                // dGrid.Delete(new List<FBEntity> { entity });
                                var saveEntity = entity.Entity.ToFBEntity();
                                saveEntity.SetObjValue("Entity.CHECKSTATES", 4);
                                saveEntity.FBEntityState = FBEntityState.Modified;
                                FBEntityService fbs = new FBEntityService();
                                fbs.SetVisitUser(saveEntity);
                                fbs.FBService.SaveCompleted += (ooo, eee) =>
                                {
                                    this.CloseProcess();
                                    if (eee.Error != null)
                                    {
                                        CommonFunction.ShowErrorMessage("操作失败, " + eee.Error.Message);
                                    }
                                    else if (eee.Result.Exception != null)
                                    {
                                        CommonFunction.ShowErrorMessage(eee.Result.Exception);
                                    }
                                    else
                                    {
                                        a2();
                                    }
                                };
                                this.ShowProcess();
                                fbs.FBService.SaveAsync(saveEntity);
                                // none;
                            };
                            var personName = entity.GetObjValue("Entity.T_FB_COMPANYBUDGETAPPLYMASTER.OWNERDEPARTMENTNAME");

                            var msg = "你确定要打回 [" + personName + "] 的部门年度预算吗?";
                            CommonFunction.AskDelete(msg, action);
                        };
                        con.Children.Clear();
                        con.Children.Add(myButton);
                    };

                    var cs = e.Row.DataContext.GetObjValue("Entity.CHECKSTATES") as decimal?;
                    if (cs.Equal(4))
                    {
                        a2();
                    }
                    else
                    {
                        a1();
                    }
                }
            };

            grid.deatilGridBar.ItemClicked += new EventHandler <ToolBar.ToolBarItemClickArgs>(deatilGridBar_ItemClicked);
            deatilGridBar_ItemClicked(grid, new ToolBar.ToolBarItemClickArgs("S1"));
        }
Пример #7
0
        public void DoAction(string actionType)
        {
            ShowProcess();
            switch (actionType)
            {
            case "Save":
                IsClose          = false;
                IsNeedToRefresh |= this.EditForm.Save();
                break;

            case "SaveAndClose":
                IsClose          = true;
                IsNeedToRefresh |= this.EditForm.Save();

                break;

            case "Delete":
                CloseProcess();
                Action action = () =>
                {
                    ShowProcess();
                    this.OrderEntity.FBEntityState = FBEntityState.Detached;
                    OrderEntityService orderSource = new OrderEntityService();
                    orderSource.SaveListCompleted += (o, e) =>
                    {
                        this.IsClose    = true;
                        IsNeedToRefresh = true;
                        OnClose();
                    };
                    orderSource.SaveList(new List <OrderEntity>()
                    {
                        this.OrderEntity
                    });
                };
                string msg = string.Empty;
                try
                {
                    msg = "你确定要删除 " + this.OrderEntity.OrderInfo.Name + " 吗?";
                }catch (Exception ex) {
                }
                CommonFunction.AskDelete(msg, action);
                break;

            case "Submit":
                //IsClose = true;
                IsNeedToRefresh |= SubmitAudit();

                break;

            case "Cancel":

                Action actionCancel = () =>
                {
                    IsClose = true;
                    OnClose();
                };

                if (this.OrderEntity.FBEntityState != FBEntityState.Unchanged)
                {
                    Action actionSave = () =>
                    {
                        DoAction("SaveAndClose");
                    };

                    CommonFunction.NotifySaveB4Close(string.Empty, actionSave, actionCancel);
                    return;
                }
                else
                {
                    actionCancel();
                }

                break;
            }
        }
Пример #8
0
        protected override void OnLoadControlComplete()
        {
            DetailGrid dGrid = this.EditForm.FindControl("OrderGrid") as DetailGrid;

            if (dGrid != null && !this.EditForm.IsReInitForm)
            {
                dGrid.ToolBars[0].Title = "选择下拨人员";
                if (dGrid.ToolBars.Count > 1)
                {
                    dGrid.ToolBars.Remove(dGrid.ToolBars[1]);
                }
                dGrid.AddToolBarItems(dGrid.ToolBars);
                double width = dGrid.ADGrid.Columns[dGrid.ADGrid.Columns.Count - 1].Width.Value;
                dGrid.ToolBarItemClick += new EventHandler <ToolBarItemClickEventArgs>(dGrid_ToolBarItemClick);

                //if (this.OrderEntity.FBEntityState != FBEntityState.Added)
                //{
                //    dGrid.ADGrid.Columns[5].Visibility = Visibility.Collapsed;
                //}
                //else
                //{
                //    dGrid.ADGrid.Columns[5].Visibility = Visibility.Visible;
                //}
                var totalWidth = dGrid.ADGrid.Columns.Sum(item => item.Width.Value);
                dGrid.ADGrid.MinWidth    = totalWidth + 10;
                dGrid.ADGrid.LoadingRow += (object sender, DataGridRowEventArgs e) =>
                {
                    if (this.EditForm.OperationType == OperationTypes.Add ||
                        this.EditForm.OperationType == OperationTypes.Edit ||
                        this.EditForm.OperationType == OperationTypes.ReSubmit)
                    {
                        var         con      = dGrid.ADGrid.Columns[1].GetCellContent(e.Row) as StackPanel;
                        ImageButton myButton = new ImageButton();
                        myButton.Margin = new Thickness(0);
                        myButton.AddButtonAction("/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/ico_16_delete.png", Utility.GetResourceStr("DELETE"));
                        myButton.Tag    = e.Row.DataContext;
                        myButton.Click += (oo, ee) =>
                        {
                            Control c      = oo as Control;
                            var     entity = c.Tag as FBEntity;
                            Action  action = () =>
                            {
                                dGrid.Delete(new List <FBEntity> {
                                    entity
                                });
                                // none;
                            };
                            var personName = entity.GetObjValue("Entity.OWNERNAME");

                            var msg = "你确定要删除" + personName + "的个人活动经费下拨吗?";
                            CommonFunction.AskDelete(msg, action);
                        };
                        con.Children.Clear();
                        con.Children.Add(myButton);
                    }
                };
            }
            if (this.EditForm.OperationType != OperationTypes.Add)
            {
                LookUp lu = this.EditForm.FindControl("AssignCompanyID") as LookUp;

                if (lu != null)
                {
                    lu.IsEnabled = false;
                }
            }
        }