public Order CancelOrder(Order order, long forOrganizationRoleUserId, long dataRecorderCreatorId, bool chargeCancellation = true) { if (order == null) { throw new InvalidOperationException("The order can not be null."); } using (var transaction = new TransactionScope()) { var orderDetailsToBeCancelled = new List <OrderDetail>(); orderDetailsToBeCancelled.AddRange(order.OrderDetails.Where(CancelOrderPredicate)); order.OrderDetails.RemoveAll(CancelOrderPredicate); foreach (var detailsToBeCancelled in orderDetailsToBeCancelled) { var cancelledOrderDetail = _orderDetailFactory.CreateNewOrderDetail(detailsToBeCancelled, forOrganizationRoleUserId, dataRecorderCreatorId); order.OrderDetails.Add(detailsToBeCancelled); order.OrderDetails.Add(cancelledOrderDetail); } if (chargeCancellation) { IConfigurationSettingRepository _configRepository = new ConfigurationSettingRepository(); var cancellationFeeString = _configRepository.GetConfigurationValue(ConfigurationSettingName.CancellationFee); decimal cancellationFee = 0; if (!string.IsNullOrEmpty(cancellationFeeString)) { decimal.TryParse(cancellationFeeString, out cancellationFee); } if (order.TotalAmountPaid >= cancellationFee) // May be greater than Cancellation fee { var cancelledFeeOrderItemTypeOrderDetail = _orderDetailFactory.CreateNewOrderDetailforCanellationItem(cancellationFee, order.Id, forOrganizationRoleUserId, dataRecorderCreatorId); var orderItemId = _orderItemRepository.SaveCancellationFeeOrderItem(); cancelledFeeOrderItemTypeOrderDetail.OrderItemId = orderItemId; order.OrderDetails.Add(cancelledFeeOrderItemTypeOrderDetail); } } order = _orderRepository.SaveOrder(order); transaction.Complete(); } _lineItems.Clear(); return(order); }
private void SearchEvent() { IConfigurationSettingRepository configurationSettingRepository = new ConfigurationSettingRepository(); string strDistance = configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.Eventdistance); string zipCode = string.Empty; int zip = 0; if (Int32.TryParse(txtZip.Text, out zip)) { zipCode = zip.ToString(); } var tag = string.Empty; var hasMammo = false; if (CustomerId > 0 && (EventSearchTypeDropdownList.SelectedValue == EventSearchFilterType.HealthPlan.ToString() || EventSearchTypeDropdownList.SelectedValue == EventSearchFilterType.Corporate.ToString() || EventSearchTypeDropdownList.SelectedValue == EventSearchFilterType.Mammo.ToString())) { tag = Customer.Tag; if (EventSearchTypeDropdownList.SelectedValue == EventSearchFilterType.Mammo.ToString()) { hasMammo = true; } } if (CustomerHasMammoTest && !IsRedirectNonMammoEvent) { hasMammo = true; } long?ProductTypeId = null; if (Customer != null && CustomerId > 0) { ProductTypeId = Customer.ProductTypeId; } if (CustomerType == CustomerType.Existing && ProductTypeId == null) { dbsearch.Visible = false; dbsearch.Style["display"] = ""; divNoRecord.Visible = true; divNoRecord.Style["display"] = ""; dgEvent.Visible = false; dvSearchResult1.InnerText = ""; dvSearchResult.InnerText = ""; return; } var eventService = IoC.Resolve <IEventService>(); var events = eventService.GetEventHostViewData(ViewType.Technician, txtState.Text, txtCity.Text, txtInvitationCodeSearch.Text, zipCode, Convert.ToInt32(strDistance), txtFrom.Text.Length > 0 ? (DateTime?)Convert.ToDateTime(txtFrom.Text) : null, txtTo.Text.Length > 0 ? (DateTime?)Convert.ToDateTime(txtTo.Text) : null, 0, CurrentRole == Roles.CallCenterRep, tag: tag, hasMammo: hasMammo, ProductType: ProductTypeId); var tbltemp = new DataTable(); tbltemp.Columns.Add("Id"); tbltemp.Columns.Add("Name"); tbltemp.Columns.Add("Date", typeof(DateTime)); tbltemp.Columns.Add("Host"); tbltemp.Columns.Add("Address"); tbltemp.Columns.Add("Distance", typeof(Decimal)); tbltemp.Columns.Add("Slots"); tbltemp.Columns.Add("GoogleMap"); tbltemp.Columns.Add("EventType"); tbltemp.Columns.Add("EventTypeImage"); tbltemp.Columns.Add("GoogleAddressVerified"); tbltemp.Columns.Add("HasBreastCancer", typeof(bool)); tbltemp.Columns.Add("AllowNonMammoPatients", typeof(bool)); if (events != null && events.Count > 0) { if (!string.IsNullOrEmpty(txtInvitationCodeSearch.Text)) { ViewState["InvitationCode"] = txtInvitationCodeSearch.Text; } else { ViewState["InvitationCode"] = null; } string googleAddressVerified = string.Empty; foreach (var eventHostViewData in events) { string strAddress = eventHostViewData.StreetAddressLine1 + "<br />" + eventHostViewData.City + "," + eventHostViewData.State + "," + eventHostViewData.Zip; googleAddressVerified = string.Empty; if (eventHostViewData.GoogleAddressVerifiedBy.HasValue) { googleAddressVerified = GetAddressVerifiedUser(eventHostViewData.GoogleAddressVerifiedBy.Value); if (string.IsNullOrEmpty(googleAddressVerified)) { googleAddressVerified = "Address Not Verified" + CommonCode.GetGoogleAddressNotVerifiedJtip(); } } //string strGoogleMap = eventHostViewData.StreetAddressLine1 + "," + eventHostViewData.City + "," + eventHostViewData.State + "," + eventHostViewData.Zip; string strGoogleMap = CommonCode.GetGoogleMapAddress(eventHostViewData.StreetAddressLine1, eventHostViewData.City, eventHostViewData.State, eventHostViewData.Zip, eventHostViewData.Latitude + "," + eventHostViewData.Longitude, eventHostViewData. UseLatitudeAndLongitudeForMapping); string strEventType = string.Empty; if (eventHostViewData.EventType != "") { strEventType = eventHostViewData.EventType.Trim().Equals("Public") ? "<img src='/App/Images/public-icon.gif' title='Public Event' />" : "<img src='/App/Images/private-icon.gif' title='Private Event' style='padding:0px 5px 0px 0px;' />"; } tbltemp.Rows.Add(new object[] { eventHostViewData.EventId, eventHostViewData.Name, eventHostViewData.EventDate.ToShortDateString(), eventHostViewData.OrganizationName, strAddress, eventHostViewData.DistanceFromZip, eventHostViewData.IsDynamicScheduling.HasValue && eventHostViewData.IsDynamicScheduling.Value ? "Dynamic Scheduling" : eventHostViewData.AvailableAppointmentSlots + "/" + eventHostViewData.TotalAppointmentSlots, strGoogleMap, eventHostViewData.EventType, strEventType, googleAddressVerified, eventHostViewData.HasBreastCancerTest.HasValue && eventHostViewData.HasBreastCancerTest.Value , eventHostViewData.AllowNonMammoPatients }); } } if (tbltemp.Rows.Count > 0) { ViewState["Event"] = tbltemp; dgEvent.DataSource = tbltemp; dgEvent.Visible = true; dgEvent.DataBind(); dvSearchResult1.InnerText = "Total: "; dvSearchResult.InnerText = tbltemp.Rows.Count + " Result found"; divNoRecord.Visible = false; divNoRecord.Style["display"] = ""; dbsearch.Visible = true; dbsearch.Style["display"] = ""; } else { dbsearch.Visible = false; dbsearch.Style["display"] = ""; divNoRecord.Visible = true; divNoRecord.Style["display"] = ""; dgEvent.Visible = false; dvSearchResult1.InnerText = ""; dvSearchResult.InnerText = ""; } }
public ConfigurationSettingsController(ILogger <ConfigurationSettingsController> logger, IOptions <Settings> settings) : base(logger) { var repository = new ConfigurationSettingRepository(settings); _confSettingService = new ConfigurationSettingService(repository); }