Beispiel #1
0
        /// <summary>
        /// Returns the value of one of the text attributes from the input parameter of the given name.
        /// </summary>
        public string GetInputParameterText(EntityEnum entity, InputParameter inputParameter)
        {
            if (inputParameter == null)
            {
                return(string.Empty);
            }

            switch (entity)
            {
            case EntityEnum.Given:
                return((inputParameter.Given == null) ? string.Empty : inputParameter.Given);

            case EntityEnum.Name:
                return((inputParameter.Name == null) ? string.Empty : inputParameter.Name);

            case EntityEnum.Value:
                return((inputParameter.Text == null) ? string.Empty : inputParameter.Text);

            case EntityEnum.Condition:
                return((inputParameter.Condition == null) ? string.Empty : inputParameter.Condition);

            default:
                return(string.Empty);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sets the value of one of the text attributes in the input parameter of the given name.
        /// </summary>
        public void SetInputParameterText(EntityEnum entity, string parameterName, string text)
        {
            InputParameter inputParameter = GetInputParameter(parameterName);

            if (inputParameter == null)
            {
                return;
            }

            switch (entity)
            {
            case EntityEnum.Given:
                inputParameter.Given = text;
                break;

            case EntityEnum.Name:
                inputParameter.Name = text;
                break;

            case EntityEnum.Value:
                inputParameter.Text = text;
                break;

            case EntityEnum.Condition:
                inputParameter.Condition = text;
                inputParameter.ParseConditions();
                break;

            default:
                break;
            }
        }
        public User GetUserDetails(string userName, string password)
        {
            User user = null;

            try
            {
                StoredProcedure coreCustomerProcedure = new StoredProcedure("usp_GetUserDetails");

                coreCustomerProcedure.WithParameters(InputParameter.Named("UserName").WithValue(userName));
                coreCustomerProcedure.WithParameters(InputParameter.Named("Password").WithValue(password));

                using (IDataReader datareader = DataConnectionHelper.GetConnectionManager().ExecuteReader(coreCustomerProcedure))
                {
                    while (datareader.Read())
                    {
                        user = new User();

                        user.UserId   = datareader.GetInt64OrDefault("UserID");
                        user.UserName = datareader.GetStringOrDefault("Name");
                        user.Email    = datareader.GetStringOrDefault("Email");
                        user.RoleId   = datareader.GetInt64OrDefault("RoleId");
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(user);
        }
Beispiel #4
0
        private object CallMethod(object instance, MethodInfo method, IList <InputParameter> inputParameters)
        {
            ParameterInfo[] methodParameters = method.GetParameters();
            if (inputParameters.Count > methodParameters.Length)
            {
                throw new InvalidOperationException($"Mismatch parameters count. Input parameters count: {inputParameters.Count}. Method parameters count: {methodParameters.Length}. MethodCallTemplate: {MethodCallTemplate}");
            }

            ParameterInfo[] requiredParams = methodParameters.Where(p => !p.IsOptional).ToArray();
            if (inputParameters.Count < requiredParams.Length)
            {
                throw new InvalidOperationException($"Mismatch parameters count. Input parameters count: {inputParameters.Count}. Method required parameters count: {requiredParams.Length}. MethodCallTemplate: {MethodCallTemplate}");
            }

            object[] callParams = methodParameters.Select(p => p.HasDefaultValue() ? p.DefaultValue : null).ToArray();
            for (int i = 0; i < inputParameters.Count; i++)
            {
                InputParameter param = inputParameters[i];
                if (param.Type != null || param.Value == null)
                {
                    callParams[i] = param.Value;
                }
                else
                {
                    Type paramType = methodParameters[i].ParameterType;
                    callParams[i] = Convert.ChangeType(param.Value, paramType);
                }
            }
            return(method.Invoke(instance, callParams));
        }
Beispiel #5
0
        public void Ctor_WithUnknownType()
        {
            var target = new InputParameter <Tuple <string> >("@p1");

            //Assert
            target.DbType.Should().Be(DbType.Object);
        }
        public Parameter Map(InputParameter param)
        {
            var mapping = Register(param.Type);

            return(new Parameter {
                type = mapping.Type, format = mapping.Format, name = param.Name
            });
        }
Beispiel #7
0
        public void Ctor_WithName()
        {
            var target = new InputParameter <int>("@p1");

            //Assert
            target.Name.Should().Be("@p1");
            target.DbType.Should().Be(DbType.Int32);
        }
Beispiel #8
0
        public void Reschedule(InputParameter param)
        {
            var triggerKey = new TriggerKey(param.Trigger, param.Group);
            var oTrigger   = Scheduler.GetTrigger(triggerKey);
            var nTrigger   = oTrigger.GetTriggerBuilder().WithCronSchedule(param.CronExpression).Build();

            Scheduler.RescheduleJob(triggerKey, nTrigger);
        }
Beispiel #9
0
        public void Named_WithValidValue()
        {
            var expected = "@s1";

            var target = InputParameter.Named(expected).WithValue("");

            //Assert
            target.Name.Should().Be(expected);
        }
Beispiel #10
0
        public void WithValue_IsValid()
        {
            var expected = 40;

            var target = InputParameter.Named("@in1").WithValue(expected);

            //Assert
            target.Value.Should().Be(expected);
        }
        /// <summary>
        /// Refreshes the data fields for the specific input parameter.
        /// </summary>
        private void RefreshParameterData(string parameterName)
        {
            InputParameter inputParameter = model.GetInputParameter(parameterName);

            richTextBox7.Text = model.GetInputParameterText(EntityEnum.Given, inputParameter);
            textBox1.Text     = model.GetInputParameterText(EntityEnum.Name, inputParameter);
            textBox2.Text     = model.GetInputParameterText(EntityEnum.Value, inputParameter);
            richTextBox4.Text = model.GetInputParameterText(EntityEnum.Condition, inputParameter);
        }
Beispiel #12
0
        public ActionResult InputParameter(InputParameter testSpecification)
        {
            ViewBag.Message = "Your contact page.";
            //Save Specification
            InputParameter input = new InputParameter(testSpecification.Name, testSpecification.Text);

            //Redirect

            return(Redirect("/"));
        }
 public List<TaskHead> GetTaskList(InputParameter param)
 {
     List<TaskHead> taskList = new List<TaskHead>();
     param.CompanyId = userService.GetLoggdInUser().CompanyId;
     param.BranchId = userService.GetLoggdInUser().BranchId;
     List<ProTask> proTaskList = new List<ProTask>();
     
         proTaskList = taskRepositry.GetTasks(userService.GetLoggdInUser().CompanyId, userService.GetLoggdInUser().BranchId)
             .Where(ts =>  ts.DateOfStart.Value.Date < DateTime.Now.Date).ToList();
     }
Beispiel #14
0
        /// <summary>
        /// Edits the value of a parameter
        /// </summary>
        /// <param name="parameter"></param>
        /// <param name="value"></param>
        virtual public void EditItem(String parameter, object value)
        {
            AppAssert.AssertNotNull(parameter, "parameter");
            AppAssert.Assert(this.parameterList.Contains(parameter), "Parameter List does not contain this parameter", parameter);
            AppAssert.AssertNotNull(value, "value");

            InputParameter inputParameter = PropertyBagDictionary.Instance.GetProperty <InputParameter>(parameter);

            inputParameter.SetInputValue(value);
        }
 public Dashboard GetDashboardTaskCount(int dateType)
 {
     InputParameter param = new InputParameter
     {
         CompanyId = userService.GetLoggdInUser().CompanyId,
         BranchId = userService.GetLoggdInUser().BranchId,
         DateType = dateType
     };
     var dashboardData = taskRepositry.GetDashboardTaskCount(param);
     return (dashboardData != null) ? dashboardData : new Dashboard();
 }
Beispiel #16
0
        public void SetsDbNullWhenStringValueIsNull()
        {
            var toTest = new InputParameter("Foo", default(string), DbType.String);

            var res = toTest.CreateDbDataParameter(CreateCommand());

            res.DbType.Should().Be(DbType.String, "it was passed in the constructor");
            res.ParameterName.Should().Be("Foo", "it was passed in the constructor");
            res.Value.Should().Be(DBNull.Value, "DBNull.Value should be used for null values");
            res.Direction.Should().Be(ParameterDirection.Input, "it is an input parameter");
        }
Beispiel #17
0
        public void DbTypeInferredWhenNotSet()
        {
            var toTest = new InputParameter("Foo", 123M);

            var res = toTest.CreateDbDataParameter(CreateCommand());

            res.DbType.Should().Be(DbType.Decimal, "it should have been inferred");
            res.ParameterName.Should().Be("Foo", "it was passed in the constructor");
            res.Value.Should().Be(123M, "it was passed in the constructor");
            res.Direction.Should().Be(ParameterDirection.Input, "it is an input parameter");
        }
Beispiel #18
0
        /// <summary>
        /// This function redirect to the search function in the practitioner controller to perform search query in FHIR server passing in the practitionerId as the input parameter
        /// </summary>
        /// <param name="patientId"></param>
        /// <returns></returns>
        public async Task Search(InputParameter patientId)
        {
            SearchInProgress = true;
            NotifyStateChanged();

            Dashboard.FetchPatientList(
                await _http.GetFromJsonAsync <Dictionary <string, Patient> >($"/api/practitioner/{patientId.Value}"));
            Dashboard.ClearMonitor();
            SearchInProgress = false;
            NotifyStateChanged();
        }
        public List <Model.DtOrderModel> GetDeliveryListBySP(InputParameter param)
        {
            List <DtOrderModel> deliveryList   = new List <DtOrderModel>();
            DataSet             dsDeliveryData = GetData($"exec sp_phar_delivery_list {param.CompanyId},{param.BranchId},{param.Customer},'{param.FromDate}','{param.ToDate}',{param.DeliveryStatusType},'{param.SearchValue}',{param.PageNo},{param.PageSize},'{param.SortColumn}','{param.SortOrder}'", "Delivery");

            if (dsDeliveryData != null && dsDeliveryData.Tables.Count > 0)
            {
                deliveryList = dsDeliveryData.Tables[0].ToList <DtOrderModel>();
            }
            return(deliveryList);
        }
Beispiel #20
0
        public void SetsConstructorValuesOnParameter()
        {
            var toTest = new InputParameter("Foo", 123, DbType.Int32);

            var res = toTest.CreateDbDataParameter(CreateCommand());

            res.DbType.Should().Be(DbType.Int32, "it was passed in the constructor");
            res.ParameterName.Should().Be("Foo", "it was passed in the constructor");
            res.Value.Should().Be(123, "it was passed in the constructor");
            res.Direction.Should().Be(ParameterDirection.Input, "it is an input parameter");
        }
Beispiel #21
0
 /// <summary>
 /// This function set parameter as a new interval setting for the timer
 /// </summary>
 /// <param name="timeInput"></param>
 /// <returns></returns>
 public void SetTime(InputParameter timeInput)
 {
     try
     {
         t.Interval = 1000 * 60 * int.Parse(timeInput.Value);
     }
     catch (InvalidCastException e)
     {
         Console.WriteLine("Value must be an integer");
         throw;
     }
 }
 public Dashboard GetDashboardTaskCount(string startDate, string endDate)
 {
     InputParameter param = new InputParameter
     {
         CompanyId = userService.GetLoggdInUser().CompanyId,
         BranchId = userService.GetLoggdInUser().BranchId,
         FromDate = startDate,
         ToDate = endDate
     };
     var dashboardData = taskRepositry.GetDashboardTaskCount(param);
     return (dashboardData != null) ? dashboardData : new Dashboard();
 }
Beispiel #23
0
        public static User GetUser(this ConnectionManager source, int id)
        {
            var cmd = new AdhocQuery("SELECT Id, Name FROM Users where Id = @id").WithParameters(
                InputParameter.Named("id").WithValue(id)
                );

            return(source.ExecuteQueryWithResult(cmd,
                                                 r => new User(r.GetInt32OrDefault("Id"))
            {
                Name = r.GetStringOrDefault("Name")
            }));
        }
 public UnexplainedVarianceProportion(
     InputParameter input,
     OutputParameter output,
     AnalyticalExpression formula,
     WorkedPointsErrorValue error
     )
 {
     this.Input             = input;
     this.Output            = output;
     this.ModelFormula      = formula;
     this.WorkedPointsError = error;
 }
        public List <Dashboard> GetDriveryWiseDeliveries()
        {
            InputParameter param = new InputParameter
            {
                CompanyId = userService.GetLoggdInUser().CompanyId,
                BranchId  = userService.GetLoggdInUser().BranchId,
                UserId    = (userService.GetLoggdInUser().Role.ToLower().Equals("driver")) ? userService.GetLoggdInUser().UserId : -1
            };

            List <Dashboard> driverWiseSummary = deliveryRepository.GetDriverWiseSummary(param);

            return((driverWiseSummary != null) ? driverWiseSummary : new List <Dashboard>());
        }
Beispiel #26
0
        /// <summary>
        /// Returns the parameter's equivalence class object from the working specification
        /// that has the given name (otherwise null).
        /// </summary>
        public EquivalenceClass GetEquivalenceClass(string parameterName, string equivalenceClassName)
        {
            InputParameter inputParameter = GetInputParameter(parameterName);

            if ((inputParameter == null) ||
                (inputParameter.EquivalenceClasses == null) ||
                !inputParameter.EquivalenceClasses.ContainsKey(equivalenceClassName))
            {
                return(null);
            }

            return(inputParameter.EquivalenceClasses[equivalenceClassName]);
        }
Beispiel #27
0
        /// <summary>
        /// Deletes the input parameter from the specification and returns true if successful.
        /// </summary>
        public bool DeleteInputParameter(string parameterName)
        {
            InputParameter inputParameter = GetInputParameter(parameterName);

            if (inputParameter == null)
            {
                return(false);
            }

            workingTestSpecification.InputParameters.Remove(parameterName);
            workingTestSpecification.SpecificationDependencies.DeleteInputParameterReferences(parameterName);
            return(true);
        }
Beispiel #28
0
        public void CanMapSimpleNullableTypes(Type type, string expectedParamType, string expectedFormat = "")
        {
            var mapper     = new TypeMapper();
            var inputParam = new InputParameter {
                Type = type
            };
            var param = mapper.Map(inputParam);

            Assert.AreEqual(expectedParamType, param.type);
            Assert.AreEqual(expectedFormat, param.format);

            Assert.IsEmpty(mapper.Models);
        }
        public IActionResult GetTaskList(string startDate, string endDate, int taskStatusType)
        {
            List <TaskHead> taskList = new List <TaskHead>();
            InputParameter  param    = new InputParameter
            {
                FromDate       = startDate,
                ToDate         = endDate,
                TaskStatusType = taskStatusType
            };

            taskList = taskService.GetTaskList(param);
            return(PartialView("TaskListPartial", taskList));
        }
Beispiel #30
0
        /// <summary>
        /// Logs all inputs to the log file
        /// </summary>
        public void LogInputs()
        {
            InputParameter inputParameter = null;

            foreach (String parameter in parameterList)
            {
                inputParameter = this.FindItem(parameter);
                if (inputParameter.Valid && inputParameter.CanLogToFile)
                {
                    Trc.Log(Microsoft.VirtualManager.SetupFramework.LogLevel.Always, parameter);
                    Trc.Log(Microsoft.VirtualManager.SetupFramework.LogLevel.Always, inputParameter.InputValue.ToString());
                }
            }
        }
Beispiel #31
0
 /// <summary>
 /// Implements the constructor: InputParameter()
 /// Direct superclasses: global::MetaDslx.Soal.NamedElement, global::MetaDslx.Soal.TypedElement, global::MetaDslx.Soal.AnnotatedElement
 /// All superclasses: global::MetaDslx.Soal.NamedElement, global::MetaDslx.Soal.TypedElement, global::MetaDslx.Soal.AnnotatedElement
 /// </summary>
 public virtual void InputParameter(InputParameter @this)
 {
     this.NamedElement(@this);
     this.TypedElement(@this);
     this.AnnotatedElement(@this);
 }