public void EmployeesWithAssets()
        {
            var source = new BindingSource();
            AssetsRepository   assetRepository = new AssetsRepository();
            List <AssetsModel> assetList       = assetRepository.GetAllEmployeeWithAssets(metroTextBox1.Text);

            source.DataSource = assetList;
            dg_employee_assets.Columns.Clear();
            dg_employee_assets.DataSource                      = source;
            dg_employee_assets.Columns["Id"].Visible           = false;
            dg_employee_assets.Columns["PropertyTag"].Visible  = false;
            dg_employee_assets.Columns["EmployeeId"].Visible   = false;
            dg_employee_assets.Columns["Price"].Visible        = false;
            dg_employee_assets.Columns["Items"].Visible        = false;
            dg_employee_assets.Columns["Quantity"].Visible     = false;
            dg_employee_assets.Columns["Serial"].Visible       = false;
            dg_employee_assets.Columns["DateAcquired"].Visible = false;



            DataGridViewButtonColumn btn = new DataGridViewButtonColumn();

            dg_employee_assets.Columns.Add(btn);
            btn.HeaderText = "View";
            btn.Text       = "View";
            btn.UseColumnTextForButtonValue = true;
            btn.Name = "btn";

            dg_employee_assets.ClearSelection();
        }
Example #2
0
 public void EmployeeAssets()
 {
     try {
         var source = new BindingSource();
         AssetsRepository   assetRepository = new AssetsRepository();
         List <AssetsModel> assetList       = assetRepository.GetEmployeeAssets(_employeeId);
         source.DataSource                           = assetList;
         dataGridView1.DataSource                    = source;
         dataGridView1.Columns["Id"].Visible         = false;
         dataGridView1.Columns["EmployeeId"].Visible = false;
         dataGridView1.Columns["Employee"].Visible   = false;
         dataGridView1.ClearSelection();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private void frm_preview_assets_Load(object sender, EventArgs e)
        {
            AssetsRepository assetRepository = new AssetsRepository();

            //EmployeeAssets1.SetParameterValue("emp_id", _employee_id);
            //EmployeeAssets1.SetDataSource(assetRepository.GetEmployeeAssets(_employee_id));
            var data = assetRepository.SelectAssetsPerEmployee(_employee_id);

            DataSet ds = new DataSet();

            ds.Tables.Add(data);

            if (ds.Tables[0].Rows.Count > 0)
            {
                EmployeeAssets1.SetParameterValue("emp_id", _employee_id);
                EmployeeAssets1.SetDataSource(ds.Tables[0]);
            }
            else
            {
                MessageBox.Show("No data.");
            }
        }
Example #4
0
        private bool PropertyTagIsAvailable()
        {
            AssetsRepository assetsRepository = new AssetsRepository();

            return(assetsRepository.CheckPropertyTagIfAvailable(txt_property_tag.Text));
        }