Building the Contoso Auto Sales Office Business Application Part 1.docx

上传人:b****5 文档编号:5126828 上传时间:2022-12-13 格式:DOCX 页数:54 大小:566.93KB
下载 相关 举报
Building the Contoso Auto Sales Office Business Application Part 1.docx_第1页
第1页 / 共54页
Building the Contoso Auto Sales Office Business Application Part 1.docx_第2页
第2页 / 共54页
Building the Contoso Auto Sales Office Business Application Part 1.docx_第3页
第3页 / 共54页
Building the Contoso Auto Sales Office Business Application Part 1.docx_第4页
第4页 / 共54页
Building the Contoso Auto Sales Office Business Application Part 1.docx_第5页
第5页 / 共54页
点击查看更多>>
下载资源
资源描述

Building the Contoso Auto Sales Office Business Application Part 1.docx

《Building the Contoso Auto Sales Office Business Application Part 1.docx》由会员分享,可在线阅读,更多相关《Building the Contoso Auto Sales Office Business Application Part 1.docx(54页珍藏版)》请在冰豆网上搜索。

Building the Contoso Auto Sales Office Business Application Part 1.docx

BuildingtheContosoAutoSalesOfficeBusinessApplicationPart1

BuildingtheContosoAutoSalesOfficeBusinessApplicationPart1

BuildingtheContosoAutoSalesOfficeBusinessApplicationPart1-SchedulingCustomerAppointments

RobertGreen

MCWTechnologies

DownloadthecodeforthistutorialonCodeGallery

Introduction

ContosoAutoSalesisafictitiousautomobiledealerspecializinginhigh-endautomobiles.Contosohascomputersystemstotalktosuppliers,togenerateaninvoicewhenacustomerpurchasesanautomobile,tobillforservicevisitsandtopayemployees.Itwantsasystemtomanagetheday-to-dayinteractionwithcustomersandimproveitslevelofpre-salescustomerservice.

ContosoAutowouldlikeasolutionbasedonOffice2007thataddressesthefollowingscenarios:

•ThesalesmanagerneedstocontactcustomerswhohaverequestedanappointmentbycallingContosoorvisitingtheWebsite.ShewantstosendamailacknowledgingtheappointmentrequestandthenscheduleappointmentsusingOutlook.

•SalesconsultantswanttouseWordtocreateandprintpricequotesforautomobiles,reflectingavailableoptionsselectedbyacustomer.

•ThefinancingmanagerwantstouseExceltogeneratefinancinginformationforcustomerswithpendingquotes.Hewantstheabilitytogeneratethisinformationinteractively,butalsowantsitcreatedautomaticallywhenthesalesconsultantgeneratesaquote.

•ThesalesmanagerwantstouseExceltorunreportsshowingquotesbymanufacturer,model,customerandemployee.Shewantstoviewreportsofflineonherlaptopandwantsthereportsautomaticallyupdatedwithuptodateinformation.

Inthistutorialseries,youwilluseVisualStudio2008tocreateanOfficeBusinessApplicationthataddresseachofthescenarioslistedabove,usingOutlook2007,Word2007andExcel2007.ThetutorialscontainbothVisualBasicandC#code.

Exercise1:

CreatetheOutlookAdd-inProject

PotentialcustomerscanrequestanappointmentbyvisitingtheContosoWebsiteorbycallingContosodirectly.TheonusisnowonContosotocontactthatcustomerandscheduleadayandtimetomeetwithasalesconsultant.Notrespondingmeanslostopportunitiesforsales.

ContosowantstouseOutlooktorespondtoandschedulecustomerrequestsforappointments.Thesalesmanagerwantstorespondviaemailtoletthecustomerknowshehasreceivedtheappointmentrequestandwillcontactthecustomer.Shewillthencallthecustomertoarrangeforanappointmentwithasalesconsultant.

Inthistutorial,youwillcreateanOutlook2007customerappointmentmanagementsolution.YouwilladdthefollowingcapabilitiestoOutlook:

•Theabilitytosendanemailtoallofthecustomerswhohaverequestedappointments.

