Example #1
0
        public override int GetCodeReceipt(int parCodePeriod = 0)
        {
            if (parCodePeriod == 0)
            {
                parCodePeriod = Global.GetCodePeriod();
            }
            ParametersCollection parameters = new ParametersCollection();

            parameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            parameters.Add("parCodePeriod", parCodePeriod, DbType.Int32);



            this.db.ExecuteNonQuery(varSqlUpdateGenWorkPlace, parameters);
            DataTable varS = this.db.Execute(varSqlSelectGenWorkPlace, parameters);

            if (varS == null || varS.Rows.Count == 0)
            {
                this.db.ExecuteNonQuery(varSqlInsertGenWorkPlace, parameters);

                return(1);
            }
            else
            {
                return(Convert.ToInt32(varS.Rows[0][0]));
            }
        }
Example #2
0
        public int GetCodeEKKA(int parCodeWares, decimal parPrice)
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parCodeWares", parCodeWares, DbType.Int32);
            varParameters.Add("parPrice", (double)parPrice, DbType.Double);
            return(this.db.GetCodeEKKA(varParameters));
        }
Example #3
0
        public void SetDefaultClient()
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parId", GlobalVar.varDefaultCodeClient, DbType.Int32);
            varParameters.Add("parData", -1, DbType.Int32);
            varWDB.InsertT1(varParameters);
            SetClient(varWDB.FindClient().Rows[0]);
        }
Example #4
0
        /// <summary>
        /// Добавляє товар в базу
        /// </summary>
        /// <param name="parCodeWares">Код товару</param>
        /// <param name="parNameWares">Назва товару</param>
        /// <param name="parPrice">Ціна</param>
        /// <returns>Артикл ЕККА</returns>
        public int AddWaresDB(int parCodeWares, string parNameWares, decimal parPrice)
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parCodeWares", parCodeWares, DbType.Int32);
            varParameters.Add("parPrice", parPrice, DbType.Decimal);
            varParameters.Add("parCodeEKKA", ++this.varCodeEKKA, DbType.Int32);
            this.db.AddWaresEkka(varParameters);
            return(this.varCodeEKKA);
        }
Example #5
0
        /// <summary>
        /// Видаляємо товар з чека
        /// </summary>
        /// <param name="varTypeDelete"></param>
        public void DeleteWaresReceipt(TypeDeleteWaresReceipt varTypeDelete, int parCodeWares = 0, int parCodeUnit = 0)
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32);

            switch (varTypeDelete)
            {
            case TypeDeleteWaresReceipt.All:
                varParameters.Add("parCodeWares", 0, DbType.Int32);
                varParameters.Add("parCodeUnit", 0, DbType.Int32);
                break;

            case TypeDeleteWaresReceipt.Current:
                varParameters.Add("parCodeWares", varWares.varCodeWares, DbType.Int32);
                varParameters.Add("parCodeUnit", varWares.varCodeUnit, DbType.Int32);
                break;

            case TypeDeleteWaresReceipt.Choice:
                varParameters.Add("parCodeWares", parCodeWares, DbType.Int32);
                varParameters.Add("parCodeUnit", parCodeUnit, DbType.Int32);
                break;
            }
            varWDB.DeleteWaresReceipt(varParameters);
            //ViewWaresReceipt();
            Global.Log(CodeEvent.DeleteWaresReceipt, (int)varTypeDelete);
        }
Example #6
0
        public void GetPrice()
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parCodeDealer", varClient.varCodeDealer, DbType.Int32);
            varParameters.Add("parCodeWares", varWares.varCodeWares, DbType.Int32);
            varParameters.Add("parDiscount", varClient.varDiscount, DbType.Decimal);
            DataRow varDR = varWDB.GetPrice(varParameters);

            varWares.varPrice     = Convert.ToDecimal(varDR[0]);
            varWares.varTypePrice = Convert.ToInt32(varDR[1]);
        }
