コード例 #1
0
        /// <summary>
        /// This method will accept the UserName and password from controller and will check whether it exists in database or not.
        /// </summary>
        /// <param name="userName">UserName of User</param>
        /// <param name="password">Password of User</param>
        /// <returns>It returns object of all the basic information of user to the controller</returns>
        public BusinessEntities.Employee Authenticate(string userName, string password)
        {
            BusinessEntities.Employee objEmployee = new BusinessEntities.Employee();
            string encryptedPassword = EncodePassword(password);

            using (Data.Model.LicenseManagementMVCEntities DbContext = new LicenseManagementMVCEntities())
            {
                //  Employee user = new Employee();
                var user = DbContext.Employees.FirstOrDefault(u => u.Email == userName && u.Password == encryptedPassword);
                BusinessEntities.Employee emp = new BusinessEntities.Employee();

                if (user != null)
                {
                    emp = new BusinessEntities.Employee()
                    {
                        EmployeeId  = user.EmployeeId,
                        FirstName   = user.FirstName,
                        LastName    = user.LastName,
                        Email       = user.Email,
                        JoiningDate = user.JoiningDate,
                        ReleaseDate = user.ReleaseDate,
                        LocationId  = user.LocationId,
                        RoleId      = user.RoleId,
                        IsReleased  = user.IsReleased
                    };
                }


                return(emp);
            }
        }
コード例 #2
0
        /// <summary>
        /// This method will fill all the Employees in an autocomplete textbox
        /// </summary>
        /// <returns>Returns a list of Employees</returns>
        public List <BusinessEntities.Employee> PopulateEmployee(string prefix)
        {
            using (Data.Model.LicenseManagementMVCEntities DbContext = new LicenseManagementMVCEntities())
            {
                List <BusinessEntities.Employee> employeeList     = new List <BusinessEntities.Employee>();
                List <Data.Model.Employee>       employeeListData = new List <Data.Model.Employee>();
                employeeListData = (from e in DbContext.Employees
                                    where e.FirstName.StartsWith(prefix)
                                    select e).ToList();

                BusinessEntities.Employee objEmp = new BusinessEntities.Employee();
                foreach (var e in employeeListData)
                {
                    objEmp = new BusinessEntities.Employee()
                    {
                        EmployeeId = e.EmployeeId,
                        FirstName  = e.FirstName,
                        LastName   = e.LastName,
                        Email      = e.Email
                    };
                    employeeList.Add(objEmp);
                }
                return(employeeList);
            }
        }
コード例 #3
0
        public void ControllerAddsViewWhenShowDetailsIfNotPresent()
        {
            container.RegisterType <IEmployeesDetailsPresenter, MockEmployeesDetailsPresenter>();
            container.RegisterType <IProjectsListPresenter, MockProjectsListPresenter>();

            var regionManager = new MockRegionManager();
            var detailsRegion = new MockRegion();

            regionManager.Regions.Add(RegionNames.DetailsRegion, detailsRegion);
            var scopedRegionManager = new MockRegionManager();

            scopedRegionManager.Regions.Add(RegionNames.TabRegion, new MockRegion());
            detailsRegion.AddReturnValue = scopedRegionManager;

            BusinessEntities.Employee employee1 = new BusinessEntities.Employee(10)
            {
                LastName = "Mock1", FirstName = "Employee1"
            };
            BusinessEntities.Employee employee2 = new BusinessEntities.Employee(11)
            {
                LastName = "Mock2", FirstName = "Employee2"
            };

            EmployeesController controller = new EmployeesController(container, regionManager);

            Assert.AreEqual <int>(0, detailsRegion.ViewsCount);

            controller.OnEmployeeSelected(employee1);
            controller.OnEmployeeSelected(employee2);

            Assert.AreEqual <int>(2, detailsRegion.ViewsCount);
        }
