Esempio n. 1
0
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            List <string> msgs = null;

            if (DataCore.GetSetting("CanAddLessThanZero") == "1")
            {
                msgs = CheckSaveB();
            }
            else
            {
                msgs = CheckSaveA();
            }
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }
        }
Esempio n. 2
0
        void editForm_LoadControlComplete(object sender, EventArgs e)
        {
            DetailGrid grid = editForm.FindChildControl <DetailGrid>("OrderGrid");

            if (grid != null)
            {
                grid.SetGridFix();
                grid.ADGrid.Columns.ForEach(item =>
                {
                    item.CanUserSort = false;
                });
                // var aa = grid.ADGrid.Columns[3].Header;
                grid.ADGrid.Columns[3].HeaderStyle = null;
                grid.ADGrid.Columns[3].HeaderStyle = Resources["activeStyle"] as Style;
                List <string> groups = new List <string> {
                    "Entity.T_FB_SUBJECT.T_FB_SUBJECTTYPE.SUBJECTTYPENAME"
                };
                grid.Groups = groups;

                grid.ADGrid.Columns[2].Visibility = Visibility.Collapsed;

                // 是否可以设置滚动
                if (DataCore.GetSetting("CanSetSubjectControl") == "1")
                {
                    grid.ADGrid.Columns[7].IsReadOnly = false;
                }
                grid.ADGrid.Columns[5].IsReadOnly = false;
                //活动经费处理
                OrderEntity oe = grid.DataContext as OrderEntity;
                oe.FBEntity.CollectionEntity.ForEach(p =>
                {
                    p.FBEntities.ForEach(item =>
                    {
                        var v = item.Entity as T_FB_SUBJECTCOMPANY;
                        if (v != null && v.T_FB_SUBJECT.SUBJECTID == DataCore.SystemSetting.MONEYASSIGNSUBJECTID)
                        {
                            item.Entity.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DeatilEntity_PropertyChanged);
                            DeatilEntity_PropertyChanged(item.Entity, null);
                        }
                    });
                });
            }
        }
Esempio n. 3
0
        private List <string> CheckSubject(T_FB_SUBJECT entitySubject)
        {
            #region 处理 Subject


            List <string> errMsg        = new List <string>();
            var           subjectTypeID = entitySubject.T_FB_SUBJECTTYPE.SUBJECTTYPEID;
            string        code          = entitySubject.SUBJECTCODE;
            if (string.IsNullOrEmpty(code))
            {
                errMsg.Add("科目编号不能为空");
            }

            string name = entitySubject.SUBJECTNAME;
            if (string.IsNullOrEmpty(name))
            {
                errMsg.Add("科目类别不能为空");
            }

            foreach (OrderEntity orderEntity in this.EntityList)
            {
                if (errMsg.Count > 0)
                {
                    break;
                }
                var subjects = orderEntity.GetRelationFBEntities(typeof(T_FB_SUBJECT).Name);

                #region 科目名称
                // 相同的科目名称在不同的科目类别中,是否可以保存
                var canSameSubjectName = DataCore.GetSetting("CanSameSubjectName") == "1";
                if (!canSameSubjectName)
                {
                    var subjectFind = subjects.FirstOrDefault(fbEntity =>
                    {
                        T_FB_SUBJECT entity = fbEntity.Entity as T_FB_SUBJECT;
                        if (entity == null)
                        {
                            return(false);
                        }
                        bool isRightType  = entity.GetType().Name == "T_FB_SUBJECT";
                        bool isNotItselft = !object.Equals(entity, entitySubject);
                        bool isSameName   = name == entity.SUBJECTNAME;
                        return(isRightType && isNotItselft && isSameName);
                    });

                    if (subjectFind != null)
                    {
                        errMsg.Add("科目名称已存在,不可重复");
                    }
                }

                #endregion

                #region 科目编号
                var subjectFind2 = subjects.FirstOrDefault(fbEntity =>
                {
                    T_FB_SUBJECT entity = fbEntity.Entity as T_FB_SUBJECT;
                    bool isRightType    = entity.GetType().Name == "T_FB_SUBJECT";
                    bool isNotItselft   = !object.Equals(entity, entitySubject);
                    bool isSameCode     = code == entity.SUBJECTCODE;

                    return(isRightType && isNotItselft && isSameCode);
                });

                if (subjectFind2 != null)
                {
                    errMsg.Add("科目编号已存在,不可重复");
                }
                #endregion
            }
            #endregion

            return(errMsg);
        }