/// <summary> /// Exports the report. /// </summary> /// <param name="exportType">Type of the export.</param> private void ExportReport(ReportTypes exportType) { int itemTypeId; int.TryParse(ddItemTypes.SelectedValue, out itemTypeId); string fileName = string.Empty; Data.Company company = GetBL <CompanyBL>().GetCompany(ViewingCompanyId); fileName = string.Format("{0}'s_Bookings", company.CompanyName); BookingDetailsReportParameters parameters = new BookingDetailsReportParameters { BookingId = this.BookingId, BookingName = GetBookingName(), CompanyId = ViewingCompanyId, ContactPerson = GetContactedPerson(), DisplayMode = DisplayMode.ToString(), ItemTypeId = itemTypeId, RelatedTable = this.RelatedTableName, SortExpression = gvBookingDetails.MasterTableView.SortExpressions.GetSortString(), UserId = this.UserID, ShowMyBookingsOnly = chkMyBookingsOnly.Checked }; string fileNameExtension; string encoding; string mimeType; byte[] reportBytes = UserWebReportHandler.GenerateBookingDetailsReport(parameters, exportType, out fileNameExtension, out encoding, out mimeType, true); Utils.ExportReport(reportBytes, mimeType, fileNameExtension, fileName); }
/// <summary> /// Loads the data. /// </summary> private void LoadData() { var itemDetails = GetBL <InventoryBL>().GetWatchListItems(CompanyId, UserID, FindFromDate, FindToDate, false, WatchListHeaderId, true); int maxContactBookingManagerId = itemDetails.Max(bd => bd.ContactBookingManagerId); int minContactBookingManagerId = itemDetails.Min(bd => bd.ContactBookingManagerId); this.ContactBookingManagerId = maxContactBookingManagerId == minContactBookingManagerId ? (int?)minContactBookingManagerId : null; Data.User contactBookingManager = ContactBookingManagerId.HasValue ? GetBL <PersonalBL>().GetUser(ContactBookingManagerId.Value) : GetBL <InventoryBL>().GetInventoryAdmin(CompanyId); gvItemDetails.DataSource = itemDetails; gvItemDetails.MasterTableView.SortExpressions.Clear(); foreach (GridSortExpression sortExpression in SortExpressions) { gvItemDetails.MasterTableView.SortExpressions.Add(sortExpression); } gvItemDetails.DataBind(); Data.Company company = GetBL <CompanyBL>().GetCompany(CompanyId); string inventoryAdminName = contactBookingManager.FirstName + " " + contactBookingManager.LastName; lblInventoryManager.Text = Support.TruncateString(inventoryAdminName, 50); lblInventoryManager.ToolTip = string.Empty; if (inventoryAdminName.Length > 50) { lblInventoryManager.ToolTip = inventoryAdminName; } lblCompany.Text = Support.TruncateString(company.CompanyName, 50); if (company.CompanyName.Length > 50) { lblCompany.ToolTip = company.CompanyName; } }
public ActionResult Index(String CompanyURL, AdminViewModel Model) { BaseViewModel PriorModel = new BaseViewModel(); PopulateModel(PriorModel); if (!ModelState.IsValid) { return(View(Model)); } Data.Company Company = Context.Companies.Where(c => c.TimeGoURL == PriorModel.CompanyURL).FirstOrDefault(); Company.CompanyName = Model.CompanyName; Company.ContactName = Model.ContactName; Company.PhoneNumber = Model.PhoneNumber; Company.EmailAddress = Model.Email; Company.TimeGoURL = Model.CompanyURL; Company.VacationApproverEmail = Model.VacationApproverEmail; Company.UpdatedById = Model.LoginId; Company.UpdatedOn = DateTime.UtcNow; Session["CompanyURL"] = Model.CompanyURL; Context.Entry(Company).State = System.Data.Entity.EntityState.Modified; Context.SaveChanges(); return(RedirectPermanent("/" + Company.TimeGoURL + "/admin")); }
public DiscountCodeUsage GetDiscountCodeUsage(bool isAdminApplied, int?companyId) { var discount = new DiscountCodeMock(DataContext).GetDiscountCode("DisCode50", 50.00M, 10, 10); Data.Company company = null; if (!companyId.HasValue) { company = new CompanyMock(DataContext).GetCompany(); } else { company = new CompanyMock(DataContext).GetCompany(companyId.Value); } DataContext.SaveChanges(); return(new DiscountCodeUsage { DiscountCode = discount, CompanyId = company.CompanyId, CreatedByUserId = 0, CreatedDate = Utils.Now, IsAdminApplied = isAdminApplied, EndDate = Utils.Today.AddDays(discount.Duration * 7), IsActive = true, StartDate = Utils.Today }); }
/// <summary> /// Gets the company address by company. /// </summary> /// <param name="company">The company.</param> /// <returns>The company address.</returns> public string GetCompanyAddress(Data.Company company) { StringBuilder address = new StringBuilder(); if (company.AddressLine1 != string.Empty) { address.Append(company.AddressLine1); address.Append(", "); } if (company.AddressLine2 != string.Empty) { address.Append(company.AddressLine2); address.Append(", "); } if (company.City != string.Empty) { address.Append(company.City); address.Append(", "); } if (company.Country.CountryName != string.Empty) { address.Append(company.Country.CountryName); address.Append("."); } return(address.ToString()); }
/// <summary> /// Adds the company. /// </summary> /// <param name="company">The company.</param> /// <param name="commit">if set to <c>true</c> [commit].</param> public void AddCompany(Data.Company company, bool commit) { DataContext.Companies.AddObject(company); if (commit) { base.SaveChanges(); } }
public FakeProductsRepo() { Data.Address address = new Data.Address() { Country = "Belgium", Id = 1, Number = 77, Street = "Ter Platen", Zipcode = "9000" }; Data.Company company = new Data.Company() { Address = address, Name = "My Company", Id = 1, PhoneNumber = 0483663598, VAT = "BE12345678", Website = "MyCompany.com" }; Data.Category category = new Data.Category() { Company = company, Id = 1, Name = "Drank" }; Data.SubCategory subCategory = new Data.SubCategory() { Category = category, Id = 1, Name = "Bier" }; _products = new List <Data.Product>(); _products.Add(new Data.Product() { SubCategory = subCategory, Id = 1, Name = "Westmalle", Price = 4.5 }); _products.Add(new Data.Product() { SubCategory = subCategory, Id = 2, Name = "Westvleteren", Price = 10 }); _products.Add(new Data.Product() { SubCategory = subCategory, Id = 3, Name = "Jupiler", Price = 2 }); }
/// <summary> /// Creates the payment summaries. /// This will create payment summaries/Invoice Requests for the repeat payments to be charged at the end of the cycle /// </summary> /// <param name="dateToConsider">The date to consider.</param> public static void CreatePaymentSummaries(DateTime dateToConsider) { using (StageBitzDB dataContext = new StageBitzDB()) { FinanceBL financeBL = new FinanceBL(dataContext); CompanyBL companyBL = new CompanyBL(dataContext); //This will get all the CompanyPaymentPackages that needs to be Charged for considering cycle List <CompanyPaymentPackage> companyPaymentPackages = (from cpp in dataContext.CompanyPaymentPackages join cps in dataContext.CompanyPaymentSummaries on cpp.CompanyId equals cps.CompanyId where cps.IsImmidiateFutureRecordCreated == false && cpp.StartDate <= dateToConsider && (cpp.EndDate > dateToConsider || cpp.EndDate == null) && cps.NextPaymentCycleStartingDate <= dateToConsider select cpp).Distinct().ToList(); foreach (CompanyPaymentPackage companyPaymentPackage in companyPaymentPackages) { Data.Company company = companyPaymentPackage.Company; PaymentSummaryDetails paymentSummaryDetails = new PaymentSummaryDetails() { CompanyPaymentPackage = companyPaymentPackage, CompanyId = companyPaymentPackage.CompanyId, ShouldProcess = !(companyBL.IsCompanySuspended(companyPaymentPackage.CompanyId) || companyBL.HasCompanySuspendedbySBAdmin(companyPaymentPackage.CompanyId)), UserId = 0, PackageStartDate = companyPaymentPackage.StartDate, PaymentMethodCodeId = companyPaymentPackage.PaymentMethodCodeId, HasPackageChanged = false, ProjectPaymentPackageTypeId = companyPaymentPackage.ProjectPaymentPackageTypeId, InventoryPaymentPackageTypeId = companyPaymentPackage.InventoryPaymentPackageTypeId, IsEducationPackage = companyPaymentPackage.IsEducationalPackage, PaymentDurationTypeCodeId = companyPaymentPackage.PaymentDurationCodeId, DiscountCodeUsageToApply = financeBL.GetLatestDiscountCodeUsage(companyPaymentPackage.CompanyId) }; //Get IsImmidiateFutureRecordCreated "False" Future Anual Summary records and make them as "True".(To commit as Processed) var unprocessedFutureSummaries = (from cps in dataContext.CompanyPaymentSummaries where cps.IsImmidiateFutureRecordCreated == false && cps.CompanyId == companyPaymentPackage.CompanyId && cps.ToDate <= dateToConsider select cps).ToList(); foreach (CompanyPaymentSummary cps in unprocessedFutureSummaries) { cps.IsImmidiateFutureRecordCreated = true; cps.LastUpdatedDate = Utils.Today; cps.LastUpdatedBy = 0; } CreateCompanyPaymentSummaries(paymentSummaryDetails, dateToConsider, dataContext); } dataContext.SaveChanges(); } }
public static Company ToCompanyContract(this Data.Company compamy) { return(new Company() { Id = compamy.Id, OwnerId = compamy.Owner.Id, CreationTime = compamy.CreationTime, Name = compamy.Name, Description = compamy.Description }); }
/// <summary> /// Suspends the company by SB admin. /// </summary> /// <param name="companyId">The company identifier.</param> /// <param name="userId">The user identifier.</param> public void SuspendCompanybySBAdmin(int companyId, int userId) { Data.Company company = DataContext.Companies.Where(c => c.CompanyId == companyId).FirstOrDefault(); if (company != null) { company.HasSuspended = true; ProjectUsageHandler.UpdatePaymentSummaryForFreeTrialCompanyBySBAdmin(companyId, null, true, userId, DataContext); } SuspendActiveProjectsByCompany(companyId, userId); }
/// <summary> /// Reactivates the company by SB admin. /// </summary> /// <param name="companyId">The company identifier.</param> /// <param name="userId">The user identifier.</param> public void ReactivateCompanybySBAdmin(int companyId, int userId) { Data.Company company = DataContext.Companies.Where(c => c.CompanyId == companyId).FirstOrDefault(); if (company != null) { company.HasSuspended = false; // This only gets executed by FT company. ProjectUsageHandler.UpdatePaymentSummaryForFreeTrialCompanyBySBAdmin(companyId, null, false, userId, DataContext); // For a FT company, this does not affects, but for a normal company. ActivateUnProcessedSummaries(companyId, userId); } DataContext.SaveChanges(); }
/// <summary> /// Loads the bread crumbs. /// </summary> /// <param name="company">The company.</param> private void LoadBreadCrumbs(Data.Company company) { bool isCompanyAdmin = Support.IsCompanyAdministrator(this.CompanyId); BreadCrumbs bc = GetBreadCrumbsControl(); bc.ClearLinks(); bc.AddLink("Company Inventory", isCompanyAdmin ? string.Format("~/Inventory/CompanyInventory.aspx?CompanyId={0}", this.CompanyId) : null); bc.AddLink("My Bookings", string.Format("~/Inventory/MyBookings.aspx?CompanyId={0}", this.CompanyId)); bc.AddLink("Booking Details", string.Format("~/Inventory/MyBookingDetails.aspx?BookingId={0}&CompanyId={1}", BookingId, CompanyId)); bc.AddLink("Change Booking Dates", null); bc.LoadControl(); bc.UpdateBreadCrumb(); }
/// <summary> /// Loads the data. /// </summary> /// <param name="excludeIds">The exclude ids.</param> public void LoadData(List <int> excludeIds = null, bool showAll = false) { Data.Company company = GetBL <CompanyBL>().GetCompany(this.CompanyId); if (company != null) { txtLocation.Text = string.Empty; var locations = GetBL <LocationBL>().GetLocations(this.CompanyId, this.UserID, showAll: showAll); var excludedLocations = excludeIds == null ? locations : locations.Where(l => !excludeIds.Contains(l.LocationId)); rtvLocations.DataSource = excludedLocations; rtvLocations.DataBind(); if (InventoryLocationDisplayMode == DisplayMode.SearchInventory || InventoryLocationDisplayMode == DisplayMode.Generic || InventoryLocationDisplayMode == DisplayMode.LocationAdmin) { rfvLocation.Enabled = false; } else if (InventoryLocationDisplayMode == DisplayMode.Admin) { ibtnClearSearch.OnClientClick = string.Concat("return ", ibtnClearSearch.ClientID, "_ClientClick();"); ibtnClearSearch.Attributes.Add("onkeypress", string.Concat("return ", ibtnClearSearch.ClientID, "_ClientKeyPress(event);")); } RadTreeNode node = new RadTreeNode(company.CompanyName, string.Empty); node.Expanded = true; node.Nodes.AddRange(rtvLocations.Nodes.Cast <RadTreeNode>()); rtvLocations.Nodes.Add(node); // Disable location that has view rights if (DisableViewOnlyLocations) { foreach (RadTreeNode tier2Loc in node.Nodes) { int locId; if (int.TryParse(tier2Loc.Value, out locId)) { bool enabled = Utils.HasLocationManagerPermission(CompanyId, this.UserID, locId) || (InventoryLocationDisplayMode != DisplayMode.LocationAdmin && Utils.IsCompanyInventoryStaffMember(CompanyId, this.UserID, locId, DataContext)); if (InventoryLocationDisplayMode == DisplayMode.Generic || InventoryLocationDisplayMode == DisplayMode.LocationAdmin) { tier2Loc.Visible = enabled; } else { // Set visible false on client side. (see InventoryLocations_Jquery_SetValue method) tier2Loc.Enabled = enabled; } } } } } }
/// <summary> /// Loads the bread crumbs. /// </summary> /// <param name="company">The company.</param> private void LoadBreadCrumbs(Data.Company company) { if (this.CompanyId > 0) { bool isCompanyAdmin = Support.IsCompanyAdministrator(this.CompanyId); BreadCrumbs bc = GetBreadCrumbsControl(); bc.ClearLinks(); bc.AddLink("Company Inventory", isCompanyAdmin ? string.Format("~/Inventory/CompanyInventory.aspx?CompanyId={0}", this.CompanyId) : null); bc.AddLink("My Bookings", string.Format("~/Inventory/MyBookings.aspx?CompanyId={0}", this.CompanyId)); bc.AddLink(string.Concat(Support.TruncateString(GetBL <InventoryBL>().GetNonProjectBooking(BookingId).Name, 30)), null); bc.LoadControl(); bc.UpdateBreadCrumb(); } }
/// <summary> /// Loads the data. /// </summary> private void LoadData() { if (DisplayMode == ViewMode.Admin) { divCompanyInventory.Visible = chkMyBookingsOnly.Visible = false; ViewingCompanyId = CompanyId; } else { //Load CompanyList only if the mode is Non-Projerct var companyList = GetBL <InventoryBL>().GetBookingCompanies(BookingId); Data.Company company = companyList.FirstOrDefault(); ViewingCompanyId = company.CompanyId; if (companyList.Count() > 1) { ddCompanyInventory.DataSource = companyList; ddCompanyInventory.DataTextField = "CompanyName"; ddCompanyInventory.DataValueField = "CompanyId"; ddCompanyInventory.DataBind(); lblCompany.Visible = false; } else { ddCompanyInventory.Visible = false; lblCompany.Text = company.CompanyName; } chkMyBookingsOnly.Visible = DisplayMode == ViewMode.Project; } if (this.OnlyShowMyBookings) { chkMyBookingsOnly.Checked = true; } ddItemTypes.DataSource = Utils.GetALLItemTypes(); ddItemTypes.DataTextField = "Name"; ddItemTypes.DataValueField = "ItemTypeId"; ddItemTypes.DataBind(); hdnUserId.Value = UserID.ToString(); string bookingName = GetBookingName(); lblBookingName.Text = Support.TruncateString(bookingName, 70); lblBookingName.ToolTip = bookingName.Length > 70 ? bookingName : string.Empty; LoadBookingDetails(); tooltipManager.TargetControls.Clear(); }
/// <summary> /// Handles the Click event of the StartNextButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void StartNextButton_Click(object sender, EventArgs e) { if (this.IsValid) { TemplatedWizardStep step = (TemplatedWizardStep)wizard.WizardSteps[0]; UserWeb.Controls.Company.CompanyDetails companyDetails = (UserWeb.Controls.Company.CompanyDetails)step.ContentTemplateContainer.FindControl("ucCompanyDetails"); Data.Company company = companyDetails.SaveCompanyDetails(false, false); paymentValidation.NewCompany = company; UserWeb.Controls.Company.CompanyHeaderDetails companyHeaderDetails = (UserWeb.Controls.Company.CompanyHeaderDetails)step.ContentTemplateContainer.FindControl("companyHeaderDetails"); paymentValidation.Media = companyHeaderDetails.GetMedia(); paymentPackageSummary.UpdatePaymentSummary(); lblTitle.Text = "Select Pricing Plans"; } }
/// <summary> /// Loads the bread crumbs. /// </summary> /// <param name="company">The company.</param> private void LoadBreadCrumbs(Data.Company company) { if (this.CompanyId > 0) { bool isCompanyAdmin = Support.IsCompanyAdministrator(this.CompanyId); BreadCrumbs bc = GetBreadCrumbsControl(); bc.ClearLinks(); bc.AddLink(company.CompanyName, isCompanyAdmin ? string.Format("~/Company/CompanyDashboard.aspx?CompanyId={0}", this.CompanyId) : null); bc.AddLink("Company Inventory", string.Format("~/Inventory/CompanyInventory.aspx?CompanyId={0}", this.CompanyId)); bc.AddLink("Manage Inventory", string.Format("~/Inventory/InventorySharing.aspx?CompanyId={0}", this.CompanyId)); bc.AddLink("Booking Details", null); bc.LoadControl(); bc.UpdateBreadCrumb(); } }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtCompanyName.Text)) { errorProvider1.SetError(txtCompanyName, "لطفا نام را وارد نمایید"); return; } using (UnitOfWork db = new UnitOfWork()) { if (companyId == 0) { var model = new Data.Company() { CompanyName = txtCompanyName.Text, }; var result = db.CompanyService.AddCompany(model); if (result.IsChange) { db.Save(); RtlMessageBox.Show(result.Message); } else { RtlMessageBox.Show(result.Message); } } else { var model = new Data.Company() { CompanyId = companyId, CompanyName = txtCompanyName.Text, }; var result = db.CompanyService.EditCompany(model); if (result.IsChange) { db.Save(); RtlMessageBox.Show(result.Message); DialogResult = DialogResult.OK; } else { RtlMessageBox.Show(result.Message); } } } }
public Guid Add(CompanyInfo companyInfo) { try { var company = new Data.Company(companyInfo.OwnerId) { Name = companyInfo.Name, Description = companyInfo.Description, }; return(company.Id); } catch { return(Guid.Empty); } }
/// <summary> /// Configures the company status. /// </summary> private void ConfigureCompanyStatus() { Data.Company company = this.GetBL <CompanyBL>().GetCompany(CompanyId); int companyStatusCodeId = company.CompanyStatusCodeId; int companyGracePeriodCodeId = Utils.GetCodeIdByCodeValue("CompanyStatus", "GRACEPERIOD"); if (this.GetBL <CompanyBL>().HasCompanySuspendedbySBAdmin(CompanyId)) { string msgCompanySuspended = "<strong>Company activity is suspended by StageBitz Admin</strong>"; multStatusCompany.ActiveViewIndex = 0; ltrlStatus.Text = msgCompanySuspended; if (this.GetBL <CompanyBL>().IsCompanyInPaymentFailedGracePeriod(CompanyId) || this.GetBL <CompanyBL>().IsCompanyPaymentFailed(CompanyId)) { multStatusCompany.ActiveViewIndex = 2; View activeView = multStatusCompany.GetActiveView(); Literal ltrlExpiresOn = (Literal)activeView.FindControl("ltrlExpiresOn"); ltrlExpiresOn.Text = msgCompanySuspended + " | Payment Failed"; imgPaymentFailed.ToolTip = ProjectFinanceHandler.GetCompanyPaymentFailureDetails(CompanyId); } } else if (IsPaymentFailedInvoicesExistForCompany) { multStatusCompany.ActiveViewIndex = 2; View activeView = multStatusCompany.GetActiveView(); Literal ltrlExpiresOn = (Literal)activeView.FindControl("ltrlExpiresOn"); Image imgPaymentFailed = (Image)activeView.FindControl("imgPaymentFailed"); imgPaymentFailed.ToolTip = ProjectFinanceHandler.GetCompanyPaymentFailureDetails(CompanyId); if (company.CompanyStatusCodeId == companyGracePeriodCodeId && IsPaymentFailedInvoicesExistForCompany) { ltrlExpiresOn.Text = string.Format("Payment Failed (Company will become read-only on {0})", Support.FormatDate(company.ExpirationDate)); } else if (IsPaymentFailedCompany) { if (companyStatusCodeId == paymentFailed) { ltrlExpiresOn.Text = "<strong>Company activity is suspended</strong>"; } else { ltrlExpiresOn.Text = Utils.GetCodeDescription(companyStatusCodeId); } } } }
/// <summary> /// Gets the export file location. /// </summary> /// <param name="relatedTable">The related table.</param> /// <param name="relatedId">The related identifier.</param> /// <param name="ShouldIncludeZipExtension">if set to <c>true</c> [should include zip extension].</param> /// <param name="downLoadFileName">Name of down load file.</param> /// <returns></returns> public string GetExportFileLocation(string relatedTable, int relatedId, bool ShouldIncludeZipExtension, out string downLoadFileName) { string baseFolder = string.Empty; string basePath = Utils.GetSystemValue("ExportFileDirectoryLocation"); switch (relatedTable) { case Common.Constants.GlobalConstants.RelatedTables.ExportFiles.Project: ProjectBL projectBL = new ProjectBL(DataContext); Data.Project project = projectBL.GetProject(relatedId); if (project != null) { downLoadFileName = string.Concat(FileHandler.GetSafeFileName(Utils.Ellipsize(project.ProjectName, 50)), ".zip"); baseFolder = Path.Combine( basePath, project.CompanyId.ToString(CultureInfo.InvariantCulture), string.Concat("P-", !ShouldIncludeZipExtension ? project.ProjectId.ToString(CultureInfo.InvariantCulture) : string.Concat(project.ProjectId, ".zip"))); return(baseFolder); } break; case Common.Constants.GlobalConstants.RelatedTables.ExportFiles.Company: CompanyBL companyBL = new CompanyBL(DataContext); Data.Company company = companyBL.GetCompany(relatedId); if (company != null) { downLoadFileName = string.Concat(string.Format("{0} Inventory", FileHandler.GetSafeFileName(Utils.Ellipsize(company.CompanyName, 50))), ".zip"); baseFolder = Path.Combine( basePath, relatedId.ToString(CultureInfo.InvariantCulture), string.Concat("C-", !ShouldIncludeZipExtension ? company.CompanyId.ToString(CultureInfo.InvariantCulture) : string.Concat(company.CompanyId, ".zip"))); return(baseFolder); } break; } downLoadFileName = string.Empty; return(baseFolder); }
/// <summary> /// Initializes the popup. /// </summary> private void InitializePopup() { ProjectArchive projectArchive = null; if (ProjectId > 0) { projectArchive = GetBL <ProjectBL>().GetProjectArchive(ProjectId); } else { projectArchive = GetBL <ProjectBL>().GetLatestProjectArchiveByCompanyId(CompanyId, UserID); } if (projectArchive != null) { User user = GetBL <PersonalBL>().GetUser(projectArchive.ProjectClosedBy); if (user != null) { lblClosedBy.Text = string.Concat(user.FirstName, " ", user.LastName); lblClosedByInventory.Text = string.Concat(user.FirstName, " ", user.LastName); } } if (CompanyId > 0) { Data.Company company = GetBL <CompanyBL>().GetCompany(CompanyId); if (company != null) { lblCompanyName.Text = company.CompanyName; lblCompanyNameInventory1.Text = company.CompanyName; lblCompanyNameInventory2.Text = company.CompanyName; } User primaryAdmin = this.GetBL <CompanyBL>().GetCompanyPrimaryAdministrator(CompanyId); if (primaryAdmin != null) { string primaryAdminLink = string.Concat("<a href='mailto:", primaryAdmin.Email1, "'>", primaryAdmin.FirstName, " ", primaryAdmin.LastName, "</a>"); ltrlPrimaryAdmin.Text = primaryAdminLink; ltrlPrimaryAdminInventory.Text = primaryAdminLink; ltrlPrimaryAdminProjectSuspended.Text = primaryAdminLink; } } }
/// <summary> /// Suspends the projects for company. /// </summary> /// <param name="companyId">The company id.</param> /// <param name="dataContext">The data context.</param> public static void SuspendProjectsForCompany(int companyId, StageBitzDB dataContext) { int projectSuspendCodeId = Utils.GetCodeIdByCodeValue("ProjectStatus", "SUSPENDED"); CompanyBL companyBL = new CompanyBL(dataContext); ProjectBL projectBL = new ProjectBL(dataContext); Data.Company company = companyBL.GetCompany(companyId); company.CompanyStatusCodeId = Utils.GetCodeIdByCodeValue("CompanyStatus", "SUSPENDEDFORNOPAYMENTOPTIONS"); //Suspend all active projects List <Data.Project> projects = projectBL.GetAllActiveProjects(companyId); foreach (Data.Project project in projects) { project.ProjectStatusCodeId = projectSuspendCodeId; project.LastUpdatedByUserId = 0; project.LastUpdatedDate = Utils.Today; } }
/// <summary> /// Exports the report. /// </summary> /// <param name="exportType">Type of the export.</param> private void ExportReport(ReportTypes exportType) { string fileName = string.Empty; InventoryManageBookingListReportParameters parameters = new InventoryManageBookingListReportParameters { BookingStatus = this.BookingStatus, CompanyId = this.CompanyId, CreatedByUserId = this.CreatedByUserId, IsInventoryManagerMode = this.DisplayMode == ViewMode.InventoryManager, SearchText = cboSearch.Text, ShowArchived = this.ShowArchived, SortExpression = gvBookings.MasterTableView.SortExpressions.GetSortString(), UserId = this.UserID }; if (this.DisplayMode == ViewMode.InventoryManager) { Data.Company company = GetBL <CompanyBL>().GetCompany(this.CompanyId.Value); if (company != null) { fileName = string.Format("{0}'s_Bookings", company.CompanyName); } } else if (this.DisplayMode == ViewMode.MyBookings) { Data.User user = GetBL <PersonalBL>().GetUser(this.CreatedByUserId.Value); if (user != null) { fileName = string.Format("{0}'s_Bookings", user.FirstName); } } string fileNameExtension; string encoding; string mimeType; byte[] reportBytes = UserWebReportHandler.GenerateInventoryManageBookingListReport(parameters, exportType, out fileNameExtension, out encoding, out mimeType); Utils.ExportReport(reportBytes, mimeType, fileNameExtension, fileName); }
/// <summary> /// Initializes the UI. /// </summary> public void InitializeUI() { if (this.ItemId == 0) { chkVisibilityInventoryObservers.Checked = chkVisibilityInventoryStaff.Checked = chkVisibilitySharedInventory.Checked = chkVisibilityInventoryTeam.Checked = false; } else { Data.Code aboveSharedInventoryCode = Utils.GetCodeByValue("InventoryVisibilityLevel", "ABOVE_SHAREDINVENTORY"); Data.Code aboveInventoryObserverCode = Utils.GetCodeByValue("InventoryVisibilityLevel", "ABOVE_IO"); Data.Code aboveInventoryStaffCode = Utils.GetCodeByValue("InventoryVisibilityLevel", "ABOVE_IS"); Data.Code aboveInventoryAdminCode = Utils.GetCodeByValue("InventoryVisibilityLevel", "ABOVE_IA"); Data.Item item = GetBL <InventoryBL>().GetItem(this.ItemId); if (item != null) { int sortOrder = item.Code.SortOrder; chkVisibilitySharedInventory.Checked = aboveSharedInventoryCode.SortOrder <= sortOrder; chkVisibilityInventoryObservers.Checked = aboveInventoryObserverCode.SortOrder <= sortOrder; chkVisibilityInventoryStaff.Checked = aboveInventoryStaffCode.SortOrder <= sortOrder; chkVisibilityInventoryTeam.Checked = chkVisibilityInventoryObservers.Checked || chkVisibilityInventoryStaff.Checked; this.CompanyId = item.CompanyId.Value; } } Data.Company company = GetBL <CompanyBL>().GetCompany(this.CompanyId); if (company != null) { ltrlChkVisibilityInventoryTeam.Text = string.Format("Inventory Team Members from <span title='{0}'>{1}</span>", company.CompanyName.Length > 30 ? company.CompanyName : string.Empty, Support.TruncateString(company.CompanyName, 30)); } }
public ActionResult SignUp(SignUpViewModel Model) { if (!ModelState.IsValid) { return(View(Model)); } //Create New Company Data.Company Company = new Data.Company(); Company.CompanyName = Model.CompanyName; Company.ContactName = Model.FirstName + " " + Model.LastName; Company.EmailAddress = Model.Email; Company.PhoneNumber = Model.PhoneNumber; Company.TimeGoURL = Model.CompanyURL; Company.UpdatedOn = DateTime.UtcNow; Company.TimezoneId = Model.TimezoneId; Company.WorkweekStaryDay = (int?)Model.WorkweekStaryDay; Context.Entry(Company).State = System.Data.Entity.EntityState.Added; Context.SaveChanges(); //Create login account for primary account Data.Employee Employee = new Data.Employee(); Employee.CompanyId = Company.CompanyId; Employee.EmailAddress = Model.Email; Employee.Phonenumber = Model.PhoneNumber; Employee.Password = Model.Password; Employee.FirstName = Model.FirstName; Employee.LastName = Model.LastName; Employee.IsActive = true; Employee.RoleId = 2; Context.Entry(Employee).State = System.Data.Entity.EntityState.Added; Context.SaveChanges(); return(RedirectPermanent("/" + Company.TimeGoURL)); }
/// <summary> /// Handles the Click event of the btnSendEmail control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnSendEmail_Click(object sender, EventArgs e) { if (!PageBase.StopProcessing) { Button button = sender as Button; if (button != null) { string feedbackEmail = Support.GetSystemValue("FeedbackEmail"); User primaryAdmin = this.GetBL <CompanyBL>().GetCompanyPrimaryAdministrator(this.CompanyId); string userWebUrl = Utils.GetSystemValue("SBUserWebURL"); string pricingPlanUrl = string.Format("{0}/Company/CompanyPricingPlans.aspx?companyId={1}", userWebUrl, this.CompanyId); // Determine the email templates based on the command name. switch (button.CommandName) { case "UserLimitProjectAdmin": User projectAdmin = GetBL <PersonalBL>().GetUser(this.UserID); Data.Project project = GetBL <ProjectBL>().GetProject(this.ProjectId); string projectAdminName = string.Concat(projectAdmin.FirstName, " ", projectAdmin.LastName); EmailSender.SendUserLimitUpgradeRequest(primaryAdmin.Email1, primaryAdmin.FirstName, projectAdminName, pricingPlanUrl, feedbackEmail, project.ProjectName); break; case "InventoryLimitInventoryManager": User inventoryManager = GetBL <PersonalBL>().GetUser(this.UserID); Data.Company company = GetBL <CompanyBL>().GetCompany(this.CompanyId); string inventoryManagerName = string.Concat(inventoryManager.FirstName, " ", inventoryManager.LastName); EmailSender.SendInventoryLimitUpgradeRequest(primaryAdmin.Email1, primaryAdmin.FirstName, inventoryManagerName, pricingPlanUrl, feedbackEmail, company.CompanyName); break; } FindParentPopup(button).HidePopup(); } } }
public ActionResult Index(String CompanyURL) { AdminViewModel Model = new AdminViewModel(); PopulateModel(Model); if (Model.LoginId == 0) { return(Expired(CompanyURL)); } Data.Company Company = Context.Companies.Where(c => c.CompanyId == Model.CompanyId).FirstOrDefault(); Model.CompanyName = Company.CompanyName; Model.ContactName = Company.ContactName; Model.PhoneNumber = Company.PhoneNumber; Model.Email = Company.EmailAddress; Model.CompanyURL = Company.TimeGoURL; Model.VacationApproverEmail = Company.VacationApproverEmail; Model.NumberOfTimeoffRequests = Context.TimeoffRequests.Count(tor => tor.ApprovalStatusId == 10 && tor.CompanyId == Model.CompanyId); return(View(Model)); }
/// <summary> /// Loads the data. /// </summary> /// <param name="company">The company.</param> public void LoadData(Data.Company company) { this.Company = company; if (DisplayMode == ViewMode.PaymentDetail) { Data.User user = this.GetBL <PersonalBL>().GetUser(UserID); txtPersonalPhone.Text = user != null ? user.Phone1 : ""; } txtCompanyName.Text = company.CompanyName; txtAddressLine1.Text = company.AddressLine1; txtAddressLine2.Text = company.AddressLine2; txtCity.Text = company.City; txtState.Text = company.State; txtPostalCode.Text = company.PostCode; txtCompanyPhone.Text = company.Phone; txtWebsite.Text = company.Website; if (company.CountryId.HasValue) { ucCountryList.SelectCountryId(company.CountryId.Value); } }
/// <summary> /// Loads the data. /// </summary> public void LoadData() { if (CompanyId > 0) { Data.Company company = this.GetBL <CompanyBL>().GetCompany(CompanyId); CompanyStatusHandler.CompanyWarningInfo warningInfo = CompanyStatusHandler.GetCompanyWarningStatus(CompanyId, company.CompanyStatusCodeId, company.ExpirationDate); if (warningInfo.WarningStatus == CompanyStatusHandler.CompanyWarningStatus.NoWarning) { var globalizationSection = WebConfigurationManager.GetSection("system.web/globalization") as GlobalizationSection; int anualDurationCodeId = (int)Utils.GetCodeIdByCodeValue("PaymentPackageDuration", "ANUAL"); int monthlyDurationCodeId = Utils.GetCodeIdByCodeValue("PaymentPackageDuration", "MONTHLY"); CompanyBL companyBL = new CompanyBL(DataContext); CompanyPaymentPackage oldPackage = this.GetBL <FinanceBL>().GetCurrentPaymentPackageFortheCompanyIncludingFreeTrial(CompanyId); if (!((companyBL.IsFreeTrialStatusIncludedFortheDay(CompanyId, Utils.Today)) || oldPackage == null)) //free trial scenario and first time configuration. In this case no banners to display. { //comming from a popup. Refer PBI 14218.If user changes from yearly->monthly and downgrading or upgrading we should display banners in AC2,AC3.5. Else if it is a downgrade, display the banner in AC 3.4. If it is just an option change or upgrade with option change, then display banner in AC1. if (PricePlanDetails != null) { divNotifyFutureRequest.Style.Add("Width", Width.ToString() + "px"); #region Calculations int durationDifference = this.GetBL <FinanceBL>().GetDurationDifference(oldPackage.StartDate, Utils.Today, oldPackage.PaymentDurationCodeId); DateTime endDate = Utils.Today; DateTime newBillingDate = Utils.Today; DateTime virtualBillingDate = Utils.Today; string newOption = PricePlanDetails.PaymentDurationCodeId == (int)Utils.GetCodeIdByCodeValue("PaymentPackageDuration", "ANUAL") ? "yearly" : "monthly"; string currentOption = oldPackage.PaymentDurationCodeId == (int)Utils.GetCodeIdByCodeValue("PaymentPackageDuration", "ANUAL") ? "yearly" : "monthly"; //In order to find whether it is an upgrade or downgrade, decimal newAmount = this.GetBL <FinanceBL>().CalculateALLPackageAmountsByPeriod(PricePlanDetails.ProjectPaymentPackageTypeId, PricePlanDetails.InventoryPaymentPackageTypeId, oldPackage.PaymentDurationCodeId); decimal oldAmount = this.GetBL <FinanceBL>().CalculateALLPackageAmountsByPeriod(oldPackage.ProjectPaymentPackageTypeId, oldPackage.InventoryPaymentPackageTypeId, oldPackage.PaymentDurationCodeId); int dayToRun = int.Parse(Utils.GetSystemValue("MonthlyFinanceProcessDay")); if (oldPackage.PaymentDurationCodeId == anualDurationCodeId) { endDate = oldPackage.EndDate != null ? (DateTime)oldPackage.EndDate : (DateTime)oldPackage.StartDate.AddYears(durationDifference); if (PricePlanDetails.PaymentDurationCodeId == monthlyDurationCodeId) { virtualBillingDate = new DateTime(endDate.Year, endDate.Month, dayToRun); newBillingDate = virtualBillingDate > endDate ? virtualBillingDate : virtualBillingDate.AddMonths(1); } } else { endDate = oldPackage.EndDate != null ? (DateTime)oldPackage.EndDate : (DateTime)oldPackage.StartDate.AddMonths(durationDifference); if (PricePlanDetails.PaymentDurationCodeId == anualDurationCodeId) { virtualBillingDate = new DateTime(endDate.Year, endDate.Month, dayToRun); newBillingDate = virtualBillingDate > endDate ? virtualBillingDate : virtualBillingDate.AddMonths(1); } } #endregion Calculations #region creating banners if (endDate == Utils.Today) { pnlNotifyFutureRequest.Visible = false; } else if (PricePlanDetails.PaymentDurationCodeId != oldPackage.PaymentDurationCodeId) //Duration change { string displayText = string.Empty; if (PricePlanDetails.PaymentDurationCodeId == monthlyDurationCodeId && newAmount != oldAmount) { if (newAmount < oldAmount) //downgrade yearly->monthly { displayText = string.Format("<b>A little note on downgrades…</b> We’re glad you’ve found the levels that are right for you in StageBitz, but we do need to let you know that we can’t offer refunds, as Yearly subscriptions are paid in advance. " + "You’re currently paid up until {0}. Your choice will be effective immediately so if you would like to continue to enjoy the higher subscription level until that date please downgrade later." + " After that, we’ll change your billing to the lower level you’ve chosen. Your {1} charges will start on {2}.", Utils.FormatDate(endDate), newOption, Utils.FormatDate(newBillingDate)); } else if (newAmount > oldAmount) //upgrade yearly->monthly { PaymentSummaryDetails paymentSummaryDetail = this.GetBL <FinanceBL>().GetPaymentSummaryDetailRecord(PricePlanDetails, true); int totalDays = (int)(endDate - Utils.Today).TotalDays; decimal prorataAmount = ProjectUsageHandler.GetProrataAmount(paymentSummaryDetail, oldPackage, this.GetBL <FinanceBL>().GetLatestDiscountCodeUsage(CompanyId), newAmount, oldAmount, endDate, totalDays); StringBuilder upgradeText = new StringBuilder(); upgradeText.Append(string.Format("You have selected to upgrade your plan and pay {0}. ", newOption)); if (prorataAmount > 0) { upgradeText.Append(string.Format("You will be charged a pro-rata amount of {0} for your upgrade. ", Utils.FormatCurrency(prorataAmount, globalizationSection.Culture))); } upgradeText.Append(string.Format("Your {0} charges will start on {1}.", newOption, Utils.FormatDate(newBillingDate))); displayText = upgradeText.ToString(); } } else { if (newAmount < oldAmount)//even for monthly->yearly downgrade we should display downgrade banner { displayText = string.Format("<b>A little note on downgrades…</b> We’re glad you’ve found the levels that are right for you in StageBitz, but we do need to let you know that we can’t offer refunds, as subscriptions are paid in advance. " + "You’re currently paid up until {0}. Your choice will be effective immediately so if you would like to continue to enjoy the higher subscription level until that date please downgrade later.", Utils.FormatDate(endDate)); } else//only an option change (yearly->monthly or monthly->yearly).Even if it is a monthly->yearly upgrade we display this banner. { displayText = string.Format("You are currently paying {0}, but you have opted to pay {1} as of {2}.", currentOption, newOption, Utils.FormatDate(endDate)); } } divNotifyFutureRequest.InnerHtml = displayText; pnlNotifyFutureRequest.Visible = true; } else { if (newAmount < oldAmount) //downgrade only. { string downgradeOnlyText = string.Format("<b>A little note on downgrades…</b> We’re glad you’ve found the levels that are right for you in StageBitz, but we do need to let you know that we can’t offer refunds, as subscriptions are paid in advance. " + "You’re currently paid up until {0}. Your choice will be effective immediately so if you would like to continue to enjoy the higher subscription level until that date please downgrade later.", Utils.FormatDate(endDate)); divNotifyFutureRequest.InnerHtml = downgradeOnlyText; pnlNotifyFutureRequest.Visible = true; } else { pnlNotifyFutureRequest.Visible = false; } } #endregion creating banners } else //Comming from company billing or price plan page { CompanyPaymentPackage futurePackage = this.GetBL <FinanceBL>().GetLatestRequestForTheCompany(CompanyId); DateTime newDurationStartDate = Utils.Today; if (futurePackage != null && oldPackage != null && futurePackage.PaymentDurationCodeId != oldPackage.PaymentDurationCodeId) { string currentPaymentDuration = string.Empty; string newPaymentDuration = string.Empty; int durationDifference = this.GetBL <FinanceBL>().GetDurationDifference(oldPackage.StartDate, Utils.Today, oldPackage.PaymentDurationCodeId); if (oldPackage.PaymentDurationCodeId == anualDurationCodeId) { currentPaymentDuration = "yearly"; newPaymentDuration = "monthly"; newDurationStartDate = oldPackage.EndDate != null ? (DateTime)oldPackage.EndDate : (DateTime)oldPackage.StartDate.AddMonths(durationDifference); } else { currentPaymentDuration = "monthly"; newPaymentDuration = "yearly"; newDurationStartDate = oldPackage.EndDate != null ? (DateTime)oldPackage.EndDate : (DateTime)oldPackage.StartDate.AddYears(durationDifference); } string optionChangedText = string.Format("You are currently paying {0}, but you have opted to pay {1} as of {2}.", currentPaymentDuration, newPaymentDuration, Utils.FormatDate(newDurationStartDate)); divNotifyFutureRequest.InnerHtml = optionChangedText; pnlNotifyFutureRequest.Visible = true; } else { pnlNotifyFutureRequest.Visible = false; } } } } } }