コード例 #4
0
        public void ShowTheNewlyAddedViewInTheDetailsRegion()
        {
            container.RegisterType <IEmployeesDetailsPresenter, MockEmployeesDetailsPresenter>();
            container.RegisterType <IProjectsListPresenter, MockProjectsListPresenter>();

            var regionManager = new MockRegionManager();
            var detailsRegion = new MockRegion();

            regionManager.Regions.Add(RegionNames.DetailsRegion, detailsRegion);
            var scopedRegionManager = new MockRegionManager();

            scopedRegionManager.Regions.Add(RegionNames.TabRegion, new MockRegion());
            detailsRegion.AddReturnValue = scopedRegionManager;

            BusinessEntities.Employee employee1 = new BusinessEntities.Employee(10)
            {
                LastName = "Mock1", FirstName = "Employee1"
            };

            EmployeesController controller = new EmployeesController(container, regionManager);

            controller.OnEmployeeSelected(employee1);

            Assert.AreEqual <int>(1, detailsRegion.ViewsCount);
            Assert.IsTrue(detailsRegion.ActivateCalled);
        }
コード例 #5
0
        public void RaiseEmployeeSelectedShouldRaiseEmployeeSelected()
        {
            int  employeeId             = 10;
            bool employeeSelectedRaised = false;

            BusinessEntities.Employee selectedEmployee = null;
            BusinessEntities.Employee employee         = new BusinessEntities.Employee(employeeId)
            {
                LastName = "Con", FirstName = "Aaron"
            };
            EmployeesListPresenter presenter = CreatePresenter();

            presenter.View.ObservableRegionContext.PropertyChanged += delegate
            {
                employeeSelectedRaised = true;
            };

            Assert.IsFalse(employeeSelectedRaised);
            view.RaiseEmployeeSelected(employee);

            selectedEmployee = view.ObservableRegionContext.Value as BusinessEntities.Employee;
            Assert.IsTrue(employeeSelectedRaised);
            Assert.AreEqual("Con", selectedEmployee.LastName);
            Assert.AreEqual("Aaron", selectedEmployee.FirstName);
            Assert.AreEqual(employeeId, selectedEmployee.EmployeeId);
        }
コード例 #6
0
        public void ControllerDoesNotAddViewWhenShowDetailsIfIsAlreadyPresent()
        {
            container.RegisterType <IEmployeesDetailsPresenter, MockEmployeesDetailsPresenter>();
            container.RegisterType <IProjectsListPresenter, MockProjectsListPresenter>();

            var regionManager = new MockRegionManager();
            var detailsRegion = new MockRegion();

            regionManager.Regions.Add(RegionNames.DetailsRegion, detailsRegion);
            var scopedRegionManager = new MockRegionManager();

            scopedRegionManager.Regions.Add(RegionNames.TabRegion, new MockRegion());
            detailsRegion.AddReturnValue = scopedRegionManager;

            BusinessEntities.Employee employee = new BusinessEntities.Employee(10)
            {
                LastName = "Con", FirstName = "Aaron"
            };

            EmployeesController controller = new EmployeesController(container, regionManager);

            Assert.AreEqual <int>(0, detailsRegion.ViewsCount);

            controller.OnEmployeeSelected(employee);
            controller.OnEmployeeSelected(employee);

            Assert.AreEqual <int>(1, detailsRegion.ViewsCount);
            Assert.IsTrue(detailsRegion.ActivateCalled);
        }
コード例 #7
0
        public void RaiseEmployeeSelectedShouldRaiseEmployeeSelected()
        {
            int  employeeId             = 10;
            bool employeeSelectedRaised = false;

            BusinessEntities.Employee selectedEmployee = null;
            BusinessEntities.Employee employee         = new BusinessEntities.Employee(employeeId)
            {
                LastName = "Con", FirstName = "Aaron"
            };
            EmployeesListPresenter presenter = CreatePresenter();

            presenter.EmployeeSelected += delegate(object sender, DataEventArgs <BusinessEntities.Employee> e)
            {
                employeeSelectedRaised = true;
                selectedEmployee       = e.Value;
            };

            Assert.IsFalse(employeeSelectedRaised);
            view.RaiseEmployeeSelected(employee);
            Assert.IsTrue(employeeSelectedRaised);
            Assert.AreEqual("Con", selectedEmployee.LastName);
            Assert.AreEqual("Aaron", selectedEmployee.FirstName);
            Assert.AreEqual(employeeId, selectedEmployee.EmployeeId);
        }
