Exemple #1
0
        public static QueryExpression GetQueryExpression(QueryExpressionInfo queryExpressionInfo, OrderEntity orderEntity)
        {
            if (queryExpressionInfo == null)
            {
                return(null);
            }
            QueryExpression queryExpression = queryExpressionInfo.GetQueryExpression();
            QueryExpression tempExp         = queryExpression;

            while (tempExp != null)
            {
                string[] strs = tempExp.PropertyName.Split('.');
                if (strs[0] == "Entity")
                {
                    tempExp.PropertyName = strs[1];
                }

                string propertyValue = tempExp.PropertyValue;
                if (propertyValue.StartsWith("{") && propertyValue.EndsWith("}"))
                {
                    propertyValue = CommonFunction.TryConvertValue(orderEntity.GetObjValue(propertyValue), propertyValue);
                }

                tempExp.PropertyValue = propertyValue;
                tempExp = tempExp.RelatedExpression;
            }
            return(queryExpression);
        }
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);
            };

            CommonFunction.AskDelete(string.Empty, action);
        }
Exemple #3
0
        public static QueryExpression GetQueryExpression(this OrderEntity orderEntity, string propertyName)
        {
            object value = orderEntity.GetObjValue("Entity." + propertyName);

            if (value != null)
            {
                return(QueryExpressionHelper.Equal(propertyName, Convert.ToString(value)));
            }
            return(null);
        }
Exemple #4
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);
        }