Example #7
0
        public void CanDetermineTableLookupValueFromQuestion()
        {
            var controller = new YamlScriptController();
            var result     = controller.Parse(YamlTestFileLoader.Load(@"TableTests.yaml"));

            Assert.False(result.IsError);
            var parameters = new ParametersCollection() as IParametersCollection;

            controller.QuestionCallback = (FormulaExpressionContext sender, QuestionArgs args) =>
            {
                Assert.True(args.Parameters[0].Name == "woonland");
                Assert.True(args.Parameters[0].Type == TypeInference.InferenceResult.TypeEnum.List);
                // This list can be used to do a selection of a valid woonland
                Assert.True(((List <object>)args.Parameters[0].Value).Count > 0);
                // Provide an anwser by selecting an item: Finland from the list
                parameters.Add(new ClientParameter(args.Parameters[0].Name,
                                                   ((List <object>)args.Parameters[0].Value)[1], TypeInference.InferenceResult.TypeEnum.List, "Dummy"));
            };
            var executionResult = new ExecutionResult(ref parameters) as IExecutionResult;

            try
            {
                var workflow = controller.ExecuteWorkflow(ref parameters, ref executionResult);
            }
            catch (UnresolvedException)
            {
                // The server lookup needs to be evaluated again to get the resulting woonlandfactor.
                // In this case the client will not need to have to answer another question.
                // Maybe this can be put in core, in order to make the client logic simpler.
                var evaluateAgain = controller.ExecuteWorkflow(ref parameters, ref executionResult);
            }
            Assert.True(parameters[0].Name == "woonland");
            Assert.True((string)parameters[0].Value == "Finland");
            Assert.True(parameters[1].Name == "woonlandfactor");
            Assert.True((double)parameters[1].Value == 0.7161);
            Assert.True(parameters[2].Name == "recht");
            Assert.True((bool)parameters[2].Value == true);

            // Quick Hack to see if recht is false by selecting woonland: Anders
            parameters.Clear();
            parameters.Add(new ClientParameter("woonland", "Anders", TypeInference.InferenceResult.TypeEnum.List, "Dummy"));
            var recalculate = controller.ExecuteWorkflow(ref parameters, ref executionResult);

            Assert.True(parameters[0].Name == "woonland");
            Assert.True((string)parameters[0].Value == "Anders");
            Assert.True(parameters[1].Name == "woonlandfactor");
            Assert.True((double)parameters[1].Value == 0);
            Assert.True(parameters[2].Name == "recht");
            Assert.True((bool)parameters[2].Value == false);
            Assert.NotNull(recalculate.Stacktrace.FindLast(p => p.IsStopExecution == true));
        }
Example #8
0
        public void SetClient(DataRow parRw)
        {
            varClient.SetClient(parRw);

            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32);
            varParameters.Add("parCodeClient", varClient.varCodeClient, DbType.Int32);
            varWDB.UpdateClient(varParameters);

            RecalcPrice();
            Global.Log(CodeEvent.SetClient, varClient.varCodeClient, 0, this.varClient.varNameClient);
        }
Example #9
0
        void SetClient(DataRow parRw)
        {
            varClient.SetClient(parRw);
            Client.Text = varClient.varNameClient;

            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32);
            varParameters.Add("parCodeClient", varClient.varCodeClient, DbType.Int32);
            varWDB.UpdateClient(varParameters);
            Bonus.Text = varClient.varSumMoneyBonus.ToString();
            RecalcPrice();
            Global.Log(CodeLog.SetClient, varClient.varCodeClient, 0, this.varClient.varNameClient);
        }
Example #10
0
 public void WriteSqlLog(string parQuery, ParametersCollection parParameters = null)
 {
     if (this.isWriteLogQvery)
     {
         string varParam = null;
         if (parParameters != null)
         {
             varParam = parParameters.ToJSON();
             ParametersCollection varParameters = new ParametersCollection();
             varParameters.Add("parCodeReceipt", GlobalVar.varReceipts[GlobalVar.varCurrentReceipt], DbType.Int32);
             varParameters.Add("parSQL", parQuery, DbType.String);
             varParameters.Add("parParam", varParam, DbType.String);
             this.varDB.ExecuteNonQuery(this.varSqlInsertvarDB, varParameters);
         }
     }
 }
Example #11
0
        public DataTable ViewWaresReceipt()
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32);
            DataTable varDtViewWaresReceipt = varWDB.ViewWaresReceipt(varParameters);
            object    sumObject;

            sumObject = varDtViewWaresReceipt.Compute("Sum(sum)", "");
            this.varReceipt.varSumReceipt = (sumObject.ToString() != "" ?   Math.Round(Convert.ToDecimal(sumObject), 2):0.0m);
            //this.varReceipt.varStSumReceipt = this.varReceipt.varSumReceipt.ToString();

            return(varDtViewWaresReceipt);
        }
