Пример #1
0
        public void GenerateEmailBodyForEstimationTeamTest()
        {
            DateTime dt = new DateTime(2011, 02, 14);

            CS_JobDescription csJobDescription = new CS_JobDescription()
                                                     {
                                                         Active = true,
                                                         NumberEmpties = 1,
                                                         NumberLoads = 2,
                                                         NumberEngines = 1
                                                     };

            CS_Division division = new CS_Division()
                                       {
                                           ID = 241,
                                           Active = true,
                                           Name = "005",
                                           Description = "White River, Ontario"
                                       };

            CS_JobDivision jobdivision = new CS_JobDivision()
                                          {
                                              Active = true,
                                              JobID = 243,
                                              DivisionID = 241,
                                              CS_Division = division
                                          };

            CS_Employee employee = new CS_Employee()
                                       {
                                           Active = true,
                                           Name = "Dcecilia",
                                           FirstName = "Test",
                                           DivisionID = 241
                                       };

            CS_Reserve reserve = new CS_Reserve()
                                     {
                                         Active = true,
                                         JobID = 243,
                                         Type = 2,
                                         CS_Employee = employee,
                                         DivisionID = 241
                                     };

            EntityCollection<CS_JobDivision> JobDivision = new EntityCollection<CS_JobDivision>();

            JobDivision.Add(jobdivision);

            CS_ScopeOfWork csScopeOfWork = new CS_ScopeOfWork()
            {
                Active = true,
                ScopeOfWork = "xxcxcxc",
                JobId = 243
            };

            EntityCollection<CS_Reserve> csReserves = new EntityCollection<CS_Reserve>();
            csReserves.Add(reserve);

            EntityCollection<CS_ScopeOfWork> scopeOfWorks = new EntityCollection<CS_ScopeOfWork>();
            scopeOfWorks.Add(csScopeOfWork);

            //Arrange
            FakeObjectSet<CS_Job> fakeJobObject = new FakeObjectSet<CS_Job>();
            fakeJobObject.AddObject
                (
                    new CS_Job()
                        {
                            ID = 243,
                            Active = true,
                            CreatedBy = "rbrandao",
                            CreationDate = DateTime.Now,
                            ModificationDate = DateTime.Now,
                            ModifiedBy = "Load",
                            Internal_Tracking = "000000025INT",
                            CS_ScopeOfWork = scopeOfWorks,
                            CS_JobDivision = JobDivision,
                            CS_Reserve = csReserves,
                            CS_CustomerInfo = new CS_CustomerInfo()
                                                  {
                                                      Active = true,
                                                      CS_Customer = new CS_Customer()
                                                                        {
                                                                            Active = true,
                                                                            Name = "Test Customer"
                                                                        },
                                                      CS_Division = division
                                                  },
                            CS_JobInfo = new CS_JobInfo()
                                             {
                                                 Active = true,
                                                 CS_JobAction = new CS_JobAction()
                                                                    {
                                                                        Active = true,
                                                                        Description = "Environmental Work, General - Undefined Scope of Work"
                                                                    },
                                                 CS_JobType = new CS_JobType()
                                                                    {
                                                                        Active = true,
                                                                        Description = "A"
                                                                    },
                                                 CS_PriceType = new CS_PriceType()
                                                 {
                                                     Active = true,
                                                     Acronym = "P"
                                                 },
                                                CS_Job_JobStatus = new EntityCollection<CS_Job_JobStatus>()
                                                                    {
                                                                        new CS_Job_JobStatus()
                                                                        {
                                                                            JobStatusId = (int)Globals.JobRecord.JobStatus.Bid,
                                                                            JobStartDate = new DateTime(2011,02,14),
                                                                            Active = true
                                                                        }
                                                                    }

                                             },
                            CS_JobDescription = csJobDescription
                        }
            );

            Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>();
            mockUnitOfWork.Setup(w => w.CreateObjectSet<CS_Job>()).Returns(fakeJobObject);

            JobModel jobModel = new JobModel(mockUnitOfWork.Object);

            string body = jobModel.GenerateEmailBodyForEstimationTeam(243);

            StringBuilder sb = new StringBuilder();

            sb.Append("<div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Proposal#:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" ##");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Job#:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" PA000000025INT");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Customer:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" Test Customer");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Division:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 005");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("JobType:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" A");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("JobAction:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" Environmental Work, General - Undefined Scope of Work");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Scope Of Work:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append("xxcxcxc");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Job start date:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append("02/14/2011 00:00:00");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Employee:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" Dcecilia, Test");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Number Engines:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 1");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Number Loads:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 2");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Number Empties:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 1");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</div>");

            Assert.AreEqual(sb.ToString(), body);
        }
Пример #2
0
        public void GenerateEmailBodyForInvoicingTeamTest()
        {
            DateTime dt = new DateTime(2011, 02, 14);

            TimeSpan timeSpan = new TimeSpan(10, 11, 59);

            CS_Country country = new CS_Country()
                                     {
                                         ID = 1,
                                         Active = true,
                                         Name = "USA"

                                     };

            CS_State state = new CS_State()
                                 {
                                     ID = 1,
                                     Active = true,
                                     Name = "Texas"
                                 };

            CS_City city = new CS_City()
                               {
                                   ID = 1,
                                   Active = true,
                                   Name = "Dalton"
                               };

            CS_LocationInfo locationInfo = new CS_LocationInfo()
                                            {
                                                Active = true,
                                                CountryID = 1,
                                                StateID = 1,
                                                CityID = 1,
                                                CS_Country = country,
                                                CS_State = state,
                                                CS_City = city
                                            };

            CS_Frequency frequency = new CS_Frequency()
                                         {
                                             Active = true,
                                             ID = 1,
                                             Description = "D"
                                         };

            CS_JobDescription csJobDescription = new CS_JobDescription()
            {
                Active = true,
                NumberEmpties = 1,
                NumberLoads = 2,
                NumberEngines = 1
            };

            CS_Division division = new CS_Division()
            {
                ID = 241,
                Active = true,
                Name = "005",
                Description = "White River, Ontario"
            };

            CS_JobDivision jobdivision = new CS_JobDivision()
            {
                Active = true,
                JobID = 243,
                DivisionID = 241,
                CS_Division = division
            };

            CS_Employee employee = new CS_Employee()
            {
                ID = 1,
                Active = true,
                Name = "Dcecilia",
                FirstName = "Test",
                DivisionID = 241
            };

            CS_Reserve reserve = new CS_Reserve()
            {
                Active = true,
                JobID = 243,
                Type = 2,
                CS_Employee = employee,
                DivisionID = 241
            };

            EntityCollection<CS_JobDivision> JobDivision = new EntityCollection<CS_JobDivision>();

            JobDivision.Add(jobdivision);

            CS_ScopeOfWork csScopeOfWork = new CS_ScopeOfWork()
            {
                Active = true,
                ScopeOfWork = "xxcxcxc",
                JobId = 243
            };

            EntityCollection<CS_Reserve> csReserves = new EntityCollection<CS_Reserve>();
            csReserves.Add(reserve);

            EntityCollection<CS_ScopeOfWork> scopeOfWorks = new EntityCollection<CS_ScopeOfWork>();
            scopeOfWorks.Add(csScopeOfWork);

            //Arrange
            FakeObjectSet<CS_Job> fakeJobObject = new FakeObjectSet<CS_Job>();
            fakeJobObject.AddObject
                (
                    new CS_Job()
                    {
                        ID = 243,
                        Active = true,
                        CreatedBy = "rbrandao",
                        CreationDate = DateTime.Now,
                        ModificationDate = DateTime.Now,
                        ModifiedBy = "Load",
                        //Internal_Tracking = "000000025INT",
                        Number = "000243",
                        CS_ScopeOfWork = scopeOfWorks,
                        CS_JobDivision = JobDivision,
                        CS_Reserve = csReserves,
                        CS_CustomerInfo = new CS_CustomerInfo()
                        {
                            Active = true,
                            CS_Customer = new CS_Customer()
                            {
                                Active = true,
                                Name = "American Test"
                            },
                            CS_Division = division,
                            CS_Contact1 = new CS_Contact()
                            {
                                ID = 1,
                                Active = true,
                                Name = "danilo",
                                LastName = "cecilia",
                            },
                            CS_Contact3 = new CS_Contact()
                                             {
                                                 ID = 1,
                                                 Active = true,
                                                 Name = "danilo",
                                                 LastName = "cecilia",
                                             },
                            //IsCustomer = true,
                            InitialCustomerContactId = 1,
                            BillToContactId = 1

                        },
                        CS_JobInfo = new CS_JobInfo()
                        {
                            Active = true,
                            InterimBill = true,
                            CS_Employee = employee,
                            EmployeeID = employee.ID,
                            CS_Frequency = frequency,
                            FrequencyID = 1,
                            CS_JobAction = new CS_JobAction()
                            {
                                Active = true,
                                Description = "Environmental Work, General - Undefined Scope of Work"
                            },
                            CS_JobType = new CS_JobType()
                            {
                                Active = true,
                                Description = "A"
                            },
                            InitialCallDate = dt,
                            InitialCallTime = timeSpan,
                            CS_PriceType = new CS_PriceType()
                                               {
                                                   Active = true,
                                                   Acronym = "P",
                                                   Description = "description test"
                                               },
                            CS_JobCategory = new CS_JobCategory()
                                                {
                                                    Active = true,
                                                    Description = "B"
                                                },
                            CS_Job_JobStatus = new EntityCollection<CS_Job_JobStatus>()
                            {
                                new CS_Job_JobStatus()
                                {
                                    Active = true,
                                    JobStatusId = (int)Globals.JobRecord.JobStatus.Active,
                                    JobStartDate = new DateTime(2011,02,14),
                                    JobCloseDate = new DateTime(2011,02,14)
                                }
                            }

                        },
                        CS_LocationInfo = locationInfo,
                        CS_JobDescription = csJobDescription
                    }
            );

            //Act
            Mock<IUnitOfWork> mockUnitOfWork = new Mock<IUnitOfWork>();
            mockUnitOfWork.Setup(w => w.CreateObjectSet<CS_Job>()).Returns(fakeJobObject);

            JobModel jobModel = new JobModel(mockUnitOfWork.Object);

            string body = jobModel.GenerateEmailBodyForInvoicingTeam(243);

            StringBuilder sb = new StringBuilder();

            sb.Append("<div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Job#:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" PA000243");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Customer:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" American Test");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Initial Customer Contact:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" danilo");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Bill to:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" cecilia, danilo");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Initial Call date:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 02/14/2011");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Initial Call time:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 10:11:59");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Price Type:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" description test");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Job Action:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" Environmental Work, General - Undefined Scope of Work");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Job Category:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" B");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Job Type:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" A");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Division:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 005");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Interim Bill:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" Yes");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Requested By:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" Dcecilia, Test");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Frequency:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" D");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Country:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" USA");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("State:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" Texas");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("City:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" Dalton");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Number Engines:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 1");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Number Loads:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 2");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Number Empties:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 1");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Scope Of Work:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append("xxcxcxc");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Job start date:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 02/14/2011 00:00:00");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<div style='width: 100%; display: inline-block;'>");
            sb.Append("<div style='text-align: right;width:30%; height:100% ;display: inline-block;float:left'><b>");
            sb.Append("Job end date:");
            sb.Append("</b></div>");
            sb.Append("<div style='text-align: left;width:68%; height:100% ;display: inline-block;float:right'>");
            sb.Append(" 02/14/2011 00:00:00");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("</div>");

            //Assert
            Assert.AreEqual(sb.ToString(), body);
        }
