コード例 #1
0
        /// <summary>
        /// Handler for Product List
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnProduct_Click(object sender, RibbonControlEventArgs e)
        {
            BONorthwindFacade    bs          = new BONorthwindFacade();
            List <ProductEntity> productList = bs.GetProducts();
            frmProducts          form        = new frmProducts(productList);

            form.ShowDialog();
        }
コード例 #2
0
ファイル: Sheet1.cs プロジェクト: kurtzace/sampleexcelvsto
        private void Init_Customers()
        {
            try
            {
                BONorthwindFacade context   = new BONorthwindFacade();
                List <Customer>   Customers = context.GetCustomers();
                Excel1.Worksheet  ws        = Globals.ThisWorkbook.Worksheets["Customers"];

                //  ws.Name = "Schedules";
                Excel1.Range range = ws.Range["A1"];
                range.Value2 = "Customer_ID";
                range.Offset[0, 1].Value2 = "Company Name";
                range.Offset[0, 2].Value2 = "Address";
                range.Offset[0, 3].Value2 = "City";
                range.Offset[0, 4].Value2 = "Country";

                int rowIndex = 1;
                int colIndex = 0;

                foreach (Customer c in Customers)
                {
                    range.Offset[rowIndex, colIndex].Value2     = c.CustomerID;
                    range.Offset[rowIndex, colIndex + 1].Value2 = c.CompanyName;
                    range.Offset[rowIndex, colIndex + 2].Value2 = c.Address;
                    range.Offset[rowIndex, colIndex + 3].Value2 = c.City;
                    range.Offset[rowIndex, colIndex + 4].Value2 = c.Country;

                    rowIndex++;
                }

                range           = ws.Range["A1:E1"];
                range.Font.Bold = true;
                range           = ws.Range["A1:E1"];
                range.EntireColumn.AutoFit();
            }
            catch (Exception ex)
            {
                string message = "Error occured while populating the schedules and error is " + ex.ToString();
                Logger.Log.Error(message);

                throw ex;
            }
        }