Example #1
0
    protected bool OnScan(IList <ScanResult> results, string relativeFolderPath, string stateFileName, string[] loginSubfolderPatterns, string loginFileName)
    {
        string mainFolder = AppArgs.GetArgString("-scan-main-folder", string.Empty);

        if (string.IsNullOrEmpty(mainFolder))
        {
            mainFolder = applicationDataPath.FullName;
        }
        else
        {
            mainFolder = Path.Combine(mainFolder, applicationDataPath.Name);
        }

        string rootFolder = Path.Combine(mainFolder, relativeFolderPath);

        return(ScanHelper.Scan(rootFolder, stateFileName, loginSubfolderPatterns, loginFileName, results));
    }
Example #2
0
        private void Rows_ItemOpened(object sender, SoaRowVM e)
        {
            if (!AppArgs.CanEditBankTransaction(true))
            {
                return;
            }

            var typ = e.DTO.DocRefType;

            if (typ == typeof(TransactionCrudVM).FullName)
            {
                Crud.EditCurrentRecord(e.DTO);
            }
            else if (typ == typeof(RequestedChequeDTO).FullName)
            {
                EditClearedDate(e.DTO);
            }
        }
Example #3
0
        public void Parse()
        {
            var args = new[] {
                "/gr:1271",
                "/inter:true",
                "/dtFrom:25.03.2014",
                "/dtTo:01.04.2014",
                "/manual:true"
            };
            var parsed = new AppArgs();

            Program.Parse(args, parsed);
            Assert.IsTrue(parsed.Manual);
            Assert.IsTrue(parsed.Interval);
            Assert.AreEqual(1271, parsed.ReportId);
            Assert.AreEqual("25.03.2014", parsed.From.ToShortDateString());
            Assert.AreEqual("01.04.2014", parsed.To.ToShortDateString());
        }
Example #4
0
        static void Main(string[] args)
        {
            var logger = new ConsoleLogger();

            CommandLineArguments clargs;

            try
            {
                clargs = args.As <CommandLineArguments>();
            }
            catch (ArgumentException ex)
            {
                logger.LogException(ex);

                Console.WriteLine();
                Console.WriteLine(AppArgs.HelpFor <CommandLineArguments>());
                return;
            }

            var weavers = FindWeavers(clargs);

            using (IInnerWeaver innerWeaver = new InnerWeaver())
            {
                // Default
                innerWeaver.KeyFilePath  = "";
                innerWeaver.SignAssembly = false;

                // Not from args
                innerWeaver.Logger  = logger;
                innerWeaver.Weavers = weavers.ToList();

                // From args
                innerWeaver.AssemblyFilePath          = clargs.AssemblyFilePath;
                innerWeaver.References                = clargs.References;
                innerWeaver.SolutionDirectoryPath     = clargs.SolutionDirectory;
                innerWeaver.IntermediateDirectoryPath = Path.GetDirectoryName(clargs.AssemblyFilePath);
                innerWeaver.DefineConstants           = clargs.DefineConstants.Split(';').ToList();
                innerWeaver.ProjectDirectoryPath      = clargs.ProjectDirectoryPath;

                innerWeaver.ReferenceCopyLocalPaths = clargs.ReferenceCopyLocalPaths?.Split(';').ToList();

                innerWeaver.Execute();
            }
        }
Example #5
0
        static AppArgs ProcessArgs(string[] args)
        {
            var result = new AppArgs();

            for (int i = 0; i < args.Length; i++)
            {
                var name = args[i];
                if (name == "-xml" && i + 1 < args.Length)
                {
                    var value = args[i + 1];
                    if (!string.IsNullOrEmpty(value))
                    {
                        result.Xml = value.Trim();
                    }
                }
            }

            return(result);
        }
Example #6
0
        protected override bool CanRunMainMethod()
        {
            if (!AppArgs.CanInputChequeDetails(false))
            {
                return(CantDo($"[{AppArgs.Credentials.Roles}] NOT authorized"));
            }

            if (!TryGetPickedItem(out FundRequestDTO dto))
            {
                return(CantDo("No selected item"));
            }

            if (!dto.Amount.HasValue)
            {
                return(CantDo("Requested Amount is blank"));
            }

            return(true);
        }