Example #12
0
        void ViewWaresReceipt()
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32);
            varDtViewWaresReceipt = varWDB.ViewWaresReceipt(varParameters);
            object sumObject;

            sumObject = varDtViewWaresReceipt.Compute("Sum(sum)", "");

            this.varReceipt.varSumReceipt = (sumObject.ToString() != "" ?   Math.Round(Convert.ToDecimal(sumObject), 2):0.0m);
            Sum.Text         = this.varReceipt.varSumReceipt.ToString();
            Wares.DataSource = varDtViewWaresReceipt;
            Wares.Refresh();
        }
Example #13
0
        public override System.Data.DataTable GetAllPermissions(int parCodeUser)
        {
            ParametersCollection varParameters = new ParametersCollection();;

            varParameters.Add("parCodeUser", parCodeUser, DbType.Int32);
            DataTable varDT = this.db.Execute(this.varSqlGetAllPermissions, varParameters);

            return(varDT);
        }
Example #14
0
        public override TypeAccess GetPermissions(int parCodeUser, CodeEvent parEvent)
        {
            ParametersCollection varParameters = new ParametersCollection();;

            varParameters.Add("parCodeUser", parCodeUser, DbType.Int32);
            varParameters.Add("parCodeAccess", (int)parEvent, DbType.Int32);

            DataTable varDT = this.db.Execute(this.varSqlGetAllPermissions, varParameters);

            if (varDT != null && varDT.Rows.Count > 0)
            {
                return((TypeAccess)varDT.Rows[0][0]);
            }
            else
            {
                return(TypeAccess.No);
            }
        }
Example #15
0
        public void WriteReceipt()
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32);

            varParameters.Add("parStateReceipt", 1, DbType.Int32);
            varParameters.Add("parSumReceipt", varReceipt.varSumReceipt, DbType.Decimal);
            varParameters.Add("parVatReceipt", varReceipt.varVatReceipt, DbType.Decimal);

            varParameters.Add("parSumCash", varReceipt.varSumCash, DbType.Decimal);
            varParameters.Add("parSumCreditCard", varReceipt.varSumCreditCard, DbType.Decimal);
            varParameters.Add("parCodeCreditCard", varReceipt.varCodeCreditCard, DbType.Int64);
            varParameters.Add("parNumberSlip", varReceipt.varNumberSlip, DbType.Int64);
            varWDB.CloseReceipt(varParameters);
            Global.Log(CodeEvent.CloseReceipt);
        }
Example #16
0
        public static void InitTranslation()
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parLanguage", Convert.ToInt32(GlobalVar.varLanguage), DbType.Int32);
            DataTable varDt = varWDB.Translation(varParameters);

            varTranslation = new Translation();
            varTranslation.Load(varDt);
        }
Example #17
0
        private ParametersCollection GetCurrentBooleanParameter()
        {
            var result = new ParametersCollection();

            //get all parameter options
            foreach (var key in (_formElement.Data as IOptionsFormElementData).Options.Keys)
            {
                result.Add(new ClientParameter(key, key == _formElement.Data.Value ? "ja" : "nee", _formElement.Data.InferedType, SemanticKey));
            }

            return(result);
        }
Example #18
0
        public void Flow_ZorgToeslag_2019_Scenario1_Condition_Branche_Test()
        {
            var controller = new YamlScriptController();
            var result     = controller.Parse(YamlTestFileLoader.Load(@"Rijksoverheid/Zorgtoeslag.yaml"));
            var parameters = new ParametersCollection();

            parameters.Add(new ClientParameter("woonland", "Nederland", TypeInference.InferenceResult.TypeEnum.List, "Dummy"));
            //  var executionResult = controller.ExecuteWorkflow(parameters);
            // Tsjechië,            0.2412
            // context.Variables.Add("woonland", "Tsjechië");
            // var formula = controller.GetFormula("woonlandfactor");
        }