コード例 #8
0
ファイル: EmployeesController.cs プロジェクト: zalid/Prism
        public virtual void OnEmployeeSelected(BusinessEntities.Employee employee)
        {
            // We are still using Push based composition here, to show the usage of scoped regionmanagers.
            // When an employee gets selected, we are creating a new instance of the EmployeeDetailsView and are pushing it in the region.
            // this would be hard to do with the 'out of the box' functionality of the pull based composition, because we
            // have a requirement where we want to push a view into the region at a specific point in time, and not when
            // the region decides it needs to pull a view into it.

            IRegion detailsRegion = regionManager.Regions[RegionNames.DetailsRegion];
            object  existingView  = detailsRegion.GetView(employee.EmployeeId.ToString(CultureInfo.InvariantCulture));

            // See if the view already exists in the region.
            if (existingView == null)
            {
                // the view does not exist yet. Create it and push it into the region
                IEmployeesDetailsPresenter detailsPresenter = this.container.Resolve <IEmployeesDetailsPresenter>();
                detailsPresenter.SetSelectedEmployee(employee);

                // the details view should receive it's own scoped region manager, therefore Add overload using 'true' (see notes below).
                detailsRegion.Add(detailsPresenter.View, employee.EmployeeId.ToString(CultureInfo.InvariantCulture), true);

                detailsRegion.Activate(detailsPresenter.View);
            }
            else
            {
                // The view already exists. Just show it.
                detailsRegion.Activate(existingView);
            }

            //************************************************************************************************
            // Note on using Scoped Regionmanagers:
            // Scoped regionmanagers are used to have multiple instances of the same region in memory at the same time.
            // Since a region gets registered with a regionmanager, the name has to be unique.
            // In this example, we are keeping several instances of the EmployeeDetailsView in memory. Each view has it's own TabRegion,
            // so each view needs it's own regionmanager. This is still hard to do with pull based composition.
            //************************************************************************************************

            //************************************************************************************************
            // Note on Push based vs Pull based composition.
            // Prism V2 is going to support both Push based (V1 style) and Pull based (New in V2) composition.
            //
            // In pull based composition, as soon as the region get's added to the visual tree, it will be populated with new instances of
            // registered views. In Pull based composition, you get less control over when views are added (only on load of the region)
            // but this allows for an easier programming model.
            //
            // In push based composition, you have to write some code that, at a certain point in time, finds a region that's already
            // created (might not be visible yet) and adds views to it. Using Push based composition, you have more control over when
            // you want to add views to a particular region, but at the expense of more complexity.
            //************************************************************************************************
        }