Example #7
0
        protected override void LoadRecordForEditing(PassbookRowDTO rec)
        {
            switch (rec.DocRefType)
            {
            case ByfBankMemoNode.TypeName:
            case PASSBOOKROW_TYPE:
                if (AppArgs.CanEditPassbookRow(true))
                {
                    CreateCrud().EditCurrentRecord(rec);
                }
                break;

            case "PassbookTally.DomainLib.DTOs.RequestedChequeDTO":
            case "RentLog.DomainLib11.DTOs.ChequeVoucherDTO":
                LaunchChequeVoucherViewer(rec);
                break;

            default: break;
            }
        }
Example #8
0
    static void Main(string[] args)
    {
        AssemblyName assemblyName = Assembly.GetExecutingAssembly().GetName();

        Console.WriteLine(string.Format("Welcome to {0} ({1})", assemblyName.Name, assemblyName.Version));

        AppArgs.Parse(args, log);

        FindBrowsers(browsers);
        string supportedBrowsers = string.Empty;

        for (int i = 0; i < browsers.Count; ++i)
        {
            if (i > 0)
            {
                supportedBrowsers += ", ";
            }
            supportedBrowsers += browsers[i].name;
        }
        Console.WriteLine("Found supported browsers: {0}", supportedBrowsers);

        List <BrowserScanResult> results = new List <BrowserScanResult>();

        Scan(results);

        if (results.Count == 0)
        {
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
            return;
        }

        int srcIndex  = SelectIndex("source index", results);
        int destIndex = SelectIndex("destination index", results);

        Copy(srcIndex, destIndex, results);

        Console.WriteLine("Press any key to exit...");
        Console.ReadKey();
    }
