Пример #1
0
        private Property LoadProperty(Annotation annotation, Context context, DocEntry entry)
        {
            Property prop = new Property();

            prop.SetName(entry.GetKey().ToString());
            Object value = entry.GetValue();

            if (value is MethodExpression)
            {
                value = ((MethodExpression)value).AsTypeLiteral(context);
            }
            if (value is TypeExpression)
            {
                IType type = ((TypeExpression)value).getType();
                value = new TypeLiteral(type);
            }
            if (value is TypeLiteral)
            {
                return(LoadProperty(annotation, context, entry, prop, (TypeLiteral)value));
            }
            else if (value is SetLiteral)
            {
                return(LoadProperty(annotation, context, entry, prop, (SetLiteral)value));
            }
            else if (value is DocumentLiteral)
            {
                return(LoadProperty(annotation, context, entry, prop, (DocumentLiteral)value));
            }
            else
            {
                throw new SyntaxError("WidgetProperties expects a Document of types as unique parameter");
            }
        }
 protected void ObtenerDetalle(string docEntry)
 {
     if (docEntry != "" && _swiftViewSboReturnDetails == null)
     {
         _swiftViewSboReturnDetails =
             (from detalle in Mvx.Ioc.Resolve <IBaseDeDatosServicio>().GetSwiftViewSboReturnDetails(docEntry)
              where detalle.DocEntry == DocEntry.ToString()
              select detalle).ToList();
     }
 }
 private void  ObtenerDetalle(string docEntry, string docNum)
 {
     if (docEntry != "" && docNum != "" && _swiftViewSboOrderDetails == null)
     {
         _swiftViewSboOrderDetails =
             (from detalle in Mvx.Ioc.Resolve <IBaseDeDatosServicio>().GetSwiftViewSboOrderDetails(docEntry, docNum)
              where detalle.DocEntry == DocEntry.ToString()
              select detalle).ToList();
     }
 }
Пример #4
0
        private Property LoadProperty(Annotation annotation, Context context, DocEntry entry, Property prop, TypeLiteral value)
        {
            IType type = resolveType(annotation, context, value);

            if (type == null)
            {
                return(null);
            }
            prop.SetValidator(new TypeValidator(type));
            return(prop);
        }
Пример #5
0
        private string GetNativeLink(DocEntry value)
        {
            var shortApi      = value.NativeShortApi ?? "???";
            var indexOfMethod = shortApi.IndexOf("::");

            if (indexOfMethod > 0)
            {
                shortApi = shortApi.Substring(indexOfMethod + 2);
            }
            return(GetMsdnLink(shortApi, value.MsdnId));
        }
Пример #6
0
        public override int GetHashCode()
        {
            int hashCode = 98921229;

            hashCode = hashCode * -1521134295 + DocEntry.GetHashCode();
            hashCode = hashCode * -1521134295 + DocNum.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDueDate.GetHashCode();
            hashCode = hashCode * -1521134295 + TaxDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(DocStatus);

            hashCode = hashCode * -1521134295 + UpdateDate.GetHashCode();
            return(hashCode);
        }
Пример #7
0
        public override int GetHashCode()
        {
            int hashCode = 1540013303;

            hashCode = hashCode * -1521134295 + DocEntry.GetHashCode();
            hashCode = hashCode * -1521134295 + DocNum.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDueDate.GetHashCode();
            hashCode = hashCode * -1521134295 + TaxDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(DocStatus);

            hashCode = hashCode * -1521134295 + UpdateDate.GetHashCode();
            hashCode = hashCode * -1521134295 + PurchaseRequestId.GetHashCode();
            return(hashCode);
        }
Пример #8
0
        /// <summary>
        /// Generates hash code
        /// </summary>
        /// <returns>hash code</returns>
        public override int GetHashCode()
        {
            var hashCode = 2126638501;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ReqName);

            hashCode = hashCode * -1521134295 + ReqType.GetHashCode();
            hashCode = hashCode * -1521134295 + DocEntry.GetHashCode();
            hashCode = hashCode * -1521134295 + DocNum.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDueDate.GetHashCode();
            hashCode = hashCode * -1521134295 + TaxDate.GetHashCode();
            hashCode = hashCode * -1521134295 + ReqDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <List <PRQ1> > .Default.GetHashCode(Items);

            return(hashCode);
        }
