public override global::System.Data.DataTable Clone()
            {
                InventoryDataTable cln = ((InventoryDataTable)(base.Clone()));

                cln.InitVars();
                return(cln);
            }
예제 #2
0
        private void UpdateInventoryDataTable()
        {
            try {
                string connectionString = ConfigurationManager.ConnectionStrings["db-connection"].ConnectionString;

                using (MySqlConnection connection = new MySqlConnection(connectionString)) {
                    connection.Open();

                    using (MySqlCommand command = new MySqlCommand("SELECT * FROM inventory")) {
                        using (MySqlDataAdapter inventoryDataAdapter = new MySqlDataAdapter()) {
                            command.Connection = connection;
                            inventoryDataAdapter.SelectCommand = command;

                            using (DataTable table = new DataTable()) {
                                inventoryDataAdapter.Fill(table);
                                InventoryDataTable.DataSource = table;
                                InventoryDataTable.DataBind();
                                InventoryDataTable.HeaderRow.Cells[0].Text = "SKU";
                                InventoryDataTable.HeaderRow.Cells[1].Text = "Description";
                                InventoryDataTable.HeaderRow.Cells[2].Text = "Quantity on Hand";
                                InventoryDataTable.HeaderRow.Cells[3].Text = "Weight";
                                InventoryDataTable.HeaderRow.Cells[4].Text = "Price";
                                InventoryDataTable.HeaderRow.Cells[5].Text = "Supplier ID";
                            }
                        }
                    }

                    connection.Close();
                }
            } catch (MySqlException err) {
                Response.Write("<script>alert('Connection was interrupted.');</script>");
            }
        }
예제 #3
0
 private void InitClass()
 {
     this.DataSetName             = "XMLCarsInventory";
     this.Prefix                  = "";
     this.EnforceConstraints      = true;
     this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
     this.tableInventory          = new InventoryDataTable();
     base.Tables.Add(this.tableInventory);
 }
예제 #4
0
 private void InitClass()
 {
     this.DataSetName        = "CarsDataSet";
     this.Prefix             = "";
     this.Namespace          = "http://tempuri.org/CarsDataSet.xsd";
     this.EnforceConstraints = true;
     this.tableInventory     = new InventoryDataTable();
     base.Tables.Add(this.tableInventory);
 }
 private void InitClass()
 {
     this.DataSetName             = "InventoryDataSet";
     this.Prefix                  = "";
     this.Namespace               = "http://tempuri.org/InventoryDataSet.xsd";
     this.EnforceConstraints      = true;
     this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
     this.tableInventory          = new InventoryDataTable();
     base.Tables.Add(this.tableInventory);
 }
 internal void InitVars(bool initTable)
 {
     this.tableInventory = ((InventoryDataTable)(base.Tables["Inventory"]));
     if ((initTable == true))
     {
         if ((this.tableInventory != null))
         {
             this.tableInventory.InitVars();
         }
     }
 }
예제 #7
0
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            _inventoryDataTable           = InventoryBLL.Current.GetInventory();
            DataGridInventory.ItemsSource = _inventoryDataTable;

            _chartData = (from i in _inventoryDataTable
                          orderby i.Status
                          group i by i.Status into grp
                          select new ChartData {
                Category = grp.Key, Value = grp.Count()
            }).ToList();

            RadLineSeries.ItemsSource = _chartData;
        }
예제 #8
0
        public int UpdateInventory(string inventoryId,
                                   string engineer,
                                   string name,
                                   string rawMaterial,
                                   string status,
                                   DateTime?developmentStartDate,
                                   DateTime?expectedCompletionDate,
                                   string supplyManagementContact,
                                   string notes,
                                   string imageSource)
        {
            var          inventoryDataTable = InventoryTableAdapter.GetInventoryByInventoryId(inventoryId);
            InventoryRow inventoryRow;

            bool isNewRecord = false;

            if (inventoryDataTable == null || inventoryDataTable?.Count == 0)
            {
                inventoryDataTable = new InventoryDataTable();
                inventoryRow       = inventoryDataTable.NewInventoryRow();
                isNewRecord        = true;
            }
            else
            {
                inventoryRow = inventoryDataTable.First();
            }

            inventoryRow.Id                      = inventoryId;
            inventoryRow.Engineer                = engineer;
            inventoryRow.Name                    = name;
            inventoryRow.RawMaterial             = rawMaterial;
            inventoryRow.Status                  = status;
            inventoryRow.SupplyManagementContact = supplyManagementContact;
            inventoryRow.Notes                   = notes;
            inventoryRow.ImageSource             = imageSource;

            inventoryRow.DevelopmentStartDate   = developmentStartDate.HasValue ? developmentStartDate.Value : DateTime.Today;
            inventoryRow.ExpectedCompletionDate = expectedCompletionDate.HasValue ? expectedCompletionDate.Value : DateTime.Today.AddMonths(1);

            if (isNewRecord)
            {
                inventoryDataTable.AddInventoryRow(inventoryRow);
            }

            return(InventoryTableAdapter.Update(inventoryDataTable));
        }
 internal InventoryRow(global::System.Data.DataRowBuilder rb) :
     base(rb)
 {
     this.tableInventory = ((InventoryDataTable)(this.Table));
 }