Example #9
0
        public List <AppReturn> get(string table, string key = "",
                                    string keyField          = "", string includedFields = "",
                                    string filter            = "", string sortFields     = "",
                                    string pageNumber        = "0", string pageSize      = "0",
                                    string requestConfig     = "", string fieldMap       = "")
        //string keyField = "")
        {
            //_g.CONFIG_FILE = "ngarbi.settings.json";
            // process request where all parameters are embedded in the Base64 querystring parameter "_p"

            // Add all parameters to the AppArgs object

            List <AppReturn> retVal = new List <AppReturn> {
            };

            if (isAppDebug)
            {
                return new List <AppReturn> {
                           DebugPath
                }
            }
            ;

            AppReturn appReturn = new AppReturn();

            if (table == "@gents")
            {
                // Generate client-side typescript files
                AppDataset.Initialize();

                appReturn.props.Add("Tables", AppDataset.AppTables.Count());
                appReturn.subsKey = "Hello Test Me!";

                appReturn.props.Add("Views", AppDataset.AppViews.Count());
                appReturn.props.Add("StoredProcedures", AppDataset.AppProcedures.Count());

                foreach (string tblCode in AppDataset.AppTables.Keys)
                {
                    DALTable tbl = AppDataset.AppTables[tblCode];
                    appReturn.processLogs.Add(tblCode, tbl.tableName);
                    appReturn.processLogs.Add(tblCode + "_relation", tbl.tableRelations == null ? "0" : tbl.tableRelations.Count.ToString());
                    foreach (string pv in tbl.tableProcessLogs.Keys)
                    {
                        appReturn.processLogs.Add(tblCode + "_proc_" + pv, tbl.tableProcessLogs[pv]);
                    }
                }

                //retVal.Add(appReturn); return retVal;
                return(new List <AppReturn> {
                    appReturn
                });
            }

            if (table == "@locs")
            {
                Stopwatch st = new Stopwatch();
                st.Start();
                string[] keyArr = key.Split('`');
                string   pCode  = "";

                if (keyArr.Length >= 2)
                {
                    pCode = keyArr[1];
                }

                DALData.DAL.BuildNodeLocation(Convert.ToInt32(keyArr[0]), pCode);
                appReturn.returnCode = table;
                st.Stop();
                appReturn.requestDuration = st.ElapsedMilliseconds;

                return(new List <AppReturn> {
                    appReturn
                });
            }
            if (table == "@mtbl")
            {
                // multi table query, accepts json formatted parameters supplied as
                // Base64 encoded querystring parameters named ?p=
                // api call <protocol>://<domain>[/application]/api/app/@mtbl?p=<base64 encoded parameters>
                return(new List <AppReturn> {
                    appReturn
                });
            }

            if (isAppDebugPaths)
            {
                return new List <AppReturn> {
                           DebugPath
                }
            }
            ;


            JObject jArgs = new JObject()
            {
            };

            // split "table" parameter to get the parent table code (first element) and from clause join codes (second element)
            string[] tableArr = table.Split('|');

            jArgs.Add("code", tableArr[0]);
            if (tableArr.Length > 1)
            {
                jArgs.Add("fromClauseExpr", tableArr[1]);
            }

            jArgs.Add("key", (key == "-" ? "" : key));
            jArgs.Add("keyField", (keyField == "-" ? "" : keyField));
            jArgs.Add("includedFields", (includedFields == "-" ? "" : includedFields));
            jArgs.Add("filter", (filter == "-" ? "" : filter));
            jArgs.Add("fieldMap", (filter == "-" ? "" : fieldMap));
            jArgs.Add("sortFields", (sortFields == "-" ? "" : sortFields));
            jArgs.Add("pageNumber", (!pageNumber.All(char.IsDigit) ? 0 : Convert.ToInt64(pageNumber)));
            jArgs.Add("pageSize", (!pageSize.All(char.IsDigit) ? 0 : Convert.ToInt64(pageSize)));
            jArgs.Add("requestConfig", (requestConfig == "-" ? "" : requestConfig));
            jArgs.Add("snapshot", _g.TKVBln(AppArgs, "snapshot"));
            jArgs.Add("distinct", _g.TKVBln(AppArgs, "distinct"));

            AppArgs.Add(_g.KEY_REQ_ARGS_ARR, new JArray()
            {
                jArgs
            });

            return(ExecuteGetRequest());
        }

        //public ReturnObjectExternal xxxxpostX(string table, [FromBody]JObject values)
        //{
        //    ReturnObject retVal = AppDataset.Post(table, values, AppArgs);
        //    return retVal.result;
        //}


        /**********************************************************************************************************
         *  Private Methods
         *********************************************************************************************************/

        //private JObject AppArgs()
        //{
        //    // Collect query string arguments and some headers ...

        //    JObject ret = new JObject();

        //    List<KeyValuePair<string, string>> retList = ControllerContext.Request.GetQueryNameValuePairs().ToList();

        //    // add request data/time stamp
        //    retList.Add(new KeyValuePair<string, string>(AppGlobals.KEY_REQUEST_STAMP, DateTime.Now.ToString()));

        //    //add content type
        //    if (this.Request.Content.Headers.Contains("Content-Type"))
        //    {
        //        ret.Add(new KeyValuePair<string, string>(AppGlobals.KEY_CONTENT_TYPE, this.Request.Content.Headers.ContentType.ToString().ToLower()));
        //    }

        //    foreach (KeyValuePair<string, string> arg in retList)
        //    {
        //        ret.Add(arg.Key, arg.Value);
        //    }
        //    return ret;
        //}
    }
}
Example #10
0
 private List <AppReturn> ProcessQParam()
 {
     // add JArray parameters to AppArgs with key _g.KEY_REQ_ARGS_ARR then process
     AppArgs.Add(_g.KEY_REQ_ARGS_ARR, DALGlobals.btoJA(_g.TKVStr(AppArgs, _g.KEY_QPARAM_JSON)));
     return(ExecuteGetRequest());
 }
Example #11
0
 public override bool CanEditRecord(LeaseDTO rec)
 => AppArgs.CanEditLease(false);
Example #12
0
 public override bool   CanEncodeNewDraft() => AppArgs.CanAddJournalVoucher(false);
Example #13
0
 public ConvertCtl(AppArgs appArgs, ConvertHandleBase converHandle)
 {
     Args          = appArgs;
     _converHandle = converHandle;
 }
Example #14
0
 protected override bool CanDeletetRecord(FundRequestDTO e) => AppArgs.CanDeleteVoucherRequest(true);
Example #15
0
 protected override bool   CanRunMainMethod() => AppArgs.CanAddLease(false);
Example #16
0
 public override bool CanEditRecord(SectionDTO rec)
 => AppArgs.CanEditSection(false);
Example #17
0
 protected override bool CanAddNewItem() => AppArgs.CanAddPassbookRow(false);
 protected override bool CanDeleteRecord(ChequeVoucherDTO rec)
 => AppArgs.CanDeletePreparedCheque(true);
