Пример #1
0
 public Instance_Config(ApiUser usr)
     : base(usr.OrganizationId, usr.DepartmentId)
 {
     User=new UserConfig(usr);
     Assets = new AssetsConfig(base.Assets);
     m_TimeZoneOffset = usr.TimeZoneOffset;
     m_TimeZoneId = usr.TimeZoneId;
     m_BusinessDayLength = GetBusinessDayLength(base.BusHourStart, base.BusMinStart, base.BusHourStop, base.BusMinStop);
 }
Пример #2
0
 public UserConfig(ApiUser usr)
 {
     LoginId = usr.LoginId;
     UserId = usr.UserId;
     Email = usr.LoginEmail;
     FirstName = usr.FirstName;
     LastName = usr.LastName;
     IsTechOrAdmin = usr.IsTechAdmin;
     IsUseWorkDaysTimer = usr.IsUseWorkDaysTimer;
 }
Пример #3
0
 public static int CreateNew(ApiUser User, Ticket Tkt)
 {
     int _initPostId = 0;
     return bigWebApps.bigWebDesk.Data.Tickets.CreateNew(User.OrganizationId, User.DepartmentId, User.UserId,
                                                  Tkt.TechnicianId, Tkt.UserId, DateTime.UtcNow, Tkt.AccountId,
                                                  Tkt.AccountLocationId, true, Tkt.LocationId, Tkt.ClassId,
                                                  Tkt.Level, Tkt.SubmissionCategory, Tkt.IsHandleByCallCentre,
                                                  Tkt.CreationCategoryId, false, Tkt.PriorityId,
                                                  Tkt.RequestCompletionDate.HasValue
                                                      ? Tkt.RequestCompletionDate.Value
                                                      : DateTime.MinValue, Tkt.RequestCompletionNote,
                                                  Tkt.SerialNumber, null, Tkt.IDMethod, Tkt.CustomFieldsXML,
                                                  Tkt.Subject, Tkt.InitialPost, null, Tkt.TicketStatus.ToString(),
                                                  out _initPostId, Tkt.ProjectId, Tkt.FolderId, 0,
                                                  Tkt.EstimatedTime);
 }
Пример #4
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);
        }
Пример #5
0
 public UserProfileViewModel(ApiUser user)
 {
     Experiences = new ObservableCollection<UserExperienceViewModel>();
     Decks = new ObservableCollection<SharedDeckGroup>();
     UserName = user.UserName;
     UserImage = user.ImageUrl;
     UserIcon = user.IconUrl;
     UserSubscription = user.Tier;
     IsSubscribed = user.IsSubscribed;
     DisconnectPercent = user.DisconnectPercent;
     if(user.Experience == null)
         user.Experience = new List<ApiUserExperience>();
     Experiences.Add(new UserExperienceViewModel(user));
     foreach (var e in user.Experience.OrderByDescending(x=>x.TotalSecondsPlayed))
     {
         Experiences.Add(new UserExperienceViewModel(e));
     }
     if (Program.LobbyClient != null && Program.LobbyClient.IsConnected)
         IsMe = Program.LobbyClient.Me.UserName.Equals(user.UserName, StringComparison.InvariantCultureIgnoreCase);
     CanChangeIcon = IsSubscribed && IsMe;
     Messenger.Default.Register<RefreshSharedDecksMessage>(this,
         x => Task.Factory.StartNew(this.RefreshSharedDecks));
     Task.Factory.StartNew(RefreshSharedDecks);
 }
Пример #6
0
 public void Load(ApiUser user)
 {
     if (user == null) return;
     User = user;
     UserProfileViewModel mod = null;
     Task.Factory.StartNew(() =>
         {
             mod = this.GetModel(user);
         })
         .ContinueWith(x =>
             {
                 this.Dispatcher.Invoke(new Action(() =>
                     {
                         if (mod != null)
                             this.Model = mod;
                     }));
             });
 }
