Exemplo n.º 1
0
        public void Create_One_Lawyer_In_Two_Accounts()
        {
            Customer customer = CreateCustomer(CreatePerson());
            Lawyer   lawyer   = CreateLawyer(CreatePerson());

            Account account1 = AccountTest.CreateAccount();

            account1.Lawyers.Add(lawyer);
            account1.Customers.Add(customer);
            this.context.BankAccounts.Add(account1);

            Account account2 = AccountTest.CreateAccount();

            account2.Lawyers.Add(lawyer);
            this.context.BankAccounts.Add(account2);

            this.context.SaveChanges();

            Assert.True(this.anotherContext.Persons.Count() == 2);
            Assert.True(this.anotherContext.BankAccounts.Count() == 2);
            var lawyers = this.anotherContext.BankAccounts.OfType <Account>().SelectMany(o => o.Lawyers).Distinct().ToList();

            Assert.True(lawyers.Count() == 1);
            Assert.True(this.anotherContext.BankAccounts.OfType <Account>().SelectMany(o => o.Customers).Count() == 1);
        }
Exemplo n.º 2
0
        public IHttpActionResult PostNewLawyer(Lawyer lawyer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid data."));
            }

            using (var ctx = new LawyerContext())
            {
                ctx.Lawyers.Add(new Lawyer()
                {
                    Id          = lawyer.Id,
                    Name        = lawyer.Name,
                    Surname     = lawyer.Surname,
                    Initials    = lawyer.Initials,
                    DateOfBirth = lawyer.DateOfBirth,
                    Email       = lawyer.Email,
                    Gender_id   = lawyer.Gender_id,
                    Title_id    = lawyer.Title_id
                });

                ctx.SaveChanges();
            }
            return(Ok());
        }
 public LawyerFreeCases(Lawyer lawyer)
 {
     _repository = RepositoryFactory.Create();
     InitializeComponent();
     Load         += LawyerFreeCases_Load;
     LawyerId.Text = lawyer.Id.ToString();
 }
Exemplo n.º 4
0
        public IHttpActionResult GetAllLawyersByID(int lid)
        {
            LawyerDTO lawyer = null;

            using (var ctx = new LawyerContext())
            {
                lawyer = ctx.Lawyers.Include("Name")
                         .Where(l => l.Id == lid)
                         .Select(l => new LawyerDTO()
                {
                    Id          = l.Id,
                    Name        = l.Name,
                    Surname     = l.Surname,
                    Initials    = l.Initials,
                    DateOfBirth = l.DateOfBirth,
                    Email       = l.Email,
                    Gender_id   = (short)l.Gender_id,
                    Title_id    = (short)l.Title_id
                }).FirstOrDefault <LawyerDTO>();
            }

            if (lawyer == null)
            {
                return(NotFound());
            }

            return(Ok(lawyer));
        }
