Ejemplo n.º 1
0
        public frmEditTypePart(TypePart sub, string NameParrent)
        {
            InitializeComponent();
            m_SubCate = sub;

            txtParrentName.Text = NameParrent;
        }
Ejemplo n.º 2
0
 public frmCreateSeriesPart(int cateId, int subId, string textParrentName)
 {
     InitializeComponent();
     m_Sub             = new TypePart();
     m_Sub.TypePartID  = subId;
     m_Sub.GroupPartId = cateId;
     _nameParrentNode  = textParrentName;
 }
Ejemplo n.º 3
0
 public void Update(TypePart entity)
 {
     if (entity == null)
     {
         throw new ArgumentNullException("entity");
     }
     base.Edit(entity);
 }
Ejemplo n.º 4
0
        public void Remove(TypePart entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            base.Delete(entity);
        }
Ejemplo n.º 5
0
        public int AddandGetRequestPaymentId(TypePart entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            string insert = string.Format(@"insert into TypePart(TypePartCode,TypePartName,GroupPartId,Note,CreateBy,CreateDate,ModifyBy,ModifyDate) output inserted.TypePartID values (@TypePartCode,@TypePartName,@GroupPartId,@Note,@CreateBy,@CreateDate,@ModifyBy,@ModifyDate)");

            return(Connection.ExecuteScalar <int>(insert, entity, Transaction));
        }
        public FSharpGeneratedConstructorFromFields([NotNull] TypePart typePart,
                                                    IList <ITypeOwner> fields) : base(typePart)
        {
            var parameters = new IParameter[fields.Count];

            for (var i = 0; i < fields.Count; i++)
            {
                parameters[i] = new FSharpGeneratedConstructorParameter(this, fields[i]);
            }

            Parameters = parameters;
        }
Ejemplo n.º 7
0
 private static TypePart GetPartFromSignature(TypePart typePart)
 {
     for (var part = typePart; part != null; part = part.NextPart)
     {
         var filePart = part.GetRoot() as FSharpProjectFilePart;
         if (filePart?.IsSignaturePart ?? false)
         {
             return(part);
         }
     }
     return(null);
 }
Ejemplo n.º 8
0
        private void cbbTypePart_SelectedValueChanged(object sender, EventArgs e)
        {
            if (isLoad)
            {
                return;
            }
            TypePart type = cbbTypePart.SelectedItem as TypePart;

            if (type == null)
            {
                return;
            }
            int typepartId = type.TypePartID;

            ComboboxUtility.BindSeriesParttWidthALl(cbbSeriesPart, typepartId.ToString());
        }
Ejemplo n.º 9
0
        public ViewpartViewModel(part part)
        {
            this.cost    = part.Cost;
            this.name    = part.Name;
            this.process = part.process;

            this.Code = process.Code;
            this.Name = process.Name;

            foreach (part p in process.parts.ToList())
            {
                nowcost += p.Cost;
            }
            type = new TypePart(part.num_type);

            back = new Command(() => {
                Ico.getValue <ContentApp>().back();
            });
        }
Ejemplo n.º 10
0
        public static MemberDecoration GetModifiers(this TypePart typePart)
        {
            var sigPart = GetPartFromSignature(typePart);

            if (sigPart != null)
            {
                return(Normalize(sigPart.Modifiers));
            }

            if (typePart == null)
            {
                return(MemberDecoration.DefaultValue);
            }

            var decoration = typePart.Modifiers;

            if (typePart.GetRoot() is FSharpProjectFilePart {
                HasPairFile : true
            })
Ejemplo n.º 11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (m_Category == null)
            {
                lblNotify1.SetText(UI.hasnoinfomation, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                return;
            }
            TypePart sub = new TypePart();

            sub.GroupPartId  = m_Category.GroupPartId;
            sub.TypePartCode = txtCode.Text;
            sub.TypePartName = txtName.Text;
            sub.Note         = txtNote.Text;
            try
            {
                int Id = 0;
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    Id = uow.TypePartBaseRepository.AddandGetRequestPaymentId(sub);
                    uow.Commit();
                }
                TreeTagPart treeTag = new TreeTagPart();
                treeTag.NodeTye        = TreeTagPart.Types.TypePart;
                treeTag.GroupPartIDTag = m_Category.GroupPartId;
                treeTag.TypePartIDTag  = Id;
                TreeNode node = new TreeNode(sub.TypePartName);
                node.Tag = treeTag;
                if (AddNode != null)
                {
                    AddNode(node);
                }
                lblNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
                Close();
            }
            catch
            {
            }
        }