Пример #9
0
        private DocChapter ConstructChapter(DirectoryInfo chapterDir)
        {
            DocChapter result = new DocChapter {
                Name = chapterDir.Name, Entries = new List <DocEntry>()
            };
            List <FileInfo> entryFiles = new List <FileInfo>(chapterDir.EnumerateFiles());

            //Read index
            if (entryFiles.Any(file => file.Name.ToLower().Equals("index.md")))
            {
                try
                {
                    DocFileContent indexContent =
                        ReadFileContent(entryFiles.First(file => file.Name.ToLower().Equals("index.md")));
                    result.ContentMd   = indexContent.Md;
                    result.ContentHtml = indexContent.Html;
                }
                catch (Exception e)
                {
                    Console.WriteLine("Could not read index for chapter " + chapterDir.Name + ": " + e);
                }
            }

            IEnumerable <string> entryNames = File.ReadAllLines(Path.Combine(chapterDir.FullName, "entries.txt"));

            foreach (string entryName in entryNames)
            {
                if (string.IsNullOrEmpty(entryName) || !entryFiles.Any(dir => dir.Name.ToLower().Equals(entryName.ToLower() + ".md")))
                {
                    Console.WriteLine("No file found for chapter: " + entryName);
                    continue;
                }
                FileInfo entryFile = entryFiles.First(dir => dir.Name.ToLower().Equals(entryName.ToLower() + ".md"));
                try
                {
                    DocEntry docEntry = ConstructEntry(entryFile);
                    result.Entries.Add(docEntry);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Could not create chapter " + entryName + ": " + e);
                }
            }

            return(result);
        }
Пример #10
0
        private Property LoadProperty(Annotation annotation, Context context, DocEntry entry, Property prop, SetLiteral literal)
        {
            SetValue values   = (SetValue)literal.interpret(context);
            IType    itemType = values.ItemType;

            if (itemType is TypeType)
            {
                HashSet <IType> types = new HashSet <IType>();
                foreach (IValue val in values.getItems())
                {
                    if (val == NullValue.Instance)
                    {
                        continue;
                    }
                    types.Add(resolveType(annotation, context, ((TypeValue)val).GetValue()));
                }
                if (types.Contains(null))
                {
                    return(null);            // something went wrong
                }
                prop.SetValidator(new TypeSetValidator(types));
                prop.SetRequired(types.Count == values.Length());         // no null filtered out
                return(prop);
            }
            else if (itemType == AnyType.Instance || itemType == TextType.Instance)
            {
                HashSet <String> texts = new HashSet <String>();
                foreach (IValue val in values.getItems())
                {
                    if (val == NullValue.Instance)
                    {
                        continue;
                    }
                    texts.Add(val.ToString());
                }
                prop.SetValidator(new ValueSetValidator(texts));
                prop.SetRequired(texts.Count == values.Length());     // no null filtered out
                return(prop);
            }
            else
            {
                throw new SyntaxError("Expected a set of Types.");
            }
        }
Пример #11
0
        /// <summary>
        /// Generates hash code
        /// </summary>
        /// <returns>hash code</returns>
        public override int GetHashCode()
        {
            var hashCode = -144526589;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CardCode);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CardName);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(NumAtCard);

            hashCode = hashCode * -1521134295 + DocEntry.GetHashCode();
            hashCode = hashCode * -1521134295 + DocNum.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDate.GetHashCode();
            hashCode = hashCode * -1521134295 + DocDueDate.GetHashCode();
            hashCode = hashCode * -1521134295 + TaxDate.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <List <RDR1> > .Default.GetHashCode(Items);

            return(hashCode);
        }
Пример #12
0
        private DocEntry GetInfo(MemberReference type)
        {
            var     docId = DocIdHelper.GetXmlId(type);
            XmlNode doc2;

            cacheNodes.TryGetValue(docId, out doc2);

            var unManagedApi = GetTag(doc2, "unmanaged");

            if (unManagedApi == null)
            {
                return(null);
            }
            var unManagedShortApi = GetTag(doc2, "unmanaged-short");
            var msdnId            = GetTag(doc2, "msdn-id");

            var docEntry = new DocEntry(unManagedApi, unManagedShortApi, msdnId)
            {
                Summary = GetTag(doc2, "summary")
            };

            return(docEntry);
        }