Example #19
0
        public List <AppReturn> get(string table, string key = "",
                                    string keyField          = "", string includedFields = "",
                                    string filter            = "", string sortFields     = "",
                                    string pageNumber        = "0", string pageSize      = "0",
                                    string requestConfig     = "", string fieldMap       = "")
        //string keyField = "")
        {
            //_g.CONFIG_FILE = "ngarbi.settings.json";
            // process request where all parameters are embedded in the Base64 querystring parameter "_p"

            // Add all parameters to the AppArgs object

            List <AppReturn> retVal = new List <AppReturn> {
            };

            if (isAppDebug)
            {
                return new List <AppReturn> {
                           DebugPath
                }
            }
            ;

            AppReturn appReturn = new AppReturn();

            if (table == "@gents")
            {
                // Generate client-side typescript files
                AppDataset.Initialize();

                appReturn.props.Add("Tables", AppDataset.AppTables.Count());
                appReturn.subsKey = "Hello Test Me!";

                appReturn.props.Add("Views", AppDataset.AppViews.Count());
                appReturn.props.Add("StoredProcedures", AppDataset.AppProcedures.Count());

                foreach (string tblCode in AppDataset.AppTables.Keys)
                {
                    DALTable tbl = AppDataset.AppTables[tblCode];
                    appReturn.processLogs.Add(tblCode, tbl.tableName);
                    appReturn.processLogs.Add(tblCode + "_relation", tbl.tableRelations == null ? "0" : tbl.tableRelations.Count.ToString());
                    foreach (string pv in tbl.tableProcessLogs.Keys)
                    {
                        appReturn.processLogs.Add(tblCode + "_proc_" + pv, tbl.tableProcessLogs[pv]);
                    }
                }

                //retVal.Add(appReturn); return retVal;
                return(new List <AppReturn> {
                    appReturn
                });
            }

            if (table == "@locs")
            {
                Stopwatch st = new Stopwatch();
                st.Start();
                string[] keyArr = key.Split('`');
                string   pCode  = "";

                if (keyArr.Length >= 2)
                {
                    pCode = keyArr[1];
                }

                DALData.DAL.BuildNodeLocation(Convert.ToInt32(keyArr[0]), pCode);
                appReturn.returnCode = table;
                st.Stop();
                appReturn.requestDuration = st.ElapsedMilliseconds;

                return(new List <AppReturn> {
                    appReturn
                });
            }
            if (table == "@mtbl")
            {
                // multi table query, accepts json formatted parameters supplied as
                // Base64 encoded querystring parameters named ?p=
                // api call <protocol>://<domain>[/application]/api/app/@mtbl?p=<base64 encoded parameters>
                return(new List <AppReturn> {
                    appReturn
                });
            }

            if (isAppDebugPaths)
            {
                return new List <AppReturn> {
                           DebugPath
                }
            }
            ;


            JObject jArgs = new JObject()
            {
            };

            // split "table" parameter to get the parent table code (first element) and from clause join codes (second element)
            string[] tableArr = table.Split('|');

            jArgs.Add("code", tableArr[0]);
            if (tableArr.Length > 1)
            {
                jArgs.Add("fromClauseExpr", tableArr[1]);
            }

            jArgs.Add("key", (key == "-" ? "" : key));
            jArgs.Add("keyField", (keyField == "-" ? "" : keyField));
            jArgs.Add("includedFields", (includedFields == "-" ? "" : includedFields));
            jArgs.Add("filter", (filter == "-" ? "" : filter));
            jArgs.Add("fieldMap", (filter == "-" ? "" : fieldMap));
            jArgs.Add("sortFields", (sortFields == "-" ? "" : sortFields));
            jArgs.Add("pageNumber", (!pageNumber.All(char.IsDigit) ? 0 : Convert.ToInt64(pageNumber)));
            jArgs.Add("pageSize", (!pageSize.All(char.IsDigit) ? 0 : Convert.ToInt64(pageSize)));
            jArgs.Add("requestConfig", (requestConfig == "-" ? "" : requestConfig));
            jArgs.Add("snapshot", _g.TKVBln(AppArgs, "snapshot"));
            jArgs.Add("distinct", _g.TKVBln(AppArgs, "distinct"));

            AppArgs.Add(_g.KEY_REQ_ARGS_ARR, new JArray()
            {
                jArgs
            });

            return(ExecuteGetRequest());
        }
Example #20
0
 public QuickBookBalanceSheetConverter(
     AppArgs appArgs
     )
 {
     _appArgs = appArgs;
 }
