示例#1
0
        private object GetTechnicians(Technicians request)
        {
            ApiUser hdUser = request.ApiUser;
            var     _cfg   = new bigWebApps.bigWebDesk.Config(hdUser.OrganizationId, hdUser.InstanceId);

            return(request.FilteredResult <UserAccount>(UserAccounts.FindUsers(hdUser.OrganizationId, hdUser.DepartmentId, hdUser.UserId, _cfg.AccountManager, _cfg.LocationTracking, request.search, request.firstname, request.lastname, request.email, "notuser", _cfg.UnassignedQue)));
            //return request.FilteredResult<UserAccount>(UserAccounts.Technicians(hdUser.OrganizationId, hdUser.DepartmentId));
        }
示例#2
0
        private object GetUsers(Users request)
        {
            ApiUser hdUser = request.ApiUser;

            if (request.id > 0)
            {
                return(UserAccounts.GetUser(hdUser.OrganizationId, hdUser.DepartmentId, request.id));
            }
            var _cfg = new bigWebApps.bigWebDesk.Config(hdUser.OrganizationId, hdUser.InstanceId);

            //v3
            //if (!string.IsNullOrEmpty(request.query))
            //{
            //    request.search = request.query;
            //}
            return(request.FilteredResult <UserAccount>(UserAccounts.FindUsers(hdUser.OrganizationId, hdUser.DepartmentId, hdUser.UserId, _cfg.AccountManager, _cfg.LocationTracking, request.search, request.firstname, request.lastname, request.email, request.role, _cfg.UnassignedQue)));
        }
示例#3
0
        public static void OnHold(ApiUser User, int TktId, string NoteText)
        {
            Config _cfg = new Config(User.OrganizationId, User.DepartmentId);
            CustomNames _cNames = CustomNames.GetCustomNames(User.OrganizationId, User.DepartmentId);

            if (!_cfg.OnHoldStatus) throw new HttpError("On Hold " + _cNames.Ticket.fullSingular + " statuses are not enabled for this instance.");

            var _tktOld = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId);
            InsertResponse(User.OrganizationId, User.DepartmentId, TktId, User.UserId, false, false, true, NoteText, string.Empty, 0, string.Empty, false);
            NotificationRules.RaiseNotificationEvent(User.OrganizationId, User.DepartmentId, User.UserId, NotificationRules.TicketEvent.PlaceOnHoldTicket, new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId, true), _tktOld, 0, DateTime.MinValue, null);
        }
示例#4
0
        public static void InputTime(ApiUser User, int TktId, int TaskTypeId, decimal Hours, int HoursOffset, string NoteText)
        {
            Config _cfg = new Config(User.OrganizationId, User.DepartmentId);
            CustomNames _cNames = CustomNames.GetCustomNames(User.OrganizationId, User.DepartmentId);

            if (!_cfg.TimeTracking) throw new HttpError("Time Tracking is not enabled for this instance.");

            int _taskTypeId = 0;
            string _taskTypeName = string.Empty;

            if (TaskTypeId == 0)
            {
                DataTable _dtTaskTypes = bigWebApps.bigWebDesk.Data.TaskType.SelectTicketAssignedTaskTypes(User.OrganizationId, User.DepartmentId, User.UserId, TktId);

                if (_dtTaskTypes.Rows.Count == 0)
                    throw new HttpError("No Assigned Task Types found for this " + _cNames.Ticket.fullSingular + ".");

                _taskTypeId = (int) _dtTaskTypes.Rows[0]["ttID"];
                _taskTypeName = _dtTaskTypes.Rows[0]["TaskTypeName"].ToString();
            }
            else
            {
                _taskTypeId = TaskTypeId;
                DataRow _rowTaskType = bigWebApps.bigWebDesk.Data.TaskType.SelectTaskType(User.OrganizationId, User.DepartmentId, _taskTypeId);

                if (_rowTaskType == null)
                    throw new HttpError("No Task Types found for TaskTypeId="+ _taskTypeId.ToString() + ".");
                _taskTypeName = _rowTaskType["TaskTypeName"].ToString();
            }

            string _hoursFull = "";

            if (Hours >= 1)
            {
                _hoursFull = ((int)Hours).ToString();
                if ((int)Hours == 1) _hoursFull += " hour ";
                else _hoursFull += " hours ";
            }

            string _minutes = string.Format("{0:00}", Hours * 60 % 60).TrimStart('0');

            if (!string.IsNullOrEmpty(_minutes))
            {
                _hoursFull += _minutes;
                if (_minutes == "1") _hoursFull += " minute";
                else _hoursFull += " minutes";
            }

            if (!string.IsNullOrEmpty(_hoursFull)) _hoursFull = "(" + _hoursFull.Trim() + ")";

            var _tktOld = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId);
            string sysGeneratedText = User.FullName;
            int _timeLogId = 0;

            if (Hours > 0)
            {
                sysGeneratedText = " logged " + Hours.ToString("0.00") + " hours " + _hoursFull + " as " + _taskTypeName + " task type.";
                decimal _hRate = Logins.SelectTechHourlyRate(User.OrganizationId, User.DepartmentId, User.UserId, _taskTypeId);
                _timeLogId = bigWebApps.bigWebDesk.Data.Tickets.InsertTime(User.OrganizationId, User.DepartmentId, TktId, User.UserId, DateTime.UtcNow, Hours, NoteText, _hRate, DateTime.UtcNow.AddHours(-(double)Hours), DateTime.UtcNow, _taskTypeId, 0, DateTime.UtcNow, User.UserId, HoursOffset, true);
            }
            InsertResponse(User.OrganizationId, User.DepartmentId, TktId, User.UserId, false, _tktOld.UserId == User.UserId, false, NoteText, sysGeneratedText, _timeLogId, string.Empty, false);
            var _tktNew = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId, true);
            foreach (TicketAssignee _ta in _tktNew.Users) _ta.SendResponse = true;
            foreach (TicketAssignee _ta in _tktNew.Technicians) _ta.SendResponse = true;
            NotificationRules.RaiseNotificationEvent(User.OrganizationId, User.DepartmentId, User.UserId, NotificationRules.TicketEvent.TicketResponse, _tktNew, _tktOld, 0, DateTime.MinValue, null);
        }