Пример #13
0
        private void LoadNodesFromAssemblies()
        {
            foreach (var assembly in m_assemblies.Values)
            {
                DotNetDocumentation documentation = null;
                if (m_assembliesDocFile.ContainsKey(assembly))
                {
                    if (File.Exists(m_assembliesDocFile[assembly]))
                    {
                        documentation = DotNetDocumentation.Load(m_assembliesDocFile[assembly]);
                    }
                }

                foreach (var type in assembly.GetTypes())
                {
                    var fields = from field in type.GetFields(BindingFlags.GetField | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static)
                                 where field.GetCustomAttribute <VariableAttribute>() != null
                                 select field;

                    object instance = null;
                    if (m_instances.ContainsKey(type))
                    {
                        instance = m_instances[type];
                    }

                    foreach (var field in fields)
                    {
                        var node     = new XmlConfigNode(field);
                        var isStatic = field.IsStatic;

                        if (!isStatic)
                        {
                            if (instance != null)
                            {
                                node.Instance = instance;
                            }
                            else
                            {
                                throw new Exception(
                                          string.Format(
                                              "{0} is not static. Declare it static or bind an instance to the type {1}",
                                              field.Name, type.Name));
                            }
                        }
                        DocEntry member = null;
                        if (documentation != null)
                        {
                            member = documentation.Members.FirstOrDefault(entry => entry.Name == type.FullName + "." + field.Name);
                        }

                        if (member != null)
                        {
                            node.Documentation = member.Summary;
                        }

                        m_nodes.Add(node.Path, node);
                    }

                    var properties = from property in type.GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static)
                                     where property.GetCustomAttribute <VariableAttribute>() != null
                                     select property;

                    foreach (var property in properties)
                    {
                        var node     = new XmlConfigNode(property);
                        var isStatic = property.GetGetMethod().IsStatic;

                        if (!isStatic)
                        {
                            if (instance != null)
                            {
                                node.Instance = instance;
                            }
                            else
                            {
                                throw new Exception(
                                          string.Format(
                                              "{0} is not static. Declare it static or bind an instance to the type {1}",
                                              property.Name, type.Name));
                            }
                        }

                        DocEntry member = null;
                        if (documentation != null)
                        {
                            member = documentation.Members.FirstOrDefault(entry => entry.Name == type.FullName + "." + property.Name);
                        }

                        if (member != null)
                        {
                            node.Documentation = member.Summary;
                        }

                        m_nodes.Add(node.Path, node);
                    }
                }
            }
        }
