Esempio n. 1
0
        /// <summary>
        /// بخشهایی که اجازه دسترسی به آنها دارد به همراه پدران و بچه ها را برمیگرداند
        /// </summary>
        /// <returns></returns>
        IList <decimal> IDataAccess.GetAccessibleDeparments()
        {
            BApplicationSettings.CheckGTSLicense();

            if (userRepository.HasAllDepartmentAccess(this.CurrentUserId))
            {
                IList <Department> list = new DepartmentRepository(false).GetAll();
                var ids = from obj in list
                          select obj.ID;
                return(ids.ToList <decimal>());
            }
            else
            {
                BDepartment    bDepartment         = new BDepartment();
                List <decimal> depList             = new List <decimal>();
                List <decimal> childAndParentsList = new List <decimal>();
                depList.AddRange(userRepository.GetUserDepartmentList(this.CurrentUserId));
                foreach (decimal depId in depList)//اضافه کردن بچه ها و والد ها
                {
                    IList <Department> childs = new List <Department>();
                    childs = bDepartment.GetDepartmentChildsByParentPath(depId);
                    childAndParentsList.AddRange(bDepartment.GetByID(depId).ParentPathList);
                    var ids = from child in childs
                              select child.ID;
                    childAndParentsList.AddRange(ids.ToList <decimal>());
                }
                depList.AddRange(childAndParentsList);
                return(depList);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// پرسنل یک بخش را برمیگرداند
 /// </summary>
 /// <param name="departmentID"></param>
 /// <returns></returns>
 public IList <Person> GetDepartmentPerson(decimal departmentID)
 {
     try
     {
         Department dep = bDep.GetByID(departmentID);
         if (dep.PersonList != null)
         {
             return(dep.PersonList.Where(x => x.Active && !x.IsDeleted).ToList());
         }
         return(new List <Person>());
     }
     catch (Exception ex)
     {
         LogException(ex, "BFlow", "GetDepartmentPerson");
         throw ex;
     }
 }
 public void Update_Test()
 {
     department_testObject.ID         = ADOdepartmentWithoutPerson.ID;
     department_testObject.CustomCode = ADOdepartmentWithoutPerson.CustomCode;
     department_testObject.ParentID   = ADOdepartmentWithoutPerson.ParentID;
     department_testObject.Name       = "Updated";
     busDep.SaveChanges(department_testObject, UIActionType.EDIT);
     department_testObject = busDep.GetByID(ADOdepartmentWithoutPerson.ID);
     Assert.AreEqual(department_testObject.Name, "Updated");
 }
Esempio n. 4
0
 /// <summary>
 /// پرسنل یک بخش را برمیگرداند
 /// </summary>
 /// <param name="departmentID"></param>
 /// <returns></returns>
 public IList <Person> GetDepartmentPerson(decimal departmentID)
 {
     try
     {
         BDepartment busDep = new BDepartment();
         return(busDep.GetByID(departmentID).PersonList);
     }
     catch (Exception ex)
     {
         LogException(ex, "BPrivateMessage", "GetDepartmentPerson");
         throw ex;
     }
 }
Esempio n. 5
0
        /// <summary>
        /// تمام پرسنل منتسب به بخشهای یک کاربر را بصورت سلسله مراتبی استخراج میکند
        /// </summary>
        /// <returns></returns>
        IList <decimal> IDataAccess.GetAccessiblePersonByDepartment()
        {
            BDepartment     bDepartment = new BDepartment();
            IDataAccess     port        = new BUser();
            List <decimal>  personList  = new List <decimal>();
            IList <decimal> depList     = port.GetAccessibleDeparments();

            foreach (decimal depId in depList)
            {
                Department dep     = bDepartment.GetByID(depId);
                var        persons = from prs in dep.PersonList
                                     select prs.ID;
                personList.AddRange(persons.ToList());
            }
            return(personList);
        }
Esempio n. 6
0
        /// <summary>
        /// تمام پرسنل منتسب به بخشهای یک کاربر و ایستگاه کنترل را بصورت سلسله مراتبی استخراج میکند
        /// </summary>
        /// <returns></returns>
        IList <decimal> IDataAccess.GetAccessiblePersonByDepartmentAndControlSatation()
        {
            BDepartment     bDepartment = new BDepartment();
            IDataAccess     port        = new BUser();
            List <decimal>  personList  = new List <decimal>();
            IList <decimal> depList     = port.GetAccessibleDeparments();

            foreach (decimal depId in depList)
            {
                Department dep     = bDepartment.GetByID(depId);
                var        persons = from prs in dep.PersonList
                                     select prs.ID;
                personList.AddRange(persons.ToList());
            }
            IList <decimal>  ctlStationList = port.GetAccessibleControlStations();
            PersonRepository prsRep         = new PersonRepository(false);

            personList.AddRange(prsRep.GetAllPersonByControlStaion(ctlStationList.ToArray()));

            return(personList);
        }
 public void GetByID_ExceptionTest()
 {
     department_testObject = busDep.GetByID(125);
 }