コード例 #9
0
        /// <summary>
        /// This method will Show SystemDetails in a grid on Employee selection
        /// </summary>
        /// <param name="objEmployee">Object containing EmployeeId of selected employee</param>
        /// <returns>Object holding systen details of system allocated to selected employee</returns>
        public List <SoftwareAllocationVm> ShowEmployeeSystemDetails(BusinessEntities.Employee objEmployee)
        {
            using (Data.Model.LicenseManagementMVCEntities DbContext = new LicenseManagementMVCEntities())
            {
                var result = from s in DbContext.SystemAllocations
                             join sd in DbContext.SystemDetails
                             on s.SystemDetailsId equals sd.SystemDetailsId
                             join b in DbContext.Brands
                             on sd.BrandId equals b.BrandId
                             join st in DbContext.SystemTypes
                             on sd.SystemTypeId equals st.SystemTypeId
                             where s.EmployeeId == objEmployee.EmployeeId
                             select new
                {
                    brand              = b.BrandName,
                    type               = st.SystemTypeName,
                    remarks            = s.Remarks,
                    series             = sd.Series,
                    processor          = sd.Processor,
                    hddSpace           = sd.HDDSpace,
                    systemAllocationId = s.SystemAllocationId,
                    allotedDate        = s.AllotedDate,
                    releaseDate        = s.ReleaseDate,
                    isReleased         = s.IsReleased,
                };

                SoftwareAllocationVm        objSystemDetails = new SoftwareAllocationVm();
                List <SoftwareAllocationVm> systemList       = new List <SoftwareAllocationVm>();
                foreach (var r in result)
                {
                    objSystemDetails = new SoftwareAllocationVm()
                    {
                        BrandName          = r.brand,
                        Series             = r.series,
                        Remarks            = r.remarks,
                        Processor          = r.processor,
                        HDDSpace           = r.hddSpace,
                        SystemType         = r.type,
                        SystemAllocationId = r.systemAllocationId,
                        AllotedDate        = r.allotedDate,
                        ReleaseDate        = r.releaseDate,
                        IsReleased         = r.isReleased
                    };
                    systemList.Add(objSystemDetails);
                }
                return(systemList);
            }
        }
コード例 #10
0
        public void ShouldSetModelOnDetailsView()
        {
            int employeeId = 10;
            BusinessEntities.Employee employee = new BusinessEntities.Employee(employeeId) { LastName = "Con", FirstName = "Aaron" };
            
            EmployeesDetailsPresenter presenter = CreatePresenter();

            Assert.IsNull(view.Model);
            
            presenter.SetSelectedEmployee(employee);

            Assert.IsNotNull(view.Model);
            Assert.AreEqual("Con", view.Model.SelectedEmployee.LastName);
            Assert.AreEqual("Aaron", view.Model.SelectedEmployee.FirstName);
            Assert.AreEqual(employeeId, view.Model.SelectedEmployee.EmployeeId);
        }
コード例 #11
0
        public void RaiseEmployeeSelectedShouldRaiseEmployeeSelected()
        {
            int employeeId = 10;
            bool employeeSelectedRaised = false;
            BusinessEntities.Employee selectedEmployee = null;
            BusinessEntities.Employee employee = new BusinessEntities.Employee(employeeId) { LastName = "Con", FirstName = "Aaron" };
            EmployeesListPresenter presenter = CreatePresenter();
            presenter.EmployeeSelected += delegate(object sender, DataEventArgs<BusinessEntities.Employee> e)
            {
                employeeSelectedRaised = true;
                selectedEmployee = e.Value;
            };

            Assert.IsFalse(employeeSelectedRaised);
            view.RaiseEmployeeSelected(employee);
            Assert.IsTrue(employeeSelectedRaised);
            Assert.AreEqual("Con", selectedEmployee.LastName);
            Assert.AreEqual("Aaron", selectedEmployee.FirstName);
            Assert.AreEqual(employeeId, selectedEmployee.EmployeeId);
        }
コード例 #12
0
        public void ShouldSetModelOnDetailsView()
        {
            int employeeId = 10;

            BusinessEntities.Employee employee = new BusinessEntities.Employee(employeeId)
            {
                LastName = "Con", FirstName = "Aaron"
            };

            EmployeesDetailsPresenter presenter = CreatePresenter();

            Assert.IsNull(view.Model);

            presenter.SetSelectedEmployee(employee);

            Assert.IsNotNull(view.Model);
            Assert.AreEqual("Con", view.Model.SelectedEmployee.LastName);
            Assert.AreEqual("Aaron", view.Model.SelectedEmployee.FirstName);
            Assert.AreEqual(employeeId, view.Model.SelectedEmployee.EmployeeId);
        }