•Theautomaticcreationoffollow-uptasksforeachcustomerwhorequestedanappointment.

•Theabilitytoauto-fillmeetingrequestswithcustomerandsalesrepinformationandsendthecustomeraconfirmationemail.

Togetstarted,inVisualStudio2008selectFile|New|ProjecttodisplaytheNewProjectdialogbox.Inthelistofprojecttypes,expandtheOfficenode.SelectVersion2007,displayingthelistoftemplatesshowninFigure1.

Figure1.VisualStudio2008providestheseOffice2007templates.

IntheTemplatespane,selectOutlook2007Add-in.NameyourprojectCustomerAppointmentsandselectanappropriatefolderfortheproject.ClickOKtocreatetheproject.

Youradd-inwillworkwithdatathatresidesintheContosoAutoSQLServerdatabase.Youfirstneedtocreatethedatabase.OpenSQLServerManagementStudioandconnecttoSQLServer(orSQLServerExpress).SelectFile|Open|FiletodisplaytheOpenFiledialogbox.Navigatetothefolderwhereyoudownloadedthistutorial’ssampleproject.NavigatetotheDatafolder.SelectInstallContosoAuto.sqlandclickOpen.ClickExecutetorunthescript.

IfyoudonothaveSQLServerManagementStudio,openacommandprompt.Todothis,locatetheCommandPromptitemintheStartmenu.Right-clickonitandselectRunasadministrator.Enterthefollowingtoinstallthedatabaseonyourlocalsqlexpressinstance:

1.sqlcmd-S.\sqlexpress-i"C:

\SampleLocation\Data\InstallContosoAuto.sql"

ReplaceC:

\SampleLocationwiththepathtothistutorial’ssampleproject.ThecommandaboveassumesyouareusingSQLServerExpress.IfyouareusingSQLServer,replace.\sqlexpresswithcomputername\instancename.Formoreinformationonsqlcmd,pleaseseetheMSDNLibrary.Closethecommandprompt.

ReturntoVisualStudio.IntheSolutionExplorer,right-clickonDataConnectionsandselectAddConnectiontodisplaytheAddConnectiondialogbox.IftheDatasourcedoesnotdisplayMicrosoftSQLServer(SqlClient),clickChange.ThisdisplaystheChangeDataSourcedialogbox.SelectMicrosoftSQLServer(SqlClient)andclickOK.

IntheAddConnectiondialogbox,enteryourcomputername(ifyouareusingSQLServer)or.\SQLEXPRESS(ifyouareusingSQLServerExpress)intheServernametextbox.SelectContosoAutofromthedatabasedrop-downlist.ClickOKtoclosetheAddConnectiondialogbox.

IntheServerExplorer,expandtheContosoAutonode.ExpandtheTablesnodetoseethetablesinthedatabase(seeFigure2).

Figure2.TheContosoAutodatabasecontainsthesetables.

ToseethedataintheManufacturerstable,right-clickonManufacturersandselectShowTableData.YoushouldseethedatashowninFigure3.UsethesametechniquetoviewthesampledataintheModelstable(seeFigure4),AvailablePackages(seeFigure5)andEmployees(seeFigure6)tables.

TheManufacturerstablecontainstheautomobilemakers.TheModelstablecontainstheautomobiles.TheAvailablePackagestablecontainsoptionsavailableforeachautomobile.TheEmployeestablecontainsContosoAuto’ssalesrepresentativesandsalesmanager.

Figure3.TheManufacturerstablecontainsthisdata.

Figure4.TheModelstablecontainsthisdata.

Figure5.TheAvailablePackagestablecontainsthisdata.

Figure6.TheEmployeestablecontainsthisdata.

TheOutlooksolutionyouarebuildinginthistutorialalsoneedsaconnectiontotheContosoAutodatabase.SelectProject|CustomerAppointmentsProperties.SelecttheSettingstab.Toaddanewsetting,enterContosoAutoConnectionStringintheNamecolumn.Select(Connectionstring)fromtheTypedrop-downlist.

