private void Doc_MouseMove(object sender, MouseEventArgs e) { // Get the current mouse position Point mousePos = e.GetPosition(null); Vector diff = startPoint - mousePos; if (e.LeftButton == MouseButtonState.Pressed && (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)) { // Get the dragged ListViewItem ListView listView = sender as ListView; ListViewItem listViewItem = FindAnchestor <ListViewItem>((DependencyObject)e.OriginalSource); if (listViewItem == null) { return; // Abort } // Find the data behind the ListViewItem DocClass item = (DocClass)listView.ItemContainerGenerator.ItemFromContainer(listViewItem); if (item == null) { return; // Abort } // Initialize the drag & drop operation startIndex = DocListView.SelectedIndex; DataObject dragData = new DataObject("docs", item); DragDrop.DoDragDrop(listViewItem, dragData, DragDropEffects.Copy | DragDropEffects.Move); } }
public void Test26() { Initial(); int[] dateCheat = { 02, 04, 2018 }; Student p1 = new Student("p1"); Student p2 = new Student("p2"); Student p3 = new Student("p3"); Student s = new Student("s"); Student v = new Student("v"); DocClass d3 = new DocClass("Null References: The Billion Dollar Mistake"); p1.CheckOut(d3.ID, dateCheat); p2.CheckOut(d3.ID, dateCheat); s.CheckOut(d3.ID, dateCheat); v.CheckOut(d3.ID, dateCheat); p3.CheckOut(d3.ID, dateCheat); PriorityQueue <int> pq = SDM.LMS.LoadPQ(d3.ID); Debug.Assert(pq.Pop() == s.PersonID); Debug.Assert(pq.Pop() == v.PersonID); Debug.Assert(pq.Pop() == p3.PersonID); }
public void Test29() { Test26(); int[] dateCheat = { 02, 04, 2018 }; Faculty p1 = new Faculty("p1"); Faculty p2 = new Faculty("p2"); Student p3 = new Student("p3"); Student s = new Student("s"); Student v = new Student("v"); DocClass d3 = new DocClass("Null References: The Billion Dollar Mistake"); p1.RenewDoc(d3.ID, dateCheat); List <CheckedOut> checkedOuts = SDM.LMS.GetCheckoutsList("p1"); Debug.Assert(checkedOuts.First().CheckOutTime == 16); Debug.Assert(checkedOuts.First().DocumentCheckedOut == "Null References: The Billion Dollar Mistake"); PriorityQueue <int> pq = SDM.LMS.LoadPQ(d3.ID); Debug.Assert(pq.Pop() == s.PersonID); Debug.Assert(pq.Pop() == v.PersonID); Debug.Assert(pq.Pop() == p3.PersonID); }
/// <summary> /// Create a type defrinition for the given class file and all inner classes. /// </summary> public override void CreateType(NetTypeDefinition declaringType, NetModule module, TargetFramework target) { if (declaringType != null) { throw new ArgumentException("Declaring type should be null"); } docClass = target.GetXmlClass(cf); var fullName = GetFullName(); var dotIndex = fullName.LastIndexOf('.'); var ns = (dotIndex > 0) ? NameConverter.UpperCamelCase(fullName.Substring(0, dotIndex)) : String.Empty; var name = (dotIndex > 0) ? NameConverter.UpperCamelCase(fullName.Substring(dotIndex + 1)) : fullName; name = CreateTypeName(null, cf, name, ns); typeDef = new NetTypeDefinition(cf, target, module.Scope); typeDef.Name = name; typeDef.Namespace = ns; typeDef.OriginalJavaClassName = cf.ClassName; typeDef.Attributes = GetAttributes(cf, cf.Fields.Any()); typeDef.IgnoreGenericArguments = !AddGenericParameters; typeDef.Description = (docClass != null) ? docClass.Description : null; module.Types.Add(typeDef); // Prepare generics CreateGenericParameters(cf, typeDef); // Add mapping var finalFullName = string.IsNullOrEmpty(ns) ? name : ns + "." + name; RegisterType(target, cf, typeDef); CreateNestedTypes(cf, typeDef, finalFullName, module, target); }
public void Test21() { Initial(); int[] timeCheat = { 05, 03, 2018 }; DateTime Now = new DateTime(2018, 04, 02); Faculty p1 = new Faculty("p1"); Student s = new Student("s"); VisitingProfessor v = new VisitingProfessor("v"); DocClass d1 = new DocClass("Introduction to Algorithms"); DocClass d2 = new DocClass("Design Patterns: Elements of Reusable Object-Oriented Software"); p1.CheckOut(d1.ID, timeCheat); p1.CheckOut(d2.ID, timeCheat); s.CheckOut(d1.ID, timeCheat); s.CheckOut(d2.ID, timeCheat); v.CheckOut(d1.ID, timeCheat); v.CheckOut(d2.ID, timeCheat); Debug.Assert(SDM.LMS.OverdueTime(p1.PersonID, d1.ID, Now) == 0); Debug.Assert(SDM.LMS.OverdueTime(p1.PersonID, d2.ID, Now) == 0); Debug.Assert(SDM.LMS.GetUserFineForDoc(p1.PersonID, d1.ID, Now) == 0); Debug.Assert(SDM.LMS.GetUserFineForDoc(p1.PersonID, d2.ID, Now) == 0); Debug.Assert(SDM.LMS.OverdueTime(s.PersonID, d1.ID, Now) == 7); Debug.Assert(SDM.LMS.OverdueTime(s.PersonID, d2.ID, Now) == 14); Debug.Assert(SDM.LMS.GetUserFineForDoc(s.PersonID, d1.ID, Now) == 700); Debug.Assert(SDM.LMS.GetUserFineForDoc(s.PersonID, d2.ID, Now) == 1400); Debug.Assert(SDM.LMS.OverdueTime(v.PersonID, d1.ID, Now) == 21); Debug.Assert(SDM.LMS.OverdueTime(v.PersonID, d2.ID, Now) == 21); Debug.Assert(SDM.LMS.GetUserFineForDoc(v.PersonID, d1.ID, Now) == 2100); Debug.Assert(SDM.LMS.GetUserFineForDoc(v.PersonID, d2.ID, Now) == 1700); }
public void Test23() { Initial(); int[] timeCheat = { 31, 03, 2018 }; Librarian lb = new Librarian("lb"); Faculty p1 = new Faculty("p1"); Student s = new Student("s"); VisitingProfessor v = new VisitingProfessor("v"); admin.ModifyLibrarian(lb.PersonID, "lb", "lb", "lb", 2); DocClass d1 = new DocClass("Introduction to Algorithms"); DocClass d2 = new DocClass("Design Patterns: Elements of Reusable Object-Oriented Software"); p1.CheckOut(d1.ID, timeCheat); s.CheckOut(d2.ID, timeCheat); v.CheckOut(d2.ID, timeCheat); lb.OutstandingRequest(d2.ID); timeCheat = new int[] { 02, 04, 2018 }; DateTime Now = new DateTime(2018, 04, 14); p1.RenewDoc(d1.ID, timeCheat); s.RenewDoc(d2.ID, timeCheat); v.RenewDoc(d2.ID, timeCheat); Debug.Assert(SDM.LMS.GetCheckout(p1.PersonID, d1.ID).TimeToBack.Day == 30); Debug.Assert(SDM.LMS.GetCheckout(s.PersonID, d2.ID).TimeToBack.Day == Now.Day); Now = new DateTime(2018, 04, 07); Debug.Assert(SDM.LMS.GetCheckout(v.PersonID, d2.ID).TimeToBack.Day == Now.Day); }
public void Test4() { SDM.LMS.ClearDB(); SDM.LMS.RegisterUser("st", "st", "st", "st", "st", false); SDM.LMS.RegisterUser("ft", "ft", "ft", "ft", "ft", false); SDM.LMS.RegisterUser("lb", "lb", "lb", "lb", "lb", true); Student st = new Student("st"); Faculty ft = new Faculty("ft"); Librarian lb = new Librarian("lb"); admin.ModifyLibrarian(lb.PersonID, "lb", "lb", "lb", 2); lb.AddBook("b", "B", "B", 0, "B", "B", 0, true, 1, ""); DocClass b = new DocClass("b"); st.CheckOut(b.ID); Debug.Assert(SDM.LMS.GetUser(lb.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(ft.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(st.PersonID) != null); Debug.Assert(SDM.LMS.GetDoc(b.ID) != null); Debug.Assert(b.Quantity == 0); Debug.Assert(SDM.LMS.GetUserBooks(st.PersonID, 7, "").Count == 1); DataBase.Checkouts checkouts = SDM.LMS.GetCheckout(st.PersonID, b.ID); Debug.Assert(checkouts.TimeToBack.Subtract((DateTime)checkouts.DateTaked).TotalDays / 7 == 2); }
public void Test10() { SDM.LMS.ClearDB(); SDM.LMS.RegisterUser("st", "st", "st", "st", "st", false); SDM.LMS.RegisterUser("lb", "lb", "lb", "lb", "lb", true); Student st = new Student("st"); Librarian lb = new Librarian("lb"); admin.ModifyLibrarian(lb.PersonID, "lb", "lb", "lb", 2); lb.AddBook("b", "B", "B", 0, "B", "B", 0, false, 1, ""); lb.AddBook("a", "A", "A", 0, "A", "A", 0, false, 0, ""); DocClass b = new DocClass("b"); DocClass a = new DocClass("a"); st.CheckOut(a.ID); st.CheckOut(b.ID); Debug.Assert(SDM.LMS.GetUser(lb.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(st.PersonID) != null); Debug.Assert(SDM.LMS.GetDoc(b.ID) != null); Debug.Assert(SDM.LMS.GetDoc(a.ID) != null); Debug.Assert(b.Quantity == 0); Debug.Assert(a.Quantity == 0); Debug.Assert(SDM.LMS.GetUserBooks(st.PersonID, 7, "").Count == 1); }
public void Test7() { SDM.LMS.ClearDB(); SDM.LMS.RegisterUser("p1", "p1", "p1", "p1", "p1", false); SDM.LMS.RegisterUser("p2", "p2", "p2", "p2", "p2", false); SDM.LMS.RegisterUser("lb", "lb", "lb", "lb", "lb", true); Student p1 = new Student("p1"); Student p2 = new Student("p2"); Librarian lb = new Librarian("lb"); admin.ModifyLibrarian(lb.PersonID, "lb", "lb", "lb", 2); lb.AddAV("b1", "B", 0, 2, ""); DocClass b1 = new DocClass("b1"); p1.CheckOut(b1.ID); p2.CheckOut(b1.ID); Debug.Assert(SDM.LMS.GetUser(lb.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(p1.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(p2.PersonID) != null); Debug.Assert(SDM.LMS.GetDoc(b1.ID) != null); Debug.Assert(b1.Quantity == 0); Debug.Assert(SDM.LMS.GetUserBooks(p1.PersonID, 7, "").Count == 1); Debug.Assert(SDM.LMS.GetUserBooks(p2.PersonID, 7, "").Count == 1); }
public void Test35() { Test34(); Librarian lb3 = new Librarian("lb3"); DocClass d1 = new DocClass("d1"); DocClass d2 = new DocClass("d2"); DocClass d3 = new DocClass("d3"); Student p1 = new Student("p1"); Student p2 = new Student("p2"); Student p3 = new Student("p3"); Student s = new Student("s"); Student v = new Student("v"); lb3.ModifyAV(d1.ID, d1.Title, d1.Autors, d1.Price, d1.Quantity - 1, d1.Tags); Debug.Assert(SDM.LMS.GetUser(p1.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(p2.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(p3.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(s.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(v.PersonID) != null); Debug.Assert(SDM.LMS.GetDoc(d1.ID) != null); Debug.Assert(SDM.LMS.GetDoc(d2.ID) != null); Debug.Assert(SDM.LMS.GetDoc(d3.ID) != null); Debug.Assert(SDM.LMS.GetDoc(d1.ID).Quantity == 2); Debug.Assert(SDM.LMS.GetDoc(d2.ID).Quantity == 3); Debug.Assert(SDM.LMS.GetDoc(d3.ID).Quantity == 3); }
/// <summary> /// Create a type defrinition for the given class file and all inner classes. /// </summary> public override void CreateType(NetTypeDefinition declaringType, NetModule module, TargetFramework target) { if (declaringType == null) { throw new ArgumentNullException("declaringType"); } docClass = target.GetXmlClass(cf); var name = NameConverter.UpperCamelCase(inner.IsAnonymous ? cf.Name : inner.Name); name = CreateTypeName(declaringType, cf, name, null); var finalFullName = parentFullName + "/" + name; var attributes = GetAttributes(cf); typeDef = new NetTypeDefinition(cf, target, module.Scope) { Name = name, Attributes = attributes }; typeDef.OriginalJavaClassName = cf.ClassName; typeDef.Description = (docClass != null) ? docClass.Description : null; parent.AddNestedType(typeDef, "", module, ref finalFullName); // Prepare generics CreateGenericParameters(cf, typeDef); // Add mapping RegisterType(target, cf, typeDef); CreateNestedTypes(cf, typeDef, finalFullName, module, target); }
private static void BupaLegacyAddTableData(DocClass result) { BupaLegacyGet2YearPrior(result); BupaLegacyGetYearPrior(result); BupaLegacyGetLastYear(result); }
public void Test17() { Test11(); Librarian lb = new Librarian("lb"); Faculty p1 = new Faculty("Sergey Afonso"); Student p2 = new Student("Nadia Teixeira"); admin.ModifyLibrarian(lb.PersonID, "lb", "lb", "lb", 2); DocClass b1 = new DocClass("Introduction to Algorithms"); DocClass b2 = new DocClass("Design Patterns: Elements of Reusable Object-Oriented Software"); DocClass b3 = new DocClass("The Mythical Man-month"); DocClass av1 = new DocClass("Null References: The Billion Dollar Mistake"); DocClass av2 = new DocClass("Information Entropy"); p1.CheckOut(b1.ID); p1.CheckOut(b2.ID); p1.CheckOut(b3.ID); p1.CheckOut(av1.ID); p2.CheckOut(b1.ID); p2.CheckOut(b2.ID); p2.CheckOut(av2.ID); List <CheckedOut> CheckedOutInfo = new List <CheckedOut> { new CheckedOut { CheckOutTime = DateTime.Now.AddDays(21).Day, DocumentCheckedOut = "Introduction to Algorithms" }, new CheckedOut { CheckOutTime = DateTime.Now.AddDays(14).Day, DocumentCheckedOut = "Design Patterns: Elements of Reusable Object-Oriented Software" }, new CheckedOut { CheckOutTime = DateTime.Now.AddDays(14).Day, DocumentCheckedOut = "Information Entropy" } }; Debug.Assert(SDM.LMS.CheckUserInfo("Nadia Teixeira", "Via Sacra, 13", "30002", 0, CheckedOutInfo)); CheckedOutInfo = new List <CheckedOut> { new CheckedOut { CheckOutTime = DateTime.Now.AddDays(28).Day, DocumentCheckedOut = "Introduction to Algorithms" }, new CheckedOut { CheckOutTime = DateTime.Now.AddDays(28).Day, DocumentCheckedOut = "Design Patterns: Elements of Reusable Object-Oriented Software" }, new CheckedOut { CheckOutTime = DateTime.Now.AddDays(28).Day, DocumentCheckedOut = "The Mythical Man-month" }, new CheckedOut { CheckOutTime = DateTime.Now.AddDays(14).Day, DocumentCheckedOut = "Null References: The Billion Dollar Mistake" } }; Debug.Assert(SDM.LMS.CheckUserInfo("Sergey Afonso", "Via Margutta, 3", "30001", 1, CheckedOutInfo)); }
public static DocClass Bupa() { var result = new DocClass("BupaTest", 4); var stBupaArab = new StaticTextRule("BupaArab", RuleBinding.Required); var firstConstr = new SearchConstraint().Page().Above().YCenter(); stBupaArab.TextToSearch = "Bupa Arabia"; //var firstConstr = (new SearchConstraint()).Page().Above.XCenter; stBupaArab.SearchConstraints.Add(firstConstr); result.AddHeaderRule(stBupaArab); return(result); }
public void Test15() { Test12(); Student p2 = new Student("Nadia Teixeira"); DocClass b1 = new DocClass("Introduction to Algorithms"); p2.CheckOut(b1.ID); Debug.Assert(SDM.LMS.GetUser(p2.PersonID) == null); }
public void Test27() { Test26(); Librarian lb = new Librarian("lb"); admin.ModifyLibrarian(lb.PersonID, "lb", "lb", "lb", 2); DocClass d3 = new DocClass("Null References: The Billion Dollar Mistake"); lb.OutstandingRequest(d3.ID); Debug.Assert(!SDM.LMS.ExistQueueForDoc(d3.ID)); }
public void Test20() { Initial(); Faculty p1 = new Faculty("p1"); DocClass d1 = new DocClass("Introduction to Algorithms"); DocClass d2 = new DocClass("Design Patterns: Elements of Reusable Object-Oriented Software"); p1.CheckOut(d1.ID, new int[] { 05, 03, 2018 }); p1.CheckOut(d2.ID, new int[] { 05, 03, 2018 }); p1.ReturnDoc(d2.ID); Debug.Assert(SDM.LMS.GetUserFineForDoc(p1.PersonID, d1.ID, new DateTime(2018, 04, 02)) == 0); }
public static DocClass Act() { var result = new DocClass("Act", 1); var stAct = new StaticTextRule("ActHead", RuleBinding.Required); stAct.TextToSearch = "Акт"; var actBot = new SearchConstraint().Page().Above().GetX(0.3); var actRight = new SearchConstraint().Page().LeftOf().GetY(0.2);; stAct.SearchConstraints.Add(actBot); stAct.SearchConstraints.Add(actRight); result.AddHeaderRule(stAct); ActAddActData(result); return(result); }
private static void BupaLegacyAddHeadData(DocClass result) { var stInceptionDate = new StaticTextRule("stInceptionDate", RuleBinding.Required); stInceptionDate.TextToSearch = "Inception Date"; stInceptionDate.SearchArea = new System.Windows.Rect(0, 0, 1000, 1000); result.AddDataRule(stInceptionDate); var stExpiryDate = new StaticTextRule("stExpiryDate", RuleBinding.Required); stExpiryDate.TextToSearch = "Expiry Date"; stExpiryDate.SearchArea = new System.Windows.Rect(0, 0, 1000, 1000); result.AddDataRule(stExpiryDate); var csInceptionDate = new CharacterStringRule("InceptionDate", RuleBinding.Required); csInceptionDate.TextToSearch = @"[a-zA-Z]{3,4}\s?\d{1,2}[,\.]?\s?\d{4}"; csInceptionDate.DependencyRule = stInceptionDate; result.AddDataRule(csInceptionDate); var dacsInceptionDate = new DependencyArea(); dacsInceptionDate.Below.Type = RelationTypes.Top; dacsInceptionDate.Below.Offset = -5; dacsInceptionDate.Above.Type = RelationTypes.Bot; dacsInceptionDate.Above.Offset = 5; dacsInceptionDate.RightOf.Type = RelationTypes.Right; dacsInceptionDate.RightOf.Offset = 100; dacsInceptionDate.LeftOf.Type = RelationTypes.Right; dacsInceptionDate.LeftOf.Offset = 1100; csInceptionDate.DependencyArea = dacsInceptionDate; var csExpiryDate = new CharacterStringRule("ExpiryDate", RuleBinding.Required); csExpiryDate.TextToSearch = @"[a-zA-Z]{3,4}\s?\d{1,2}[,\.]?\s?\d{4}"; csExpiryDate.DependencyRule = stExpiryDate; result.AddDataRule(csExpiryDate); var dacsExpiryDate = new DependencyArea(); dacsExpiryDate.Below.Type = RelationTypes.Top; dacsExpiryDate.Below.Offset = -5; dacsExpiryDate.Above.Type = RelationTypes.Bot; dacsExpiryDate.Above.Offset = 5; dacsExpiryDate.RightOf.Type = RelationTypes.Right; dacsExpiryDate.RightOf.Offset = 100; dacsExpiryDate.LeftOf.Type = RelationTypes.Right; dacsExpiryDate.LeftOf.Offset = 1100; csExpiryDate.DependencyArea = dacsExpiryDate; }
public void Test2() { SDM.LMS.ClearDB(); SDM.LMS.RegisterUser("st", "st", "st", "st", "st", false); SDM.LMS.RegisterUser("lb", "lb", "lb", "lb", "lb", true); Student st = new Student("st"); Librarian lb = new Librarian("lb"); DocClass A = new DocClass("A"); st.CheckOut(A.ID); Debug.Assert(SDM.LMS.GetUser(lb.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(st.PersonID) != null); Debug.Assert(SDM.LMS.GetDoc(A.ID) == null); Debug.Assert(SDM.LMS.GetUserBooks(st.PersonID, 7, "").Count == 0); }
private static void BupaLegacyGet2YearPrior(DocClass result) { var st2YPrior = new StaticTextRule("2YearsPrior", RuleBinding.Required); st2YPrior.TextToSearch = "Policy Year"; st2YPrior.SearchArea = new System.Windows.Rect(0, 0, 1000, 1000); result.AddDataRule(st2YPrior); var rgcsMonthlyClaims = new RepeatingCSRule("2YPrior_MonthlyClaim_0", RuleBinding.Required); rgcsMonthlyClaims.TextToSearch = @"\d{3,7}"; rgcsMonthlyClaims.DependencyRule = st2YPrior; rgcsMonthlyClaims.InterlineSpaces = 30; result.AddDataRule(rgcsMonthlyClaims); var dargMonthlyClaims = new DependencyArea(); dargMonthlyClaims.Below.Type = RelationTypes.Bot; dargMonthlyClaims.Below.Offset = 10; dargMonthlyClaims.LeftOf.Type = RelationTypes.Right; dargMonthlyClaims.LeftOf.Offset = 50; dargMonthlyClaims.RightOf.Type = RelationTypes.Left; //dargMonthlyClaims.RightOf.Offset = 250; dargMonthlyClaims.Above.Type = RelationTypes.Bot; dargMonthlyClaims.Above.Offset = 70; rgcsMonthlyClaims.DependencyArea = dargMonthlyClaims; var rgcsNumberOfLives = new RepeatingCSRule("2YPrior_NumberOfLives_0", RuleBinding.Required); rgcsNumberOfLives.TextToSearch = @"[\da-zA-Z]{1,3}"; rgcsNumberOfLives.DependencyRule = st2YPrior; rgcsNumberOfLives.InterlineSpaces = 30; result.AddDataRule(rgcsNumberOfLives); var dargNumberOfLives = new DependencyArea(); dargNumberOfLives.Below.Type = RelationTypes.Bot; dargNumberOfLives.Below.Offset = 10; dargNumberOfLives.LeftOf.Type = RelationTypes.Right; dargNumberOfLives.LeftOf.Offset = 320; dargNumberOfLives.RightOf.Type = RelationTypes.Right; dargNumberOfLives.RightOf.Offset = 200; dargNumberOfLives.Above.Type = RelationTypes.Bot; dargNumberOfLives.Above.Offset = 70; rgcsNumberOfLives.DependencyArea = dargNumberOfLives; }
public void Test25() { Initial(); int[] dateCheat = { 02, 04, 2018 }; Faculty p1 = new Faculty("p1"); Student s = new Student("s"); VisitingProfessor v = new VisitingProfessor("v"); DocClass d3 = new DocClass("Null References: The Billion Dollar Mistake"); p1.CheckOut(d3.ID, dateCheat); s.CheckOut(d3.ID, dateCheat); v.CheckOut(d3.ID, dateCheat); PriorityQueue <int> pq = SDM.LMS.LoadPQ(d3.ID); Debug.Assert(pq.Pop() == v.PersonID); }
public static DocClass TawuniaLegacy() { var result = new DocClass("Tawunia", 2); var crNumRule = new StaticTextRule("CrNum", RuleBinding.Optional); result.AddHeaderRule(crNumRule); crNumRule.TextToSearch = "CR number"; crNumRule.SearchArea = new System.Windows.Rect(0, 0, 1000, 1000); var stBupaArabia = new StaticTextRule("Bupa Arabia", RuleBinding.Prohibited); result.AddHeaderRule(stBupaArabia); stBupaArabia.TextToSearch = "Bupa Arabia"; stBupaArabia.SearchArea = new System.Windows.Rect(0, 0, 2000, 3000); var InceptionRule = new StaticTextRule("Inception", RuleBinding.Required); result.AddHeaderRule(InceptionRule); InceptionRule.DependencyRule = crNumRule; var depAr = new DependencyArea(); InceptionRule.DependencyArea = depAr; depAr.Below.Type = RelationTypes.Bot; depAr.RightOf.Type = RelationTypes.Left; depAr.RightOf.Offset = -100; depAr.LeftOf.Type = RelationTypes.Right; depAr.LeftOf.Offset = 100; depAr.Above.Type = RelationTypes.Right; depAr.Above.Offset = 150; InceptionRule.TextToSearch = "Inception"; InceptionRule.SearchArea = new System.Windows.Rect(0, 0, 1000, 1000); var PolicyRule = new StaticTextRule("PolicyRule", RuleBinding.Required); result.AddFooterRule(PolicyRule); PolicyRule.TextToSearch = "Policy Holder Confirmation"; PolicyRule.SearchArea = new System.Windows.Rect(0, 0, 1000, 2000); TawuniaLegacyAddDataRules(result); TawuniaLegacySecondPageFields(result); return(result); }
private void UpdateList() { //DocList = new List<DocClass>(); try { response = JsonConvert.DeserializeObject <Message>(server.SendMsg("GetDocument", Data.ServiceSel)); if (response.args[0] == "no_doc") { return; } for (var i = 0; i < response.args.Count; i += 3) { DocClass doc = new DocClass(); doc.ID = response.args[i]; if (response.args[i + 1].Contains(".doc")) { doc.Pim = response.args[i + 1].Split('/').Last().Replace(".doc", ""); } if (response.args[i + 1].Contains(".docx")) { doc.Pim = response.args[i + 1].Split('/').Last().Replace(".docx", ""); } if (doc.Pim == null) { doc.Pim = response.args[i + 1].Split('/').Last(); } doc.Date = response.args[i + 2]; DocList.Add(doc); } /*DocClass doc1 = new DocClass(); * doc1.ID = "Технические"; * doc1.Pim = "Технические"; * Items.Add(doc1);*/ } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Test34() { Test32(); Librarian lb1 = new Librarian("lb1"); Librarian lb2 = new Librarian("lb2"); Librarian lb3 = new Librarian("lb3"); SDM.CurrentUser = lb2; lb2.AddBook("d1", "d1", "d1", 2018, "d1", "d1", 2000, false, 3, ""); lb2.AddBook("d2", "d2", "d2", 2018, "d2", "d2", 2000, false, 3, ""); lb2.AddBook("d3", "d3", "d3", 2018, "d3", "d3", 2000, false, 3, ""); DocClass d1 = new DocClass("d1"); DocClass d2 = new DocClass("d2"); DocClass d3 = new DocClass("d3"); lb2.RegisterUser("p1", "p1", "p1", "Via Margutta, 3", "30001", false); lb2.RegisterUser("p2", "p2", "p2", "Via Sacra, 13", "30002", false); lb2.RegisterUser("p3", "p3", "p3", "Via del Corso, 22", "30003", false); lb2.RegisterUser("s", "s", "s", "s", "s", false); lb2.RegisterUser("v", "v", "v", "v", "v", false); Student p1 = new Student("p1"); Student p2 = new Student("p2"); Student p3 = new Student("p3"); Student s = new Student("s"); Student v = new Student("v"); Debug.Assert(SDM.LMS.GetUser(p1.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(p2.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(p3.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(s.PersonID) != null); Debug.Assert(SDM.LMS.GetUser(v.PersonID) != null); Debug.Assert(SDM.LMS.GetDoc(d1.ID) != null); Debug.Assert(SDM.LMS.GetDoc(d2.ID) != null); Debug.Assert(SDM.LMS.GetDoc(d3.ID) != null); Debug.Assert(SDM.LMS.GetDoc(d1.ID).Quantity == 3); Debug.Assert(SDM.LMS.GetDoc(d2.ID).Quantity == 3); Debug.Assert(SDM.LMS.GetDoc(d3.ID).Quantity == 3); }
public void Test12() { Test11(); Librarian lb = new Librarian("lb"); Student p2 = new Student("Nadia Teixeira"); admin.ModifyLibrarian(lb.PersonID, "lb", "lb", "lb", 2); DocClass b1 = new DocClass("Introduction to Algorithms"); DocClass b3 = new DocClass("The Mythical Man-month"); lb.ModifyAV(b1.ID, b1.Title, b1.Autors, b1.Price, b1.Quantity - 2, ""); lb.ModifyAV(b3.ID, b3.Title, b3.Autors, b3.Price, b3.Quantity - 1, ""); lb.DeleteUser(p2.PersonID); Debug.Assert(SDM.LMS.GetUser(p2.PersonID) == null); Debug.Assert(b1.Quantity == 1); Debug.Assert(b3.Quantity == 0); }
public void Test18() { Test11(); Librarian lb = new Librarian("lb"); Faculty p1 = new Faculty("Sergey Afonso"); Student p2 = new Student("Nadia Teixeira"); admin.ModifyLibrarian(lb.PersonID, "lb", "lb", "lb", 2); DocClass b1 = new DocClass("Introduction to Algorithms"); DocClass b2 = new DocClass("Design Patterns: Elements of Reusable Object-Oriented Software"); DocClass av1 = new DocClass("Null References: The Billion Dollar Mistake"); p1.CheckOut(b1.ID, new int[] { 09, 02, 2018 }); p1.CheckOut(b2.ID, new int[] { 02, 02, 2018 }); p2.CheckOut(b1.ID, new int[] { 05, 02, 2018 }); p2.CheckOut(av1.ID, new int[] { 17, 02, 2018 }); DateTime now = new DateTime(2018, 03, 05); List <OverdueInfo> overdueInfos = new List <OverdueInfo>() { new OverdueInfo { Overdue = (int)now.Subtract(new DateTime(2018, 02, 02).AddDays(28)).TotalDays, DocumentChekedOut = "Design Patterns: Elements of Reusable Object-Oriented Software" } }; Debug.Assert(SDM.LMS.CheckUserInfo("Sergey Afonso", "Via Margutta, 3", "30001", 1, overdueInfos, now)); overdueInfos = new List <OverdueInfo> { new OverdueInfo { Overdue = (int)now.Subtract(new DateTime(2018, 02, 05).AddDays(21)).TotalDays, DocumentChekedOut = "Introduction to Algorithms" }, new OverdueInfo { Overdue = (int)now.Subtract(new DateTime(2018, 02, 17).AddDays(14)).TotalDays, DocumentChekedOut = "Null References: The Billion Dollar Mistake" } }; Debug.Assert(SDM.LMS.CheckUserInfo("Nadia Teixeira", "Via Sacra, 13", "30002", 0, overdueInfos, now)); }
public static DocClass BupaLegacy() { var result = new DocClass("Bupa", 4); var stBupaArabia = new StaticTextRule("BupaArabia", RuleBinding.Required); stBupaArabia.TextToSearch = "Bupa Arabia for Cooperative Insurance"; result.AddHeaderRule(stBupaArabia); stBupaArabia.SearchArea = new System.Windows.Rect(0, 0, 2000, 500); var stSignature = new StaticTextRule("SignatureNStamp", RuleBinding.Required); stSignature.TextToSearch = "Signature & Stamp"; result.AddFooterRule(stSignature); stSignature.SearchArea = new System.Windows.Rect(0, 0, 1500, 3000); BupaLegacyAddHeadData(result); BupaLegacyAddTableData(result); return(result); }
private void UpdateList() { Items = new ObservableCollection <DocClass>(); try { response = JsonConvert.DeserializeObject <Message>(server.SendMsg("GetDocument", Data.ServiceSel)); if (response.args[0] == "no_doc") { return; } for (var i = 0; i < response.args.Count; i += 3) { DocClass doc = new DocClass(); doc.ID = response.args[i]; if (response.args[i + 1].Contains(".doc")) { doc.Pim = response.args[i + 1].Split('/').Last().Replace(".doc", ""); } if (response.args[i + 1].Contains(".docx")) { doc.Pim = response.args[i + 1].Split('/').Last().Replace(".docx", ""); } doc.Date = response.args[i + 2]; Items.Add(doc); } DocClass doc1 = new DocClass(); doc1.ID = "Технические"; doc1.Pim = "Технические"; Items.Add(doc1); } catch { MessageBox.Show("Произошла ошибка! Обратитесь к поддержке!"); } }
public void Test30() { Initial(); Faculty p1 = new Faculty("p1"); VisitingProfessor v = new VisitingProfessor("v"); DocClass d1 = new DocClass("Introduction to Algorithms"); p1.CheckOut(d1.ID, new int[] { 26, 03, 2018 }); p1.RenewDoc(d1.ID, new int[] { 29, 03, 2018 }); v.CheckOut(d1.ID, new int[] { 29, 03, 2018 }); v.RenewDoc(d1.ID, new int[] { 30, 03, 2018 }); List <CheckedOut> checkedOuts = SDM.LMS.GetCheckoutsList("p1"); Debug.Assert(checkedOuts.First().CheckOutTime == 26); Debug.Assert(checkedOuts.First().DocumentCheckedOut == "Introduction to Algorithms"); checkedOuts = SDM.LMS.GetCheckoutsList("v"); Debug.Assert(checkedOuts.First().CheckOutTime == 5); Debug.Assert(checkedOuts.First().DocumentCheckedOut == "Introduction to Algorithms"); }
/// <summary> /// Create a type defrinition for the given class file and all inner classes. /// </summary> public override void CreateType(NetTypeDefinition declaringType, NetModule module, TargetFramework target) { if (declaringType == null) throw new ArgumentNullException("declaringType"); docClass = target.GetXmlClass(cf); var name = NameConverter.UpperCamelCase(inner.IsAnonymous ? cf.Name : inner.Name); name = CreateTypeName(declaringType, cf, name, null); var finalFullName = parentFullName + "/" + name; var attributes = GetAttributes(cf); typeDef = new NetTypeDefinition(cf, target, module.Scope) { Name = name, Attributes = attributes }; typeDef.OriginalJavaClassName = cf.ClassName; typeDef.Description = (docClass != null) ? docClass.Description : null; parent.AddNestedType(typeDef, "", module, ref finalFullName); // Prepare generics CreateGenericParameters(cf, typeDef); // Add mapping RegisterType(target, cf, typeDef); CreateNestedTypes(cf, typeDef, finalFullName, module, target); }
/// <summary> /// Try to get a class by it's name. /// </summary> public bool TryGetClassByName(string name, out DocClass @class) { return classesByName.TryGetValue(name, out @class); }
/// <summary> /// Try to get a class by it's id. /// </summary> public bool TryGetClassById(string id, out DocClass @class) { return classesById.TryGetValue(id, out @class); }
/// <summary> /// Load the given field /// </summary> private void LoadField(DocClass @class, XElement memberdef) { var name = memberdef.GetElementValue("name"); var xmlField = new DocField(name) { Description = GetDescription(memberdef) }; @class.Fields.Add(xmlField); }
/// <summary> /// Load the given method /// </summary> private void LoadMethod(DocClass @class, XElement memberdef) { var name = memberdef.GetElementValue("name"); var xmlMethod = new DocMethod(name) { Description = GetDescription(memberdef) }; @class.Methods.Add(xmlMethod); // Load parameter var ns = @class.Namespace; foreach (var p in memberdef.Elements("param")) { LoadParameter(xmlMethod, p, ns); } }
/// <summary> /// Create a type definition for the given class file and all inner classes. /// </summary> public override void CreateType(NetTypeDefinition declaringType, NetModule module, TargetFramework target) { if (declaringType != null) throw new ArgumentException("Declaring type should be null"); docClass = target.GetXmlClass(cf); var fullName = GetFullName(); var dotIndex = fullName.LastIndexOf('.'); var ns = (dotIndex > 0) ? ConvertNamespace(fullName, dotIndex) : String.Empty; var name = (dotIndex > 0) ? NameConverter.UpperCamelCase(fullName.Substring(dotIndex + 1)) : fullName; name = CreateTypeName(null, cf, name, ns); typeDef = new NetTypeDefinition(cf, target, module.Scope); typeDef.Name = name; typeDef.Namespace = ns; typeDef.OriginalJavaClassName = cf.ClassName; typeDef.Attributes = GetAttributes(cf, cf.Fields.Any()); typeDef.IgnoreGenericArguments = !AddGenericParameters; typeDef.Description = (docClass != null) ? docClass.Description : null; module.Types.Add(typeDef); // Prepare generics CreateGenericParameters(cf, typeDef); // Add mapping var finalFullName = string.IsNullOrEmpty(ns) ? name : ns + "." + name; RegisterType(target, cf, typeDef); CreateNestedTypes(cf, typeDef, finalFullName, module, target); }
/// <summary> /// Load the given class /// </summary> private void LoadClass(XElement compounddef) { var id = compounddef.GetAttribute("id"); var name = compounddef.GetElementValue("compoundname"); var xmlClass = new DocClass(name) { Id = id, Description = GetDescription(compounddef) }; classesById.Add(xmlClass.Id, xmlClass); classesByName.Add(xmlClass.Name, xmlClass); var index = xmlClass.Name.IndexOf('<'); if (index > 0) { // Generic class var elementName = xmlClass.Name.Substring(0, index); if (!classesByName.ContainsKey(elementName)) { classesByName.Add(elementName, xmlClass); } } foreach (var memberdef in compounddef.Descendants("memberdef").Where(x => x.GetAttribute("kind") == "function")) { LoadMethod(xmlClass, memberdef); } foreach (var memberdef in compounddef.Descendants("memberdef").Where(x => x.GetAttribute("kind") == "variable")) { LoadField(xmlClass, memberdef); } }