Example #1
0
        //validate form and create record
        private void createAsset_button_Click(object sender, EventArgs e)
        {
            if (assetName_textBox.Text.Trim().Equals("") || assetId_textBox.Text.Trim().Equals("") || assetDescription_textBox.Text.Trim().Equals(""))
            {
                MessageBox.Show(this, "Please fill in all required details");
            }
            else
            {
                //creating object
                BusinessLayer.Asset asset = new BusinessLayer.Asset()
                {
                    Asset_id          = assetId_textBox.Text,
                    Asset_name        = assetName_textBox.Text,
                    Asset_description = assetDescription_textBox.Text,
                    asset_status      = "Available",
                    asset_type        = "normal"
                };

                //check if record was saved properly
                BusinessLayer.Classes.InventoryUtil Utils = new BusinessLayer.Classes.InventoryUtil();
                if (Utils.newAsset(asset))
                {
                    this.Close();
                }
            }
        }
Example #2
0
        public ViewAsset(BusinessLayer.Asset asset)
        {
            InitializeComponent();

            assetID_txt.Text          = asset.Asset_id;
            assetName_txt.Text        = asset.Asset_name;
            assetDescription_txt.Text = asset.Asset_description;
        }