Exemplo n.º 5
0
 public static LawyerDTO ToLawyerDTO(Lawyer lawyer)
 {
     return(new LawyerDTO
     {
         Id = lawyer.Id,
         UserId = lawyer.UserId,
         Certificates = lawyer.Certificates,
         Description = lawyer.Description,
         CertificatesEn = lawyer.CertificatesEn,
         DescriptionEn = lawyer.DescriptionEn,
         Fees = lawyer.Fees,
         IsOnline = lawyer.ModifiedDate.AddMinutes(20) >= DateTime.Now,
         Name = lawyer.User.Name,
         NameEn = lawyer.User.NameEn,
         Rate = CalculateRate(lawyer.Reviews),
         Specialization = lawyer.Specialization != null ? lawyer.Specialization.Name : "",
         SpecializationEn = lawyer.Specialization != null ? lawyer.Specialization.NameEn : "",
         SpecializationId = lawyer.SpecializationId,
         Reviews = lawyer.Reviews.Select(r => ReviewDTO.ToReviewDTO(r)),
         ExperienceId = lawyer.ExperienceId,
         ExperienceName = lawyer.Experience != null ? lawyer.Experience.Name : "",
         ExperienceNameEn = lawyer.Experience != null ? lawyer.Experience.NameEn : "",
         VideoURL = lawyer.VideoURL,
         Video = Utils.GetVideo(lawyer.VideoURL),
         ProfileImg = string.IsNullOrEmpty(lawyer.User.ProfileImg) ? "/images/personal-img.jpg" : lawyer.User.ProfileImg,
     });
 }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Speciality,Age,MobileNumber")] Lawyer lawyer)
        {
            if (id != lawyer.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lawyer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LawyerExists(lawyer.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(lawyer));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> PutLawyer(int id, Lawyer lawyer)
        {
            if (id != lawyer.Id)
            {
                return(BadRequest());
            }

            _context.Entry(lawyer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LawyerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 8
0
        static void Polymorphism()
        {
            // Polymorphism: The ability to change properties and behaviors within a class.

            Clown clown = new Clown();

            Console.WriteLine($" Clowns Say: {clown.Talk()}");

            Lawyer lawyer = new Lawyer();

            Console.WriteLine($"Lawyer Says: { lawyer.Talk()}");

            Bozo bozo = new Bozo();

            Console.WriteLine($"BOZO SAYS: {bozo.Talk()}");

            Person[] myPeeps = { clown, lawyer, bozo };

            for (int i = 0; i < myPeeps.Length; i++)
            {
                if (myPeeps[i] is Clown)
                {
                    Console.WriteLine(clown.Eat());
                }
                else
                {
                    Console.WriteLine("I am not a clown");
                }
            }

            Car car = new Car();

            clown.Drive(car);
        }
Exemplo n.º 9
0
        public async Task <ActionResult> AddLawyer(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                // var newUser = new ApplicationUser { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email };
                var newUser = new ApplicationUser {
                    UserName = model.Email, Email = model.Email, FirstName = model.FirstName, LastName = model.LastName, Address = model.Address
                };

                var result = await UserManager.CreateAsync(newUser, model.Password);

                if (result.Succeeded)
                {
                    Lawyer newLawyer = new Lawyer {
                        Id = newUser.Id, CostPerHour = 0
                    };
                    db.Lawyers.Add(newLawyer);
                    db.SaveChanges();

                    await UserManager.AddToRoleAsync(newUser.Id, MyCustomRoles.Lawyer);

                    return(RedirectToAction("GetLawyers", "Admin"));
                }
            }


            return(View(model));
        }
Exemplo n.º 10
0
        public async Task OnGetAsync(long?id)
        {
            if (id.HasValue)
            {
                Lawyer lawyer = await _lawyerService.GetLawyerByPrincipalAsync(User);

                LawyerSchedule schedule = lawyer.LawyerSchedules.FirstOrDefault(ls => ls.ID == id.Value);

                ScheduleId = id;

                TimeBegin = schedule.TimeBegin;
                TimeEnd   = schedule.TimeEnd;
                Date      = schedule.TimeBegin.Date;

                if (schedule.RecurringDays != RecurringDays.None)
                {
                    IsRecurring = true;
                    Sunday      = (schedule.RecurringDays & RecurringDays.Sunday) > 0;
                    Monday      = (schedule.RecurringDays & RecurringDays.Monday) > 0;
                    Tuesday     = (schedule.RecurringDays & RecurringDays.Tuesday) > 0;
                    Wednesday   = (schedule.RecurringDays & RecurringDays.Wednesday) > 0;
                    Thursday    = (schedule.RecurringDays & RecurringDays.Thursday) > 0;
                    Friday      = (schedule.RecurringDays & RecurringDays.Friday) > 0;
                    Saturday    = (schedule.RecurringDays & RecurringDays.Saturday) > 0;
                }
            }
            else
            {
                Date = DateTime.Today;
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Presents the lawyer with options to define the libraries they would be willing to meet veterans at
        /// </summary>
        public async Task OnGetAsync()
        {
            Lawyer lawyer = await _lawyerService.GetLawyerByPrincipalAsync(User);

            SelectedLibraryIds = (await _libraryService.GetAllLibrariesForLawyerAsync(lawyer.ApplicationUserId)).Select(l => l.ID);
            AllLibraries       = new MultiSelectList(_libraryService.GetAllLibraries(), "ID", "Name");
        }
Exemplo n.º 12
0
        public void AddALawyer()
        {
            // setting up the expectations
            Lawyer newLawyer = new Lawyer
            {
                Name        = "Neos",
                Surname     = "Surneos",
                Initials    = "NS",
                DateOfBirth = new DateTime(2000, 1, 1),
                Email       = "*****@*****.**",
                GenderRefId = 1,
                TitleRefId  = 1
            };

            CollectionAssert.DoesNotContain(Lawyers, newLawyer);

            using (LawyerService lawyerService = new LawyerService(MockContext.Object))
            {
                // test add new lawyer
                lawyerService.Add(newLawyer);
                MockLawyersSet.Verify(m => m.Add(It.IsAny <Lawyer>()), Times.Once);
                CollectionAssert.Contains(Lawyers, newLawyer);
                Assert.AreEqual(true, newLawyer.Active);

                // also test that findByName fetches the new lawyer
                Assert.AreEqual(newLawyer, lawyerService.GetAll(Doubles.GetParameters(Name: newLawyer.Name)).FirstOrDefault());

                // same goes with the surname
                Assert.AreEqual(newLawyer, lawyerService.GetAll(Doubles.GetParameters(Surname: newLawyer.Surname)).FirstOrDefault());
            }
        }
Exemplo n.º 13
0
        public async Task <ActionResult <Lawyer> > PostLawyer(Lawyer lawyer)
        {
            _context.Lawyers.Add(lawyer);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLawyer", new { id = lawyer.Id }, lawyer));
        }
Exemplo n.º 14
0
        static Hero PlayerSetup()
        {
            Console.WriteLine("What is your name?");

            string name   = Console.ReadLine();
            string choice = "0";

            while (choice != "1" && choice != "2" && choice != "3" && choice != "4")
            {
                Console.WriteLine("What was your role within the company? Use your number keys to decide\n1. Programmer - Writes and Speaks in the obscure language of Code, confusing opponents with mathematical precision.\n2. Lawyer - Knows the ways of the Law, with a post-graduate degree that cost them in the hundreds of thousands. Legaleses opponents into submission.\n3. Accountant - Master of the books and TPS Reports. Number crunches their way to victory.\n4. Office Bum - How did you even get this job, let alone another one? Must be lucky I guess.");
                choice = Console.ReadLine();
            }

            switch (choice)
            {
            case ("1"):
                Programmer prohero = new Programmer(name);
                return(prohero);

            case ("2"):
                // Change Ninja to another class of hero.
                Lawyer lawhero = new Lawyer(name);
                return(lawhero);

            case ("3"):
                // Change Ninja to another class of hero.
                Accountant acchero = new Accountant(name);
                return(acchero);

            case ("4"):
                OfficeBum bumhero = new OfficeBum(name);
                return(bumhero);
            }
            return(null);
        }
Exemplo n.º 15
0
 /// <summary>
 /// 编辑律师
 /// </summary>
 /// <param name="lawyer"></param>
 public void Update(Lawyer lawyer)
 {
     if (manage.Edit(lawyer) > 0)
     {
         result.success = true;
     }
 }
Exemplo n.º 16
0
 public string AddLawyerToAccount(Guid accountId, LawyerDto lawyerDto)
 {
     try
     {
         Guid personId = lawyerDto.PersonId;
         AccountRepository repository = new AccountRepository();
         Person            person     = repository.ActiveContext.Persons.Where(p => p.Id == personId).FirstOrDefault();
         if (person == null)
         {
             return("the person id is invalid and person can't be find");
         }
         Account account =
             repository.ActiveContext.BankAccounts.OfType <Account>()
             .Include("Lawyers.Person")
             .FirstOrDefault(a => a.Id == accountId);
         if (account == null)
         {
             return("account id is invalid and lawyer can't be added");
         }
         if (!account.ContainLawyer(personId))
         {
             Lawyer lawyer = Lawyer.CreateLawyer(person, lawyerDto.StartDate);
             account.Lawyers = new Collection <Lawyer>();
             account.Lawyers.Add(lawyer);
             repository.ActiveContext.SaveChanges();
             return("lawyer added successfully");
         }
         return("lawyer was there and can't be recreated");
     }
     catch (Exception fException)
     {
         return(fException.Message);
     }
 }
Exemplo n.º 17
0
        /// <summary>
        /// 作用:分析一行得到自然人实体类
        /// 作者:汪建龙
        /// 编写时间:2017年3月6日14:52:36
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private static Lawyer AnalyzeLawyer(IRow row)
        {
            var cells = new NPOI.SS.UserModel.ICell[11];

            for (var i = 0; i < cells.Length; i++)
            {
                cells[i] = row.GetCell(i);
            }
            var name = cells[0].ToString();

            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            var lawyer = new Lawyer
            {
                Name     = name,
                BornTime = cells[2].ToString().Trim(),
                Number   = cells[4].ToString().Trim(),
                Address  = cells[8].ToString().Trim(),
                TelPhone = cells[9].ToString().Trim(),
                EMail    = cells[10].ToString().Trim()
            };

            try
            {
                lawyer.Sex        = EnumHelper.GetEnum <Sex>(cells[1].ToString().Trim());
                lawyer.Credential = EnumHelper.GetEnum <Credential>(cells[3].ToString().Trim());
            }
            catch
            {
            }
            return(lawyer);
        }
Exemplo n.º 18
0
        public void Create_Complex_Account2()
        {
            PersonRepository context  = new PersonRepository();
            Person           person   = PersonTest.CreatePerson();
            Customer         customer = PersonTest.CreateCustomer(person);
            Lawyer           lawyer   = PersonTest.CreateLawyer(person);

            if (person != null)
            {
                context.Add(person);
            }

            /*            GeneralAccount generalAccount = CreateGeneralAccount();
             * IndexAccount indexAccount = CreateIndexAccount();
             * Account account = CreateAccount();
             * indexAccount.Accounts.Add(account);
             * generalAccount.IndexAccounts.Add(indexAccount);
             * context.Add(generalAccount);
             * CustomerRepository customerRepository = new CustomerRepository();
             * customer.Accounts.Add(account);
             * customerRepository.Add(customer);
             * LawyerRepository lawyerRepository = new LawyerRepository();
             * lawyer.Accounts.Add(account);
             * lawyerRepository.Add(lawyer);*/
        }
Exemplo n.º 19
0
 // Go Do It 
 /// <summary>
 /// This Method to add new lowyer
 /// </summary>
 /// <param name="lo">Object</param>
 /// <returns> Return true  or false </returns>
 public bool NewLowyer(Lawyer lo)
 {
     context =new DbDataContext();
     context.Lawyers.InsertOnSubmit(lo);
     context.SubmitChanges();
     return true;
 }
Exemplo n.º 20
0
 public void Add(Lawyer lawyer)
 {
     if (lawyer.Name.Length > 2 && lawyer.Email.Length > 5 && lawyer.Password.Length > 5)
     {
         _lawyerDal.Add(lawyer);
     }
 }
        public void PostNewLawyer_ShouldPostLawyer()
        {
            // Arrange
            var mockRepository = new Mock <ILawyerRepository>();
            var controller     = new LawyerController(mockRepository.Object);
            var model          = new Lawyer()
            {
                Name        = "Max",
                Surname     = "Steel",
                Initials    = "m.s.",
                Email       = "*****@*****.**",
                DateOfBirth = DateTime.Parse("2005-09-01"),
                Gender_id   = 1,
                Title_id    = 1
            };

            // Act
            IHttpActionResult actionResult = controller.PostNewLawyer(model);
            var createdResult = actionResult as CreatedAtRouteNegotiatedContentResult <Lawyer>;

            // Assert
            Assert.IsNotNull(createdResult);
            Assert.AreEqual("DefaultApi", createdResult.RouteName);
            Assert.AreEqual(model.Name, createdResult.RouteValues["name"]);
        }
Exemplo n.º 22
0
 /// <summary>
 /// 添加律师
 /// </summary>
 /// <param name="lawyer"></param>
 public void Insert(Lawyer lawyer)
 {
     if (manage.Add(lawyer) > 0)
     {
         result.success = true;
     }
 }
Exemplo n.º 23
0
        public ActionResult Bill(string LawyerID, int CaseID)
        {
            Lawyer lawyer = db.Lawyers.Single(b => b.Id == LawyerID);

            ViewBag.lawyer = lawyer;

            Cases caseName = db.Cases.Single(m => m.CaseID == CaseID);

            ViewBag.caseName = caseName;

            LawyerCases lc = db.LawerCases.Single(a => a.CaseID == CaseID && a.LawyerID == LawyerID);

            int Starthours = lc.AssignDate.Hour;
            int Endhours   = lc.ExpiredDate.Hour;



            int CostPerHour = lc.Lawyer.CostPerHour;
            int Duration    = Endhours - Starthours;

            int total = CostPerHour * Duration;

            if (ModelState.IsValid)
            {
                lc.TotalHours = Duration;

                db.SaveChanges();
            }



            ViewBag.total = total;

            return(View("Bill", lc));
        }
Exemplo n.º 24
0
        public ActionResult DeleteConfirmed(int id)
        {
            Lawyer lawyer = db.Lawyers.Find(id);

            db.Lawyers.Remove(lawyer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 25
0
 /// <summary>
 /// 编辑律师
 /// </summary>
 /// <param name="lawyer"></param>
 /// <returns></returns>
 public int Edit(Lawyer lawyer)
 {
     using (var db = new Entities())
     {
         db.Entry <Lawyer>(lawyer).State = System.Data.Entity.EntityState.Modified;
         return(db.SaveChanges());
     }
 }
Exemplo n.º 26
0
 /// <summary>
 /// 添加律师
 /// </summary>
 /// <param name="lawyer"></param>
 /// <returns></returns>
 public int Add(Lawyer lawyer)
 {
     using (var db = new Entities())
     {
         db.Lawyer.Add(lawyer);
         return(db.SaveChanges());
     }
 }
        private static void AddLawyer(List <Lawyer> lawyers, Lawyer newLawyer)
        {
            if (lawyers.Any(l => l.ID == newLawyer.ID))
            {
                throw new ArgumentException(GlobalConstants.InvalidAdding);
            }

            lawyers.Add(newLawyer);
        }
Exemplo n.º 28
0
 public TriggerHandleDTO(User user, Admin admin, Lawyer lawyer, string message, string image, DateTime date)
 {
     User    = user;
     Admin   = admin;
     Lawyer  = lawyer;
     Message = message;
     Image   = image;
     Date    = date;
 }
Exemplo n.º 29
0
        public bool Post_Lawyer(Lawyer lawyer)
        {
            lawyer.IsActive = true;
            var postTask = _client.PostAsJsonAsync("lawyers", lawyer);

            postTask.Wait();

            return(postTask.Result.IsSuccessStatusCode);
        }
Exemplo n.º 30
0
        public bool Put_Lawyer(Lawyer lawyer)
        {
            lawyer.IsActive = false;
            var putTask = _client.PutAsJsonAsync("lawyers", lawyer);

            putTask.Wait();

            return(putTask.Result.IsSuccessStatusCode);
        }
 public async Task <IActionResult> Create([Bind("Name,Surname,Initials,DateOfBirth,Gender_id,Title_id,EmailAddress")] Lawyer lawyer)
 {
     if (_mtHttpClientService.Post_Lawyer(lawyer))
     {
         return(RedirectToAction("Index"));
     }
     ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");
     return(View(_mtHttpClientService.Create_GTVM(_mtHttpClientService.Get_All_Genders(_mtHttpClientService.Client_Get_Async("gender")), _mtHttpClientService.Get_All_Titles(_mtHttpClientService.Client_Get_Async("title")), null)));
 }
Exemplo n.º 32
0
        public bool EditLowyer(Lawyer low, int xid)
        {
            low.Id = xid;
            var q = CompiledQuery.Compile((DbDataContext db, int i) =>
                db.Lawyers.Single(d => d.Id == i));
            var lawyer = q(context, xid);
            lawyer.LawyerName = low.LawyerName;
            lawyer.Address = low.Address;
            lawyer.Phone = low.Phone;
            lawyer.Describe = low.Describe;
            lawyer.FollowUpIssues = low.FollowUpIssues;

            context.SubmitChanges();

            return true;
        }
Exemplo n.º 33
0
        private static Lawyer ProcessIndividual(int i)
        {
            Lawyer lawyer = new Lawyer();

            HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
            htmlDoc.OptionFixNestedTags = true;
            WebClient client = new WebClient();
            string detailUrl = "https://www.wyomingbar.org/directory/index.html?-Token.vid=" + i;
            string downloadString = client.DownloadString(detailUrl); ;
            htmlDoc.LoadHtml(downloadString);

            if (htmlDoc.DocumentNode != null)
            {
                var test = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]");
                if (!test.InnerHtml.Contains("Record is missing"))
                {
                    Console.WriteLine(i);

                    try
                    {
                        var nameNode = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/p[2]");
                        lawyer.Name = nameNode.InnerHtml;

                        var addressAndPhoneNode = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/p[3]");
                        lawyer.Address = addressAndPhoneNode.InnerHtml.Replace("<br>", " ");

                        var website = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/table/tr/td/a");
                        bool isMissingRow = false;
                        if (website != null)
                        {
                            if (string.IsNullOrEmpty(website.InnerHtml))
                            {
                                isMissingRow = true;
                            }
                            else
                            {
                                var checkForNowWebsite = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/table/tr[1]/td[3]");
                                if (checkForNowWebsite != null && checkForNowWebsite.InnerHtml.Contains("Judicial District"))
                                {
                                    isMissingRow = true;
                                }
                                else
                                {
                                    lawyer.Website = website.InnerHtml;
                                }
                            }

                            int firstRowIndex = isMissingRow ? 1 : 2;
                            var email = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/table/tr[" + firstRowIndex + "]/td/a");
                            if (email != null)
                            {
                                isMissingRow = true;
                                lawyer.Email = email.InnerHtml;
                            }

                            string districtLoc = "/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/table/tr[" + firstRowIndex + "]/td[3]";
                            var district = htmlDoc.DocumentNode.SelectSingleNode(districtLoc);
                            lawyer.District = district.InnerHtml.Replace("Judicial District: ", "");

                            var county = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/table/tr[" + (firstRowIndex + 1) + "]/td");
                            lawyer.County = county.InnerHtml.Replace("County: ", "");

                            var admissionDate = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/table/tr[" + (firstRowIndex + 1) + "]/td[3]");
                            lawyer.AdmissionDate = admissionDate.InnerHtml.Replace("Admission Date: ", "");

                            var status = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/table/tr[" + (firstRowIndex + 2) + "]/td");
                            lawyer.Status = status.InnerHtml.Replace("Status: ", "");

                            var discipline = htmlDoc.DocumentNode.SelectSingleNode("/html/body/table[4]/tr/td[3]/table/tr[1]/td[2]/table/tr[" + (firstRowIndex + 3) + "]/td");
                            lawyer.Discipline = discipline.InnerHtml.Replace("Public Discipline: ", "");
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("--------------------------------------------------\n");
                        Console.WriteLine("Cannot Parse:" + i);
                        Console.WriteLine("--------------------------------------------------\n");
                    }
                }
            }
            return lawyer;
        }
Exemplo n.º 34
0
        public bool DeleteLawyer(Lawyer law, int xid)
        {
            law.Id = xid;
            var q = CompiledQuery.Compile((DbDataContext db, int i) =>
                db.Lawyers.Single(p => p.Id == i));
            var xLaw = q(context, xid);
            context.Lawyers.DeleteOnSubmit(xLaw);
            context.SubmitChanges();

            return true;
        }