Example #1
0
        public static List<int> getDepartmentIds(string userId, dx_docboxEntities database)
        {
            List<int> departmentIdsUser = new List<int>();

            if (database != null)
            {
                var departmentsIds = from userDepts in database.DX_USERDEPT where userDepts.userid == userId.Trim() select userDepts.deptid;

                if (departmentsIds.ToList().Count > 0)
                {

                        departmentIdsUser = (List<int>)(departmentsIds.ToList());
                }
            }
            return departmentIdsUser;
        }
Example #2
0
        public static List<string> getDepartmentName(string userId, dx_docboxEntities database)
        {
            List<string> departmentNames=new List<string>();

            if (database != null)
            {
                var departmentsIds = from userDepts in database.DX_USERDEPT where userDepts.userid == userId.Trim() select userDepts.deptid;

                if (departmentsIds.ToList().Count > 0)
                {

                    var depts = from departments in database.DX_DEPARTMENT where departmentsIds.Contains(departments.deptid) select departments.name;
                    if (depts.ToList().Count > 0)
                        departmentNames =(List<string>) (depts.ToList());
                }
            }
            return departmentNames;
        }
Example #3
0
        public static int getDepartmentId(string deptname, dx_docboxEntities database)
        {
            if (database != null && deptname != null)
            {
                try
                {
                    var deptid = database.DX_DEPARTMENT.SingleOrDefault(department => department.name == deptname).deptid;

                    if (deptid > 0)
                    {
                        return Convert.ToInt32(deptid);
                    }
                }
                catch (Exception)
                {

                }
            }
            return 0;
        }