Example #19
0
        /// <summary>
        /// Performs the navigation to the given target
        /// </summary>
        /// <param name="target"></param>
        public void Navigate(NavigateMode mode, string target, params object[] args)
        {
            if (String.IsNullOrEmpty(target))
            {
                IShowMessageViewService showMessageService = ViewServiceLocator.GetViewService <IShowMessageViewService>();

                showMessageService.ButtonSetup = DialogButton.Ok;
                showMessageService.Caption     = "Warning";
                showMessageService.Text        = "Option not mapped to a view.";

                showMessageService.ShowMessage();

                return;
            }

            Application.Current.Dispatcher.BeginInvoke
            (
                DispatcherPriority.Background,
                new ThreadStart
                (
                    delegate
            {
                ParametersCollection navParams = null;
                string area = null;

                if (args != null && args.Length > 0)
                {
                    navParams = new ParametersCollection();
                    navParams.Add(NavigationParams.NavigationParamsKey, args);
                }

                var smnode = SiteMapService.SiteMap.RootNode.ChildNodes
                             .OfType <NavigationNode>()
                             .Traverse <NavigationNode>(node => ((node.ChildNodes) != null ? node.ChildNodes.OfType <NavigationNode>() : null))
                             .Where(n => n.Url == target).SingleOrDefault();

                if (smnode != null)
                {
                    area = smnode.SiteArea;
                }

                NavigationRequest request   = new NavigationRequest(target, navParams, area, mode);
                IDisposable navigationToken = nRoute.Navigation.NavigationService.Navigate(request);

                if (navigationToken != null)
                {
                    navigationToken.Dispose();
                    navigationToken = null;
                }
            }
                )
            );
        }
Example #20
0
        public override DataRow Login(string parLogin, string parPassword)
        {
            ParametersCollection parColl = new ParametersCollection();

            parColl.Add("parLogin", parLogin, DbType.String);
            parColl.Add("parPassWord", parPassword, DbType.String);

            DataTable dt = db.Execute(varSqlLogin, parColl);

            if (dt == null || dt.Rows.Count == 0)
            {
                //DataTable dt = new DataTable();
                //dt.Columns.Add("code_user", typeof(int));
                //dt.Columns.Add("name_user", typeof(string));
                //dt.Columns.Add("login", typeof(string));
                //dt.Columns.Add("password", typeof(string));
                dt.Rows.Add(-2, "Неправильний логін чи пароль", parLogin, parPassword);
                return(dt.Rows[0]);
            }
            return(dt.Rows[0]);
        }
Example #21
0
        void PrintReceipt()
        {
            //Друк чека!!!
            //varEKKA.p
            //Збереження роздукованого чека
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32);

            varParameters.Add("parStateReceipt", 1, DbType.Int32);
            varParameters.Add("parSumReceipt", varReceipt.varSumReceipt, DbType.Decimal);
            varParameters.Add("parVatReceipt", varReceipt.varVatReceipt, DbType.Decimal);

            varParameters.Add("parSumCash", varReceipt.varSumCash, DbType.Decimal);
            varParameters.Add("parSumCreditCard", varReceipt.varSumCreditCard, DbType.Decimal);
            varParameters.Add("parCodeCreditCard", varReceipt.varCodeCreditCard, DbType.Int64);
            varParameters.Add("parNumberSlip", varReceipt.varNumberSlip, DbType.Int64);
            varWDB.CloseReceipt(varParameters);
            Global.Log(CodeLog.CloseReceipt);
            NewReceipt();             //Відкримаємо новий чек.
        }
Example #22
0
        public override DataRow GetGlobalVar(int parIdWorkPlace)
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkPlace", parIdWorkPlace, DbType.Int32);
            DataTable varDT = this.db.Execute(this.varSqlInitGlobalVar, varParameters);

            if (varDT != null && varDT.Rows.Count > 0)
            {
                return(varDT.Rows[0]);
            }
            else
            {
                return(null);
            }
        }
Example #23
0
        public override object GetConfig(string parStr)
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parNameVar", parStr, DbType.String);
            DataTable varDT = this.db.Execute(this.varSqlConfig, varParameters);

            if (varDT != null && varDT.Rows.Count > 0)
            {
                return(varDT.Rows[0][0]);
            }
            else
            {
                return(null);
            }
        }
