public static int Update(int DeptID, int CriteriaID, int UserId, int NotificationRuleId, CriteriaType ctype, string CriteriaName, CriteriaState cstate)
 {
     SqlParameter _pRVAL = new SqlParameter("@RETURN_VALUE", SqlDbType.Int);
     _pRVAL.Direction = ParameterDirection.ReturnValue;
     SqlParameter _pCriteriaId = new SqlParameter("@Id", SqlDbType.Int);
     _pCriteriaId.Direction = ParameterDirection.InputOutput;
     if (CriteriaID != 0) _pCriteriaId.Value = CriteriaID;
     else _pCriteriaId.Value = DBNull.Value;
     SqlParameter _pUserId = new SqlParameter("@UserId", SqlDbType.Int);
     if (UserId != 0) _pUserId.Value = UserId;
     else _pUserId.Value = DBNull.Value;
     SqlParameter _pNotificationRuleId = new SqlParameter("@NotificationRuleId", SqlDbType.Int);
     if (NotificationRuleId != 0) _pNotificationRuleId.Value = NotificationRuleId;
     else _pNotificationRuleId.Value = DBNull.Value;
     SqlParameter _pBitLimitToAssignedTkts = new SqlParameter("@btLimitToAssignedTkts", SqlDbType.Bit);
     SqlParameter _pBitDisabledReports = new SqlParameter("@btDisabledReports", SqlDbType.Bit);
     SqlParameter _pBitNoFilter = new SqlParameter("@btNoFilter", SqlDbType.Bit);
     switch (cstate)
     {
         case CriteriaState.DisabledReports:
             _pBitDisabledReports.Value = true;
             _pBitLimitToAssignedTkts.Value = false;
             _pBitNoFilter.Value = true;
             break;
         case CriteriaState.FilterEnabled:
             _pBitDisabledReports.Value = false;
             _pBitLimitToAssignedTkts.Value = false;
             _pBitNoFilter.Value = false;
             break;
         case CriteriaState.LimitToAssignedTickets:
             _pBitDisabledReports.Value = false;
             _pBitLimitToAssignedTkts.Value = true;
             _pBitNoFilter.Value = false;
             break;
         case CriteriaState.NoFilter:
             _pBitDisabledReports.Value = false;
             _pBitLimitToAssignedTkts.Value = false;
             _pBitNoFilter.Value = true;
             break;
     }
     UpdateData("sp_UpdateTicketCriteria", new SqlParameter[] { _pRVAL, new SqlParameter("@DId", DeptID), _pCriteriaId, _pUserId, _pNotificationRuleId, new SqlParameter("@CriteriaType", (byte)ctype), new SqlParameter("@CriteriaName", CriteriaName), _pBitLimitToAssignedTkts, _pBitDisabledReports, _pBitNoFilter });
     if ((int)_pRVAL.Value < 0) return (int)_pRVAL.Value;
     else return (int)_pCriteriaId.Value;
 }
Beispiel #2
0
        public static string ToCssClass(CriteriaState state)
        {
            string css = string.Empty;

            switch (state)
            {
                case CriteriaState.Red:
                    css = "danger";
                    break;
                case CriteriaState.Amber:
                    css = "warning";
                    break;
                case CriteriaState.Green:
                    css = "success";
                    break;
            }

            return css;
        }
