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); }
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; }
public static void DeleteFreshBooksCategory(ApiUser hdUser, Instance_Config instanceConfig, string categoryID) { FreshBooks.DeleteAndUnlinkCategory(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.FBoAuthConsumerKey, instanceConfig.FBoAuthSecret, categoryID); }
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; })); }); }
public int AddUser(ApiUser user) { return _client.AddUser(user); }
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); }
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); }
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; }
static void Main(string[] args) { // Configiration string folderLocation = @""; // read config file string[] lines = File.ReadAllLines(@"./../../../config.txt"); // debuging Console.WriteLine("Contents of config.txt = "); // iterate through lines in config file foreach (string line in lines) { // debuging Console.WriteLine("\t" + line); // seperate line into usable information string[] info = line.Split('>'); // checks for Reportlacation in line if (info[0] == "ReportsLocation") { // set folder location to lacation specified on the confic.txt file folderLocation += info[1]; Console.WriteLine(folderLocation); } } // Process // array of folders named after branchId string[] BranchFolders = Directory.GetDirectories(folderLocation); // iterate through directory foreach (var branch in BranchFolders) { // seperator for path split char[] seperator = { '\\' }; // debuging Console.WriteLine(branch.Split(seperator).Last()); // get api User from db according to branchid ApiUser user = new ApiUser(); using (var context = new DBContext()) { user = context.ApiUsers .Where(b => b.BranchId == branch.Split(seperator).Last()).First(); } // array of reports in folder string[] reports = Directory.GetFiles(Path.Combine(folderLocation, Path.GetFileNameWithoutExtension(branch))); // array of creditdatateport objects to be added to database CreditDataReport[] reportsDb = new CreditDataReport[reports.Length]; // counter int index = 0; // iterate through report files foreach (var report in reports) { // debuging Console.WriteLine(report); // new CreditDataReport object to be added to reportsDb array CreditDataReport reportDb = new CreditDataReport(); reportDb.ApiUserId = user.id; reportDb.PdfReport = File.ReadAllBytes(report); reportDb.ReportName = Path.GetFileNameWithoutExtension(report); reportDb.DateAdded = File.GetLastWriteTime(report); reportDb.ActorCode = ""; reportDb.ConsumerFirstname = ""; reportDb.ConsumerIdentifier = ""; reportDb.SysUserId = ""; // add object to array reportsDb[index] = reportDb; index++; } // get xml reports folder string xmlDirectory = Directory.GetDirectories(Path.Combine(folderLocation, branch)).First(); // array of reports in xml folder string[] xmlReports = Directory.GetFiles(Path.Combine(folderLocation, branch, Path.GetFileNameWithoutExtension(xmlDirectory))); // counter index = 0; // iterate through xml report files foreach (var xmlreport in xmlReports) { // debuging Console.WriteLine(xmlreport); // adding report byte array from xml file to report object in reportsDb reportsDb[index].XmlReport = File.ReadAllBytes(xmlreport); // adding and saving database changes using (var context = new DBContext()) { context.Reports.Add(reportsDb[index]); context.SaveChanges(); } index++; } } }
public OperationStatus ImportData(User user) { var token = _tokenStore.Find(user.EmailAddress); if (token == null || token.HasExpired) { return new OperationStatus(false, "Please Renew your token") { TokenExpired = true } } ; var consumer = new Consumer(user.Company.ConsumerKey, user.Company.ConsumerSecret); var apiUser = new ApiUser { Name = user.EmailAddress, OrganisationId = user.Company.OrganisationId }; var coreApi = new XeroCoreApi(_baseUri, _authenticator, consumer, apiUser, new DefaultMapper(), new DefaultMapper()); var invoices = coreApi.Invoices.Find().ToList(); var pos = new List <PurchaseOrder>(); var bills = new List <Bill>(); foreach (var invoice in invoices) { if (invoice.Type == InvoiceType.AccountsReceivable) { bills.Add(new Bill { InvoiceId = invoice.Id.ToString(), CreateDate = invoice.Date.GetValueOrDefault(DateTime.MaxValue), DueDate = invoice.DueDate.GetValueOrDefault(DateTime.MaxValue), Amount = invoice.AmountDue.GetValueOrDefault(0), Currency = invoice.CurrencyCode ?? "AUD", CurrencyRate = invoice.CurrencyRate.GetValueOrDefault(0), OrganisationId = user.Company.OrganisationId }); } else if (invoice.Type == InvoiceType.AccountsPayable) { pos.Add(new PurchaseOrder { InvoiceId = invoice.Id.ToString(), CreateDate = invoice.Date.GetValueOrDefault(DateTime.MaxValue), DueDate = invoice.DueDate.GetValueOrDefault(DateTime.MaxValue), Amount = invoice.AmountDue.GetValueOrDefault(0), Currency = invoice.CurrencyCode ?? "AUD", CurrencyRate = invoice.CurrencyRate.GetValueOrDefault(0), OrganisationId = user.Company.OrganisationId }); } } var result = new OperationStatus(); var billSaveResult = _billRepository.SaveBills(bills, user.Company.OrganisationId); if (!billSaveResult.Status) { result.Status = false; result.Message = " Failed to import bills. Please try again"; return(result); } var poSaveResult = _purchaseOrderRepository.SavePOs(pos, user.Company.OrganisationId); if (!poSaveResult.Status) { result.Status = false; result.Message = " Failed to import purchase orders. Please try again"; return(result); } result.Status = true; result.Message = "Data has been successfully imported"; return(result); } }
public static void UnlinkQuickBooksInvoice(ApiUser hdUser, int invoice_id) { QuickBooks.UnlinkQuickBooksInvoice(hdUser.OrganizationId, hdUser.DepartmentId, invoice_id); }
public object Any(Technicians request) { ApiUser hdUser = request.ApiUser; return(UserAccounts.Technicians(hdUser.OrganizationId, hdUser.DepartmentId, request.page, request.limit)); }
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); }
// GET: ApiUser/Create public ActionResult Create() { ApiUser user = new ApiUser(); return(View(user)); }
public object GetPriorities(Priorities request) { ApiUser hdUser = request.ApiUser; return(Models.Priorities.All(hdUser.OrganizationId, hdUser.DepartmentId, hdUser.IsTechAdmin)); }
public static void UnlinkQuickBooksBill(ApiUser hdUser, int bill_id) { QuickBooks.UnlinkQuickBooksBill(hdUser.OrganizationId, hdUser.DepartmentId, bill_id, true); }
public void Update(ApiUser user) { _user = user; }
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); }
public static List <WorklistTicket> GetTickets(ApiUser hdUser, Guid OrgId, int DeptId, int UserId, string status, string role, string Class, string account, string location, string project, bool IsTechAdmin, bool IsUseWorkDaysTimer, string sort_order, string sort_by, string search = "", int page = 0, int limit = 25, DateTime?start_date = null, DateTime?end_date = null) { string tkts = ""; if (!string.IsNullOrWhiteSpace(search) && Micajah.Common.Configuration.FrameworkConfiguration.Current.WebApplication.Integration.Azure.Search.Enabled) { tkts = bigWebApps.bigWebDesk.Data.Tickets.SearchTicketsInAzure(hdUser.OrganizationId, hdUser.DepartmentId, false, search); /*if (string.IsNullOrEmpty(tkts)) * { * return new List<WorklistTicket>(); * //tkts = "0"; * } */ } Worklist.QueryFilter _qFilter = new Worklist.QueryFilter(); if (string.IsNullOrEmpty(role) || role.ToLower() == "all") { role = "notset"; } if (!string.IsNullOrEmpty(status)) { string originalstatus = status; status = status.Replace(",", "").Replace("_", "").ToLowerInvariant(); Worklist.TicketStatusMode ticketStatusMode; if (Enum.TryParse <Worklist.TicketStatusMode>(status, true, out ticketStatusMode)) { _qFilter.TicketStatus = ticketStatusMode; } else { if (originalstatus.Contains(",")) { string statuses = originalstatus.Replace("_", "").ToLowerInvariant(); string status_query = string.Empty; foreach (string _status in statuses.Split(',')) { switch (_status.ToLower()) { case "closed": status_query += " OR tkt.status='Closed' "; break; case "open": status_query += " OR tkt.status='Open' "; break; case "onhold": status_query += " OR tkt.status='On Hold' "; break; case "partsonorder": status_query += " OR tkt.status='Parts On Order' "; break; case "waiting": status_query += " OR (tkt.status='Open' AND tkt.WaitingDate is not null) "; break; } } if (!string.IsNullOrEmpty(status_query)) { _qFilter.SQLWhere = " AND (" + status_query.Substring(3) + ")"; } } else { switch (status) { case "waiting": _qFilter.TicketStatus = Worklist.TicketStatusMode.OpenWaitingOnResponse; break; case "newmessages": switch (role) { case "tech": _qFilter.ShowNewMessages = Worklist.NewMessagesMode.User; break; case "user": _qFilter.ShowNewMessages = Worklist.NewMessagesMode.Technician; break; default: _qFilter.ShowNewMessages = Worklist.NewMessagesMode.UserAndTech; break; } ; break; case "closed": _qFilter.TicketStatus = Worklist.TicketStatusMode.Close; break; } } } } Worklist.SortMode ticketSortMode; if (Enum.TryParse <Worklist.SortMode>(role, true, out ticketSortMode)) { _qFilter.Sort = ticketSortMode; } else { switch (role) { case "tech": _qFilter.Sort = Worklist.SortMode.MyTickets; break; case "user": _qFilter.Sort = Worklist.SortMode.MyTicketsAsUser; break; case "alt_tech": _qFilter.Sort = Worklist.SortMode.MyTicketsAsAlternateTech; break; } } int queueId; if (int.TryParse(Class, out queueId)) { _qFilter.TechnicianId = queueId; Class = ""; } if (!string.IsNullOrEmpty(Class)) { int class_id = 0; if (int.TryParse(Class, out class_id)) { if (class_id > 0) { _qFilter.SQLWhere += " AND tkt.class_id = " + class_id; } } else { _qFilter.SQLWhere += " AND dbo.fxGetFullClassName(" + DeptId.ToString() + ", tkt.class_id) like '%" + Class + "%'"; } } if (!string.IsNullOrEmpty(account)) { int account_id = 0; if (int.TryParse(account, out account_id)) { if (account_id != 0) { _qFilter.AccountId = account_id; } } else { _qFilter.SQLWhere += " AND (ISNULL(acct.vchName, CASE WHEN ISNULL(tkt.btNoAccount, 0) = 0 THEN co.company_name ELSE '' END) like '%" + account + "%')"; } } if (!string.IsNullOrEmpty(project)) { int project_id = 0; if (int.TryParse(project, out project_id)) { if (project_id != 0) { _qFilter.ProjectID = project_id; } } else { _qFilter.SQLWhere += " AND dbo.fxGetFullProjectName(" + DeptId.ToString() + ", tkt.ProjectID) like '%" + project + "%'"; } } if (!string.IsNullOrEmpty(location)) { int location_id = 0; if (int.TryParse(location, out location_id)) { if (location_id != 0) { _qFilter.AccountLocationId = location_id; } } else { _qFilter.SQLWhere += " AND dbo.fxGetUserLocationName(" + DeptId.ToString() + ", tkt.LocationId) like '%" + location + "%'"; } } if (start_date.HasValue) { if (start_date.Value.TimeOfDay.TotalSeconds > 0) { start_date = start_date.Value.Date; } _qFilter.SQLWhere += string.Format(" AND tkt.CreateTime >= '{0}'", start_date.Value.ToString("yyyy-MM-dd hh:mm:ss")); } if (end_date.HasValue) { if (end_date.Value.TimeOfDay.TotalSeconds == 0) { end_date = end_date.Value.Date.AddDays(1).AddSeconds(-1); } _qFilter.SQLWhere += string.Format(" AND tkt.CreateTime <= '{0}'", end_date.Value.ToString("yyyy-MM-dd hh:mm:ss")); } Instance_Config config = new Instance_Config(hdUser); if (!string.IsNullOrWhiteSpace(search)) { string _query = ""; if (!string.IsNullOrEmpty(tkts)) { _query += " AND (tkt.Id IN (" + tkts + ")"; } else { _query += " AND (tkt.subject LIKE '%" + search + "%' OR ISNULL(tlip2.CountFoundInitPost, 0) > 0 OR tkt.note LIKE '%" + search + "%' OR ISNULL(tlcn2.CountFoundClosureNotes, 0) > 0"; _qFilter.SQLJoin += " LEFT OUTER JOIN (SELECT TId, COUNT(*) AS CountFoundInitPost FROM TicketLogs WHERE DId=" + hdUser.DepartmentId + " AND vchType = 'Initial Post' AND vchNote LIKE '%" + search + "%' GROUP BY TId) tlip2 ON tlip2.TId = tkt.Id " + "LEFT OUTER JOIN (SELECT TId, COUNT(*) AS CountFoundClosureNotes FROM TicketLogs WHERE DId=" + hdUser.DepartmentId + " AND vchType = 'Closed' AND vchNote LIKE '%" + search + "%' GROUP BY TId) tlcn2 ON tlcn2.TId = tkt.Id "; } if (config.SerialNumber) { _query += " OR tkt.SerialNumber LIKE '%" + search + "%'"; } _query += ")"; _qFilter.SQLWhere += _query; } limit = limit <= 0 ? 25 : limit; page = page < 0 ? 0 : page; string pager = string.Format(" OFFSET ({0} * {1}) ROWS FETCH NEXT {1} ROWS ONLY ", page, limit); _qFilter.PageIndex = page; if (sort_by != "days_old") { _qFilter.SortColumnIndex = 0; _qFilter.IsSortColumnDesc = "desc" == sort_order; _qFilter.SortColumnSQLAlias = sort_by ?? "CreateTime"; } bigWebApps.bigWebDesk.UserAuth userAuth = new bigWebApps.bigWebDesk.UserAuth { Role = hdUser.Role, OrgID = hdUser.OrganizationId, lngDId = hdUser.DepartmentId, tintTicketTimer = hdUser.tintTicketTimer, lngUId = hdUser.UserId, InstanceID = hdUser.InstanceId //ee.strGSUserRootLocationId //ee.sintGSUserType }; //Use global filters bool useGlobalFilters = hdUser.Role != bigWebApps.bigWebDesk.UserAuth.UserRole.Administrator && (role == "notset" || role == "tech"); bool limitToAssignedTickets = (useGlobalFilters) ? GlobalFilters.IsFilterEnabled(hdUser.OrganizationId, hdUser.DepartmentId, UserId, GlobalFilters.FilterState.LimitToAssignedTickets) : false; if (limitToAssignedTickets) { _qFilter.SQLWhere += " AND tkt.technician_id=" + UserId.ToString(); _qFilter.SQLJoin += " LEFT OUTER JOIN TicketAssignment AS TA2 ON TA2.DepartmentId=" + hdUser.DepartmentId + " AND TA2.TicketId = tkt.Id AND TA2.UserId = " + UserId + " AND TA2.AssignmentType = " + ((int)Ticket.TicketAssignmentType.Technician).ToString() + " AND TA2.IsPrimary = 0 AND TA2.StopDate IS NULL"; } //Use global filters if (useGlobalFilters) { _qFilter.SQLWhere += GlobalFilters.GlobalFiltersSqlWhere(userAuth, config, "tkt.", "tlj2.", "SupGroupID", null); } //(limitToAssignedTickets ? "TA2." : null //bigWebApps.bigWebDesk.Data.Worklist.Filter m_Filter = new bigWebApps.bigWebDesk.Data.Worklist.Filter(tt.DepartmentId, tt.UserId, true, tt.OrganizationId); //bool shortMode = true; //Worklist.ColumnsSetting m_ColSet = shortMode ? new Worklist.ColumnsSetting("0,2", tt.DepartmentId, tt.UserId, config.AccountManager && config.LocationTracking, tt.OrganizationId) : // new Worklist.ColumnsSetting(tt.DepartmentId, tt.UserId, config.AccountManager && config.LocationTracking, tt.OrganizationId); //if sherpadesk //DataTable dt = Worklist.SelectTicketsByFilter(ee, config, m_ColSet, m_Filter, _qFilter, false, FilesSources.AzureFileService, limit); DataTable dt = Worklist.SelectTicketsByFilter(OrgId, DeptId, UserId, _qFilter, IsTechAdmin, pager); if (dt != null) { //var config = new Instance_Config() dt.Columns.Add(new DataColumn("DaysOldSort", typeof(long))); dt.Columns.Add(new DataColumn("DaysOlds", typeof(string))); foreach (DataRow dr in dt.Rows) { int min = Utils.GetDaysOldInMinutes(OrgId, DeptId, IsUseWorkDaysTimer, dr.GetString("Status"), dr.Get <DateTime>("CreateTime"), dr.Get <DateTime?>("ClosedTime") ?? DateTime.UtcNow); dr["DaysOldSort"] = min; dr["DaysOlds"] = bigWebApps.bigWebDesk.Functions.DisplayDateDuration(min, config.BusinessDayLength, true); } } IEnumerable <WorklistTicket> wrklisttickets = new WorklistTickets(dt); return(wrklisttickets.ToList()); }
public static void AttachAlternateUser(ApiUser User, int TktId, int UserId) { AttachAlternateAssignee(User.OrganizationId, User.DepartmentId, TktId, UserId, TicketAssignmentType.User, true); }
public object Get(Location request) { ApiUser hdUser = request.ApiUser; return(Models.Location.GetLocation(hdUser.OrganizationId, hdUser.DepartmentId, request.location_id)); }
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); }
public object Post(LocationsPost request) { ApiUser hdUser = request.ApiUser; return(Models.Location.AddLocation(hdUser, request.name, request.description, request.parent_location_id, request.type_id, request.is_active, request.auditor_id, request.audit_days)); }
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); }
public object Get(LocationTypes request) { ApiUser hdUser = request.ApiUser; return(Models.LocationTypes.GetLocationTypes(hdUser.OrganizationId, hdUser.DepartmentId)); }
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); }
public void Add(ApiUser user) { Add(user, UserUpdateMode.Overwrite); }
public static void UnlinkFreshBooksCategory(ApiUser hdUser, string categoryID) { FreshBooks.UnlinkFreshBooksCategory(hdUser.OrganizationId, hdUser.DepartmentId, categoryID); }
public void Add(ApiUser user, UserUpdateMode mode) { AddInternal(user, mode); }
public object Get(Projects request) { ApiUser hdUser = request.ApiUser; return(Models.Projects.GetProjectDetails(hdUser.OrganizationId, hdUser.DepartmentId, request.id)); }
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); }
public static void UpdateData(ApiUser User, int userID, int qb_employee_id, int accountID, int qb_customer_id, int taskTypeID, int qb_service_id, int qb_vendor_id) { QuickBooks.UpdateData(User.OrganizationId, User.DepartmentId, userID, qb_employee_id, accountID, qb_customer_id, taskTypeID, qb_service_id, qb_vendor_id); }
public object Post(POST_TodoItem request) { ApiUser hdUser = request.ApiUser; CheckToDos(hdUser); Guid todoItemId = Guid.Empty; Guid todoListId = Guid.Empty; if (!string.IsNullOrEmpty(request.task_id) && !Guid.TryParse(request.task_id, out todoItemId)) { return(new HttpResult("", HttpStatusCode.NotFound)); } DataRow plRow = null; if (!string.IsNullOrEmpty(request.task_id)) { plRow = bigWebApps.bigWebDesk.Data.ToDo.SelectToDoItem(hdUser.OrganizationId, hdUser.DepartmentId, todoItemId.ToString()); if (plRow == null) { throw new HttpError(HttpStatusCode.NotFound, "Wrong ToDo Task Id"); } todoListId = Guid.Parse(plRow["ToDoListId"].ToString()); } string text = (request.text != null ? request.text : ""); DateTime due_date = request.due_date ?? DateTime.MinValue; decimal estimated_remain = request.estimated_remain ?? 0; int assigned_id = request.assigned_id ?? 0; if (!string.IsNullOrEmpty(request.task_id)) { bigWebApps.bigWebDesk.Data.ToDo.UpdateToDoItem(hdUser.OrganizationId, todoItemId.ToString(), hdUser.DepartmentId, text, hdUser.UserId, assigned_id, estimated_remain, due_date, true, request.title, request.notify ?? true); if (request.time_hours.HasValue) { Instance_Config instanceConfig = new Instance_Config(hdUser); if (!instanceConfig.TimeTracking) { throw new HttpError("Time Tracking is not enabled for this instance."); } if (!plRow.IsNull("TimeInvoiceId")) { throw new HttpError("Time log associated with this ToDo Item has been invoiced and can not be edited."); } if (!plRow.IsNull("TimeBillId")) { throw new HttpError("Time log associated with this ToDo Item has been paid and can not be edited."); } decimal time_hours = request.time_hours.Value; bool time_is_billable = request.time_is_billable ?? true; int time_task_type_id = request.time_task_type_id ?? 0; if (!plRow.IsNull("TimeId")) { if (time_hours < 0) { bigWebApps.bigWebDesk.Data.ToDo.UnlinkToDoTime(hdUser.OrganizationId, hdUser.DepartmentId, int.Parse(plRow["TimeId"].ToString()), !plRow.IsNull("ProjectId")); } else if (time_hours == 0) { if (!plRow.IsNull("ProjectId")) { Models.Projects.DeleteProjectTime(hdUser, int.Parse(plRow["TimeId"].ToString())); } else { Models.Ticket.DeleteTicketTime(hdUser, int.Parse(plRow["TimeId"].ToString())); } } else { if (!plRow.IsNull("ProjectId")) { DataRow rowProjectTime = bigWebApps.bigWebDesk.Data.Project.SelectProjectTimeByID(hdUser.OrganizationId, hdUser.DepartmentId, int.Parse(plRow["TimeId"].ToString())); if (rowProjectTime == null) { throw new HttpError(System.Net.HttpStatusCode.NotFound, "Project Time Id Not Found"); } int techID = 0; if (!rowProjectTime.IsNull("UserId")) { techID = int.Parse(rowProjectTime["UserId"].ToString()); } DateTime?start_date = null; if (!rowProjectTime.IsNull("StartTimeUTC")) { start_date = (DateTime)rowProjectTime["StartTimeUTC"]; } DateTime?stop_date = null; if (!rowProjectTime.IsNull("StopTimeUTC")) { stop_date = (DateTime)rowProjectTime["StopTimeUTC"]; } Models.Projects.EditProjectTime(hdUser, -1, int.Parse(plRow["ProjectId"].ToString()), techID, time_task_type_id, start_date, stop_date, time_hours, hdUser.TimeZoneOffset, rowProjectTime["Note"].ToString(), time_is_billable, (DateTime)rowProjectTime["Date"], int.Parse(plRow["TimeId"].ToString()), int.Parse(rowProjectTime["ContractID"].ToString())); } else { DataRow tlRow = bigWebApps.bigWebDesk.Data.Tickets.SelectTicketTimeByID(hdUser.OrganizationId, hdUser.DepartmentId, int.Parse(plRow["TimeId"].ToString())); if (tlRow == null) { throw new HttpError(HttpStatusCode.NotFound, "No data found"); } DateTime?start_date = null; if (!tlRow.IsNull("StartTime")) { start_date = (DateTime)tlRow["StartTime"]; } DateTime?stop_date = null; if (!tlRow.IsNull("StopTime")) { stop_date = (DateTime)tlRow["StopTime"]; } decimal?remainHours = null; if (!tlRow.IsNull("HoursRemaining")) { remainHours = decimal.Parse(tlRow["HoursRemaining"].ToString()); } int contract_id = 0; if (!tlRow.IsNull("ContractID")) { contract_id = int.Parse(tlRow["ContractID"].ToString()); } Ticket.EditTime(hdUser, int.Parse(plRow["TimeId"].ToString()), start_date, stop_date, time_is_billable, (DateTime)tlRow["Date"], time_hours, time_task_type_id, tlRow["Note"].ToString(), remainHours, int.Parse(tlRow["Complete"].ToString()), contract_id, tlRow["ContractName"].ToString()); } } } else { int techID = (request.assigned_id.HasValue && request.assigned_id.Value > 0 && hdUser.IsAdmin) ? request.assigned_id.Value : hdUser.UserId; if (!plRow.IsNull("ProjectId")) { Models.Projects.PostProjectTime(hdUser, -1, int.Parse(plRow["ProjectId"].ToString()), techID, time_task_type_id, null, null, time_hours, hdUser.TimeZoneOffset, string.Empty, time_is_billable, DateTime.UtcNow, 0, 0, todoItemId.ToString(), string.Empty); } else { bigWebApps.bigWebDesk.Data.Ticket _tktNew = null; Ticket.InputTime(hdUser, int.Parse(plRow["ListTicketId"].ToString()), time_task_type_id, null, null, time_hours, hdUser.TimeZoneOffset, string.Empty, time_is_billable, DateTime.UtcNow, 0, techID, ref _tktNew, 0, 0, 0, todoItemId.ToString()); } } } } else { if (!string.IsNullOrEmpty(request.list_id) && !Guid.TryParse(request.list_id, out todoListId)) { throw new HttpError(HttpStatusCode.NotFound, "Wrong ToDo List Id"); } if (!string.IsNullOrEmpty(request.list_id)) { CheckToDoList(hdUser, todoListId); } else { int ticketID = CheckAddToDoListConditions(hdUser, request.ticket_key, request.project_id); int projectID = (request.project_id ?? 0); string name = "Main"; string filter = string.Empty; if (ticketID > 0) { filter = "TicketId = " + ticketID.ToString(); } else if (projectID > 0) { filter = "ProjectId = " + projectID.ToString(); } else { name = "My ToDo's"; filter = "ProjectId IS NULL AND TicketId IS NULL"; } DataTable table = bigWebApps.bigWebDesk.Data.ToDo.SelectToDoListsByUser(hdUser.OrganizationId, hdUser.DepartmentId, assigned_id); foreach (DataRow row in table.Select(filter)) { string toDoListName = (string)row["ToDoListName"]; if (string.Compare(name, toDoListName, StringComparison.OrdinalIgnoreCase) == 0) { todoListId = (Guid)row["ToDoListId"]; break; } } if (todoListId == Guid.Empty) { todoListId = Guid.NewGuid(); bigWebApps.bigWebDesk.Data.ToDo.InsertToDoList(hdUser.OrganizationId, todoListId.ToString(), hdUser.DepartmentId, name, string.Empty, ticketID, projectID); } } bigWebApps.bigWebDesk.Data.ToDo.InsertToDoItem(hdUser.OrganizationId, hdUser.DepartmentId, text, todoListId.ToString(), hdUser.UserId, assigned_id, estimated_remain, due_date, true, request.title, request.notify ?? true); } if (request.notify ?? false) { string userName = string.Empty; if (!string.IsNullOrEmpty(hdUser.FirstName) && !string.IsNullOrEmpty(hdUser.LastName)) { userName = hdUser.FirstName + " " + hdUser.LastName; } bigWebApps.bigWebDesk.Data.ToDo.SendToDoEmail(hdUser.OrganizationId, hdUser.InstanceId, hdUser.UserId, userName, hdUser.LoginEmail, todoListId.ToString(), text, due_date, estimated_remain, assigned_id, request.title); } return(new HttpResult("", HttpStatusCode.OK)); }
public static void DeleteQuickBooksBill(ApiUser hdUser, Instance_Config instanceConfig, int bill_id) { QuickBooks.DeleteAndUnlinkBill(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.QBoAuthConsumerKey, instanceConfig.QBoAuthSecret, bill_id); }
public void Update(OperationMapper operationMapper, List <ApiImportance> importances, List <ApiTag> tags, List <ApiFrequency> frequencies, List <ApiOperation> operations, ApiUser user, List <DalOperationsGroupTags> relations, List <ApiTransactionType> transactionTypes) { _importances = importances; _frequencies = frequencies; _transactionTypes = transactionTypes; _tagMapper.Update(tags); _dalRelations = relations; _operations = operations; _operationMapper = operationMapper; _user = user; }
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); } }
/// <inheritdoc /> public async Task <NugetFeed> GetFeedAsync(ApiUser user, string feed, string view) { var result = this.cache != null && this.options.CacheFeedsInternally ? await this.cache.GetOrCreateAsync( $"<{feed}>.<{view}>", async entry => { var p = await this.GetPackages(user, feed, view); entry.SetValue(p); var timeout = this.options.InternalCacheTimeout > TimeSpan.Zero ? this.options.InternalCacheTimeout : TimeSpan.FromMinutes(1); entry.SetAbsoluteExpiration(timeout); return(p); }) : await this.GetPackages(user, feed, view); var packages = new List <NugetPackage>(); using (var semaphore = new SemaphoreSlim(5)) { var tasks = result.Packages.Where(p => p.Name.StartsWith(feed)).Select( async package => { // ReSharper disable once AccessToDisposedClosure await semaphore.WaitAsync(); try { packages.Add( new NugetPackage { Id = package.Name, Versions = (await this.azureDevOpsFeedsService.GetFeedViewPackageVersionsAsync( user, package.Links.Versions.Href)).Versions .Select( v => new Tuple <string, NugetPackageVersion>( GetBranch(v.Version), new NugetPackageVersion { Version = v.Version, PublishDate = v.PublishDate })) .GroupBy(p => p.Item1).ToDictionary( g => g.Key, g => g.Select(i => i.Item2).ToArray()) }); } finally { // ReSharper disable once AccessToDisposedClosure semaphore.Release(); } }); await Task.WhenAll(tasks); } return(new NugetFeed { Name = feed, Packages = packages.ToDictionary(p => p.Id) }); }
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); }
public static void UnlinkQuickBooksEmployee(ApiUser hdUser, int userID) { QuickBooks.UnlinkQuickBooksEmployee(hdUser.OrganizationId, hdUser.DepartmentId, userID); }
public static void AttachAlternateTechnician(ApiUser User, int TktId, int TechId) { AttachAlternateAssignee(User.OrganizationId, User.DepartmentId, TktId, TechId, TicketAssignmentType.Technician, true); }
public static void DeleteQuickBooksEmployee(ApiUser hdUser, Instance_Config instanceConfig, int userID) { QuickBooks.DeleteAndUnlinkEmployee(hdUser.OrganizationId, hdUser.DepartmentId, instanceConfig, instanceConfig.QBoAuthConsumerKey, instanceConfig.QBoAuthSecret, userID); }
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); } }
public string Get() { ApiUser apiUser = UnitOfWork.ApiUsers.Get().First(); return(Helper.Signature(apiUser.Secret, apiUser.AppId)); }
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); }
public UserRetModel(ApiUser userToShow) { this.NickName = userToShow.NickName; this.Email = userToShow.Email; this.FirstName = userToShow.FirstName; }
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); }
public object Put(QB_Expense_Update request) { ApiUser hdUser = request.ApiUser; Instance_Config instanceConfig = new Instance_Config(hdUser); CheckQBOnlineIntegration(instanceConfig); int travel_id = 0; if (request.travel_id.HasValue) { travel_id = request.travel_id.Value; } CheckExpenseAndUpdateQBAccount(hdUser, request.expense_id, request.qb_account_id, travel_id); string notes = ""; string note_internal = ""; int qb_employee_id = 0; int qb_vendor_id = 0; int markup = 0; DateTime date = DateTime.Now; bool overwrite_changes = false; if (request.overwrite_changes.HasValue) { overwrite_changes = request.overwrite_changes.Value; } if (request.notes != null) { notes = request.notes; } if (request.note_internal != null) { note_internal = request.note_internal; } if (request.qb_employee_id.HasValue) { qb_employee_id = request.qb_employee_id.Value; } if (request.qb_vendor_id.HasValue) { qb_vendor_id = request.qb_vendor_id.Value; } if (request.date.HasValue) { date = request.date.Value; } if (request.markup.HasValue) { markup = request.markup.Value; } bool qb_is_employee = request.qb_is_employee ?? false; bool is_billable = request.is_billable ?? true; try { string result = QBExpenses.CreateExpense(hdUser, instanceConfig, qb_employee_id, request.qb_customer_id, request.qb_service_id, request.qb_account_id, qb_is_employee, request.amount, notes, note_internal, date, is_billable, markup, request.expense_id, request.key, request.qb_sync_token, overwrite_changes, qb_vendor_id, travel_id); if (result == "ok") { return(new HttpResult("", HttpStatusCode.OK)); } else { throw new HttpError(Utils.ClearString(result)); } } catch (Exception ex) { throw new HttpError(Utils.ClearString(ex.Message)); } }
public ApiUser UpdateUser(ApiUser user) { return _client.UpdateUser(user); }
public object Put(QB_Time_Update request) { ApiUser hdUser = request.ApiUser; Instance_Config instanceConfig = new Instance_Config(hdUser); CheckQBOnlineIntegration(instanceConfig); bool isProjectLog = false; bool overwrite_changes = false; string notes = ""; int qb_employee_id = 0; int qb_vendor_id = 0; DateTime date = DateTime.Now; if (request.is_project_log.HasValue) { isProjectLog = request.is_project_log.Value; } if (request.qb_employee_id.HasValue) { qb_employee_id = request.qb_employee_id.Value; } if (request.qb_vendor_id.HasValue) { qb_vendor_id = request.qb_vendor_id.Value; } if (request.overwrite_changes.HasValue) { overwrite_changes = request.overwrite_changes.Value; } if (request.notes != null) { notes = request.notes; } if (request.date.HasValue) { date = request.date.Value; } decimal time_offset = hdUser.TimeZoneOffset; if (request.time_offset.HasValue) { time_offset = request.time_offset.Value; } bool is_billable = request.is_billable ?? true; bool is_rate_fixed = request.is_rate_fixed ?? false; try { string result = QBTimeActivities.CreateTimeActivity(hdUser, instanceConfig, qb_employee_id, request.qb_customer_id, request.qb_service_id, request.hours, request.hourly_rate, notes, date, request.time_id, isProjectLog, is_billable, request.start_time, request.stop_time, time_offset, request.key, request.qb_sync_token, overwrite_changes, qb_vendor_id, is_rate_fixed); if (result == "ok") { return(new HttpResult("", HttpStatusCode.OK)); } else { throw new HttpError(Utils.ClearString(result)); } } catch (Exception ex) { throw new HttpError(Utils.ClearString(ex.Message)); } }
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); }
public static void UpdateData(ApiUser User, int userID, int fbStaffID, int accountID, int fbClientId, int projectID, int fbProjectID, int taskTypeID, int fbTaskTypeID, string category_id, int fb_category_id) { FreshBooks.UpdateData(User.OrganizationId, User.DepartmentId, userID, fbStaffID, accountID, fbClientId, projectID, fbProjectID, taskTypeID, fbTaskTypeID, category_id, fb_category_id); }
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; }
public async Task <bool> ValidateUser(LoginUserDTO userDTO) { _user = await _useManager.FindByNameAsync(userDTO.Email); return(_user != null && await _useManager.CheckPasswordAsync(_user, userDTO.Password)); }
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); }
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; }