Example #1
0
        private bool CheckTicketIdPrivilege(string ticketId)
        {
            decimal?staffTypeId   = StaffBiz.GetStaffType(HttpContext.Current.User.Identity.Name);
            string  staff_type_id = staffTypeId != null?staffTypeId.Value.ToString() : "";

            string username = HttpContext.Current.User.Identity.Name;

            if (!RoleBiz.CheckTicketIdPrivilege(ticketId, username, AppUtil.GetRecursiveStaff(username), AppUtil.GetRecursiveTeam(username), staff_type_id))
            {
                string message       = "ข้อมูลผู้มุ่งหวังรายนี้ ท่านไม่มีสิทธิในการมองเห็น";
                string lastOwnerName = LeadBiz.GetLastOwnerName(ticketId);

                if (!string.IsNullOrEmpty(lastOwnerName))
                {
                    message += " ณ ปัจจุบันผู้เป็นเจ้าของ คือ " + lastOwnerName.ToString().Trim();
                }

                AppUtil.ClientAlertAndRedirect(Page, message, "COC_SCR_002.aspx");
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private void SetDept()
        {
            decimal?stafftype = StaffBiz.GetStaffType(HttpContext.Current.User.Identity.Name);

            if (stafftype != null)
            {
                if (stafftype == COCConstant.StaffType.ITAdministrator)
                {
                    cmbDepartment.Enabled = true;
                }
                else
                {
                    cmbDepartment.Enabled = false;
                    int?dept = StaffBiz.GetDepartmentId(HttpContext.Current.User.Identity.Name);
                    if (dept != null)
                    {
                        cmbDepartment.SelectedIndex = cmbDepartment.Items.IndexOf(cmbDepartment.Items.FindByValue(dept.ToString()));
                    }
                }
            }
        }