Example #24
0
        /// <summary>
        /// Відновлює чеки на основі LogSQL
        /// </summary>
        /// <param name="parCodeReceipt">Код Чека</param>
        /// <param name="parDB">база в яку відновлювати</param>
        public void RectoreReceipt(Int32 parCodeReceipt, WDB parDB)
        {
            ParametersCollection varParameters = new ParametersCollection();
            string varSQL, varParam;

            varParameters.Add("parCodeReceipt", parCodeReceipt, DbType.Int32);
            DataTable varDT = varDB.Execute(varSqlSelectvarDB, varParameters);

            foreach (DataRow row in varDT.Rows)
            {
                varParameters = new ParametersCollection();
                varSQL        = Convert.ToString(row["SQL"]);
                varParam      = Convert.ToString(row["PARAM"]);
                varParameters.AddJSON(varParam);
                parDB.ExecuteNonQuery(varSQL, varParameters);
            }
        }
        private void MatchCatchAll(ContentPathSegment contentPathSegment, IEnumerable <string> remainingRequestSegments,
                                   ParametersCollection defaultValues, ParametersCollection matchedValues)
        {
            object obj2;
            string str = string.Join(string.Empty, remainingRequestSegments.ToArray <string>());
            ParameterSubsegment subsegment = contentPathSegment.Subsegments[0] as ParameterSubsegment;

            if (str.Length > 0)
            {
                obj2 = str;
            }
            else
            {
                defaultValues.TryGetValue(subsegment.ParameterName, out obj2);
            }
            matchedValues.Add(subsegment.ParameterName, obj2);
        }
Example #26
0
        public void NewReceipt()
        {
            varClient.Clear();
            SetDefaultClient();
            varReceipt.SetReceipt(varWDB.GetCodeReceipt());


            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", varReceipt.varCodeReceipt, DbType.Int32);
            varParameters.Add("parDateReceipt", varReceipt.varDateReceipt, DbType.DateTime);
            varParameters.Add("parCodeWarehouse", GlobalVar.varCodeWarehouse, DbType.Int32);
            varParameters.Add("parCodePattern", varReceipt.varCodePattern, DbType.Int32);
            varParameters.Add("parCodeClient", varClient.varCodeClient, DbType.Int32);
            varParameters.Add("parNumberCashier", varUser.varCodeUser, DbType.Int32);
            varParameters.Add("parUserCreate", varUser.varCodeUser, DbType.Int32);

            varWDB.AddReceipt(varParameters);

            Global.Log(CodeEvent.NewReceipt, varReceipt.varCodePeriod, varReceipt.varCodeReceipt, varReceipt.varDateReceipt.ToString());
        }
Example #27
0
        private void Config()
        {
            ParametersCollection.Add(ObjectDistanceLabel);
            ParametersCollection.Add(ObjectDistanceTextBox);

            ParametersCollection.Add(ObjectSpeedLabel);
            ParametersCollection.Add(ObjectSpeedTextBox);

            ParametersCollection.Add(SignalSpeedLabel);
            ParametersCollection.Add(SignalSpeedTextBox);

            ParametersCollection.Add(MomentInTimeLabel);
            ParametersCollection.Add(MomentInTimeTextBox);


            ResultsCollection.Add(ResultDistanceLabel);
            ResultsCollection.Add(ResultDistanceTextBox);
        }
Example #28
0
        /// <summary>
        /// Власне шукає товар/клієнта.
        /// </summary>
        /// <param name="parStr"></param>
        void FindData(string parStr)
        {
            RezultFind varRezult = varWork.varWDB.FindData(parStr);

            Global.Log(CodeEvent.Find, (int)varRezult.TypeFind, varRezult.Count, parStr);

            if (varRezult.Count == 0)
            {
                Message("Нічого не знайшли!!!");
                return;
            }


            switch (varRezult.TypeFind)
            {
            case  TypeFind.Wares:                     //Товар
                ParametersCollection varParameters = new ParametersCollection();
                varParameters.Add("parDiscount", varWork.varClient.varDiscount, DbType.Int32);
                varDtWares = varWork.varWDB.FindWares(varParameters);

                if (varDtWares.Rows.Count == 1)
                {
                    varWork.varWares.SetWares(varDtWares.Rows[0]);
                    EditQuantity();
                }
                else
                {
                    ChoiceWares(varDtWares);
                }
                break;

            case TypeFind.Client:                     //Клієнт
                if (varRezult.Count > 1)
                {
                    ChoiceClient();
                }
                else
                {
                    SetClient(varWork.varWDB.FindClient().Rows[0]);
                }
                break;
            }
            Input.Text = "";
        }
Example #29
0
        public IParametersCollection GetParametersToSend(int step)
        {
            var result = new ParametersCollection();
            //for each item up till the current step get the parameter that corresponds with the items parameterName and key
            //for instance step 3; give paramaters for step 1 and 2 (item 0 and 1)...
            //...i.e. the first 2 items; number to take = 3 - 1
            var steps = Steps.ToList().GetRange(0, Math.Max(0, Math.Min(Parameters.Count(), step - 1)));

            steps.ForEach(s =>
            {
                foreach (var p in Parameters)
                {
                    if (s.IsMatch(p))
                    {
                        result.Add(p);
                    }
                }
            });
            return(result);
        }