示例#5
0
        public static void Confirm(ApiUser User, int TktId, string NoteText)
        {
            Config _cfg = new Config(User.OrganizationId, User.DepartmentId);

            if (!_cfg.ConfirmationTracking) throw new HttpError("Confirmation Tracking is not enabled for this instance.");

            UpdateConfirmation(User.OrganizationId, User.DepartmentId, TktId, User.UserId, true, NoteText);
            var _tktNew = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId, true);
            foreach (TicketAssignee _ta in _tktNew.Users) _ta.SendResponse = true;
            foreach (TicketAssignee _ta in _tktNew.Technicians) _ta.SendResponse = true;
            NotificationRules.RaiseNotificationEvent(User.OrganizationId, User.DepartmentId, User.UserId, NotificationRules.TicketEvent.TicketConfirmation, _tktNew, null, 0, DateTime.MinValue, null);
        }
示例#6
0
        public static void Close(ApiUser User, int TktId, string NoteText, bool SendNotifications, bool resolved, bool confirmed, string confirm_note)
        {
            Config _cfg = new Config(User.OrganizationId, User.DepartmentId);
            CustomNames _cNames = CustomNames.GetCustomNames(User.OrganizationId, User.DepartmentId);
            var _tktOld = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId);

            if (_cfg.ResolutionTracking)
            {
                UpdateResolution(User.OrganizationId, User.DepartmentId, TktId, 0, resolved);
                if (_cfg.ConfirmationTracking && confirmed)
                    UpdateConfirmation(User.OrganizationId, User.DepartmentId, TktId, User.UserId, true, confirm_note);
            }

            string sysGeneratedText = _cNames.Ticket.FullSingular + " was CLOSED by " + User.FullName + ".";
            CloseTicket(User.OrganizationId, User.DepartmentId, TktId, User.UserId, NoteText, sysGeneratedText, DateTime.UtcNow, string.Empty);
            if (SendNotifications)
            {
                var _tktNew = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId, true)
                                  {IsSendNotificationEmail = true};
                foreach (TicketAssignee _ta in _tktNew.Users) _ta.SendResponse = true;
                foreach (TicketAssignee _ta in _tktNew.Technicians) _ta.SendResponse = true;
                NotificationRules.RaiseNotificationEvent(User.OrganizationId, User.DepartmentId, User.UserId,
                                                         NotificationRules.TicketEvent.CloseTicket, _tktNew, _tktOld, 0,
                                                         DateTime.MinValue, null);
            }
        }
示例#7
0
        public static Config GetConfig(Guid OrgID, int departmentId)
        {
            if (HttpContext.Current == null || HttpContext.Current.Cache == null) return new Config(OrgID, departmentId);

            Config configurationObject = (Config)HttpContext.Current.Cache.Get(GetCachedConfigObjectKey(OrgID, departmentId));

            if (configurationObject == null)
            {
                configurationObject = new Config(OrgID, departmentId);
                HttpContext.Current.Cache.Add(GetCachedConfigObjectKey(OrgID, departmentId), configurationObject, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(30), System.Web.Caching.CacheItemPriority.Default, null);
            }
            return configurationObject;
        }
示例#8
0
 public static bool IsReqAfterHoursAlert(int DeptID, Config DeptConfig, DateTime CheckDateTime, string _wDays)
 {
     CheckDateTime = DB2UserDateTime(CheckDateTime);
     DateTime _timeStart = new DateTime(CheckDateTime.Year, CheckDateTime.Month, CheckDateTime.Day, DeptConfig.BusHourStart, DeptConfig.BusMinStart, 0);
     DateTime _timeStop = new DateTime(CheckDateTime.Year, CheckDateTime.Month, CheckDateTime.Day, DeptConfig.BusHourStop, DeptConfig.BusMinStop, 59);
     if (CheckDateTime < _timeStart || CheckDateTime > _timeStop) return true;
     if (_wDays.Length > 6)
     {
         if ((int)CheckDateTime.DayOfWeek > 0)
         {
             if (_wDays.Substring((int)CheckDateTime.DayOfWeek - 1, 1) == "0") return true;
         }
         else
         {
             if (_wDays.Substring(6, 1) == "0") return true;
         }
     }
     System.Data.DataTable _hdays = Data.Companies.SelectHolidays(DeptID, CheckDateTime.Year);
     foreach (System.Data.DataRow _hday in _hdays.Rows)
     {
         if (CheckDateTime >= (DateTime)_hday["dtStart"] && CheckDateTime <= (DateTime)_hday["dtStop"]) return true;
     }
     return false;
 }