├── README.md
└── Session 6
└── FP-main
├── README.md
└── Declarative Programming
├── declaritve
├── obj
│ └── Debug
│ │ ├── declaritve.csproj.CoreCompileInputs.cache
│ │ ├── declaritve.exe
│ │ ├── declaritve.pdb
│ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ ├── declaritve.csprojAssemblyReference.cache
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ └── declaritve.csproj.FileListAbsolute.txt
├── bin
│ └── Debug
│ │ ├── declaritve.exe
│ │ ├── declaritve.pdb
│ │ └── declaritve.exe.config
├── App.config
├── Properties
│ └── AssemblyInfo.cs
├── declaritve.csproj
├── Program.cs
├── Graph1 - Copy (2).dgml
└── Graph1.dgml
├── declaritve.sln
└── CodeMap.dgml
/README.md:
--------------------------------------------------------------------------------
1 | # FP
--------------------------------------------------------------------------------
/Session 6/FP-main/README.md:
--------------------------------------------------------------------------------
1 | # FP
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/declaritve.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | 7f4b213b428f4c013f19137338418ee1f5525793
2 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/bin/Debug/declaritve.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ElsayedMustafaM/FP/HEAD/Session 6/FP-main/Declarative Programming/declaritve/bin/Debug/declaritve.exe
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/bin/Debug/declaritve.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ElsayedMustafaM/FP/HEAD/Session 6/FP-main/Declarative Programming/declaritve/bin/Debug/declaritve.pdb
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/declaritve.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ElsayedMustafaM/FP/HEAD/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/declaritve.exe
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/declaritve.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ElsayedMustafaM/FP/HEAD/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/declaritve.pdb
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ElsayedMustafaM/FP/HEAD/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/declaritve.csprojAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ElsayedMustafaM/FP/HEAD/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/declaritve.csprojAssemblyReference.cache
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ElsayedMustafaM/FP/HEAD/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/bin/Debug/declaritve.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30717.126
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "declaritve", "declaritve\declaritve.csproj", "{D1C45F3A-77A1-40B6-8284-F1C1DC9803C6}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {D1C45F3A-77A1-40B6-8284-F1C1DC9803C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {D1C45F3A-77A1-40B6-8284-F1C1DC9803C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {D1C45F3A-77A1-40B6-8284-F1C1DC9803C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {D1C45F3A-77A1-40B6-8284-F1C1DC9803C6}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {CF4A0763-4011-4C0C-837A-3A75557B55FC}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("declaritve")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("declaritve")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("d1c45f3a-77a1-40b6-8284-f1c1dc9803c6")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/obj/Debug/declaritve.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Elsayed.Mustafa\source\repos\declaritve\declaritve\bin\Debug\declaritve.exe.config
2 | C:\Users\Elsayed.Mustafa\source\repos\declaritve\declaritve\bin\Debug\declaritve.exe
3 | C:\Users\Elsayed.Mustafa\source\repos\declaritve\declaritve\bin\Debug\declaritve.pdb
4 | C:\Users\Elsayed.Mustafa\source\repos\declaritve\declaritve\obj\Debug\declaritve.csproj.CoreCompileInputs.cache
5 | C:\Users\Elsayed.Mustafa\source\repos\declaritve\declaritve\obj\Debug\declaritve.exe
6 | C:\Users\Elsayed.Mustafa\source\repos\declaritve\declaritve\obj\Debug\declaritve.pdb
7 | C:\Users\Elsayed.Mustafa\source\repos\declaritve\declaritve\obj\Debug\declaritve.csprojAssemblyReference.cache
8 | C:\Users\Mohamed-Hammad\Downloads\FP-main (2)\FP-main\Declarative Programming\declaritve\bin\Debug\declaritve.exe.config
9 | C:\Users\Mohamed-Hammad\Downloads\FP-main (2)\FP-main\Declarative Programming\declaritve\bin\Debug\declaritve.exe
10 | C:\Users\Mohamed-Hammad\Downloads\FP-main (2)\FP-main\Declarative Programming\declaritve\bin\Debug\declaritve.pdb
11 | C:\Users\Mohamed-Hammad\Downloads\FP-main (2)\FP-main\Declarative Programming\declaritve\obj\Debug\declaritve.csprojAssemblyReference.cache
12 | C:\Users\Mohamed-Hammad\Downloads\FP-main (2)\FP-main\Declarative Programming\declaritve\obj\Debug\declaritve.csproj.CoreCompileInputs.cache
13 | C:\Users\Mohamed-Hammad\Downloads\FP-main (2)\FP-main\Declarative Programming\declaritve\obj\Debug\declaritve.exe
14 | C:\Users\Mohamed-Hammad\Downloads\FP-main (2)\FP-main\Declarative Programming\declaritve\obj\Debug\declaritve.pdb
15 | G:\Blazor\Session 6\FP-main\Declarative Programming\declaritve\bin\Debug\declaritve.exe.config
16 | G:\Blazor\Session 6\FP-main\Declarative Programming\declaritve\bin\Debug\declaritve.exe
17 | G:\Blazor\Session 6\FP-main\Declarative Programming\declaritve\bin\Debug\declaritve.pdb
18 | G:\Blazor\Session 6\FP-main\Declarative Programming\declaritve\obj\Debug\declaritve.csprojAssemblyReference.cache
19 | G:\Blazor\Session 6\FP-main\Declarative Programming\declaritve\obj\Debug\declaritve.csproj.CoreCompileInputs.cache
20 | G:\Blazor\Session 6\FP-main\Declarative Programming\declaritve\obj\Debug\declaritve.exe
21 | G:\Blazor\Session 6\FP-main\Declarative Programming\declaritve\obj\Debug\declaritve.pdb
22 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/declaritve.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D1C45F3A-77A1-40B6-8284-F1C1DC9803C6}
8 | Exe
9 | declaritve
10 | declaritve
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using System.Xml.Linq;
7 |
8 | using System;
9 | using System.Runtime.CompilerServices;
10 |
11 | namespace Declarative
12 | {
13 | internal static class Program
14 | {
15 |
16 |
17 | public static void Main(string[] args)
18 | {
19 | InvoicingPath InvoicePath = new InvoicingPath();
20 | AvailabilityPath AvailabilityPath = new AvailabilityPath();
21 | (Order order, ProcessConfiguration processConfiguration) = setConfiguration();
22 |
23 | Func CostOfOrder = CalcAdjustedCostofOrder(processConfiguration, InvoicePath, AvailabilityPath);
24 |
25 | Console.WriteLine(CostOfOrder(order));
26 | Console.ReadLine();
27 | }
28 |
29 | //Setup of the Process Configuration and Data
30 | public static (Order order, ProcessConfiguration processConfiguration) setConfiguration()
31 | {
32 | ProcessConfiguration processConfiguration = new ProcessConfiguration();
33 | Customer customer = new Customer();
34 | Order order = new Order();
35 | processConfiguration.invoiceChoice = InvoiceChoice.Inv3;
36 | processConfiguration.shippingChoice = ShippingChoice.Sh2;
37 | processConfiguration.freightChoice = FreightChoice.fr3;
38 | processConfiguration.availabilityChoice = AvailabilityChoice.AV2;
39 | processConfiguration.shippingDateChoice = ShippingDateChoice.SD2;
40 | order.customer = customer;
41 | order.date = new DateTime(2021, 3, 16);
42 | order.cost = 2000;
43 | return (order, processConfiguration);
44 | }
45 |
46 | //Adjusted Cost for Order
47 | public static Func CalcAdjustedCostofOrder(ProcessConfiguration c, InvoicingPath InvoicePath, AvailabilityPath AvailabilityPath)
48 | {
49 | return (x) => AdjustCost(x, InvoicePathFunc(c, InvoicePath), AvailabilityPathFunc(c, AvailabilityPath));
50 | }
51 |
52 | //Adjusted Cost
53 | public static double AdjustCost(Order r, Func calcFreigt, Func calcShippingDate)
54 | {
55 |
56 | Freight f = calcFreigt(r);
57 | ShippingDate s = calcShippingDate(r);
58 | Console.WriteLine("\n\nDay of Shipping : " + s.date.DayOfWeek.ToString() + "\n");
59 |
60 | double cost = (s.date.DayOfWeek.ToString() == "Monday") ? f.cost + 1000 : f.cost + 500;
61 |
62 | ///Finall Cost
63 | return cost;
64 | }
65 |
66 | /// Return InvoicePath Composed Function
67 | public static Func InvoicePathFunc(ProcessConfiguration c, InvoicingPath fpl)
68 | {
69 |
70 | Func p = fpl.InvoiceFunctions.Where((x) => x.InvoiceChoose == c.invoiceChoice).Select((x) => x.CalcInvoice).FirstOrDefault()
71 | .Compose(fpl.ShippingFunctions.Where((x) => x.ShippingChoose == c.shippingChoice).Select((x) => x.calcShipping).FirstOrDefault())
72 | .Compose(fpl.frieghtFunctions.Where((x) => x.freightChoose == c.freightChoice).Select((x) => x.calcFrieght).FirstOrDefault());
73 | return p;
74 | }
75 |
76 | /// /// Return AvailabilityPath Composed Funcrtion
77 | public static Func AvailabilityPathFunc(ProcessConfiguration c, AvailabilityPath spl)
78 | {
79 |
80 | Func p = spl.AvailabilityFunctions.Where((x) => x.availabilityChoose == c.availabilityChoice).Select((x) => x.calcAvailability).FirstOrDefault()
81 | .Compose(spl.ShippingDateFunctions.Where((x) => x.shippingDateChoose == c.shippingDateChoice).Select((x) => x.calcShippingDate).FirstOrDefault());
82 |
83 | return p;
84 | }
85 |
86 |
87 | // Compose Function
88 | public static Func Compose(this Func f, Func g)
89 | {
90 | return (x) => g(f(x));
91 | }
92 |
93 | #region Basic Data
94 | public class InvoicingPath
95 | {
96 | public List<(InvoiceChoice InvoiceChoose, Func CalcInvoice)> InvoiceFunctions;
97 | public List<(ShippingChoice ShippingChoose, Func calcShipping)> ShippingFunctions;
98 | public List<(FreightChoice freightChoose, Func calcFrieght)> frieghtFunctions;
99 |
100 | public InvoicingPath()
101 | {
102 | InvoiceFunctions = new List<(InvoiceChoice InvoiceChoose, Func CalcInvoice)>()
103 | {
104 | (InvoiceChoice.Inv1,calcInvoice1),
105 | (InvoiceChoice.Inv2,calcInvoice2),
106 | (InvoiceChoice.Inv3,calcInvoice3),
107 | (InvoiceChoice.Inv4,calcInvoice4),
108 | (InvoiceChoice.Inv5,calcInvoice5)
109 | };
110 | ShippingFunctions = new List<(ShippingChoice ShippingChoose, Func calcShipping)>()
111 | {
112 | (ShippingChoice.Sh1,calcShipping1),
113 | (ShippingChoice.Sh2,calcShipping2),
114 | (ShippingChoice.Sh3,calcShipping3)
115 | };
116 | frieghtFunctions = new List<(FreightChoice freightChoose, Func calcFrieght)>()
117 | {
118 | (FreightChoice.fr1,calcFreightCost1),
119 | (FreightChoice.fr2,calcFreightCost2),
120 | (FreightChoice.fr3,calcFreightCost3),
121 | (FreightChoice.fr4,calcFreightCost4),
122 | (FreightChoice.fr5,calcFreightCost5),
123 | (FreightChoice.fr6,calcFreightCost6)
124 | };
125 | }
126 |
127 | }
128 | public class AvailabilityPath
129 | {
130 |
131 | public List<(AvailabilityChoice availabilityChoose, Func calcAvailability)> AvailabilityFunctions;
132 |
133 | public List<(ShippingDateChoice shippingDateChoose, Func calcShippingDate)> ShippingDateFunctions;
134 |
135 | public AvailabilityPath ()
136 | {
137 | AvailabilityFunctions = new List<(AvailabilityChoice availabilityChoose, Func calcAvailability)>()
138 | {
139 | (AvailabilityChoice.AV1,calcAvailability1),
140 | (AvailabilityChoice.AV2,calcAvailability2),
141 | (AvailabilityChoice.AV3,calcAvailability3),
142 | (AvailabilityChoice.AV4,calcAvailability4)
143 | };
144 | ShippingDateFunctions = new List<(ShippingDateChoice shippingDateChoose, Func calcShippingDate)>()
145 | {
146 | (ShippingDateChoice.SD1,calcShippingDate1),
147 | (ShippingDateChoice.SD2,calcShippingDate2),
148 | (ShippingDateChoice.SD3,calcShippingDate3),
149 | (ShippingDateChoice.SD4,calcShippingDate4),
150 | (ShippingDateChoice.SD5,calcShippingDate5),
151 | };
152 | }
153 |
154 | }
155 |
156 | public static Invoice calcInvoice1(Order o)
157 | {
158 | Console.WriteLine("Invoice 1");
159 | Invoice invoice = new Invoice();
160 | invoice.cost = o.cost * 1.1;
161 | return invoice;
162 | }
163 | public static Invoice calcInvoice2(Order o)
164 | {
165 | Console.WriteLine("Invoice 2");
166 | Invoice invoice = new Invoice();
167 | invoice.cost = o.cost * 1.2;
168 | return invoice;
169 | }
170 | public static Invoice calcInvoice3(Order o)
171 | {
172 | Console.WriteLine("Invoice 3");
173 | Invoice invoice = new Invoice();
174 | invoice.cost = o.cost * 1.3;
175 | return invoice;
176 | }
177 | public static Invoice calcInvoice4(Order o)
178 | {
179 | Console.WriteLine("Invoice 4");
180 | Invoice invoice = new Invoice();
181 | invoice.cost = o.cost * 1.4;
182 | return invoice;
183 |
184 | }
185 | public static Invoice calcInvoice5(Order o)
186 | {
187 | Console.WriteLine("Invoice 5");
188 | Invoice invoice = new Invoice();
189 | invoice.cost = o.cost * 1.5;
190 | return invoice;
191 | }
192 |
193 | public static Shipping calcShipping1(Invoice o)
194 | {
195 | Console.WriteLine("Shipping 1");
196 | Shipping s = new Shipping();
197 | s.ShipperID = (o.cost > 1000) ? 1 : 2;
198 | s.cost = o.cost;
199 |
200 | return s;
201 | }
202 | public static Shipping calcShipping2(Invoice i)
203 | {
204 | Console.WriteLine("Shipping 2");
205 | Shipping s = new Shipping();
206 |
207 | s.ShipperID = (i.cost > 1100) ? 1 : 2;
208 | s.cost = i.cost;
209 |
210 | return s;
211 | }
212 | public static Shipping calcShipping3(Invoice i)
213 | {
214 | Console.WriteLine("Shipping 3");
215 | Shipping s = new Shipping();
216 | s.ShipperID = (i.cost > 1200) ? 1 : 2;
217 | s.cost = i.cost;
218 |
219 | return s;
220 | }
221 |
222 | public static Freight calcFreightCost1(Shipping s)
223 | {
224 | Console.WriteLine("Freight 1");
225 | Freight f = new Freight();
226 | f.cost = (s.ShipperID == 1) ? s.cost * 0.25 : s.cost * 0.5;
227 | return f;
228 | }
229 | public static Freight calcFreightCost2(Shipping s)
230 | {
231 | Console.WriteLine("Freight 2");
232 | Freight f = new Freight();
233 | f.cost = (s.ShipperID == 1) ? s.cost * 0.28 : s.cost * 0.52;
234 | return f;
235 | }
236 | public static Freight calcFreightCost3(Shipping s)
237 | {
238 | Console.WriteLine("Freight 3");
239 | Freight f = new Freight();
240 | f.cost = (s.ShipperID == 1) ? s.cost * 0.3 : s.cost * 0.6;
241 | return f;
242 | }
243 | public static Freight calcFreightCost4(Shipping s)
244 | {
245 | Console.WriteLine("Freight 4");
246 | Freight f = new Freight();
247 | f.cost = (s.ShipperID == 1) ? s.cost * 0.35 : s.cost * 0.65;
248 | return f;
249 | }
250 | public static Freight calcFreightCost5(Shipping s)
251 | {
252 | Console.WriteLine("Freight 5");
253 | Freight f = new Freight();
254 | f.cost = (s.ShipperID == 1) ? s.cost * 0.15 : s.cost * 0.2;
255 | return f;
256 | }
257 | public static Freight calcFreightCost6(Shipping s)
258 | {
259 | Console.WriteLine("Freight 6");
260 | Freight f = new Freight();
261 | f.cost = (s.ShipperID == 1) ? s.cost * 0.1 : s.cost * 0.15;
262 | return f;
263 | }
264 |
265 | public static Availability calcAvailability1(Order o)
266 | {
267 | Console.WriteLine("Availability 1");
268 | Availability a = new Availability();
269 | a.date = o.date.AddDays(3);
270 | return a;
271 | }
272 | public static Availability calcAvailability2(Order o)
273 | {
274 | Console.WriteLine("Availability 2");
275 | Availability a = new Availability();
276 | a.date = o.date.AddDays(2);
277 | return a;
278 | }
279 | public static Availability calcAvailability3(Order o)
280 | {
281 | Console.WriteLine("Availability 3");
282 | Availability a = new Availability();
283 | a.date = o.date.AddDays(1);
284 | return a;
285 | }
286 | public static Availability calcAvailability4(Order o)
287 | {
288 | Console.WriteLine("Availability 4");
289 | Availability a = new Availability();
290 | a.date = o.date.AddDays(4);
291 | return a;
292 | }
293 |
294 | public static ShippingDate calcShippingDate1(Availability o)
295 | {
296 | Console.WriteLine("ShippingDate 1");
297 | ShippingDate a = new ShippingDate();
298 | a.date = o.date.AddDays(1);
299 | return a;
300 | }
301 | public static ShippingDate calcShippingDate2(Availability o)
302 | {
303 | Console.WriteLine("ShippingDate 2");
304 | ShippingDate a = new ShippingDate();
305 | a.date = o.date.AddDays(2);
306 | return a;
307 | }
308 | public static ShippingDate calcShippingDate3(Availability o)
309 | {
310 | Console.WriteLine("ShippingDate 3");
311 | ShippingDate a = new ShippingDate();
312 | a.date = o.date.AddHours(14);
313 | return a;
314 | }
315 | public static ShippingDate calcShippingDate4(Availability o)
316 | {
317 | Console.WriteLine("ShippingDate 4");
318 | ShippingDate a = new ShippingDate();
319 | a.date = o.date.AddHours(20);
320 | return a;
321 | }
322 | public static ShippingDate calcShippingDate5(Availability o)
323 | {
324 | Console.WriteLine("ShippingDate 5");
325 | ShippingDate a = new ShippingDate();
326 | a.date = o.date.AddHours(10);
327 | return a;
328 | }
329 | #endregion
330 |
331 | }
332 |
333 | // Classes
334 | public class ProcessConfiguration
335 | {
336 | public InvoiceChoice invoiceChoice { get; set; }
337 | public ShippingChoice shippingChoice { get; set; }
338 | public FreightChoice freightChoice { get; set; }
339 | public AvailabilityChoice availabilityChoice { get; set; }
340 | public ShippingDateChoice shippingDateChoice { get; set; }
341 |
342 | }
343 |
344 | public class Customer
345 | {
346 |
347 | }
348 | public class Order
349 | {
350 | public Customer customer { get; set; }
351 | public DateTime date { get; set; }
352 | public double cost { get; set; }
353 |
354 | }
355 | public class Invoice
356 | {
357 |
358 | public double cost { get; set; }
359 | public Invoice()
360 | {
361 | cost = 0;
362 | }
363 | }
364 | public class Shipping
365 | {
366 |
367 | public double cost { get; set; }
368 | public int ShipperID { get; set; }
369 | public Shipping()
370 | {
371 | cost = 0;
372 | }
373 | }
374 | public class Freight
375 | {
376 | public double cost { get; set; }
377 |
378 | public Freight()
379 | {
380 | cost = 0;
381 | }
382 | }
383 | public class Availability
384 | {
385 | public DateTime date { get; set; }
386 | public Availability()
387 | {
388 |
389 | }
390 | }
391 | public class ShippingDate
392 | {
393 | public DateTime date { get; set; }
394 |
395 | public ShippingDate()
396 | {
397 | }
398 | }
399 |
400 | public enum InvoiceChoice
401 | {
402 | Inv1 = 0,
403 | Inv2 = 1,
404 | Inv3 = 2,
405 | Inv4 = 3,
406 | Inv5 = 4
407 | }
408 | public enum ShippingChoice
409 | {
410 | Sh1,
411 | Sh2,
412 | Sh3,
413 | }
414 | public enum FreightChoice
415 | {
416 | fr1,
417 | fr2,
418 | fr3,
419 | fr4,
420 | fr5,
421 | fr6
422 | }
423 | public enum AvailabilityChoice
424 | {
425 | AV1,
426 | AV2,
427 | AV3,
428 | AV4
429 | }
430 | public enum ShippingDateChoice
431 | {
432 | SD1,
433 | SD2,
434 | SD3,
435 | SD4,
436 | SD5
437 | }
438 |
439 | }
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/Graph1 - Copy (2).dgml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
195 |
200 |
204 |
210 |
215 |
220 |
227 |
231 |
236 |
240 |
244 |
248 |
252 |
256 |
260 |
264 |
270 |
276 |
282 |
288 |
295 |
301 |
307 |
313 |
320 |
326 |
332 |
336 |
340 |
344 |
349 |
355 |
361 |
367 |
373 |
379 |
385 |
389 |
393 |
397 |
401 |
405 |
409 |
413 |
417 |
420 |
423 |
426 |
430 |
436 |
442 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/declaritve/Graph1.dgml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
195 |
200 |
204 |
210 |
215 |
220 |
227 |
231 |
236 |
240 |
244 |
248 |
252 |
256 |
260 |
264 |
270 |
276 |
282 |
288 |
295 |
301 |
307 |
313 |
320 |
326 |
332 |
336 |
340 |
344 |
349 |
355 |
361 |
367 |
373 |
379 |
385 |
389 |
393 |
397 |
401 |
405 |
409 |
413 |
417 |
420 |
423 |
426 |
430 |
436 |
442 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
--------------------------------------------------------------------------------
/Session 6/FP-main/Declarative Programming/CodeMap.dgml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
528 |
533 |
537 |
543 |
548 |
553 |
560 |
564 |
569 |
573 |
577 |
581 |
585 |
589 |
593 |
597 |
603 |
609 |
615 |
621 |
628 |
634 |
640 |
646 |
653 |
659 |
665 |
669 |
673 |
677 |
682 |
688 |
694 |
700 |
706 |
712 |
718 |
722 |
726 |
730 |
734 |
738 |
742 |
746 |
750 |
753 |
756 |
759 |
763 |
769 |
775 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
--------------------------------------------------------------------------------