Building the Contoso Auto Sales Office Business Application Part 1.docx
- 文档编号:5126828
- 上传时间:2022-12-13
- 格式:DOCX
- 页数:54
- 大小:566.93KB
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页珍藏版)》请在冰豆网上搜索。
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
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Building the Contoso Auto Sales Office Business Application Part
![提示](https://static.bdocx.com/images/bang_tan.gif)
链接地址:https://www.bdocx.com/doc/5126828.html