Пример #7
0
        private static void CreateApiUser(ApiAccount forAccount)
        {
            string password = GeneratePassword();
            ApiUser apiUser = new ApiUser
            {
                Email = GenerateEmailAddress(),
                Password = password,
            };

            ApiUser createdApiUser = _client.CreateApiUser(forAccount.Id, apiUser);
            Console.WriteLine("API user '{0}' has been created with the password '{1}'", createdApiUser.Email, password);
        }
Пример #8
0
 public int AddUser(ApiUser user)
 {
     return _client.AddUser(user);
 }
Пример #9
0
        public static void ReOpen(ApiUser User, int TktId, string NoteText)
        {
            CustomNames _cNames = CustomNames.GetCustomNames(User.OrganizationId, User.DepartmentId);
            Ticket _tktOld = new Ticket(User.OrganizationId, User.DepartmentId, TktId, User.InstanceId);

            if (_tktOld.TicketStatus != Ticket.Status.Closed) throw new HttpError(_cNames.Ticket.FullSingular + " is not Closed now to ReOpen it.");
            InsertResponse(User.OrganizationId, User.DepartmentId, TktId, User.UserId, false, _tktOld.UserId == User.UserId, false, NoteText, string.Empty, 0, string.Empty, true);
            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.ReOpenTicket, _tktNew, null, 0, DateTime.MinValue, null);
        }
Пример #10
0
        public static void PickUp(ApiUser User, int TktId, string NoteText)
        {
            var _tktOld = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId);

            if (_tktOld.TechnicianType == Logins.UserType.Queue) //Queue PickUp
            {
                UpdateTechnician(User.OrganizationId, User.DepartmentId, TktId, User.UserId, false);
                InsertLogMessage(User.OrganizationId, User.DepartmentId, TktId, User.UserId, "Queue Pickup", NoteText, "Picked Up from " + _tktOld.TechnicianFirstName + " " + _tktOld.TechnicianLastName + " by " + User.FullName);
                var _tktNew = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId, true);
                NotificationRules.RaiseNotificationEvent(User.OrganizationId, User.DepartmentId, User.UserId, NotificationRules.TicketEvent.PickUpTicket, _tktNew, _tktOld, 0, DateTime.MinValue, null);
            }
            else
            {
                Ticket.UpdateTechnician(User.OrganizationId, User.DepartmentId, TktId, User.UserId, true);
                if (_tktOld.TicketStatus == Status.OnHold) Ticket.UpdateStatus(User.OrganizationId, User.DepartmentId, TktId, Ticket.Status.Open);
                CustomNames _cNames = CustomNames.GetCustomNames(User.OrganizationId, User.DepartmentId);
                string sysGeneratedText = User.FullName + " picked up this " + _cNames.Ticket.FullSingular + " from " + _tktOld.TechnicianFirstName + " " + _tktOld.TechnicianLastName;
                sysGeneratedText += "<br>This " + _cNames.Ticket.FullSingular + " was transferred by choosing route by " + _cNames.Technician.FullSingular + ".";
                if (_tktOld.TicketStatus == Status.OnHold) sysGeneratedText += "<br>This " + _cNames.Ticket.FullSingular + " was set back to \"Open\" staus from \"On Hold\" status.";
                InsertLogMessage(User.OrganizationId, User.DepartmentId, TktId, User.UserId, "Transfer", NoteText, sysGeneratedText);
                var _tktNew = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId, true);
                NotificationRules.RaiseNotificationEvent(User.OrganizationId, User.DepartmentId, User.UserId, NotificationRules.TicketEvent.TransferTicket, _tktNew, _tktOld, 0, DateTime.MinValue, null);
            }
        }
Пример #11
0
 public UserProfileViewModel(ApiUser user)
 {
     UserName = user.UserName;
     UserImage = user.ImageUrl;
     UserIcon = user.IconUrl;
     UserSubscription = user.Tier;
     IsSubscribed = user.IsSubscribed;
     if(Program.LobbyClient != null && Program.LobbyClient.IsConnected)
         IsMe = Program.LobbyClient.Me.UserName.Equals(user.UserName, StringComparison.InvariantCultureIgnoreCase);
     CanChangeIcon = IsSubscribed && IsMe;
 }