Пример #14
0
        private Property LoadProperty(Annotation annotation, Context context, DocEntry entry, Property prop, DocumentLiteral doc)
        {
            foreach (DocEntry child in doc.GetEntries())
            {
                String name  = child.GetKey().ToString();
                Object value = child.GetValue();
                switch (name)
                {
                case "required":
                    if (value is BooleanLiteral)
                    {
                        prop.SetRequired(((BooleanLiteral)value).interpret(context) == BooleanValue.TRUE);
                        break;
                    }
                    throw new SyntaxError("Expected a Boolean value for 'required'.");

                case "help":
                    if (value is TextLiteral)
                    {
                        prop.SetHelp((String)((TextLiteral)value).getValue().GetStorableData());
                        break;
                    }
                    throw new SyntaxError("Expected a Text value for 'help'.");

                case "type":
                    if (value is TypeLiteral)
                    {
                        IType type = resolveType(annotation, context, (TypeLiteral)value);
                        if (type == null)
                        {
                            return(null);
                        }
                        prop.SetValidator(new TypeValidator(type));
                        break;
                    }
                    else if (value is DocumentLiteral)
                    {
                        PropertyMap embedded = LoadProperties(annotation, context, ((DocumentLiteral)value).GetEntries());
                        if (embedded != null)
                        {
                            prop.SetValidator(new TypeValidator(new PropertiesType(embedded)));
                            break;
                        }
                    }
                    throw new SyntaxError("Expected a Type value for 'type'.");

                case "types":
                    if (value is SetLiteral)
                    {
                        SetValue values = (SetValue)((SetLiteral)value).interpret(context);
                        if (values.ItemType is TypeType)
                        {
                            HashSet <IType> types = new HashSet <IType>();
                            foreach (IValue val in values.getItems())
                            {
                                if (val == NullValue.Instance)
                                {
                                    continue;
                                }
                                types.Add(resolveType(annotation, context, ((TypeValue)val).GetIType()));
                            }
                            if (types.Contains(null))
                            {
                                return(null);                        // TODO something went wrong
                            }
                            prop.SetValidator(new TypeSetValidator(types));
                            prop.SetRequired(types.Count == values.Length());                     // no null filtered out
                            break;
                        }
                    }
                    throw new SyntaxError("Expected a Set of types for 'types'.");

                case "values":
                    if (value is SetLiteral)
                    {
                        SetValue         values = (SetValue)((SetLiteral)value).interpret(context);
                        HashSet <String> texts  = new HashSet <String>();
                        foreach (IValue val in values.getItems())
                        {
                            if (val == NullValue.Instance)
                            {
                                continue;
                            }
                            texts.Add(val.GetStorableData().ToString());
                        }
                        prop.SetValidator(new ValueSetValidator(texts));
                        prop.SetRequired(texts.Count == values.Length());                 // no null filtered out
                        break;
                    }
                    throw new SyntaxError("Expected a Set value for 'values'.");

                default:
                    throw new SyntaxError("Unknown property attribute: " + name);
                }
            }
            return(prop);
        }
        private void GuardarRegistros()
        {
            TFunctions Reg;
            Int32      i;

            SAPbouiCOM.EditText oEditText;
            SAPbouiCOM.ComboBox oComboBox;
            String DocEntry, ProcNomE, ProcNomD, ProcNomR, ProcNomC, ProcNomL, ProcNomS, Hab, TipoDoc, CantLineas, ProcNomDe;
            Int32  _return = 0;

            try
            {
                Reg       = new TFunctions();
                Reg.SBO_f = FSBOf;

                oMtx.FlushToDataSource();
                i = 1;
                while (i <= oMtx.RowCount)
                {
                    oEditText = (EditText)(oMtx.Columns.Item("DocEntry").Cells.Item(i).Specific);
                    DocEntry  = (System.String)(oEditText.Value).Trim();

                    oEditText = (EditText)(oMtx.Columns.Item("ProcNomE").Cells.Item(i).Specific);
                    ProcNomE  = (System.String)(oEditText.Value).Trim();

                    oEditText = (EditText)(oMtx.Columns.Item("ProcNomD").Cells.Item(i).Specific);
                    ProcNomD  = (System.String)(oEditText.Value).Trim();

                    oEditText = (EditText)(oMtx.Columns.Item("ProcNomR").Cells.Item(i).Specific);
                    ProcNomR  = (System.String)(oEditText.Value).Trim();

                    oEditText = (EditText)(oMtx.Columns.Item("ProcNomC").Cells.Item(i).Specific);
                    ProcNomC  = (System.String)(oEditText.Value).Trim();

                    //oEditText = (EditText)(oMtx.Columns.Item("ProcNomDe").Cells.Item(i).Specific);
                    //ProcNomDe = (System.String)(oEditText.Value).Trim();

                    //oEditText = (EditText)(oMtx.Columns.Item("ProcNomL").Cells.Item(i).Specific);
                    //ProcNomL = (System.String)(oEditText.Value).Trim();

                    //oEditText = (EditText)(oMtx.Columns.Item("ProcNomS").Cells.Item(i).Specific);
                    //ProcNomS = (System.String)(oEditText.Value).Trim();

                    oComboBox = (ComboBox)(oMtx.Columns.Item("Habili").Cells.Item(i).Specific);
                    Hab       = oComboBox.Value;

                    oComboBox = (ComboBox)(oMtx.Columns.Item("TipoDoc").Cells.Item(i).Specific);
                    TipoDoc   = oComboBox.Value;

                    //oComboBox = (ComboBox)(oMtx.Columns.Item("TipoDocPE").Cells.Item(i).Specific);
                    //TipoDocPE = oComboBox.Value;

                    oEditText  = (EditText)(oMtx.Columns.Item("CantLineas").Cells.Item(i).Specific);
                    CantLineas = (System.String)(oEditText.Value).Trim();

                    oDBDSH.Clear();
                    oDBDSH.InsertRecord(0);
                    oDBDSH.SetValue("DocEntry", 0, DocEntry);
                    oDBDSH.SetValue("U_TipoDoc", 0, TipoDoc);
                    //oDBDSH.SetValue("U_TipoDocPE", 0, TipoDocPE);
                    oDBDSH.SetValue("U_Habili", 0, Hab);
                    oDBDSH.SetValue("U_ProcNomE", 0, ProcNomE);
                    oDBDSH.SetValue("U_ProcNomD", 0, ProcNomD);
                    oDBDSH.SetValue("U_ProcNomR", 0, ProcNomR);
                    oDBDSH.SetValue("U_ProcNomC", 0, ProcNomC);
                    //oDBDSH.SetValue("U_ProcNomDe", 0, ProcNomDe);
                    //oDBDSH.SetValue("U_ProcNomL", 0, ProcNomL);
                    //oDBDSH.SetValue("U_ProcNomS", 0, ProcNomS);
                    oDBDSH.SetValue("U_CantLineas", 0, CantLineas);


                    if (DocEntry.Trim() == "")
                    {
                        _return = Reg.FEPROCAdd(oDBDSH);
                    }
                    else
                    {
                        _return = Reg.FEPROCUpt(oDBDSH);
                    }

                    if (_return != 0)
                    {
                        oEditText       = (EditText)(oMtx.Columns.Item("DocEntry").Cells.Item(i).Specific);
                        oEditText.Value = _return.ToString();
                        FSBOApp.StatusBar.SetText("Se ha guardado regsitro Tipo Documento " + TipoDoc, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                    }
                    else
                    {
                        FSBOApp.StatusBar.SetText("No se ha guardado regsitro Tipo Documento " + TipoDoc, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    }

                    i++;
                }

                oMtx.FlushToDataSource();
                oMtx.AutoResizeColumns();

                if (_return > 0)
                {
                    oForm.Mode = BoFormMode.fm_OK_MODE;
                }
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin GuardarRegistro
        private void Guardar_Registros()
        {
            String CardCode;
            String CardName;
            String Activado;
            Int32  DocEntry;
            Int32  lRetCode;

            SAPbouiCOM.ProgressBar oProgressBar = null;

            oForm.Freeze(true);
            try
            {
                FSBOApp.StatusBar.SetText("Inicio de actualización lista negra", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                oProgressBar = FSBOApp.StatusBar.CreateProgressBar("Actualizando lista negra...", odt.Rows.Count, false);

                for (Int32 iCont_1 = 0; iCont_1 < odt.Rows.Count; iCont_1++)
                {
                    if (((System.String)odt.GetValue("U_CardCode", iCont_1)).Trim().Length > 0)
                    {
                        oDBDSHeader.Clear();
                        oDBDSHeader.InsertRecord(0);

                        DocEntry = ((System.Int32)odt.GetValue("DocEntry", iCont_1));
                        CardCode = ((System.String)odt.GetValue("U_CardCode", iCont_1)).Trim();
                        CardName = ((System.String)odt.GetValue("U_CardName", iCont_1)).Trim();
                        s        = ((System.String)odt.GetValue("U_Activado", iCont_1)).Trim();
                        if (s == "")
                        {
                            Activado = "N";
                        }
                        else
                        {
                            Activado = s;
                        }
                        oDBDSHeader.SetValue("U_CardCode", 0, CardCode);
                        oDBDSHeader.SetValue("U_CardName", 0, CardName);
                        oDBDSHeader.SetValue("U_Activado", 0, Activado);

                        if (DocEntry != 0)
                        {
                            oDBDSHeader.SetValue("DocEntry", 0, DocEntry.ToString());
                            lRetCode = Funciones.UpdDataSourceInt1("VID_FELISTANE", oDBDSHeader, "", null, "", null, "", null);
                        }
                        else
                        {
                            lRetCode = Funciones.AddDataSourceInt1("VID_FELISTANE", oDBDSHeader, "", null, "", null, "", null);
                        }

                        if (lRetCode == 0)
                        {
                            FSBOApp.StatusBar.SetText("No se ha actualizado proveedor " + CardCode, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                        else
                        {
                            FSBOApp.StatusBar.SetText("Se ha actualizado proveedor " + CardCode, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                    }
                    oProgressBar.Value = iCont_1 + 1;
                }
                oProgressBar.Value = oProgressBar.Maximum;

                oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE;
                CargarGrid();
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("Guardar_Registros: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
                oProgressBar.Stop();
                FSBOf._ReleaseCOMObject(oProgressBar);
            }
        }
Пример #17
0
        private DocEntry GetInfo(MemberReference type)
        {
            var docId = DocIdHelper.GetXmlId(type);
            XmlNode doc2;
            cacheNodes.TryGetValue(docId, out doc2);

            var unManagedApi = GetTag(doc2, "unmanaged");
            if (unManagedApi == null)
            {
                return null;
            }
            var unManagedShortApi = GetTag(doc2, "unmanaged-short");
            var msdnId = GetTag(doc2, "msdn-id");

            var docEntry = new DocEntry(unManagedApi, unManagedShortApi, msdnId) {Summary = GetTag(doc2, "summary")};
            return docEntry;
        }
Пример #18
0
 private string GetNativeLink(DocEntry value)
 {
     var shortApi = value.NativeShortApi ?? "???";
     var indexOfMethod = shortApi.IndexOf("::");
     if (indexOfMethod > 0)
     {
         shortApi = shortApi.Substring(indexOfMethod + 2);
     }
     return GetMsdnLink(shortApi, value.MsdnId);
 }