Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves the first set of items specified by count by Quantity
        /// </summary>
        /// <param name="Quantity">Quantity value</param>
        /// <param name="count">Number of records to be retrieved</param>
        public System.Collections.Generic.List <Stock> SelectByQuantity(System.Int32?Quantity, int count)
        {
            var list = new System.Collections.Generic.List <Stock>();

            using (var command = EntityBase.CreateCommand(Transaction))
            {
                if (Quantity != null)
                {
                    command.CommandText = "SELECT TOP(" + count + ") * FROM Stock WHERE Quantity=@Quantity";                                        command.CommandText = "SELECT * FROM Stock WHERE Quantity=@Quantity";
                    command.Parameters.Add("@Quantity", System.Data.SqlDbType.Int);
                    command.Parameters["@Quantity"].Value = Quantity != null ? (object)Quantity : System.DBNull.Value;
                }
                else
                {
                    command.CommandText = "SELECT TOP(" + count + ") * FROM Stock WHERE Quantity IS NULL";
                }

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var item = new Stock();
                        item.Id          = (System.Int32?)(reader.IsDBNull(0) ? null : reader["Id"]);
                        item.ProductId   = (System.Int32?)(reader.IsDBNull(1) ? null : reader["ProductId"]);
                        item.Quantity    = (System.Int32?)(reader.IsDBNull(2) ? null : reader["Quantity"]);
                        item.LastUpdated = (System.DateTime?)(reader.IsDBNull(3) ? null : reader["LastUpdated"]);
                        list.Add(item);
                    }
                }
            }
            return(list.Count > 0 ? list : null);
        }
        // GET: Campaign/Edit/5
        public async Task <IActionResult> Edit(System.Int32?id)
        {
            var currentUser = await _userManager.GetCurrentUser(Context);

            if (currentUser == null)
            {
                return(new HttpUnauthorizedResult());
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }
            Campaign campaign = _dataAccess.GetCampaign((int)id);

            if (!await UserIsTenantAdminOfCampaign(currentUser, campaign))
            {
                return(new HttpUnauthorizedResult());
            }
            if (campaign == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            return(WithTenants(View(campaign)));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Delete(System.Int32?id)
        {
            var currentUser = await _userManager.GetCurrentUser(Context);

            if (currentUser == null || !await _userManager.IsTenantAdmin(currentUser))
            {
                return(new HttpUnauthorizedResult());
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            Activity activity = await Task.Run(() => _dataAccess.GetActivity((int)id));

            if (activity == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            if (!await UserIsTenantAdminOfActivity(currentUser, activity))
            {
                return(new HttpUnauthorizedResult());
            }

            return(View(activity));
        }
Ejemplo n.º 4
0
 public TimeInvariantInputDTO(
     System.Double p_Percentage_32_Public,
     System.Int32?p_SystemValue_32_of_32_Improvement_32_Affecting_32_All_32_Public)
 {
     Percentage_32_Public = p_Percentage_32_Public;
     SystemValue_32_of_32_Improvement_32_Affecting_32_All_32_Public = p_SystemValue_32_of_32_Improvement_32_Affecting_32_All_32_Public;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Retrieves the first set of items specified by count by Level
        /// </summary>
        /// <param name="Level">Level value</param>
        /// <param name="count">Number of records to be retrieved</param>
        public System.Collections.Generic.List <EnglishSentences> SelectByLevel(System.Int32?Level, int count)
        {
            var list = new System.Collections.Generic.List <EnglishSentences>();

            using (var command = EntityBase.CreateCommand(Transaction))
            {
                if (Level != null)
                {
                    command.CommandText = "SELECT TOP(" + count + ") * FROM EnglishSentences WHERE Level=@Level";
                    command.Parameters.Add("@Level", System.Data.SqlDbType.Int);
                    command.Parameters["@Level"].Value = Level != null ? (object)Level : System.DBNull.Value;
                }
                else
                {
                    command.CommandText = "SELECT TOP(" + count + ") * FROM EnglishSentences WHERE Level IS NULL";
                }

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var item = new EnglishSentences();
                        item.ID      = (System.Int32?)(reader.IsDBNull(0) ? null : reader["ID"]);
                        item.Content = (reader.IsDBNull(1) ? null : reader["Content"] as System.String);
                        item.Level   = (System.Int32?)(reader.IsDBNull(2) ? null : reader["Level"]);
                        list.Add(item);
                    }
                }
            }
            return(list.Count > 0 ? list : null);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Retrieves the first set of items specified by count by Id
        /// </summary>
        /// <param name="Id">Id value</param>
        /// <param name="count">Number of records to be retrieved</param>
        public System.Collections.Generic.List <Product> SelectById(System.Int32?Id, int count)
        {
            var list = new System.Collections.Generic.List <Product>();

            using (var command = EntityBase.CreateCommand(Transaction))
            {
                if (Id != null)
                {
                    command.CommandText = "SELECT TOP(" + count + ") * FROM Product WHERE Id=@Id";                                  command.CommandText = "SELECT * FROM Product WHERE Id=@Id";
                    command.Parameters.Add("@Id", System.Data.SqlDbType.Int);
                    command.Parameters["@Id"].Value = Id != null ? (object)Id : System.DBNull.Value;
                }
                else
                {
                    command.CommandText = "SELECT TOP(" + count + ") * FROM Product WHERE Id IS NULL";
                }

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var item = new Product();
                        item.Id          = (System.Int32?)(reader.IsDBNull(0) ? null : reader["Id"]);
                        item.PartNumber  = (reader.IsDBNull(1) ? null : reader["PartNumber"] as System.String);
                        item.Ean13       = (reader.IsDBNull(2) ? null : reader["Ean13"] as System.String);
                        item.Name        = (reader.IsDBNull(3) ? null : reader["Name"] as System.String);
                        item.Description = (reader.IsDBNull(4) ? null : reader["Description"] as System.String);
                        item.Rating      = (System.Decimal?)(reader.IsDBNull(5) ? null : reader["Rating"]);
                        list.Add(item);
                    }
                }
            }
            return(list.Count > 0 ? list : null);
        }
Ejemplo n.º 7
0
 public void Create(System.String Content, System.Int32?Level)
 {
     Create(new EnglishSentences
     {
         Content = Content,
         Level   = Level,
     });
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MovieSettings_GetRecord"/> class.
 /// </summary>
 public MovieSettings_GetRecord(System.Int32?ID,
                                System.String Name,
                                System.String Value,
                                System.String Description)
 {
     _ID          = ID;
     _Name        = Name;
     _Value       = Value;
     _Description = Description;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Delete records by Quantity
        /// </summary>
        /// <param name="Quantity">Quantity value</param>
        public int DeleteByQuantity(System.Int32?Quantity)
        {
            using (var command = EntityBase.CreateCommand(Transaction))
            {
                command.CommandText = "DELETE FROM [Stock] WHERE Quantity=@Quantity";
                command.Parameters.Add("@Quantity", System.Data.SqlDbType.Int);
                command.Parameters["@Quantity"].Value = Quantity != null ? (object)Quantity : System.DBNull.Value;

                return(command.ExecuteNonQuery());
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Delete records by Id
        /// </summary>
        /// <param name="Id">Id value</param>
        public int DeleteById(System.Int32?Id)
        {
            using (var command = EntityBase.CreateCommand(Transaction))
            {
                command.CommandText = "DELETE FROM [Product] WHERE Id=@Id";
                command.Parameters.Add("@Id", System.Data.SqlDbType.Int);
                command.Parameters["@Id"].Value = Id != null ? (object)Id : System.DBNull.Value;

                return(command.ExecuteNonQuery());
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Delete records by ID
        /// </summary>
        /// <param name="ID">ID value</param>
        public int DeleteByID(System.Int32?ID)
        {
            using (var command = EntityBase.CreateCommand(Transaction))
            {
                command.CommandText = "DELETE FROM [EnglishSentences] WHERE ID=@ID";
                command.Parameters.Add("@ID", System.Data.SqlDbType.Int);
                command.Parameters["@ID"].Value = ID != null ? (object)ID : System.DBNull.Value;

                return(command.ExecuteNonQuery());
            }
        }
 public TimeInvariantInputDTO(
     System.Int32?p_SystemEmployee_32_Cost_32_to_32_Replace,
     System.Int32?p_SystemEmployee_32_Productivity_32_Value,
     System.Double?p_SystemLabour_32_Cost_32_Per_32_hour,
     System.Int32?p_SystemValue_32_per_32_Candidate_32_Attracted)
 {
     SystemEmployee_32_Cost_32_to_32_Replace      = p_SystemEmployee_32_Cost_32_to_32_Replace;
     SystemEmployee_32_Productivity_32_Value      = p_SystemEmployee_32_Productivity_32_Value;
     SystemLabour_32_Cost_32_Per_32_hour          = p_SystemLabour_32_Cost_32_Per_32_hour;
     SystemValue_32_per_32_Candidate_32_Attracted = p_SystemValue_32_per_32_Candidate_32_Attracted;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Delete records by Level
        /// </summary>
        /// <param name="Level">Level value</param>
        public int DeleteByLevel(System.Int32?Level)
        {
            using (var command = EntityBase.CreateCommand(Transaction))
            {
                command.CommandText = "DELETE FROM [EnglishSentences] WHERE Level=@Level";
                command.Parameters.Add("@Level", System.Data.SqlDbType.Int);
                command.Parameters["@Level"].Value = Level != null ? (object)Level : System.DBNull.Value;

                return(command.ExecuteNonQuery());
            }
        }
Ejemplo n.º 14
0
        public int DeleteByLevel(System.Int32?Level)
        {
            var items = mockDataSource.Where(c => c.Level == Level);
            var count = 0;

            foreach (var item in new System.Collections.Generic.List <EnglishSentences>(items))
            {
                mockDataSource.Remove(item);
                count++;
            }
            return(count);
        }
Ejemplo n.º 15
0
 public TimeInvariantInputDTO(
     System.Double?p_SystemCall_32_Center_32_Cost,
     System.Double?p_SystemCall_32_Center_32_Cost_32_Per_32_Call,
     System.Int32?p_SystemContact_32_Center_32_Calls,
     System.Double?p_SystemLow_32_Effort_32_Customer_32_Value,
     System.Double?p_SystemSeconds_32_to_32_Close_32_Call)
 {
     SystemCall_32_Center_32_Cost = p_SystemCall_32_Center_32_Cost;
     SystemCall_32_Center_32_Cost_32_Per_32_Call = p_SystemCall_32_Center_32_Cost_32_Per_32_Call;
     SystemContact_32_Center_32_Calls            = p_SystemContact_32_Center_32_Calls;
     SystemLow_32_Effort_32_Customer_32_Value    = p_SystemLow_32_Effort_32_Customer_32_Value;
     SystemSeconds_32_to_32_Close_32_Call        = p_SystemSeconds_32_to_32_Close_32_Call;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Inserts a new record to the table without specifying the primary key
        /// </summary>
        /// <param name="ProductId">ProductId value</param>
        /// <param name="Quantity">Quantity value</param>
        /// <param name="LastUpdated">LastUpdated value</param>
        public void Create(System.Int32?ProductId, System.Int32?Quantity, System.DateTime?LastUpdated)
        {
            using (var command = EntityBase.CreateCommand(Transaction))
            {
                command.CommandText = "INSERT INTO [Stock] (ProductId, Quantity, LastUpdated)  VALUES (@ProductId, @Quantity, @LastUpdated)";

                command.Parameters.Add("@ProductId", System.Data.SqlDbType.Int);
                command.Parameters["@ProductId"].Value = ProductId != null ? (object)ProductId : System.DBNull.Value;
                command.Parameters.Add("@Quantity", System.Data.SqlDbType.Int);
                command.Parameters["@Quantity"].Value = Quantity != null ? (object)Quantity : System.DBNull.Value;
                command.Parameters.Add("@LastUpdated", System.Data.SqlDbType.DateTime);
                command.Parameters["@LastUpdated"].Value = LastUpdated != null ? (object)LastUpdated : System.DBNull.Value;
                command.ExecuteNonQuery();
            }
        }
Ejemplo n.º 17
0
 public TimeVariantInputDTO(
     System.Boolean p_Manufacturer_32_Support,
     System.Int32?p_Number_32_of_32_Assets,
     System.Double?p_POF,
     System.Boolean p_Self_32_Monitored,
     System.Boolean p_Standard_32_OS,
     CL.FormulaHelper.DTOs.TimePeriodDTO p_TimePeriod)
 {
     Manufacturer_32_Support = p_Manufacturer_32_Support;
     Number_32_of_32_Assets  = p_Number_32_of_32_Assets;
     POF = p_POF;
     Self_32_Monitored = p_Self_32_Monitored;
     Standard_32_OS    = p_Standard_32_OS;
     TimePeriod        = p_TimePeriod;
 }
        public IActionResult Delete(System.Int32?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            TodoItem todoItem = db.Todos.Single(m => m.Id == id);

            if (todoItem == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            return(View(todoItem));
        }
        // GET: Bike/Edit/5
        public IActionResult Edit(System.Int32?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            Bike bike = db.Bikes.Single(m => m.BikeId == id);

            if (bike == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            return(View(bike));
        }
Ejemplo n.º 20
0
        // GET: Campaign/Details/5
        public async Task <IActionResult> Details(System.Int32?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            Campaign campaign = _dataAccess.GetCampaign((int)id);

            if (campaign == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            return(View(campaign));
        }
Ejemplo n.º 21
0
        public IActionResult Delete(System.Int32?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            Country country = db.Countries.Single(m => m.Id == id);

            if (country == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            return(View(country));
        }
Ejemplo n.º 22
0
        // GET: Products/Details/5
        public IActionResult Details(System.Int32?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            Product product = db.Products.Single(m => m.ProductId == id);

            if (product == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            return(View(product));
        }
Ejemplo n.º 23
0
        public IActionResult Delete(System.Int32?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            Person person = db.Person.Single(m => m.ID == id);

            if (person == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            return(View(person));
        }
Ejemplo n.º 24
0
        public IActionResult Delete(System.Int32?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            Employee employee = _employeeRepository.Get(id);

            if (employee == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            return(View(employee));
        }
Ejemplo n.º 25
0
        // GET: Products/Edit/5
        public IActionResult Edit(System.Int32?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            Product product = db.Products.Single(m => m.ProductId == id);

            if (product == null)
            {
                return(new HttpStatusCodeResult(404));
            }

            ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "DisplayName", product.CategoryId);
            return(View(product));
        }
Ejemplo n.º 26
0
        //[Benchmark]
        public System.Int32?Additions_IntNull()
        {
            System.Int32?s = 0;
            System.Int32?d = 7;

            for (var cc = 0; cc < cycles; cc++)
            {
                s = 0;
                d = 7;

                for (var i = 0; i < count; i++)
                {
                    s += d;
                }
            }

            return(s);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Inserts a new record to the table without specifying the primary key
        /// </summary>
        /// <param name="Content">Content value</param>
        /// <param name="Level">Level value</param>
        public void Create(System.String Content, System.Int32?Level)
        {
            if (Content != null && Content.Length > 100)
            {
                throw new System.ArgumentException("Max length for Content is 100");
            }

            using (var command = EntityBase.CreateCommand(Transaction))
            {
                command.CommandText = "INSERT INTO [EnglishSentences] (Content, Level)  VALUES (@Content, @Level)";

                command.Parameters.Add("@Content", System.Data.SqlDbType.NVarChar);
                command.Parameters["@Content"].Value = Content != null ? (object)Content : System.DBNull.Value;
                command.Parameters.Add("@Level", System.Data.SqlDbType.Int);
                command.Parameters["@Level"].Value = Level != null ? (object)Level : System.DBNull.Value;
                command.ExecuteNonQuery();
            }
        }
Ejemplo n.º 28
0
        //-------------------------------------------------------------------------------------
        public override bool Equals(object obj)
        {
            BitField other = (obj as BitField);

            if (other != null)
            {
                return(this == other.Value);
            }

            System.Int32?i = (obj as System.Int32?);
            if (i != null)
            {
                if (!i.HasValue)
                {
                    return(false);
                }

                return(this == i.Value);
            }

            return(false);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Inserts a new record to the table specifying all fields
        /// </summary>
        /// <param name="Id">Id value</param>
        /// <param name="PartNumber">PartNumber value</param>
        /// <param name="Ean13">Ean13 value</param>
        /// <param name="Name">Name value</param>
        /// <param name="Description">Description value</param>
        /// <param name="Rating">Rating value</param>
        public void Create(System.Int32?Id, System.String PartNumber, System.String Ean13, System.String Name, System.String Description, System.Decimal?Rating)
        {
            if (PartNumber != null && PartNumber.Length > Product.PartNumber_Max_Length)
            {
                throw new System.ArgumentException("Max length for PartNumber is 100");
            }
            if (Ean13 != null && Ean13.Length > Product.Ean13_Max_Length)
            {
                throw new System.ArgumentException("Max length for Ean13 is 100");
            }
            if (Name != null && Name.Length > Product.Name_Max_Length)
            {
                throw new System.ArgumentException("Max length for Name is 100");
            }
            if (Description != null && Description.Length > Product.Description_Max_Length)
            {
                throw new System.ArgumentException("Max length for Description is 100");
            }

            using (var command = EntityBase.CreateCommand(Transaction))
            {
                command.CommandText = "INSERT INTO [Product] (Id, PartNumber, Ean13, Name, Description, Rating)  VALUES (@Id, @PartNumber, @Ean13, @Name, @Description, @Rating)";

                command.Parameters.Add("@Id", System.Data.SqlDbType.Int);
                command.Parameters["@Id"].Value = Id != null ? (object)Id : System.DBNull.Value;
                command.Parameters.Add("@PartNumber", System.Data.SqlDbType.NVarChar);
                command.Parameters["@PartNumber"].Value = PartNumber != null ? (object)PartNumber : System.DBNull.Value;
                command.Parameters.Add("@Ean13", System.Data.SqlDbType.NVarChar);
                command.Parameters["@Ean13"].Value = Ean13 != null ? (object)Ean13 : System.DBNull.Value;
                command.Parameters.Add("@Name", System.Data.SqlDbType.NVarChar);
                command.Parameters["@Name"].Value = Name != null ? (object)Name : System.DBNull.Value;
                command.Parameters.Add("@Description", System.Data.SqlDbType.NVarChar);
                command.Parameters["@Description"].Value = Description != null ? (object)Description : System.DBNull.Value;
                command.Parameters.Add("@Rating", System.Data.SqlDbType.Decimal);
                command.Parameters["@Rating"].Value = Rating != null ? (object)Rating : System.DBNull.Value;
                command.ExecuteNonQuery();
            }
        }
Ejemplo n.º 30
0
    public NeuralNetwork(System.UInt32[] Topology, System.Int32?Seed = 0)
    {
        // Validation checks
        if (Topology.Length < 2)
        {
            throw new System.ArgumentException("A Neural Network cannot contain less than 2 layers.", "Topology");
        }

        for (int i = 0; i < Topology.Length; i++)
        {
            if (Topology[i] < 1)
            {
                throw new System.ArgumentException("A single layer of neurons must contain at least, one neuron.", "Topology");
            }
        }

        //Initialise randomiser
        if (Seed.HasValue)
        {
            TheRandomiser = new System.Random(Seed.Value);
        }
        else
        {
            TheRandomiser = new System.Random();
        }

        // Set Topology
        TheTopology = new List <uint>(Topology).AsReadOnly();

        // Initialise sections
        Sections = new NeuralSection[TheTopology.Count - 1];

        // Set the sections
        for (int i = 0; i < Sections.Length; i++)
        {
            Sections[i] = new NeuralSection(TheTopology[i], TheTopology[i + 1], TheRandomiser);
        }
    }