コード例 #1
0
        public List <ApproverInfo> GetApproverDetails(string StaffNumber)
        {
            List <ApproverInfo> List_of_Approver          = new List <ApproverInfo>();
            ApprovalListConnectionDataContext projectconn = new ApprovalListConnectionDataContext();
            var ApproverList = (from distinct in projectconn.IC_A_Users
                                where distinct.StaffNumber == StaffNumber
                                select
                                new ApproverInfo
            {
                StaffNumber = distinct.StaffNumber,
                name = distinct.StaffName,
                Email = distinct.Emails,
                Grade = distinct.Grade,
                Branch = distinct.Branch,
                DeptTitle = distinct.DeptTitle,
                Jobtitle = distinct.Jobtitle,
                IsAdmin = (distinct.AdminRole == 1) ? true : false
            });

            foreach (var approvelist in ApproverList)
            {
                ApproverInfo approve = new ApproverInfo();
                approve.StaffNumber = approvelist.StaffNumber;
                approve.name        = approvelist.name;
                approve.Email       = approvelist.Email;
                approve.Grade       = approvelist.Grade;
                approve.Jobtitle    = approvelist.Jobtitle;
                approve.DeptTitle   = approvelist.DeptTitle;
                approve.Branch      = approvelist.Branch;
                approve.IsAdmin     = approvelist.IsAdmin;
                List_of_Approver.Add(approve);
            }
            return(List_of_Approver);
        }
コード例 #2
0
        public List <string> getApprovernames()
        {
            ApprovalListConnectionDataContext approval = new ApprovalListConnectionDataContext();
            var approvalinfo = from distinct in approval.IC_A_Users
                               select distinct.StaffName;

            return(approvalinfo.ToList());
        }
コード例 #3
0
        public bool ValidateAdminUser(string UserNo)
        {
            ApprovalListConnectionDataContext approval = new ApprovalListConnectionDataContext();
            var approvalname = (from distinct in approval.IC_A_Users
                                where distinct.StaffNumber == UserNo && distinct.AdminRole == 1
                                select
                                new
            {
                StaffName = distinct.StaffName
            });

            if (approvalname.Count() < 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #4
0
        public List <ApproverInfo> GetApproverList()
        {
            List <ApproverInfo> ApproverList = new List <ApproverInfo>();

            try
            {
                ApprovalListConnectionDataContext projectconn = new ApprovalListConnectionDataContext();
                var Projectinfo = (from distinct in projectconn.IC_A_Users
                                   select
                                   new
                {
                    StaffNo = distinct.StaffNumber,
                    Staffname = distinct.StaffName,
                    Email = distinct.Emails,
                    Branch = distinct.Branch,
                    Grade = distinct.Grade,
                    Jobtitle = distinct.Jobtitle,
                    Dept = distinct.DeptTitle
                });
                foreach (var approverlist in Projectinfo)
                {
                    ApproverInfo approver = new ApproverInfo();
                    approver.StaffNumber = approverlist.StaffNo;
                    approver.name        = approverlist.Staffname;
                    approver.Email       = approverlist.Email;
                    approver.Branch      = approverlist.Branch;
                    approver.Jobtitle    = approverlist.Jobtitle;
                    approver.Grade       = approverlist.Grade;
                    approver.DeptTitle   = approverlist.Dept;
                    ApproverList.Add(approver);
                }
            }
            catch (Exception ex)
            {
                // return ex.Message;
            }
            return(ApproverList);
        }
コード例 #5
0
        public List <ApproverInfo> getApproverInfo()
        {
            ApprovalListConnectionDataContext approval = new ApprovalListConnectionDataContext();
            var approvalinfo = (from distinct in approval.IC_A_Users where distinct.AdminRole == 0
                                select
                                new
            {
                StaffName = distinct.StaffName,
                StaffNo = distinct.StaffNumber,
                Email = distinct.Emails
            });
            List <ApproverInfo> ApproverList = new List <ApproverInfo>();

            foreach (var info in approvalinfo)
            {
                ApproverInfo approver = new ApproverInfo();
                approver.name        = info.StaffName;
                approver.StaffNumber = info.StaffNo;
                approver.Email       = info.Email;
                ApproverList.Add(approver);
            }
            return(ApproverList);
        }