Beispiel #3
0
            public TicketCriteria(int DeptID, int TicketCriteriaID)
            {
                m_DeptID = DeptID;
                if (TicketCriteriaID == 0)
                {
                    return;
                }
                DataRow _row = SelectOne(DeptID, TicketCriteriaID);

                if (_row == null)
                {
                    return;
                }
                m_ID                 = TicketCriteriaID;
                m_UserID             = _row.IsNull("UserId") ? 0 : (int)_row["UserId"];
                m_NotificationRuleID = _row.IsNull("NotificationRuleId") ? 0 : (int)_row["NotificationRuleId"];
                m_Name               = _row["CriteriaName"].ToString();
                m_CriteriaType       = (CriteriaType)((byte)_row["CriteriaType"]);
                if (!(bool)_row["btNoFilter"])
                {
                    m_CriteriaState = CriteriaState.FilterEnabled;
                }
                else if ((bool)_row["btDisabledReports"])
                {
                    m_CriteriaState = CriteriaState.DisabledReports;
                }
                else if ((bool)_row["btLimitToAssignedTkts"])
                {
                    m_CriteriaState = CriteriaState.LimitToAssignedTickets;
                }
                DataTable _dt = SelectCriteriaDataByType(DeptID, FilterType.CommonFilter, TicketCriteriaID);

                foreach (DataRow _r in _dt.Rows)
                {
                    m_FilterTypeStates[(int)_r["ID"]] = (bool)_r["State"];
                }
            }
 public TicketCriteria(int DeptID, int TicketCriteriaID)
 {
     m_DeptID = DeptID;
     if (TicketCriteriaID == 0) return;
     DataRow _row = SelectOne(DeptID, TicketCriteriaID);
     if (_row == null) return;
     m_ID = TicketCriteriaID;
     m_UserID = _row.IsNull("UserId") ? 0 : (int)_row["UserId"];
     m_NotificationRuleID = _row.IsNull("NotificationRuleId") ? 0 : (int)_row["NotificationRuleId"];
     m_Name = _row["CriteriaName"].ToString();
     m_CriteriaType = (CriteriaType)((byte)_row["CriteriaType"]);
     if (!(bool)_row["btNoFilter"]) m_CriteriaState = CriteriaState.FilterEnabled;
     else if ((bool)_row["btDisabledReports"]) m_CriteriaState = CriteriaState.DisabledReports;
     else if ((bool)_row["btLimitToAssignedTkts"]) m_CriteriaState = CriteriaState.LimitToAssignedTickets;
     DataTable _dt=SelectCriteriaDataByType(DeptID, FilterType.CommonFilter, TicketCriteriaID);
     foreach (DataRow _r in _dt.Rows) m_FilterTypeStates[(int)_r["ID"]]=(bool)_r["State"];
 }
Beispiel #5
0
        public static int Update(int DeptID, int CriteriaID, int UserId, int NotificationRuleId, CriteriaType ctype, string CriteriaName, CriteriaState cstate)
        {
            SqlParameter _pRVAL = new SqlParameter("@RETURN_VALUE", SqlDbType.Int);

            _pRVAL.Direction = ParameterDirection.ReturnValue;
            SqlParameter _pCriteriaId = new SqlParameter("@Id", SqlDbType.Int);

            _pCriteriaId.Direction = ParameterDirection.InputOutput;
            if (CriteriaID != 0)
            {
                _pCriteriaId.Value = CriteriaID;
            }
            else
            {
                _pCriteriaId.Value = DBNull.Value;
            }
            SqlParameter _pUserId = new SqlParameter("@UserId", SqlDbType.Int);

            if (UserId != 0)
            {
                _pUserId.Value = UserId;
            }
            else
            {
                _pUserId.Value = DBNull.Value;
            }
            SqlParameter _pNotificationRuleId = new SqlParameter("@NotificationRuleId", SqlDbType.Int);

            if (NotificationRuleId != 0)
            {
                _pNotificationRuleId.Value = NotificationRuleId;
            }
            else
            {
                _pNotificationRuleId.Value = DBNull.Value;
            }
            SqlParameter _pBitLimitToAssignedTkts = new SqlParameter("@btLimitToAssignedTkts", SqlDbType.Bit);
            SqlParameter _pBitDisabledReports     = new SqlParameter("@btDisabledReports", SqlDbType.Bit);
            SqlParameter _pBitNoFilter            = new SqlParameter("@btNoFilter", SqlDbType.Bit);

            switch (cstate)
            {
            case CriteriaState.DisabledReports:
                _pBitDisabledReports.Value     = true;
                _pBitLimitToAssignedTkts.Value = false;
                _pBitNoFilter.Value            = true;
                break;

            case CriteriaState.FilterEnabled:
                _pBitDisabledReports.Value     = false;
                _pBitLimitToAssignedTkts.Value = false;
                _pBitNoFilter.Value            = false;
                break;

            case CriteriaState.LimitToAssignedTickets:
                _pBitDisabledReports.Value     = false;
                _pBitLimitToAssignedTkts.Value = true;
                _pBitNoFilter.Value            = false;
                break;

            case CriteriaState.NoFilter:
                _pBitDisabledReports.Value     = false;
                _pBitLimitToAssignedTkts.Value = false;
                _pBitNoFilter.Value            = true;
                break;
            }
            UpdateData("sp_UpdateTicketCriteria", new SqlParameter[] { _pRVAL, new SqlParameter("@DId", DeptID), _pCriteriaId, _pUserId, _pNotificationRuleId, new SqlParameter("@CriteriaType", (byte)ctype), new SqlParameter("@CriteriaName", CriteriaName), _pBitLimitToAssignedTkts, _pBitDisabledReports, _pBitNoFilter });
            if ((int)_pRVAL.Value < 0)
            {
                return((int)_pRVAL.Value);
            }
            else
            {
                return((int)_pCriteriaId.Value);
            }
        }