Exemple #1
0
        void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSelectedRow(true))
            {
                return;
            }
            if (this.DefaultEntity.OrderType == typeof(T_FB_SUMSETTINGSMASTER))
            {
                for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
                {
                    OrderEntity order          = this.ADtGrid.SelectedItems[i] as OrderEntity;
                    string      ownerCompanyid = order.GetOwnerInfo().Company.Value.ToString();
                    var         q = from ent in SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts
                                    where ent.CompanyID == ownerCompanyid
                                    select ent;
                    if (q.FirstOrDefault() == null)
                    {
                        MessageBox.Show("你没有权限修改此单据!");
                        return;
                    }
                }
            }

            OrderEntity orderEntity = this.ADtGrid.SelectedItems[0] as OrderEntity;

            ShowEditForm(orderEntity, OperationTypes.Edit);
        }
Exemple #2
0
        void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSelectedRow(true))
            {
                return;
            }
            for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
            {
                OrderEntity order  = this.ADtGrid.SelectedItems[i] as OrderEntity;
                object      states = order.GetObjValue(EntityFieldName.CheckStates);
                if (states.ToString() != ((int)SMT.SaaS.FrameworkUI.CheckStates.UnSubmit).ToString())
                {
                    CommonFunction.NotifySelection(Utility.GetResourceStr("Msg_NoDeleteOrder"));
                    return;
                }
            }

            Action action = () =>
            {
                List <OrderEntity> list = new List <OrderEntity>();
                for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
                {
                    OrderEntity order = this.ADtGrid.SelectedItems[i] as OrderEntity;

                    order.FBEntityState = FBEntityState.Detached;

                    list.Add(order);
                }
                OrderSource.SaveList(list);
            };

            if (this.DefaultEntity.OrderType == typeof(T_FB_SUMSETTINGSMASTER))
            {
                for (int i = 0; i < this.ADtGrid.SelectedItems.Count; i++)
                {
                    OrderEntity order          = this.ADtGrid.SelectedItems[i] as OrderEntity;
                    string      ownerCompanyid = order.GetOwnerInfo().Company.Value.ToString();
                    var         q = from ent in SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts
                                    where ent.CompanyID == ownerCompanyid
                                    select ent;
                    if (q.FirstOrDefault() == null)
                    {
                        MessageBox.Show("你没有权限删除此单据!");
                        return;
                    }
                }
            }

            CommonFunction.AskDelete(string.Empty, action);
        }