Ejemplo n.º 12
0
        public static void BindTypePartWidthALl(MetroSearchComboBox cbb, string groupPartId)
        {
            IList <TypePart> lstSupplier;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstSupplier = groupPartId != "0" ? uow.TypePartBaseRepository.FindByGroupID(int.Parse(groupPartId)) : uow.TypePartBaseRepository.All();
                uow.Commit();
            }
            if (lstSupplier == null)
            {
                return;
            }
            cbb.DataSource = null;
            cbb.DataSource = lstSupplier;
            TypePart objAll = new TypePart {
                TypePartName = "Tất cả", TypePartID = 0
            };

            lstSupplier.Add(objAll);
            cbb.DisplayMember = "TypePartName";
            cbb.ValueMember   = "TypePartID";
        }
Ejemplo n.º 13
0
        public static MemberDecoration GetModifiers(this TypePart typePart)
        {
            var sigPart = GetPartFromSignature(typePart);

            if (sigPart != null)
            {
                return(Normalize(sigPart.Modifiers));
            }

            if (typePart == null)
            {
                return(MemberDecoration.DefaultValue);
            }

            var decoration          = typePart.Modifiers;
            var isHiddenBySignature = (typePart.GetRoot() as FSharpProjectFilePart)?.HasPairFile ?? false;

            if (isHiddenBySignature)
            {
                decoration.AccessRights = AccessRights.INTERNAL;
            }

            return(Normalize(decoration));
        }
Ejemplo n.º 14
0
        public static MemberDecoration GetModifiers(this TypePart typePart)
        {
            var sigPart = GetPartFromSignature(typePart);

            if (sigPart != null)
            {
                return(Normalize(sigPart.Modifiers));
            }

            if (typePart == null)
            {
                return(MemberDecoration.DefaultValue);
            }

            var decoration = typePart.Modifiers;

            if (typePart.GetRoot() is FSharpProjectFilePart projectFilePart && projectFilePart.HasPairFile)
            {
                // We already know there's no type part in a signature file.
                // If there's a signature file then this type is hidden.
                decoration.AccessRights = AccessRights.INTERNAL;
            }

            if (typePart is TypeAbbreviationOrDeclarationPartBase part && !part.IsUnionCase)
            {
                // Type abbreviation is a union case declaration when its right part is a simple named type
                // that is not resolved to anything.
                // When the part is abbreviation, we modify it's visibility to hide from other languages.
                //
                // We cannot set it directly in the part modifiers,
                // since it depends on resolve which needs committed documents and is slow.
                decoration.AccessRights = AccessRights.INTERNAL;
            }

            return(Normalize(decoration));
        }
        public static IList <ITypeMember> GetGeneratedMembers(this TypePart typePart)
        {
            if (!(typePart.TypeElement is { } typeElement))
            {
                return(EmptyList <ITypeMember> .Instance);
            }

            var result = new LocalList <ITypeMember>(new ITypeMember[]
            {
                new EqualsSimpleTypeMethod(typeElement),
                new EqualsObjectMethod(typeElement),
                new EqualsObjectWithComparerMethod(typeElement),

                new GetHashCodeMethod(typeElement),
                new GetHashCodeWithComparerMethod(typeElement),
            });

            if (typePart is ISimpleTypePart simpleTypePart)
            {
                if (simpleTypePart.OverridesToString)
                {
                    result.Add(new ToStringMethod(typeElement));
                }

                if (simpleTypePart.HasCompareTo)
                {
                    result.Add(new CompareToSimpleTypeMethod(typeElement));
                    result.Add(new CompareToObjectMethod(typeElement));
                    result.Add(new CompareToObjectWithComparerMethod(typeElement));
                }
            }

            switch (typePart)
            {
            case IRecordPart recordPart:
                result.Add(new FSharpGeneratedConstructorFromFields(typePart));
                if (recordPart.CliMutable && typePart is Class.IClassPart)
                {
                    result.Add(new DefaultConstructor(typeElement));
                }
                break;

            case IExceptionPart exceptionPart:
                result.Add(new ExceptionConstructor(typePart));
                if (exceptionPart.HasFields)
                {
                    result.Add(new FSharpGeneratedConstructorFromFields(typePart));
                }
                break;

            case IUnionPart unionPart:
                result.Add(new UnionTagProperty(typeElement));
                foreach (var unionCase in unionPart.Cases)
                {
                    if (unionCase.HasFields)
                    {
                        result.Add(new FSharpUnionCaseNewMethod(unionCase));

                        if (!unionPart.HasNestedTypes)
                        {
                            result.AddRange(unionCase.CaseFields);
                        }
                        else if (unionCase.NestedType is { } nestedType)
                        {
                            result.Add(nestedType);
                        }
                    }

                    if (!unionPart.IsSingleCase)
                    {
                        result.Add(new FSharpUnionCaseIsCaseProperty(unionCase));
                    }
                }

                if (!unionPart.IsSingleCase)
                {
                    result.Add(new FSharpUnionTagsClass(typeElement));
                }
                break;
            }

            return(result.ResultingList());
        }