Пример #12
0
 public UserProfileViewModel(ApiUser user)
 {
     Decks = new ObservableCollection<SharedDeckGroup>();
     UserName = user.UserName;
     UserImage = user.ImageUrl;
     UserIcon = user.IconUrl;
     UserSubscription = user.Tier;
     IsSubscribed = user.IsSubscribed;
     if (Program.LobbyClient != null && Program.LobbyClient.IsConnected)
         IsMe = Program.LobbyClient.Me.UserName.Equals(user.UserName, StringComparison.InvariantCultureIgnoreCase);
     CanChangeIcon = IsSubscribed && IsMe;
     Messenger.Default.Register<RefreshSharedDecksMessage>(this,
         x => Task.Factory.StartNew(this.RefreshSharedDecks));
     Task.Factory.StartNew(RefreshSharedDecks);
 }
Пример #13
0
 public static string CreateTimeEntry(ApiUser hdUser, Instance_Config instanceConfig, int staffID, int projectID, int taskID, 
     decimal hours, string notes, DateTime date, int timeLogID, bool isProjectLog)
 {
     return FreshBooks.CreateTimeEntry(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret,
         staffID, projectID, taskID, hours, notes, date, timeLogID, isProjectLog);
 }
Пример #14
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);
        }
Пример #15
0
 public static void Response(ApiUser User, int TktId, string NoteText)
 {
     var _tktOld = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId);
     string _toReceipts = string.Empty;
     List<Models.TicketAssignee> _tktUsers = Models.TicketAssignments.TicketUsers(User.OrganizationId, User.DepartmentId, TktId);
     foreach (Models.TicketAssignee _ta in _tktUsers)
     {
         if (_ta.UserId == User.UserId) continue;
         _toReceipts += _ta.UserFullName + ", ";
     }
     List<Models.TicketAssignee> _tktTechs = Models.TicketAssignments.TicketTechnicians(User.OrganizationId, User.DepartmentId, TktId);
     foreach (Models.TicketAssignee _ta in _tktTechs)
     {
         if (_ta.UserId == User.UserId) continue;
         _toReceipts += _ta.UserFullName + ", ";
     }
     InsertResponse(User.OrganizationId, User.DepartmentId, TktId, User.UserId, false, _tktOld.UserId == User.UserId, false, NoteText, string.Empty, 0, _toReceipts, false);
     var _tktNew = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId, true);
     foreach (TicketAssignee _usrTkt in _tktNew.Users) _usrTkt.SendResponse = true;
     foreach (TicketAssignee _usrTkt in _tktNew.Technicians) _usrTkt.SendResponse = true;
     NotificationRules.RaiseNotificationEvent(User.OrganizationId, User.DepartmentId, User.UserId, NotificationRules.TicketEvent.TicketResponse, _tktNew, null, 0, DateTime.MinValue, null);
 }
Пример #16
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);
        }