コード例 #13
0
        public void RaiseEmployeeSelectedShouldRaiseEmployeeSelected()
        {
            int employeeId = 10;
            bool employeeSelectedRaised = false;
            BusinessEntities.Employee selectedEmployee = null;
            BusinessEntities.Employee employee = new BusinessEntities.Employee(employeeId) { LastName = "Con", FirstName = "Aaron" };
            EmployeesListPresenter presenter = CreatePresenter();
            presenter.View.ObservableRegionContext.PropertyChanged += delegate
            {
                employeeSelectedRaised = true;
            };

            Assert.IsFalse(employeeSelectedRaised);
            view.RaiseEmployeeSelected(employee);

            selectedEmployee = view.ObservableRegionContext.Value as BusinessEntities.Employee;
            Assert.IsTrue(employeeSelectedRaised);
            Assert.AreEqual("Con", selectedEmployee.LastName);
            Assert.AreEqual("Aaron", selectedEmployee.FirstName);
            Assert.AreEqual(employeeId, selectedEmployee.EmployeeId);
        }
コード例 #14
0
ファイル: Address.cs プロジェクト: rave-apps/RMS_Training
        /// <summary>
        /// Gets the address.
        /// </summary>
        /// <param name="objEmployee">The obj get certification details.</param>
        /// <returns></returns>
        public BusinessEntities.RaveHRCollection GetAddress(BusinessEntities.Employee objEmployee)
        {
            //Object declaration of QualificationDetails class
            Rave.HR.DataAccessLayer.Employees.Address objAddressDAL;

            try
            {
                //Created new instance of QualificationDetails class to call objGetQualificationDetailsDAL() of Data access layer
                objAddressDAL = new Rave.HR.DataAccessLayer.Employees.Address();

                //Call to GetQualificationDetails() of Data access layer and return the Qualifications
                return(objAddressDAL.GetEmployeeAddress(objEmployee));
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASS_NAME, GETADDRESS, EventIDConstants.RAVE_HR_EMPLOYEE_BUSNIESS_LAYER);
            }
        }
コード例 #15
0
        public virtual void OnEmployeeSelected(BusinessEntities.Employee employee)
        {
            IRegion detailsRegion = regionManager.Regions[RegionNames.DetailsRegion];
            object  existingView  = detailsRegion.GetView(employee.EmployeeId.ToString(CultureInfo.InvariantCulture));

            if (existingView == null)
            {
                IProjectsListPresenter projectsListPresenter = this.container.Resolve <IProjectsListPresenter>();
                projectsListPresenter.SetProjects(employee.EmployeeId);

                IEmployeesDetailsPresenter detailsPresenter = this.container.Resolve <IEmployeesDetailsPresenter>();
                detailsPresenter.SetSelectedEmployee(employee);

                IRegionManager detailsRegionManager = detailsRegion.Add(detailsPresenter.View, employee.EmployeeId.ToString(CultureInfo.InvariantCulture), true);
                IRegion        region = detailsRegionManager.Regions[RegionNames.TabRegion];
                region.Add(projectsListPresenter.View, "CurrentProjectsView");
                detailsRegion.Activate(detailsPresenter.View);
            }
            else
            {
                detailsRegion.Activate(existingView);
            }
        }
コード例 #16
0
        public void ControllerAddsViewWhenShowDetailsIfNotPresent()
        {
            container.RegisterType<IEmployeesDetailsPresenter, MockEmployeesDetailsPresenter>();
            container.RegisterType<IProjectsListPresenter, MockProjectsListPresenter>();

            var regionManager = new MockRegionManager();
            var detailsRegion = new MockRegion();
            regionManager.Regions.Add(RegionNames.DetailsRegion, detailsRegion);
            var scopedRegionManager = new MockRegionManager();
            scopedRegionManager.Regions.Add(RegionNames.TabRegion, new MockRegion());
            detailsRegion.AddReturnValue = scopedRegionManager;

            BusinessEntities.Employee employee1 = new BusinessEntities.Employee(10) { LastName = "Mock1", FirstName = "Employee1" };
            BusinessEntities.Employee employee2 = new BusinessEntities.Employee(11) { LastName = "Mock2", FirstName = "Employee2" };

            EmployeesController controller = new EmployeesController(container, regionManager);

            Assert.AreEqual<int>(0, detailsRegion.ViewsCount);

            controller.OnEmployeeSelected(employee1);
            controller.OnEmployeeSelected(employee2);

            Assert.AreEqual<int>(2, detailsRegion.ViewsCount);
        }