Ejemplo n.º 16
0
 public Component this[TypePart part] => Components.FirstOrDefault(c => c.TypePart == part);
Ejemplo n.º 17
0
 protected FSharpGeneratedConstructor(TypePart typePart) =>
Ejemplo n.º 18
0
 public FSharpGeneratedConstructorFromFields([NotNull] TypePart typePart) : base(typePart)
 {
 }
Ejemplo n.º 19
0
 internal FSharpUnionTagsClass([NotNull] TypePart typePart) =>
Ejemplo n.º 20
0
 public ExceptionConstructor(TypePart typePart) : base(typePart)
 {
 }
Ejemplo n.º 21
0
 protected override bool AcceptsPart(TypePart part) =>
 part is IModulePart;
Ejemplo n.º 22
0
 public bool IsType(TypePart type)
 {
     return(TypePart == type);
 }
Ejemplo n.º 23
0
 public void Add(TypePart entry)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 24
0
        public static IList <ITypeMember> GetGeneratedMembers(this TypePart typePart)
        {
            var typeElement = typePart.TypeElement;

            if (typeElement == null)
            {
                return(EmptyList <ITypeMember> .Instance);
            }

            var result = new LocalList <ITypeMember>(new ITypeMember[]
            {
                new EqualsSimpleTypeMethod(typeElement),
                new EqualsObjectMethod(typeElement),
                new EqualsObjectWithComparerMethod(typeElement),

                new GetHashCodeMethod(typeElement),
                new GetHashCodeWithComparerMethod(typeElement),
            });

            if (typePart is ISimpleTypePart simpleTypePart)
            {
                if (simpleTypePart.OverridesToString)
                {
                    result.Add(new ToStringMethod(typeElement));
                }

                if (simpleTypePart.HasCompareTo)
                {
                    result.Add(new CompareToSimpleTypeMethod(typeElement));
                    result.Add(new CompareToObjectMethod(typeElement));
                    result.Add(new CompareToObjectWithComparerMethod(typeElement));
                }
            }

            switch (typePart)
            {
            case IRecordPart recordPart:
                result.Add(new FSharpGeneratedConstructorFromFields(typePart, recordPart.Fields));
                if (recordPart.CliMutable)
                {
                    result.Add(new DefaultConstructor(typeElement));
                }
                break;

            case IExceptionPart exceptionPart:
                result.Add(new ExceptionConstructor(typePart));
                var fields = exceptionPart.Fields;
                if (!fields.IsEmpty())
                {
                    result.Add(new FSharpGeneratedConstructorFromFields(typePart, fields));
                }
                break;

            case IUnionPart unionPart:
                var cases             = unionPart.Cases;
                var isSingleCaseUnion = cases.Count == 1;

                result.Add(new UnionTagProperty(typeElement));

                foreach (var unionCase in cases)
                {
                    if (!isSingleCaseUnion)
                    {
                        result.Add(new IsUnionCaseProperty(typeElement, "Is" + unionCase.ShortName));
                    }

                    if (unionCase is FSharpNestedTypeUnionCase typedCase)
                    {
                        result.Add(new NewUnionCaseMethod(typedCase));

                        if (!unionPart.HasPublicNestedTypes)
                        {
                            result.AddRange(typedCase.CaseFields);
                        }
                    }
                }

                if (!isSingleCaseUnion)
                {
                    result.Add(new FSharpUnionTagsClass(typePart));
                }
                break;
            }

            return(result.ResultingList());
        }
Ejemplo n.º 25
0
 protected override bool AcceptsPart(TypePart part) =>
 base.AcceptsPart(part) && !(part is IModulePart);
Ejemplo n.º 26
0
 protected override bool AcceptsPart(TypePart part) =>
 part is ObjectExpressionTypePart;