Пример #17
0
        public static void TransferToTech(ApiUser User, int TktId, int TechId, string NoteText, bool KeepTechAttached)
        {
            DataRow _row = Logins.SelectUserDetails(User.OrganizationId, User.DepartmentId, TechId);
            if (_row == null) throw new HttpError("The user account Id=" + TechId.ToString() + " is not associated with this Department.");

            string techFullName = _row["FirstName"].ToString() + " " + _row["LastName"].ToString();
            CustomNames _cNames = CustomNames.GetCustomNames(User.OrganizationId, User.DepartmentId);

            if ((int)_row["UserType_Id"] != 2 && (int)_row["UserType_Id"] != 3 && (int)_row["UserType_Id"] != 4) throw new HttpError("User " + techFullName + " is not " + _cNames.Technician.FullSingular + " or Administrator or Queue.");

            var _tktOld = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId);

            UpdateTechnician(User.OrganizationId, User.DepartmentId, TktId, TechId, KeepTechAttached);
            if (_tktOld.TicketStatus == Status.OnHold) UpdateStatus(User.OrganizationId, User.DepartmentId, TktId, Status.Open);
            string sysGeneratedText = User.FullName;
            if (TechId == User.UserId)
                sysGeneratedText += " picked up this " + _cNames.Ticket.FullSingular + " from " + _tktOld.TechnicianFirstName + " " + _tktOld.TechnicianLastName;
            else
                sysGeneratedText += " transfered this " + _cNames.Ticket.FullSingular + " to " + techFullName + ".";
            sysGeneratedText += "<br>This " + _cNames.Ticket.FullSingular + " was transferred by choosing route by " + _cNames.Technician.FullSingular + ".";
            if (_tktOld.TicketStatus == Status.OnHold) sysGeneratedText += "<br>This " + _cNames.Ticket.FullSingular + " was set back to \"Open\" staus from \"On Hold\" status.";
            InsertLogMessage(User.OrganizationId, User.DepartmentId, TktId, User.UserId, "Transfer", NoteText, sysGeneratedText);
            var _tktNew = new bigWebApps.bigWebDesk.Data.Ticket(User.OrganizationId, User.DepartmentId, TktId, true);
            NotificationRules.RaiseNotificationEvent(User.OrganizationId, User.DepartmentId, User.UserId, NotificationRules.TicketEvent.TransferTicket, _tktNew, _tktOld, 0, DateTime.MinValue, null);
        }
Пример #18
0
 public ApiUser UpdateUser(ApiUser user)
 {
     return _client.UpdateUser(user);
 }
Пример #19
0
 public static void AttachAlternateTechnician(ApiUser User, int TktId, int TechId)
 {
     AttachAlternateAssignee(User.OrganizationId, User.DepartmentId, TktId, TechId, TicketAssignmentType.Technician, true);
 }
Пример #20
0
 public UserExperienceViewModel(ApiUser usr)
 {
     this.Level = usr.Level;
     this.Image = "pack://application:,,,/Resources/logolarge.png";
     this.Name = "OCTGN";
     this.TotalGamesPlayed = usr.TotalGamesPlayed;
     this.TotalTimePlayed = FormatTime(usr.TotalSecondsPlayed);
     this.AverageGameTime = FormatTime(usr.AverageGameLength);
 }
Пример #21
0
 public static void AttachAlternateUser(ApiUser User, int TktId, int UserId)
 {
     AttachAlternateAssignee(User.OrganizationId, User.DepartmentId, TktId, UserId, TicketAssignmentType.User, true);
 }
Пример #22
0
        private UserProfileViewModel GetModel(ApiUser user)
        {
            UserProfileViewModel ret = null;
            try
            {
                var client = new ApiClient();
                ApiUser me;
                me = client.UsersFromUsername(new[] { user.UserName }).FirstOrDefault();
                ret = me == null ? new UserProfileViewModel(new ApiUser()) : new UserProfileViewModel(me);

            }
            catch (Exception ex)
            {
                Log.Warn("GetModel", ex);
            }
            return ret;
        }
Пример #23
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);
            }
        }
Пример #24
0
 public static void UpdateData(ApiUser User, int userID, int fbStaffID, int accountID, int fbClientId, int projectID,
     int fbProjectID, int taskTypeID, int fbTaskTypeID)
 {
     FreshBooks.UpdateData(User.OrganizationId, User.DepartmentId, userID, fbStaffID, accountID, fbClientId, projectID, fbProjectID, taskTypeID, fbTaskTypeID);
 }
Пример #25
0
 private UserProfileViewModel GetModel(ApiUser user)
 {
     UserProfileViewModel ret = null;
         var client = new ApiClient();
         ApiUser me;
         me = client.UsersFromUsername(new[] { user.UserName }).FirstOrDefault();
         ret = me == null ? new UserProfileViewModel(new ApiUser()) : new UserProfileViewModel(me);
     return ret;
 }