コード例 #17
0
        public void ControllerDoesNotAddViewWhenShowDetailsIfIsAlreadyPresent()
        {
            container.RegisterType<IEmployeesDetailsPresenter, MockEmployeesDetailsPresenter>();
            container.RegisterType<IProjectsListPresenter, MockProjectsListPresenter>();

            var regionManager = new MockRegionManager();
            var detailsRegion = new MockRegion();
            regionManager.Regions.Add(RegionNames.DetailsRegion, detailsRegion);
            var scopedRegionManager = new MockRegionManager();
            scopedRegionManager.Regions.Add(RegionNames.TabRegion, new MockRegion());
            detailsRegion.AddReturnValue = scopedRegionManager;

            BusinessEntities.Employee employee = new BusinessEntities.Employee(10) { LastName = "Con", FirstName = "Aaron" };

            EmployeesController controller = new EmployeesController(container, regionManager);

            Assert.AreEqual<int>(0, detailsRegion.ViewsCount);

            controller.OnEmployeeSelected(employee);
            controller.OnEmployeeSelected(employee);

            Assert.AreEqual<int>(1, detailsRegion.ViewsCount);
            Assert.IsTrue(detailsRegion.ActivateCalled);
        }
コード例 #18
0
 public bool UpdateEmployee(BusinessEntities.Employee employee)
 {
     return(base.Channel.UpdateEmployee(employee));
 }
コード例 #19
0
        public void ShowTheNewlyAddedViewInTheDetailsRegion()
        {
            container.RegisterType<IEmployeesDetailsPresenter, MockEmployeesDetailsPresenter>();
            container.RegisterType<IProjectsListPresenter, MockProjectsListPresenter>();

            var regionManager = new MockRegionManager();
            var detailsRegion = new MockRegion();
            regionManager.Regions.Add(RegionNames.DetailsRegion, detailsRegion);
            var scopedRegionManager = new MockRegionManager();
            scopedRegionManager.Regions.Add(RegionNames.TabRegion, new MockRegion());
            detailsRegion.AddReturnValue = scopedRegionManager;

            BusinessEntities.Employee employee1 = new BusinessEntities.Employee(10) { LastName = "Mock1", FirstName = "Employee1" };

            EmployeesController controller = new EmployeesController(container, regionManager);

            controller.OnEmployeeSelected(employee1);

            Assert.AreEqual<int>(1, detailsRegion.ViewsCount);
            Assert.IsTrue(detailsRegion.ActivateCalled);
        }