Пример #3
0
        public void AddDivisionToJob(int divisionId, int jobId, string userName)
        {
            IList<CS_JobDivision> lstjobDiv = _jobDivisionRepository.ListAll(w => w.JobID == jobId);

            bool notAssigned = !lstjobDiv.Any(a => a.DivisionID == divisionId && a.Active);

            if (notAssigned)
            {
                CS_JobDivision jobDivision = new CS_JobDivision
                {
                    Active = true,
                    CreatedBy = userName,
                    CreationDate = DateTime.Now,
                    PrimaryDivision = false,
                    ModifiedBy = userName,
                    ModificationDate = DateTime.Now,
                    JobID = jobId,
                    DivisionID = divisionId
                };

                _jobDivisionRepository.Add(jobDivision);
            }
        }
        public void AddDivisionFromCustomerInfo(CS_Division division)
        {
            if (division != null && !(division.ID <= 0))
            {
                if (!ContainsDivisionInList(division.ID))
                {
                    CS_JobDivision jobDivision = new CS_JobDivision();
                    CS_JobDivision removeAlreadySelectedDivision = null;
                    jobDivision.CS_Division = division;

                    foreach (var item in _view.JobDivisionEntityList)
                    {
                        if (item.IsFromCustomerInfo)
                            removeAlreadySelectedDivision = item;
                        item.PrimaryDivision = false;
                    }

                    if (removeAlreadySelectedDivision != null)
                    {
                        _view.JobDivisionEntityList.Remove(removeAlreadySelectedDivision);
                    }

                    jobDivision.IsFromCustomerInfo = true;
                    jobDivision.DivisionID = jobDivision.CS_Division.ID;
                    jobDivision.Active = true;
                    jobDivision.CreatedBy = _view.CreatedBy;
                    jobDivision.CreationDate = DateTime.Now;
                    jobDivision.ModifiedBy = _view.CreatedBy;
                    jobDivision.ModificationDate = DateTime.Now;
                    jobDivision.PrimaryDivision = true;
                    jobDivision.IsFromCustomerInfo = true;
                    _view.JobDivisionEntityList.Add(jobDivision);
                    _view.ListJobDivision();
                }
            }
        }
Пример #5
0
        protected void btnAddDivision_Click(object sender, EventArgs e)
        {
            _jobDivisionItem = new CS_JobDivision();
            _jobDivisionItem.DivisionID = int.Parse(ddlDivision.SelectedValue);
            _jobDivisionItem.CreatedBy = this.UserName;
            _jobDivisionItem.Active = true;
            _presenter.AddDivision(null);

            ScriptManager.GetCurrent(this.Page).SetFocus(btnAddDivision);
        }
        public void SaveJobDivision(IList<int> lstDivisions, string userName, int jobId)
        {
            foreach (int divisionId in lstDivisions)
            {
                CS_JobDivision jobDivision = new CS_JobDivision
                {
                    Active = true,
                    CreatedBy = userName,
                    CreationDate = DateTime.Now,
                    PrimaryDivision = false,
                    ModifiedBy = userName,
                    ModificationDate = DateTime.Now,
                    JobID = jobId,
                    DivisionID = divisionId
                };

                _jobDivisionRepository.Add(jobDivision);
            }
        }