ClicktheellipsisintheValuetextbox.ThisdisplaystheConnectionPropertiesdialogbox.CreateaconnectiontotheContosoAutodatabase.ClickOKtoclosetheConnectionPropertiesdialogbox.ClosetheProjectDesigner,savingyourchanges.

YouwilluseaDataSettocommunicatewiththeContosoAutodatabase.RatherthancreatetheDataSetfromscratch,youwilluseanexistingversionofit.SelectProject|AddExistingItemtodisplaytheOpenFiledialogbox.Navigatetothefolderwhereyoudownloadedthistutorial’ssampleproject.NavigatetotheDataSets\CustomerAppointmentsfolder.ThennavigatetotheVBorCSfolderdependingonthelanguageyouareusing.SelectContosoAutoDataSet.xsdandclickOKtoaddtheDataSettotheproject.

IntheSolutionExplorer,double-clickContosoAutoDataSet.xsdtoopentheDataSetDesigner(seeFigure7).TakeafewminutestofamiliarizeyourselfwiththetablesandTableAdapters.

Figure7.Theadd-inusesthisDataSettoworkwiththedataintheContosoAutodatabase.

ClosetheDataSetDesigner.Saveyourchanges.SelectBuild|BuildSolutionandverifythattheprojectcompilescorrectly.

Exercise2:

BuildaCustomOutlookMenu

Inthisexercise,youwilladdaCustomersmenutoOutlook.Thesalesmanagerwillusethismenutorespondtocustomerappointmentrequestsandtoscheduleappointments.

AddtheMenutoOutlook

TheThisAddInclasscurrentlyhastwomethods.ThisAddIn_Startuprunswhentheadd-inloads,shortlyafterOutlookstarts.ThisAddIn_Shutdownrunswhentheadd-inunloads,shortlybeforeOutlookstops.

YourfirstthoughtmightbetoputcodelikethefollowingtoaddtheCustomersmenuintheStartupeventhandler.

'VisualBasic

'GetareferencetotheOutlookmainmenubar

mainMenuBar=thisExplorer.CommandBars.ActiveMenuBar

'LocatetheHelpmenu

Try

helpMenuIndex=mainMenuBar.Controls("Help").Index

Catch

helpMenuIndex=mainMenuBar.Controls.Count

EndTry

'CreateaCustomersmenutotheleftoftheHelpmenu

mainMenu=CType(mainMenuBar.Controls.Add(_

Office.MsoControlType.msoControlPopup,Type.Missing,_

Type.Missing,helpMenuIndex,True),Office.CommandBarPopup)

mainMenu.Caption="Customers"

mainMenu.Visible=True

1.//C#

2.//GetareferencetotheOutlookmainmenubar

3.mainMenuBar=thisExplorer.CommandBars.ActiveMenuBar;

4.//LocatetheHelpmenu

5.try

6.{

7.helpMenuIndex=mainMenuBar.Controls["Help"].Index;

8.}

9.catch

10.{

11.helpMenuIndex=mainMenuBar.Controls.Count;

12.}

13.//CreateaCustomersmenutotheleftoftheHelpmenu

14.mainMenu=((Office.CommandBarPopup)

15.(mainMenuBar.Controls.Add(Office.MsoControlType.msoControlPopup,

16.Type.Missing,Type.Missing,helpMenuIndex,true)));

17.mainMenu.Caption="Customers";

18.mainMenu.Visible=true;

ThiscodewilladdaCustomersmenu.However,itwillonlyappearinonewindow.Outlookwilladdthemenutowhateverwindowitopenedfirstwhenitstarted.ThiswilltypicallybetheInbox,buttheusercanchangeOutlook’sstartupfolderintheOptionsdialog.Ifyouthenopenanotherwindow,suchastheCalendarorContacts,theCustomersmenuwillnotappearinthatwindow.

ContrastthiswithWordorExcel,whereaddingamenuitemaddsthatmenutotheapplication,nottowhateverdocumentiscurrentlyopen.TheCommandBarscollectionobjectrepresentsthemenubarandtoolbarsin

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 商业计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1