コード例 #20
0
        /// <summary>
        /// Gets the Employee Address.
        /// </summary>
        /// <param name="objGetCertificationDetails">The object get certification details.</param>
        /// <returns></returns>
        public BusinessEntities.RaveHRCollection GetEmployeeAddress(BusinessEntities.Employee objEmployee)
        {
            //Initialise Data Access Class object
            objDA = new DataAccessClass();

            //Initialise SqlParameter Class object
            sqlParam = new SqlParameter[1];

            //Initialise Collection class object
            raveHRCollection = new BusinessEntities.RaveHRCollection();

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    //Open the connection to DB
                    objDA.OpenConnection(DBConstants.GetDBConnectionString());

                    //Check each parameters nullibality and add values to sqlParam object accordingly
                    sqlParam[0] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int);
                    if (objEmployee.EMPId == 0)
                    {
                        sqlParam[0].Value = DBNull.Value;
                    }
                    else
                    {
                        sqlParam[0].Value = objEmployee.EMPId;
                    }

                    objDataReader = objDA.ExecuteReaderSP(SPNames.Employee_GetAddress, sqlParam);

                    while (objDataReader.Read())
                    {
                        //Initialise the Business Entity object
                        objAddress = new BusinessEntities.Address();

                        objAddress.EmployeeAddressId = Convert.ToInt32(objDataReader[DbTableColumn.EmployeeAddressId].ToString());
                        objAddress.EMPId             = Convert.ToInt32(objDataReader[DbTableColumn.EMPId].ToString());
                        objAddress.Addres            = objDataReader[DbTableColumn.Address].ToString();
                        objAddress.FlatNo            = objDataReader[DbTableColumn.FlatNo].ToString();
                        objAddress.BuildingName      = objDataReader[DbTableColumn.BuildingName].ToString();
                        objAddress.Street            = objDataReader[DbTableColumn.Street].ToString();
                        objAddress.Landmark          = objDataReader[DbTableColumn.LandMark].ToString();
                        objAddress.State             = objDataReader[DbTableColumn.State].ToString();
                        objAddress.Country           = objDataReader[DbTableColumn.Country].ToString();
                        objAddress.City        = objDataReader[DbTableColumn.City].ToString();
                        objAddress.Pincode     = objDataReader[DbTableColumn.PinCode].ToString();
                        objAddress.AddressType = int.Parse(objDataReader[DbTableColumn.AddressType].ToString());

                        // Add the object to Collection
                        raveHRCollection.Add(objAddress);
                    }

                    if (!objDataReader.IsClosed)
                    {
                        objDataReader.Close();
                    }

                    ts.Complete();
                }
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, GETADDRESS, EventIDConstants.RAVE_HR_EMPLOYEE_DATA_ACCESS_LAYER);
            }
            finally
            {
                if (!objDataReader.IsClosed)
                {
                    objDataReader.Close();
                }
                objDA.CloseConncetion();
            }

            // Return the Collection
            return(raveHRCollection);
        }
コード例 #21
0
 public void OnEmployeeSelected(BusinessEntities.Employee employee)
 {
     ShowEmployeeDetailsCalled = true;
 }