Example #21
0
        static void Main(string[] args)
        {
            HSLColor  baseColour;
            PantsArgs appArgs;

            string inputFile;
            var    resolvedInputFilePath = ProgramFilesx86() + DefaultInputFile;

            // verify the input arguments
            var output = "Generic.xaml";

            try
            {
                appArgs   = args.As <PantsArgs>();
                inputFile = string.IsNullOrEmpty(appArgs.InputFile)
                                        ? resolvedInputFilePath
                                        : appArgs.InputFile;

                if (!string.IsNullOrEmpty(appArgs.OutputFile))
                {
                    output = appArgs.OutputFile;
                }

                baseColour = new HSLColor(appArgs.Colour);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine();
                Console.WriteLine(AppArgs.HelpFor <PantsArgs>());
                WaitForInput();

                return;
            }

            // check that the input file exists
            if (!File.Exists(inputFile))
            {
                Console.WriteLine("Default generic.xaml file '{0}' could not be found.", inputFile);
                Console.WriteLine("You must specify a value for the /inputfile parameter to continue.");
                Console.WriteLine("You can grab a version from https://raw.github.com/Code52/HAMMER/master/SampleData/generic.xaml and add it to this folder...");
                WaitForInput();

                return;
            }

            var doc        = XDocument.Load(inputFile);
            var dictionary = doc.Element(XamlPresentationNamespace + "ResourceDictionary");

            if (dictionary == null)
            {
                Console.WriteLine("Error: Input file '{0}' does not contain a resource dictionary", inputFile);
                WaitForInput();

                return;
            }

            var themeResources = (XElement)dictionary.FirstNode;

            foreach (var x in themeResources.Elements())
            {
                var brushKey = x.Attribute(XamlRootNamespace + "Key");
                if (brushKey == null)
                {
                    continue;
                }

                var key = brushKey.Value;
                if (key == "HighContrast")
                {
                    continue;
                }

                /* Generate dictionary code */
                if (appArgs.Generate)
                {
                    Console.WriteLine("{{\"{0}\", new Dictionary<string, double>{{", key);
                }

                foreach (var brush in Brushes[key])
                {
                    var y = x.Elements().FirstOrDefault(i => i.Attribute(XamlRootNamespace + "Key").Value == brush.Key);
                    if (y == null)
                    {
                        continue;
                    }

                    var attribute = y.Attribute("Color");
                    if (attribute == null)
                    {
                        continue;
                    }

                    /* Generate dictionary code */
                    if (appArgs.Generate)
                    {
                        var c = new HSLColor(attribute.Value.Substring(3));
                        Console.WriteLine("{{\"{0}\", {1}}},", brush, c.Luminosity - BaseLuminosity);
                    }

                    var newColour = new HSLColor(baseColour.Hue, baseColour.Saturation, baseColour.Luminosity + brush.Value);
                    attribute.SetValue(newColour.ToHex());
                }

                /* Generate dictionary code */
                if (appArgs.Generate)
                {
                    Console.WriteLine("}}");
                }
            }

            doc.Save(output);

            Console.WriteLine("Completed");
            Console.WriteLine("Output file is at '{0}'", Path.GetFullPath(output));
            Console.WriteLine("Press any key to finish");
            WaitForInput();
        }
Example #22
0
 public bool CanEditClearedDate()
 => PassbookRow != null && PassbookRepo != null &&
 AppArgs.CanEditClearedDate(false);
 protected override bool CanEncodeNewDraft()
 => AppArgs.CanAddBankTransaction(false);
Example #24
0
 protected override bool CanDeleteRecord(JournalVoucherDTO rec) => AppArgs.CanDeleteJournalVoucher(true);
Example #25
0
 public override bool CanEditRecord(StallDTO rec)
 => AppArgs.CanEditStall(true);
Example #26
0
 internal SoaRowsRepo1 GetSoaRepo()
 => AppArgs.GetPassbookDB(AccountId).GetSoaRepo();
Example #27
0
 public override bool   CanEncodeNewDraft() => AppArgs.CanAddCollector(false);
Example #28
0
 protected override bool CanEncodeNewDraft()
 => AppArgs.CanAddVoucherRequest(false);
Example #29
0
 public override bool CanEncodeNewDraft() => AppArgs.CanAddStall(false);
Example #30
0
 public override bool CanEditRecord(JournalVoucherDTO rec) => AppArgs.CanEditJournalVoucher(true);