public async Task <bool> UploadPhoto(string filePath, string uploadedFileType) { var companySettings = _appDbContext.CompanySettings.FirstOrDefault(); if (companySettings == null) { companySettings = new CompanySettings(); } if (uploadedFileType == Constants.UploadProfileImage) { companySettings.CompanyLogo = filePath; } else if (uploadedFileType == Constants.UploadHeaderLogoImage) { companySettings.HeaderLogo = filePath; } else { companySettings.LoginBackgroundImagePath = filePath; } if (companySettings != null) { _appDbContext.Update(companySettings); } else { _appDbContext.CompanySettings.Add(companySettings); } return(await _appDbContext.SaveChangesAsync() > 0); }
/// <summary> /// Initializes a new instance of the Vendor class. /// </summary> /// <param name="id">_________</param> /// <param name="userId">__________</param> /// <param name="assignedUserId">__________</param> /// <param name="companyId">________</param> /// <param name="clientId">________</param> /// <param name="name">________</param> /// <param name="website">________</param> /// <param name="privateNotes">________</param> /// <param name="industryId">________</param> /// <param name="sizeId">________</param> /// <param name="address1">________</param> /// <param name="address2">________</param> /// <param name="city">________</param> /// <param name="state">________</param> /// <param name="postalCode">________</param> /// <param name="workPhone">The client phone number</param> /// <param name="countryId">________</param> /// <param name="currencyId">________</param> /// <param name="customValue1">________</param> /// <param name="customValue2">________</param> /// <param name="customValue3">________</param> /// <param name="customValue4">________</param> /// <param name="vatNumber">________</param> /// <param name="idNumber">________</param> /// <param name="isDeleted">________</param> /// <param name="lastLogin">Timestamp</param> /// <param name="createdAt">Timestamp</param> /// <param name="updatedAt">Timestamp</param> public Vendor(string id = default(string), string userId = default(string), string assignedUserId = default(string), string companyId = default(string), string clientId = default(string), IList <VendorContact> contacts = default(IList <VendorContact>), string name = default(string), string website = default(string), string privateNotes = default(string), string industryId = default(string), string sizeId = default(string), string address1 = default(string), string address2 = default(string), string city = default(string), string state = default(string), string postalCode = default(string), string workPhone = default(string), string countryId = default(string), string currencyId = default(string), string customValue1 = default(string), string customValue2 = default(string), string customValue3 = default(string), string customValue4 = default(string), string vatNumber = default(string), string idNumber = default(string), bool?isDeleted = default(bool?), double?lastLogin = default(double?), double?createdAt = default(double?), double?updatedAt = default(double?), CompanySettings settings = default(CompanySettings)) { Id = id; UserId = userId; AssignedUserId = assignedUserId; CompanyId = companyId; ClientId = clientId; Contacts = contacts; Name = name; Website = website; PrivateNotes = privateNotes; IndustryId = industryId; SizeId = sizeId; Address1 = address1; Address2 = address2; City = city; State = state; PostalCode = postalCode; WorkPhone = workPhone; CountryId = countryId; CurrencyId = currencyId; CustomValue1 = customValue1; CustomValue2 = customValue2; CustomValue3 = customValue3; CustomValue4 = customValue4; VatNumber = vatNumber; IdNumber = idNumber; IsDeleted = isDeleted; LastLogin = lastLogin; CreatedAt = createdAt; UpdatedAt = updatedAt; Settings = settings; CustomInit(); }
/// <summary> /// /// </summary> /// <param name="appContract"></param> private void ProcessQueue(ApplicationContract appContract) { if (appContract != null) { // Retrieve the connection string for this Application Contract. var connString = appContract.GenerateConnectionStr(); // Retrieve the company data for the specified ID. CompanySettingsForId = new CompanySettings(connString, Config.CompanyId); // Create a new SQL Cache. MakoCache = new SqlCacheRepo(appContract.GenerateConnectionStr(), MakoLogger); // Create a new Queue management object. var queueManager = new QueueManagement(Config.CompanyId, appContract.GenerateConnectionStr()); // Clear the queue for this Company ID. queueManager.ClearQueue(); // IsRunning = true; // while (IsRunning) { // ProcessQueueItem(appContract, MakoLogger, MakoCache, queueManager); } } }
public CompanySettingsWebServicesView(ConfigurationWrapper config) { _companySettings = config.CompanySettings; InitializeComponent(); BindingContext = _companySettings.WebServices; }
public void ExecuteTestToEditCompanySettings() { ExecuteTestToAccountNameCompanySettings(); System.Threading.Thread.Sleep(2000); CompanySettings CompanySettingsEdit = new CompanySettings(); CompanySettingsEdit.CompanyNameForm("Joni Company"); CompanySettingsEdit.CompanyWebsiteForm("www.google.com"); CompanySettingsEdit.CompanyDescriptionForm("kompani kot"); CompanySettingsEdit.PrimaryInvestorCompanyForm(); CompanySettingsEdit.SecondaryInvestorCompanyForm(); CompanySettingsEdit.PortofolioSizeForm("50000"); CompanySettingsEdit.FundDomicileInterestForm(); CompanySettingsEdit.InvestmentVehicleInterestForm(); //CompanySettingsEdit.FirstLossCapitalYesForm(); // CompanySettingsEdit.EditPreferencesForm(); CompanySettingsEdit.CompanyContinentForm(); CompanySettingsEdit.CompanyCountryForm(); CompanySettingsEdit.CompanyZipCodeForm("00001"); CompanySettingsEdit.CompanyStateForm("Sidney"); CompanySettingsEdit.CompanyCityForm("P Sherman 42"); CompanySettingsEdit.CompanyAddress1Form("Komuna e sidnew"); CompanySettingsEdit.CompanyAddress2Form("Lulishtja"); CompanySettingsEdit.CompanyAddress3Form(""); //CompanySettingsEdit.UploadCompanyPhoto(); //CompanySettingsEdit.CancelSaveCompanySettings(); //CompanySettingsEdit.SaveCompanySettings(); }
/// <summary> /// Initializes a new instance of the Company class. /// </summary> /// <param name="id">The company hash id</param> /// <param name="sizeId">The company size ID</param> /// <param name="industryId">The company industry ID</param> /// <param name="slackWebhookUrl">The slack webhook notification /// URL</param> /// <param name="googleAnalyticsKey">The google analytics key</param> /// <param name="portalMode">Determines the client facing urls ie: /// subdomain,domain,iframe</param> /// <param name="subdomain">Specifies the first part of the company /// domain ie acme in acme.domain.com</param> /// <param name="portalDomain">The fully qualified domain for client /// facing URLS</param> /// <param name="enabledTaxRates">Number of taxes rates used per /// entity</param> /// <param name="fillProducts">Toggles filling a product description /// based on product key</param> /// <param name="convertProducts">___________</param> /// <param name="updateProducts">Toggles updating a product description /// which description changes</param> /// <param name="showProductDetails">Toggles showing a product /// description which description changes</param> /// <param name="customFields">Custom fields map</param> /// <param name="enableProductCost">______________</param> /// <param name="enableProductQuantity">______________</param> /// <param name="defaultQuantity">______________</param> /// <param name="customSurchargeTaxes1">Toggles charging taxes on /// custom surcharge amounts</param> /// <param name="customSurchargeTaxes2">Toggles charging taxes on /// custom surcharge amounts</param> /// <param name="customSurchargeTaxes3">Toggles charging taxes on /// custom surcharge amounts</param> /// <param name="customSurchargeTaxes4">Toggles charging taxes on /// custom surcharge amounts</param> /// <param name="logo">The company logo - binary</param> public Company(string id = default(string), string sizeId = default(string), string industryId = default(string), string slackWebhookUrl = default(string), string googleAnalyticsKey = default(string), string portalMode = default(string), string subdomain = default(string), string portalDomain = default(string), int?enabledTaxRates = default(int?), bool?fillProducts = default(bool?), bool?convertProducts = default(bool?), bool?updateProducts = default(bool?), bool?showProductDetails = default(bool?), object customFields = default(object), bool?enableProductCost = default(bool?), bool?enableProductQuantity = default(bool?), bool?defaultQuantity = default(bool?), bool?customSurchargeTaxes1 = default(bool?), bool?customSurchargeTaxes2 = default(bool?), bool?customSurchargeTaxes3 = default(bool?), bool?customSurchargeTaxes4 = default(bool?), object logo = default(object), CompanySettings settings = default(CompanySettings)) { Id = id; SizeId = sizeId; IndustryId = industryId; SlackWebhookUrl = slackWebhookUrl; GoogleAnalyticsKey = googleAnalyticsKey; PortalMode = portalMode; Subdomain = subdomain; PortalDomain = portalDomain; EnabledTaxRates = enabledTaxRates; FillProducts = fillProducts; ConvertProducts = convertProducts; UpdateProducts = updateProducts; ShowProductDetails = showProductDetails; CustomFields = customFields; EnableProductCost = enableProductCost; EnableProductQuantity = enableProductQuantity; DefaultQuantity = defaultQuantity; CustomSurchargeTaxes1 = customSurchargeTaxes1; CustomSurchargeTaxes2 = customSurchargeTaxes2; CustomSurchargeTaxes3 = customSurchargeTaxes3; CustomSurchargeTaxes4 = customSurchargeTaxes4; Logo = logo; Settings = settings; CustomInit(); }
public CompanyController(ISettingsProvider settingsProvider) { if (settingsProvider == null) { throw new ArgumentNullException(nameof(settingsProvider)); } _settings = settingsProvider.GetSettings <CompanySettings>(nameof(CompanySettings)); }
public ActionResult Index() { ListHelper.InitializeReportTypeList(); // Get the company from the id. var company = _companyManager.Get(CompanyId); var companySettings = new CompanySettings { Company = company, SlackWebhooks = _slackManager.GetWebhooks(CompanyId), ListHelper = ListHelper }; return(View(companySettings)); }
public CompanyController(ApplicationDbContext db, IOptions <CompanySettings> companySettings, IOptions <GeneralSettings> generalSettings, UserManager <ApplicationUser> userManager, IWebHostEnvironment webHostEnvironment, IMapper mapper) { _db = db; _generalSettings = generalSettings.Value; _companySettings = companySettings.Value; _userManager = userManager; _webHostEnvironment = webHostEnvironment; _mapper = mapper; }
public async Task CreateCompanyDatabase() { var builder = new CompanySettingsBuilder(); CompanySettings config = builder.GetSettings(); var options = new DbContextOptionsBuilder <CompanyContext>() .UseSqlServer(config.ConnectionString) .Options; using (var context = new CompanyContext(options)) { // await context.Database.EnsureDeletedAsync(); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { var selectedSMTP = leApproverSetup.SelectedItem as CompanySMTPClient; var number = selectedSMTP?.Number; if (cSetting.ApproveSMTP != number) { var modified = new CompanySettings(); StreamingManager.Copy(cSetting, modified); modified._ApproveSMTP = number; api.UpdateNoResponse(cSetting, modified); } this.DialogResult = true; }
private void SetField(string propertyName, object oldValue, object newValue, CompanySettings settings) { if ((oldValue != null || newValue != null) && ((oldValue != null && newValue == null) || (newValue != null && oldValue == null) || oldValue.ToString() != newValue.ToString())) { settings.SetMemberValue(propertyName, newValue); Change change = new Change() { PropertyName = propertyName, PrevValue = ((oldValue == null) ? "<NULL>" : oldValue.ToString()), NewValue = ((newValue == null) ? "<NULL>" : newValue.ToString()) }; changes.Add(change); } }
/// <summary> /// Initializes a new instance of the Credit class. /// </summary> /// <param name="id">_________</param> /// <param name="userId">__________</param> /// <param name="assignedUserId">__________</param> /// <param name="companyId">________</param> /// <param name="clientId">________</param> /// <param name="statusId">________</param> /// <param name="invoiceId">The linked invoice this credit is applied /// to</param> /// <param name="number">The credit number - is a unique alpha numeric /// number per credit per company</param> /// <param name="poNumber">________</param> /// <param name="terms">________</param> /// <param name="publicNotes">________</param> /// <param name="privateNotes">________</param> /// <param name="footer">________</param> /// <param name="customValue1">________</param> /// <param name="customValue2">________</param> /// <param name="customValue3">________</param> /// <param name="customValue4">________</param> /// <param name="taxName1">________</param> /// <param name="taxName2">________</param> /// <param name="taxRate1">_________</param> /// <param name="taxRate2">_________</param> /// <param name="taxName3">________</param> /// <param name="taxRate3">_________</param> /// <param name="totalTaxes">The total taxes for the credit</param> /// <param name="lineItems">_________</param> /// <param name="amount">_________</param> /// <param name="balance">_________</param> /// <param name="discount">_________</param> /// <param name="partial">_________</param> /// <param name="isAmountDiscount">_________</param> /// <param name="isDeleted">_________</param> /// <param name="usesInclusiveTaxes">Defines the type of taxes used as /// either inclusive or exclusive</param> /// <param name="date">The Credit Date</param> /// <param name="lastSentDate">The last date the credit was sent /// out</param> /// <param name="nextSendDate">The Next date for a reminder to be /// sent</param> /// <param name="partialDueDate">_________</param> /// <param name="dueDate">_________</param> /// <param name="lastViewed">Timestamp</param> /// <param name="updatedAt">Timestamp</param> /// <param name="archivedAt">Timestamp</param> /// <param name="customSurcharge1">First Custom Surcharge</param> /// <param name="customSurcharge2">Second Custom Surcharge</param> /// <param name="customSurcharge3">Third Custom Surcharge</param> /// <param name="customSurcharge4">Fourth Custom Surcharge</param> /// <param name="customSurchargeTaxes">Toggles charging taxes on custom /// surcharge amounts</param> public Credit(string id = default(string), string userId = default(string), string assignedUserId = default(string), string companyId = default(string), string clientId = default(string), string statusId = default(string), string invoiceId = default(string), string number = default(string), string poNumber = default(string), string terms = default(string), string publicNotes = default(string), string privateNotes = default(string), string footer = default(string), string customValue1 = default(string), string customValue2 = default(string), string customValue3 = default(string), string customValue4 = default(string), string taxName1 = default(string), string taxName2 = default(string), double?taxRate1 = default(double?), double?taxRate2 = default(double?), string taxName3 = default(string), double?taxRate3 = default(double?), double?totalTaxes = default(double?), object lineItems = default(object), double?amount = default(double?), double?balance = default(double?), double?discount = default(double?), double?partial = default(double?), bool?isAmountDiscount = default(bool?), bool?isDeleted = default(bool?), bool?usesInclusiveTaxes = default(bool?), System.DateTime?date = default(System.DateTime?), System.DateTime?lastSentDate = default(System.DateTime?), System.DateTime?nextSendDate = default(System.DateTime?), System.DateTime?partialDueDate = default(System.DateTime?), System.DateTime?dueDate = default(System.DateTime?), CompanySettings settings = default(CompanySettings), double?lastViewed = default(double?), double?updatedAt = default(double?), double?archivedAt = default(double?), double?customSurcharge1 = default(double?), double?customSurcharge2 = default(double?), double?customSurcharge3 = default(double?), double?customSurcharge4 = default(double?), bool?customSurchargeTaxes = default(bool?)) { Id = id; UserId = userId; AssignedUserId = assignedUserId; CompanyId = companyId; ClientId = clientId; StatusId = statusId; InvoiceId = invoiceId; Number = number; PoNumber = poNumber; Terms = terms; PublicNotes = publicNotes; PrivateNotes = privateNotes; Footer = footer; CustomValue1 = customValue1; CustomValue2 = customValue2; CustomValue3 = customValue3; CustomValue4 = customValue4; TaxName1 = taxName1; TaxName2 = taxName2; TaxRate1 = taxRate1; TaxRate2 = taxRate2; TaxName3 = taxName3; TaxRate3 = taxRate3; TotalTaxes = totalTaxes; LineItems = lineItems; Amount = amount; Balance = balance; Discount = discount; Partial = partial; IsAmountDiscount = isAmountDiscount; IsDeleted = isDeleted; UsesInclusiveTaxes = usesInclusiveTaxes; Date = date; LastSentDate = lastSentDate; NextSendDate = nextSendDate; PartialDueDate = partialDueDate; DueDate = dueDate; Settings = settings; LastViewed = lastViewed; UpdatedAt = updatedAt; ArchivedAt = archivedAt; CustomSurcharge1 = customSurcharge1; CustomSurcharge2 = customSurcharge2; CustomSurcharge3 = customSurcharge3; CustomSurcharge4 = customSurcharge4; CustomSurchargeTaxes = customSurchargeTaxes; CustomInit(); }
public static string CreateLPNLabel(Session session, Inventory inventoryRecord, bool shortLPN) { bool addMForMultiple = false; if (VerifyLPNSettings(inventoryRecord.InventoryItemID.ItemCustomerID)) { int LPNBaseNumber = 0; CompanySettings LPNSettings = CompanySettingsBLL.GetSettings(); if (inventoryRecord.LPNNumber.HasValue && inventoryRecord.LPNNumber.Value > 0) { LPNBaseNumber = inventoryRecord.LPNNumber.Value; } else { LPNBaseNumber = GetNextLPNNumber(inventoryRecord.InventoryItemID.ItemCustomerID); inventoryRecord.LPNNumber = LPNBaseNumber; inventoryRecord.FullLPNNumber = inventoryRecord.InventoryItemID.ItemCustomerID.LPNPrefix + ("0000000000" + LPNBaseNumber.ToString()).Substring(("0000000000" + LPNBaseNumber.ToString()).Length - inventoryRecord.InventoryItemID.ItemCustomerID.LastLPNNumber.ToString().Length); inventoryRecord.Save(); } if (shortLPN == false && InventoryBLL.IsMultiLPN(session, LPNBaseNumber, inventoryRecord.InventoryItemID.ItemCustomerID.CustomerID, inventoryRecord.InventoryDate)) { addMForMultiple = true; } string largeCode = GetLPNLargeCode(session, inventoryRecord, addMForMultiple); string LPNSuffix = ("0000000000" + LPNBaseNumber.ToString()).Substring(("0000000000" + LPNBaseNumber.ToString()).Length - inventoryRecord.InventoryItemID.ItemCustomerID.LastLPNNumber.ToString().Length); string LPNNumber = inventoryRecord.InventoryItemID.ItemCustomerID.LPNPrefix + LPNSuffix; if (LPNBaseNumber == 0) { return(string.Empty); } if (shortLPN) { CreateShortLPNLabel(session, LPNSettings.LPNHorizontalAdjustment, LPNSettings.LPNVerticalAdjustment, inventoryRecord, LPNBaseNumber, LPNSettings.LPNPrintCopies, largeCode, LPNNumber); } else { CreateLargeLPNLabel(session, LPNSettings.LPNHorizontalAdjustment, LPNSettings.LPNVerticalAdjustment, inventoryRecord, LPNBaseNumber, LPNSettings.LPNPrintCopies, largeCode, LPNNumber); } return(lpnTextLabel); } return(string.Empty); }
public static int GetEmployeePrepaidExpense(Employee Employee, DateTime DateOfAccrual) { CompanySettings companySettings = GetCompanySettings(DateTime.Now) as CompanySettings; if (companySettings == null) { return(0); } if (companySettings.AdvancePercentage == 0) { return(0); } DateTime firstDayCurrentMonth = new DateTime(DateOfAccrual.Year, DateOfAccrual.Month, 1); DateTime lastDayCurrentMonth = new DateTime(DateOfAccrual.Year, DateOfAccrual.Month, DateTime.DaysInMonth(DateOfAccrual.Year, DateOfAccrual.Month)); if (companySettings.UseAdvanceDay) { lastDayCurrentMonth = new DateTime(DateOfAccrual.Year, DateOfAccrual.Month, companySettings.DayOfAdvancePayment); } var employeeWorkPeriod = GetEmployeeWorkPeriod(Employee); if (employeeWorkPeriod.DismissalDate <= lastDayCurrentMonth) { return(0); } int daysWorkedEmployeeForPeriod = GetDaysWorkedEmployeeForPeriod(Employee, firstDayCurrentMonth, lastDayCurrentMonth); if (daysWorkedEmployeeForPeriod < companySettings.MinimumNumberOfDaysWorked) { return(0); } int plannedWorkingDaysForPeriod = GetPlannedWorkingDaysForPeriod(firstDayCurrentMonth, lastDayCurrentMonth); return(Employee.Salary / plannedWorkingDaysForPeriod * daysWorkedEmployeeForPeriod * companySettings.AdvancePercentage / 100); }
public bool UpdateCompanySettings(float?packers, float?operators, float?supers, short?minPerHour, int?universalCustomer, string lpnPrinter, byte LPNMoveRight, byte LPNMoveDown, byte LPNCopies, int?Location) { CompanySettings settings = GetSettings(); if (settings == null) { //It is a new Product return(false); } Change change = new Change() { PropertyName = CompanySettings.Fields.PK_ID.PropertyName, PrevValue = settings.PK_ID.ToString(), NewValue = settings.PK_ID.ToString() }; changes.Add(change); SetField(CompanySettings.Fields.dblPackersPay.PropertyName, settings.dblPackersPay, (packers ?? 0), settings); SetField(CompanySettings.Fields.dblOperatorsPay.PropertyName, settings.dblOperatorsPay, (operators ?? 0), settings); SetField(CompanySettings.Fields.dblSupersPay.PropertyName, settings.dblSupersPay, (supers ?? 0), settings); SetField(CompanySettings.Fields.intMinPerHour.PropertyName, settings.intMinPerHour, (minPerHour ?? 45), settings); SetField(CompanySettings.Fields.UniversalCustomer.PropertyName, settings.UniversalCustomer, (universalCustomer ?? 0), settings); SetField(CompanySettings.Fields.LPNPrinterName.PropertyName, settings.LPNPrinterName, (string.IsNullOrEmpty(lpnPrinter) ? null : lpnPrinter), settings); SetField(CompanySettings.Fields.LPNHorizontalAdjustment.PropertyName, settings.LPNHorizontalAdjustment, LPNMoveRight, settings); SetField(CompanySettings.Fields.LPNVerticalAdjustment.PropertyName, settings.LPNVerticalAdjustment, LPNMoveDown, settings); SetField(CompanySettings.Fields.LPNPrintCopies.PropertyName, settings.LPNPrintCopies, LPNCopies, settings); SetField(CompanySettings.Fields.DefaultLocation.PropertyName, settings.DefaultLocation, Session.DefaultSession.GetObjectByKey <Locations>(Location), settings); try { settings.Save(); } catch (Exception ex) { return(false); } UpdateAuditTrail(); return(true); }
/// <summary> /// Initializes a new instance of the Client class. /// </summary> /// <param name="id">_________</param> /// <param name="userId">__________</param> /// <param name="companyId">________</param> /// <param name="name">________</param> /// <param name="website">________</param> /// <param name="privateNotes">________</param> /// <param name="clientHash">________</param> /// <param name="industryId">________</param> /// <param name="sizeId">________</param> /// <param name="address1">________</param> /// <param name="address2">________</param> /// <param name="city">________</param> /// <param name="state">________</param> /// <param name="postalCode">________</param> /// <param name="phone">The client phone number</param> /// <param name="countryId">________</param> /// <param name="customValue1">________</param> /// <param name="customValue2">________</param> /// <param name="customValue3">________</param> /// <param name="customValue4">________</param> /// <param name="vatNumber">________</param> /// <param name="idNumber">________</param> /// <param name="shippingAddress1">________</param> /// <param name="shippingAddress2">________</param> /// <param name="shippingCity">________</param> /// <param name="shippingState">________</param> /// <param name="shippingPostalCode">________</param> /// <param name="shippingCountryId">________</param> /// <param name="isDeleted">________</param> /// <param name="balance">________</param> /// <param name="paidToDate">________</param> /// <param name="creditBalance">An amount which is available to the /// client for future use.</param> /// <param name="lastLogin">Timestamp</param> /// <param name="createdAt">Timestamp</param> /// <param name="updatedAt">Timestamp</param> public Client(string id = default(string), string userId = default(string), string companyId = default(string), IList <ClientContact> contacts = default(IList <ClientContact>), string name = default(string), string website = default(string), string privateNotes = default(string), string clientHash = default(string), string industryId = default(string), string sizeId = default(string), string address1 = default(string), string address2 = default(string), string city = default(string), string state = default(string), string postalCode = default(string), string phone = default(string), string countryId = default(string), string customValue1 = default(string), string customValue2 = default(string), string customValue3 = default(string), string customValue4 = default(string), string vatNumber = default(string), string idNumber = default(string), string shippingAddress1 = default(string), string shippingAddress2 = default(string), string shippingCity = default(string), string shippingState = default(string), string shippingPostalCode = default(string), string shippingCountryId = default(string), bool?isDeleted = default(bool?), double?balance = default(double?), double?paidToDate = default(double?), double?creditBalance = default(double?), double?lastLogin = default(double?), double?createdAt = default(double?), double?updatedAt = default(double?), CompanySettings settings = default(CompanySettings)) { Id = id; UserId = userId; CompanyId = companyId; Contacts = contacts; Name = name; Website = website; PrivateNotes = privateNotes; ClientHash = clientHash; IndustryId = industryId; SizeId = sizeId; Address1 = address1; Address2 = address2; City = city; State = state; PostalCode = postalCode; Phone = phone; CountryId = countryId; CustomValue1 = customValue1; CustomValue2 = customValue2; CustomValue3 = customValue3; CustomValue4 = customValue4; VatNumber = vatNumber; IdNumber = idNumber; ShippingAddress1 = shippingAddress1; ShippingAddress2 = shippingAddress2; ShippingCity = shippingCity; ShippingState = shippingState; ShippingPostalCode = shippingPostalCode; ShippingCountryId = shippingCountryId; IsDeleted = isDeleted; Balance = balance; PaidToDate = paidToDate; CreditBalance = creditBalance; LastLogin = lastLogin; CreatedAt = createdAt; UpdatedAt = updatedAt; Settings = settings; CustomInit(); }
public ActionResult Index(CompanySettings companySettings, HttpPostedFileBase logoFile) { if (ModelState.IsValid) { if (logoFile != null && logoFile.ContentLength > 0) { var path = SaveFile(logoFile); companySettings.Company.LogoPath = path; } _companyManager.Update(companySettings.Company); this.SetNotificationMessage(NotificationType.Success, "Settings saved successfully."); if (companySettings.Company.EnableCommenting && (CurrentUser.DisplayName == CurrentUser.Email)) { return(Redirect(string.Format("{0}?comments-enabled=1", Url.Action("EditProfile", "Manage")))); } return(RedirectToAction("Index")); } return(View(companySettings)); }
private void CreateNewCompany() { //if (CompanyName.Text == "" || InvoiceNumber.Text == "") //{ // return; //} /* Create new company and app settings file */ if (CompanySettings.Name == null) { //TODO: send message return; } _config.AppSettings.CurrentCompany.Name = CompanySettings.Name; var company = _config.AppSettings.Companies.Find(x => x.Name.Equals(_config.AppSettings.CurrentCompany.Name)); if (company == null) { _config.AppSettings.Companies.Add(_config.AppSettings.CurrentCompany); } _config.AppSettings.CurrentCompany.Data.Database = _databaseService; _databaseService.Server = DatabaseService.DefaultSqlite; _databaseService.Database = _config.AppSettings.CurrentCompany.Name; _config.AppSettings.Save(); CompanySettings.Name = _config.AppSettings.CurrentCompany.Name; CompanySettings.InvoiceNumber = CompanySettings.InvoiceNumber; CompanySettings.Filename = _config.AppSettings.CurrentCompany.Name + ".json"; CompanySettings.Save(); _navigationService.PopModalAsync(true); }
public void SaveUpdateSettings(SqlConnection con, SqlTransaction trans, CompanySettings s) { try { string qstr; if (s.SlNo == 0) { qstr = "INSERT INTO T_RefNoSettings (SettingCode,SettingTitle,SettingValue,CompanyID) VALUES ('" + s.SettingCode + "','" + s.SettingTitle + "','" + s.SettingValue + "'," + LogInInfo.CompanyID.ToString() + ")"; } else { qstr = "UPDATE T_RefNoSettings SET SettingCode='" + s.SettingCode + "',SettingTitle='" + s.SettingTitle + "',SettingValue='" + s.SettingValue + "' WHERE SLNO=" + s.SlNo.ToString(); } SqlCommand cmd = new SqlCommand(qstr, con, trans); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } }
protected void btn_Save_Click(object sender, EventArgs e) { settings.Name = tbx_name.Text; settings.Street = tbx_street.Text; settings.PostalCode = tbx_postalcode.Text; settings.City = tbx_city.Text; settings.State = tbx_state.Text; settings.Country = tbx_country.Text; settings.Phone = tbx_phone.Text; settings.Email = tbx_email.Text; settings.LinkedIn = tbx_linkedin.Text; settings.FaceBook = tbx_facebook.Text; settings.Twitter = tbx_twitter.Text; settings.Stock = tbx_stock.Text; settings = settings.Save(); var eventArgsJavaScript = String.Format("{{Message:'{0}',controlIDs:window.frameElement.dialogArgs}}", "The Properties have been updated."); ((EnhancedLayoutsPage)Page).EndOperation(ModalDialogResult.OK, eventArgsJavaScript); Context.Response.Flush(); Context.Response.End(); }
public CompanyController(ISettingsProvider settingsProvider) { _settings = settingsProvider.GetSettings <CompanySettings>(nameof(CompanySettings)); }
protected override void OnInit(EventArgs e) { base.OnInit(e); settings = new CompanySettings(); settings = settings.Load(); }
public void Update(CompanySettings pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <CompanySettings>().Update(pt); }
public void Delete(CompanySettings pt) { _unitOfWork.Repository <CompanySettings>().Delete(pt); }
public CompanySettings Create(CompanySettings pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <CompanySettings>().Insert(pt); return(pt); }
public async Task <IActionResult> Update([FromBody] CompanySettings companySettings) { return(Ok(await _companySettingsService.Edit(companySettings))); }
/// <summary> /// The get company settings. /// </summary> /// <param name="company"> /// The company. /// </param> /// <param name="database"> /// The database. /// </param> /// <returns> /// The StruSoft.Impact.V120.ProjectManager.Core.ProjectBrowser.CompanySettings. /// </returns> private static CompanySettings GetCompanySettings( string company, ImpactDatabase database ) { string companySettingsQuery = GetCompanySettingsQuery( company ).ToString(); string settingValue = database.GetFirst( companySettingsQuery, column => column[0].Cast<string>() ); UnitSystemType unitSystem; CompanySettings companySettings = new CompanySettings(); if( !Enum.TryParse( settingValue, true, out unitSystem ) ) { // Default to metric if we failed conversion. unitSystem = UnitSystemType.Metric; // Since we could not find a unit system in the database for the specified company, // we must assume there are no company units either. So we create default company settings. companySettings.UnitSystem = unitSystem; foreach( var item in CreateDefaultUnitData( unitSystem ) ) { companySettings[item.Parameter] = item; } } else { companySettings.UnitSystem = unitSystem; // Get the company units from the database. string companyUnitsQuery = GetCompanyUnitsQuery( company ).ToString(); var companyUnitList = database.GetAll( companyUnitsQuery, column => { UnitParameter parameter; if( !Enum.TryParse( column[0].Cast<string>(), true, out parameter ) ) { return null; } UnitType unitType = column[1].Cast<UnitType>(); return new CompanyUnit( parameter, unitType, column[2].Cast<int>(), column[3].Cast<int>() ); }); // Join the default unit data with the unit data from the database. If any unit is // missing from the database, then we'll use the default unit instead. var leftJoin = ( from defaultUnit in CreateDefaultUnitData( unitSystem ) join databaseUnit in companyUnitList on defaultUnit.Parameter equals databaseUnit.Parameter into joinedList from companyUnit in joinedList.DefaultIfEmpty( defaultUnit ) select companyUnit ).ToList(); foreach( var item in leftJoin ) { companySettings[item.Parameter] = item; } } ImpactQuery dateFormatQuery = new ImpactQuery( true ) { From = { ImpCompany.As( "T1" ) }, Select = { ImpCompany.DateFormat }, Where = { ImpCompany.Company.Equal( company ), } }; var dateFormatList = database.GetAll( dateFormatQuery.ToString(), column => column[0].Cast<CompanyDateFormat>() ); if( dateFormatList.Count > 0 ) { companySettings.DateFormat = dateFormatList[0]; } else { companySettings.DateFormat = CompanyDateFormat.Sweden; } return companySettings; }
/// <summary> /// Create a new post /// </summary> public CompanySettingsRoot() { this.CompanySettings = null; } // End of the constructor
/// <summary> /// /// </summary> /// <param name="logRunType"></param> /// <param name="companySettingsForId"></param> /// <param name="connStr"></param> /// <param name="companyId"></param> /// <param name="queueId"></param> /// <param name="detail"></param> public static void InsertIntoLog(int logRunType, CompanySettings companySettingsForId, string connStr, int companyId, int queueId, string detail) { try { if (logRunType == 4) { companySettingsForId.Settings.TryGetValue(10, out var rtLogSetting); if (rtLogSetting == null) { return; } if (!bool.TryParse(rtLogSetting.Value, out bool b)) { b = false; // default to false } if (!b) { return; } } else { companySettingsForId.Settings.TryGetValue(11, out var rLogSetting); if (rLogSetting == null) { return; } if (!bool.TryParse(rLogSetting.Value, out bool b)) { b = false; // default to false } if (!b) { return; } } using (var conn = new SqlConnection(connStr)) using (var cmd = conn.CreateCommand()) { conn.Open(); cmd.CommandText = $@" BEGIN TRANSACTION Declare @RecordNumber int; Select @RecordNumber = ISNULL(MAX([RecordNumber]),0)+1 FROM {(logRunType == 4 ? "[dbo].[LogRealTime]" : "[dbo].[LogRun]")} Where CompanyId = @CompanyId and QueueId = @QueueId INSERT INTO {(logRunType == 4 ? "[dbo].[LogRealTime]" : "[dbo].[LogRun]")} ([CompanyId], [QueueId], [RecordNumber], [Detail]) VALUES (@CompanyId, @QueueId, @RecordNumber, @Detail) COMMIT TRANSACTION "; cmd.Parameters.Add("@CompanyId", SqlDbType.Int).Value = companyId; cmd.Parameters.Add("@QueueId", SqlDbType.Int).Value = queueId; cmd.Parameters.Add("@Detail", SqlDbType.NVarChar, 1024).Value = detail; cmd.ExecuteNonQuery(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public CompanySettings Add(CompanySettings pt) { _unitOfWork.Repository <CompanySettings>().Insert(pt); return(pt); }