コード例 #22
0
        //send mail function
        public void SendEmail(IRMSEmail objEmailConfigEntities)
        {
            SmtpClient  mailClient = null;
            MailMessage message    = null;

            try
            {
                //--Check mailing on or off
                if (ConfigurationManager.AppSettings["MailingOnOrOff"].ToString().ToLower() == "off")
                {
                    return;
                }

                //--Get the entity values
                string strFrom = objEmailConfigEntities.From;
                if (strFrom.Trim() == string.Empty)
                {
                    //--Get logged in user
                    AuthorizationManager authoriseduser = new AuthorizationManager();
                    strFrom = authoriseduser.getLoggedInUserEmailId();
                    //GoogleMail
                    //strFrom = getLoggedInUserEmailId();
                }
                string strTo      = string.Join(",", (string[])objEmailConfigEntities.To.ToArray(Type.GetType("System.String")));
                string strCC      = string.Join(",", (string[])objEmailConfigEntities.CC.ToArray(Type.GetType("System.String")));
                string strSubject = objEmailConfigEntities.Subject;
                string strBody    = objEmailConfigEntities.Body;

                string strHead = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><HEAD><META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\"><META content=\"MSHTML 6.00.6000.16525\" name=GENERATOR><STYLE></STYLE></HEAD><BODY><DIV><FONT face=Verdana size=2>";

                string strFooter = "</font></div></body>";

                mailClient = new SmtpClient();
                message    = new MailMessage();
                string strFullBody = strBody;

                //smtp mail host
                mailClient.Host = ConfigurationSettings.AppSettings["SmtpServer"];
                //smtp mail port
                mailClient.Port = int.Parse(ConfigurationSettings.AppSettings["Port"]);

                //from mail Address
                MailAddress fromAddress = new MailAddress(strFrom);
                message.From = fromAddress;

                char chr = ',';
                strTo = strTo.Trim(chr);
                strCC = strCC.Trim(chr);

                string[] strToMails = strTo.Split(chr);
                string[] strCCMails = strCC.Split(chr);

                for (int cont = 0; cont < strToMails.Length; cont++)
                {
                    //to mail address
                    if (strToMails[cont].Trim() != "")
                    {
                        // CR - 29936 Sachin Start
                        // Commented following code and Added conditions to check whether employee has exited of not
                        // message.To.Add(strToMails[cont]);
                        Rave.HR.BusinessLayer.Employee.Employee EmpTo = new Rave.HR.BusinessLayer.Employee.Employee();
                        BusinessEntities.Employee emp = new BusinessEntities.Employee();
                        emp.EmailId = strToMails[cont];
                        emp         = EmpTo.GetEmployeeByEmpId(emp);
                        if (emp != null && emp.LastWorkingDay != null)
                        {
                            if (emp.LastWorkingDay == DateTime.MinValue)
                            {
                                message.To.Add(strToMails[cont]);
                            }
                        }
                        // CR - 29936 Sachin End
                    }
                }

                for (int cont = 0; cont < strCCMails.Length; cont++)
                {
                    //cc mail address
                    if (strCCMails[cont].Trim() != "")
                    {
                        // CR - 29936 Sachin
                        // Commented following code and Added conditions to check whether employee has exited of not
                        // message.CC.Add(strCCMails[cont]);
                        Rave.HR.BusinessLayer.Employee.Employee EmpTo = new Rave.HR.BusinessLayer.Employee.Employee();
                        BusinessEntities.Employee emp = new BusinessEntities.Employee();
                        emp.EmailId = strCCMails[cont];
                        emp         = EmpTo.GetEmployeeByEmpId(emp);
                        if (emp != null && emp.LastWorkingDay != null)
                        {
                            if (emp.LastWorkingDay == DateTime.MinValue)
                            {
                                message.CC.Add(strCCMails[cont]);
                            }
                        }
                        // CR - 29936 Sachin End
                    }
                }

                //--CC to self
                message.CC.Add(strFrom);

                //--Subject
                message.Subject = strSubject;
                //--Body
                message.Body       = strHead + strFullBody + strFooter;
                message.IsBodyHtml = true;

                //--Send
                mailClient.Send(message);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message,
                                          ex,
                                          Sources.CommonLayer,
                                          CLASS_NAME_RP,
                                          "SendEmail",
                                          EventIDConstants.MAIL_EXCEPTION);
            }
            finally
            {
                if (message != null)
                {
                    message = null;
                }
                if (mailClient != null)
                {
                    mailClient = null;
                }
            }
        }
コード例 #23
0
       public void SetSelectedEmployee(UIComposition.Modules.Employee.BusinessEntities.Employee employee)
       {
           SetSelectedEmployeeCalled = true;
           SelectedEmployee = employee;
 
       }
コード例 #24
0
ファイル: MockEmployeesListView.cs プロジェクト: zalid/Prism
 internal void RaiseEmployeeSelected(BusinessEntities.Employee employee)
 {
     EmployeeSelected(this, new DataEventArgs <BusinessEntities.Employee>(employee));
 }
コード例 #25
0
 public void SetSelectedEmployee(UIComposition.Modules.Employee.BusinessEntities.Employee employee)
 {
     SetSelectedEmployeeCalled = true;
     SelectedEmployee          = employee;
 }
コード例 #26
0
 public int CreateEmployee2(BusinessEntities.Employee employee)
 {
     return(base.Channel.CreateEmployee2(employee));
 }
コード例 #27
0
 public bool DelEmployee(BusinessEntities.Employee employee)
 {
     return(base.Channel.DelEmployee(employee));
 }