Example #30
0
 public ParametersBase(string source)
 {
   if (String.IsNullOrEmpty(source)) return;
   _Source = source;
   int typeTail = source.IndexOf(";");
   if (typeTail == -1)
   {
     _Type = source;
     return;
   }
   _Type = source.Substring(0, typeTail);
   string p = source.Substring(typeTail + 1, source.Length - typeTail - 1);
   _Parameters = new ParametersCollection();
   Regex myReg = new Regex(@"(?<key>.+?)=((""(?<value>.+?)"")|((?<value>[^\;]+)))[\;]{0,1}", RegexOptions.Singleline);
   MatchCollection mc = myReg.Matches(p);
   foreach (Match m in mc)
   {
     if (!_Parameters.ContainsKey(m.Groups["key"].Value))
     {
       _Parameters.Add(m.Groups["key"].Value.Trim(), m.Groups["value"].Value);
     }
   }
 }
Example #31
0
        public bool ReturnLastReceipt(int parIdWorkPlace, int parCodePeriod, int parCodeReceipt)
        {
            ParametersCollection varParameters = new ParametersCollection();

            varParameters.Add("parIdWorkplace", parIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriod", parCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceipt", parCodeReceipt, DbType.Int32);
            varParameters.Add("parIdWorkplaceReturn", GlobalVar.varIdWorkPlace, DbType.Int32);
            varParameters.Add("parCodePeriodReturn", varReceipt.varCodePeriod, DbType.Int32);
            varParameters.Add("parCodeReceiptReturn", varReceipt.varCodeReceipt, DbType.Int32);
            varParameters.Add("parUserCreate", varUser.varCodeUser, DbType.Int32);

            if (GlobalVar.varIdWorkPlace == parIdWorkPlace)
            {
                if (parCodePeriod != varReceipt.varCodePeriod)
                {
                    string varReceiptFile = GlobalVar.varPathDB + parCodePeriod.ToString().Substring(0, 6) + @"\Rc_" + parIdWorkPlace.ToString() + "_" + parCodePeriod.ToString() + ".db";
                    if (File.Exists(varReceiptFile))
                    {
                        varWDB.ExecuteNonQuery("ATTACH '" + varReceiptFile + "' AS rrc");
                        bool varRez = varWDB.CopyWaresReturnReceipt(varParameters);
                        varWDB.ExecuteNonQuery("DETACH DATABASE rrc");
                        return(varRez);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(varWDB.CopyWaresReturnReceipt(varParameters));
                }
            }
            else              // Якщо інше робоче місце
            {
                //return false;
            }
            return(false);
        }
Example #32
0
        /// <summary>
        /// Performs the navigation to the given target
        /// </summary>
        /// <param name="target"></param>
        public void Navigate(NavigateMode mode, string target, params object[] args)
        {
            if (String.IsNullOrEmpty(target))
            {
                IShowMessageViewService showMessageService = ViewServiceLocator.GetViewService<IShowMessageViewService>();

                showMessageService.ButtonSetup  = DialogButton.Ok;
                showMessageService.Caption      = "Warning";
                showMessageService.Text         = "Option not mapped to a view.";

                showMessageService.ShowMessage();

                return;
            }

            Application.Current.Dispatcher.BeginInvoke
            (
                DispatcherPriority.Background,
                new ThreadStart
                (
                    delegate
                    {
                        ParametersCollection    navParams   = null;
                        string                  area        = null;

                        if (args != null && args.Length > 0)
                        {
                            navParams = new ParametersCollection();
                            navParams.Add(NavigationParams.NavigationParamsKey, args);
                        }

                        var smnode = SiteMapService.SiteMap.RootNode.ChildNodes
                            .OfType<NavigationNode>()
                            .Traverse<NavigationNode>(node => ((node.ChildNodes) != null ? node.ChildNodes.OfType<NavigationNode>() : null))
                            .Where(n => n.Url == target).SingleOrDefault();

                        if (smnode != null)
                        {
                            area = smnode.SiteArea;
                        }

                        NavigationRequest   request         = new NavigationRequest(target, navParams, area, mode);
                        IDisposable         navigationToken = nRoute.Navigation.NavigationService.Navigate(request);

                        if (navigationToken != null)
                        {
                            navigationToken.Dispose();
                            navigationToken = null;
                        }
                    }
                )
            );
        }