public void DeleteSupplier(ISupplier supplier) { //Calls delete on a specific supplier. SupplierEntity sup = supplier as SupplierEntity; supplierMapper.Delete(sup); }
public void SellArticle(ISupplier supplier, int articleId, int buyerId) { Article article = supplier.GetArticle(articleId); if (article.ID == -1) { throw new NullReferenceException("It's not allowed to sell empty articles!"); } article.IsSold = true; article.SoldDate = DateTime.Now; article.BuyerUserID = buyerId; _logger.WriteMessage(LogLevelConsts.DEBUG, String.Format("Trying to sell article with ID: {0}, from supplier: '{1}'", article.ID, supplier.ToString())); try { _databaseDriver.SaveArticle(article); _logger.WriteMessage(LogLevelConsts.INFO, String.Format("Article with ID: {0} is sold. Supplier is: '{1}'", article.ID, supplier.ToString())); } catch (NullReferenceException ex) { _logger.WriteMessage(LogLevelConsts.ERROR, String.Format("Could not save article with ID: {0}.", article.ID)); throw new Exception(String.Format("Could not save article with ID: {0}. \n Message: {1}", article.ID, ex.Message)); } }
public IBooking CreateBooking(ISupplier supplier, ICustomer customer, string sale, int bookingNumber, DateTime StartDate, DateTime EndDate) { //Calls Bookingcollection class for create return(bookingCollection.Create((Supplier)supplier, (Customer)customer, sale, bookingNumber, StartDate, EndDate)); }
/// <summary> /// Instantiates the <see cref="ImagePipelineCore"/>. /// </summary> /// <param name="producerSequenceFactory"> /// The factory that creates all producer sequences. /// </param> /// <param name="requestListeners"> /// The listeners for the image requests. /// </param> /// <param name="isPrefetchEnabledSupplier"> /// The supplier for enabling prefetch. /// </param> /// <param name="bitmapMemoryCache"> /// The memory cache for CloseableImage. /// </param> /// <param name="encodedMemoryCache"> /// The memory cache for IPooledByteBuffer. /// </param> /// <param name="mainBufferedDiskCache"> /// The default buffered disk cache. /// </param> /// <param name="smallImageBufferedDiskCache"> /// The buffered disk cache used for small images. /// </param> /// <param name="cacheKeyFactory"> /// The factory that creates cache keys for the pipeline. /// </param> /// <param name="threadHandoffProducerQueue"> /// Move further computation to different thread. /// </param> /// <param name="flexByteArrayPool"> /// The memory pool use for BitmapImage conversion. /// </param> public ImagePipelineCore( ProducerSequenceFactory producerSequenceFactory, HashSet <IRequestListener> requestListeners, ISupplier <bool> isPrefetchEnabledSupplier, IMemoryCache <ICacheKey, CloseableImage> bitmapMemoryCache, IMemoryCache <ICacheKey, IPooledByteBuffer> encodedMemoryCache, BufferedDiskCache mainBufferedDiskCache, BufferedDiskCache smallImageBufferedDiskCache, ICacheKeyFactory cacheKeyFactory, ThreadHandoffProducerQueue threadHandoffProducerQueue, FlexByteArrayPool flexByteArrayPool) { _idCounter = 0; _producerSequenceFactory = producerSequenceFactory; _requestListener = new ForwardingRequestListener(requestListeners); _isPrefetchEnabledSupplier = isPrefetchEnabledSupplier; _bitmapMemoryCache = bitmapMemoryCache; _encodedMemoryCache = encodedMemoryCache; _mainBufferedDiskCache = mainBufferedDiskCache; _smallImageBufferedDiskCache = smallImageBufferedDiskCache; _cacheKeyFactory = cacheKeyFactory; _threadHandoffProducerQueue = threadHandoffProducerQueue; _flexByteArrayPool = flexByteArrayPool; _handleResultExecutor = Executors.NewFixedThreadPool(MAX_DATA_SOURCE_SUBSCRIBERS); }
public FinalliseBookingState(ProcessBooking bookingProc) : base(bookingProc.Booking) { this.bookingProc = bookingProc; SupplierFactory factory = new SupplierFactory(); supplier = factory.GetSupplier(bookingProc.Booking); }
public int AddSupplier(string name, string phone, string address, string country) { ISupplier supplier = factor.CreateSupplier(name, phone, address + ", " + country); emailSender.SendEmail(name + "@gmail.com", "You have been registed. Thanks for using! \n HAVE A GOOD DAY"); return(supplierRepo.SaveSupplier(supplier)); }
static void Main(string[] args) { // name = ""; Test2 tt = new Test2(); tt.GetDD(); tt.Test(); ISupplier obj = CarFactory.GiveMyCar(0); obj.CarSupplier(); obj = CarFactory.GiveMyCar(1); obj.CarSupplier(); TestType t = new TestType(); string a = t.GetValue(); Console.Write(a); Console.ReadLine(); //singletone design pattern //singleTon s = singleTon.Instance; //s.Data = 100; //Console.WriteLine("Data of S object : " + s.Data); //singleTon s1 = singleTon.Instance; //Console.WriteLine("Data of S1 object : " + s.Data); //Console.ReadLine(); //Console.WriteLine("Hello World!"); //Customer cu = new Customer(new OracleServer()); //cu.cusAdd(); //Console.ReadKey(); }
public ZhongXin() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); MyBLL = ZhongXinFactory.Create(); MySupplier = SupplierFactory.CreateSupplier(); DBHelper = SQLHelperFactory.CreateSQLHelper(); pub = new Public_Class(); sendmessages = new ZhongXinUtil.SendMessages(); //Supplier_ID = tools.CheckInt(Session["supplier_id"].ToString()); //佣金 CommissionAccNo = System.Configuration.ConfigurationManager.AppSettings["zhongxin_commissionaccno"]; CommissionAccNm = System.Configuration.ConfigurationManager.AppSettings["zhongxin_commissionaccnm"]; //交易保证金 GuaranteeAccNo = System.Configuration.ConfigurationManager.AppSettings["zhongxin_dealguaranteeaccno"]; GuaranteeAccNm = System.Configuration.ConfigurationManager.AppSettings["zhongxin_dealguaranteeaccnm"]; }
public void PayCottageIndustrySupplier(ISupplier seller) { Console.WriteLine(); Console.WriteLine($"Amount to pay: {seller.MoneyToPay}"); seller.MoneyToPay = 0; Console.WriteLine($"We payed {seller.MoneyToPay} (using micro payment)"); }
public void Format(StringBuilder output, int spellID, ISupplier supplier) { foreach (var node in nodes) { node.Format(output, spellID, supplier); } }
public MakePaymentState(ProcessBooking bookingProc) : base(bookingProc.Booking) { this.bookingProc = bookingProc; SupplierFactory factory = new SupplierFactory(); supplier = factory.GetSupplier(bookingProc.Booking); }
/// <summary> /// Returns the encoded <see cref="CountingMemoryCache{K, V}"/>. /// </summary> public static CountingMemoryCache <ICacheKey, IPooledByteBuffer> Get( ISupplier <MemoryCacheParams> encodedMemoryCacheParamsSupplier, IMemoryTrimmableRegistry memoryTrimmableRegistry, PlatformBitmapFactory platformBitmapFactory) { IValueDescriptor <IPooledByteBuffer> valueDescriptor = new ValueDescriptorImpl <IPooledByteBuffer>( (value) => { return(value.Size); }); ICacheTrimStrategy trimStrategy = new NativeMemoryCacheTrimStrategy(); CountingMemoryCache <ICacheKey, IPooledByteBuffer> countingCache = new CountingMemoryCache <ICacheKey, IPooledByteBuffer>( valueDescriptor, trimStrategy, encodedMemoryCacheParamsSupplier, platformBitmapFactory, false); memoryTrimmableRegistry.RegisterMemoryTrimmable(countingCache); return(countingCache); }
public PreAuthorisationState(ProcessBooking bookingProc) : base(bookingProc.Booking) { this.bookingProc = bookingProc; SupplierFactory factory = new SupplierFactory(); supplier = factory.GetSupplier(bookingProc.Booking); }
public Cart() { Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); encrypt = EncryptFactory.CreateEncrypt(); MyOrders = OrdersFactory.CreateOrders(); MyCart = OrdersGoodsTmpFactory.CreateOrdersGoodsTmp(); MyProduct = ProductFactory.CreateProduct(); MyMem = MemberFactory.CreateMember(); Mypackage = PackageFactory.CreatePackage(); MyAddr = MemberAddressFactory.CreateMemberAddress(); MyDelivery = DeliveryWayFactory.CreateDeliveryWay(); MyPayway = PayWayFactory.CreatePayWay(); Mydelierytime = DeliveryTimeFactory.CreateDeliveryTime(); MyInvioce = OrdersInvoiceFactory.CreateOrdersInvoice(); MyFavorFee = PromotionFavorFeeFactory.CreatePromotionFavorFee(); MyCoupon = PromotionFavorCouponFactory.CreatePromotionFavorCoupon(); MyPolicy = PromotionFavorPolicyFactory.CreatePromotionFavorPolicy(); MyGift = PromotionFavorGiftFactory.CreatePromotionFavorGift(); MyCommission = SupplierCommissionCategoryFactory.CreateSupplierCommissionCategory(); MySupplier = SupplierFactory.CreateSupplier(); MyFavor = PromotionFavorFactory.CreatePromotionFavor(); MyLimit = PromotionLimitFactory.CreatePromotionLimit(); MyMemberFavor = MemberFavoritesFactory.CreateMemberFavorites(); pageurl = new PageURL(int.Parse(Application["Static_IsEnable"].ToString())); }
private void validateSupplier(ISupplier value) { if (value == null) { throw new ArgumentOutOfRangeException("Supplier", "Supplier was not found"); } }
public virtual void removeSupplier(ISupplier supplier) { lock (suppliers) { suppliers.Remove(supplier.Id); } }
internal GetSupplierModel(ISupplier supplier) { SupplierId = supplier.Id; Name = supplier.Name; Address = CreateAddressModel(supplier.Address); PrimaryContact = CreatePrimaryContactModel(supplier.PrimaryContact); }
protected CargoCarrier(IRouteMap routeMap, ISupplier supplier) { _routeMap = routeMap ?? throw new ArgumentNullException(nameof(routeMap)); _supplier = supplier ?? throw new ArgumentNullException(nameof(supplier)); _route = routeMap.FromLocation(supplier); }
public Storage(ISupplier supplier) { this.supplier = supplier; storageItems = new List <IGlassware>(); productData = new List <ProductData>(); ParseDataFromSupplier(); }
/// <summary> /// Instantiates the bitmap counting memory cache. /// </summary> public static CountingMemoryCache <ICacheKey, CloseableImage> Get( ISupplier <MemoryCacheParams> bitmapMemoryCacheParamsSupplier, IMemoryTrimmableRegistry memoryTrimmableRegistry, PlatformBitmapFactory platformBitmapFactory, bool isExternalCreatedBitmapLogEnabled) { IValueDescriptor <CloseableImage> valueDescriptor = new ValueDescriptorImpl <CloseableImage>( (value) => { return(value.SizeInBytes); }); ICacheTrimStrategy trimStrategy = new BitmapMemoryCacheTrimStrategy(); CountingMemoryCache <ICacheKey, CloseableImage> countingCache = new CountingMemoryCache <ICacheKey, CloseableImage>( valueDescriptor, trimStrategy, bitmapMemoryCacheParamsSupplier, platformBitmapFactory, isExternalCreatedBitmapLogEnabled); memoryTrimmableRegistry.RegisterMemoryTrimmable(countingCache); return(countingCache); }
/// <summary> /// This is an optimization that will fault all the ConcatVectors into memory, and future .get() on the Supplier objs /// will result in a very fast return by reference. /// </summary> /// <remarks> /// This is an optimization that will fault all the ConcatVectors into memory, and future .get() on the Supplier objs /// will result in a very fast return by reference. Basically this works by wrapping the output of the old thunks /// inside new, thinner closures that carry around the answer in memory. This is a no-op if vectors were already /// cached. /// </remarks> public virtual void CacheVectors() { if (originalThunks != null) { return; } originalThunks = new NDArray <ISupplier <ConcatVector> >(GetDimensions()); // OPTIMIZATION: // Rather than use the standard iterator, which creates lots of int[] arrays on the heap, which need to be GC'd, // we use the fast version that just mutates one array. Since this is read once for us here, this is ideal. IEnumerator <int[]> fastPassByReferenceIterator = FastPassByReferenceIterator(); int[] assignment = fastPassByReferenceIterator.Current; while (true) { ISupplier <ConcatVector> originalThunk = GetAssignmentValue(assignment); originalThunks.SetAssignmentValue(assignment, originalThunk); // Construct a new, thinner closure around the cached value ConcatVector result = originalThunk.Get(); SetAssignmentValue(assignment, null); // Set the assignment arrays correctly if (fastPassByReferenceIterator.MoveNext()) { fastPassByReferenceIterator.Current; } else { break; } } }
// This method starts an asynchronous calculation. // First, it checks the supplied task ID for uniqueness. // If taskId is unique, it creates a new WorkerEventHandler // and calls its BeginInvoke method to start the calculation. public void SearchAsync( FlightSearchParams flightSearchParams, ISupplier supplier, object taskId) { // Create an AsyncOperation for taskId. AsyncOperation asyncOp = AsyncOperationManager.CreateOperation(taskId); // Multiple threads will access the task dictionary, // so it must be locked to serialize access. lock (_userStateToLifetime.SyncRoot) { if (_userStateToLifetime.Contains(taskId)) { throw new ArgumentException( "Task ID parameter must be unique", "taskId"); } _userStateToLifetime[taskId] = asyncOp; } // Start the asynchronous operation. var workerDelegate = new WorkerEventHandler(SearchWorker); workerDelegate.BeginInvoke( flightSearchParams, supplier, asyncOp, null, null); IsBusy = true; }
public IBooking CreateBooking(ISupplier supplier, ICustomer customer, string sale, int bookingNumber, DateTime StartDate, DateTime EndDate) { //Calls Bookingcollection class for create return bookingCollection.Create((Supplier)supplier, (Customer)customer, sale, bookingNumber, StartDate, EndDate); }
public InitialState(ProcessBooking bookingProc) : base(bookingProc.Booking) { this.bookingProc = bookingProc; SupplierFactory factory = new SupplierFactory(); supplier = factory.GetSupplier(bookingProc.Booking); }
/// <summary> /// Checks if any of the suppliers has Article in specified price range in stock /// </summary> /// <param name="id">Id of the article</param> /// <param name="maxExpectedPrice">Max price of the Article</param> /// <param name="suppliers">List of suppliers available</param> /// <param name="index">recursion index</param> /// <returns>Article if found, null if not existing</returns> private Article FindArticle(int id, int maxExpectedPrice, ISupplier[] suppliers, int index = 0) { if (suppliers.Length == index) { logger.Debug("No more suppliers to check"); return(null); } ISupplier supplier = suppliers[index]; logger.Debug($"Checking supplier [Name = {supplier.ToString()}]"); var articleExists = supplier.ArticleInInventory(id); if (articleExists) { Article tempArticle = supplier.GetArticle(id); if (maxExpectedPrice >= tempArticle.ArticlePrice) { return(tempArticle); } } logger.Debug($"Supplier [Name = {supplier.ToString()}]: Article not found, searching at another supplier"); return(FindArticle(id, maxExpectedPrice, suppliers, index + 1)); }
/// <summary> /// 签约 /// </summary> public void AccountSign() { ZhongXinInfo entity = GetZhongXinByID(tools.CheckInt(Request["ID"])); ISupplier mysupplierBll = SupplierFactory.CreateSupplier(); SupplierInfo entitySypplier = mysupplierBll.GetSupplierByID(entity.SupplierID, Public.GetUserPrivilege()); if (entity == null) { Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}"); } string strResult = string.Empty; if (sendmessages.AccountSign(entity.CompanyName, ref strResult)) { entity.Register = 1; entity.SubAccount = strResult; } else { Public.Msg("error", "错误信息", strResult, false, "{back}"); } if (MyBLL.EditZhongXin(entity)) { //推送短信 SMS mySMS = new SMS(); mySMS.Send(entitySypplier.Supplier_Mobile, entity.CompanyName, "zhongxin_info"); Public.Msg("positive", "操作成功", "操作成功", true, "zhongxin_list.aspx"); } else { Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}"); } }
public void Initialize() { _byteBufferRef = CloseableReference <IPooledByteBuffer> .of( new TrivialPooledByteBuffer(new byte[] { }), _releaser); _inputStreamSupplier = new MockSupplier <FileStream>(_inputStream); }
public Orders() { Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); encrypt = EncryptFactory.CreateEncrypt(); MyOrders = OrdersFactory.CreateOrders(); Mylog = OrdersLogFactory.CreateOrdersLog(); MyDelivery = DeliveryWayFactory.CreateDeliveryWay(); MyPayway = PayWayFactory.CreatePayWay(); MyProduct = ProductFactory.CreateProduct(); Mypackage = PackageFactory.CreatePackage(); Myorderdelivery = OrdersDeliveryFactory.CreateOrdersDelivery(); MyFavorFee = PromotionFavorFeeFactory.CreatePromotionFavorFee(); MyCoupon = PromotionFavorCouponFactory.CreatePromotionFavorCoupon(); MyBack = OrdersBackApplyFactory.CreateOrdersBackApply(); MyPolicy = PromotionFavorPolicyFactory.CreatePromotionFavorPolicy(); MySupplier = SupplierFactory.CreateSupplier(); Mydelierytime = DeliveryTimeFactory.CreateDeliveryTime(); MyMember = MemberFactory.CreateMember(); MyConsumption = MemberConsumptionFactory.CreateMemberConsumption(); pageurl = new PageURL(int.Parse(Application["Static_IsEnable"].ToString())); MyAccountLog = MemberAccountLogFactory.CreateMemberAccountLog(); MyFavor = PromotionFavorFactory.CreatePromotionFavor(); MyCouponRule = PromotionCouponRuleFactory.CreatePromotionFavorCoupon(); MyInvoice = OrdersInvoiceFactory.CreateOrdersInvoice(); }
internal Supplier(IDataAccessFacade dataAccessFacade, ISupplier supplierEntity) { this.dataAccessFacade = dataAccessFacade; _supplierEntity = supplierEntity; initializeParty(_supplierEntity); readPaymentRules(); }
public SearchCompletedEventArgs(List<AirItinerary> airItineraries, ISupplier supplier ,Exception error, bool isCancelled, object userState) : base(error, isCancelled, userState) { Results = airItineraries; ErrorMessage = error != null ? error.Message : string.Empty; Supplier = supplier; }
public IBooking CreateBooking(ISupplier supplier, ICustomer customer, string sale, int bookingNumber, DateTime startDate, DateTime endDate) { BookingEntity booking = new BookingEntity(supplier, customer, sale, bookingNumber, startDate, endDate); bookings.Add(booking); return booking; }
public int AddSupplier(string name, string email) { ISupplier supplier = factory.CreateSupplier(name, email); int id = supplierRepository.AddSupplier(supplier); Debug.WriteLine("Supplier with ID " + id + " added to repo from facade"); return(id); }
public GraphTraversalSource WithSideEffect(string key, ISupplier initialValue, IBinaryOperator reducer) { var source = new GraphTraversalSource(new List <ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); source.Bytecode.AddSource("withSideEffect", key, initialValue, reducer); return(source); }
public void AddPaymentRule(ISupplier supplier, ICustomer customer, BookingType bookingType, decimal percentage, int daysOffset, BaseDate baseDate, PaymentType paymentType) { Supplier supp = (Supplier)supplier; Customer cust = (Customer)customer; supp.AddPaymentRule(cust, bookingType, percentage, daysOffset, baseDate, paymentType); }
public GraphTraversalSource WithSack(ISupplier initialValue, IUnaryOperator splitOperator, IBinaryOperator mergeOperator) { var source = new GraphTraversalSource(new List <ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); source.Bytecode.AddSource("withSack", initialValue, splitOperator, mergeOperator); return(source); }
public GraphTraversalSource WithSack(ISupplier initialValue) { var source = new GraphTraversalSource(new List <ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); source.Bytecode.AddSource("withSack", initialValue); return(source); }
public IEnumerable<IInventoryItem> GetInventoryItems(ISupplier supplier) { if (supplier == null) { throw new ArgumentNullException("supplier"); } return _inventoryService.GetInventoryItemsBySupplier(supplier.ToDao()).ToEnumerable<IInventoryItem>(); }
internal Supplier(string name, string note, SupplierType type, IDataAccessFacade dataAccessFacade) { //Calls validation on "name" for securing right input. validateName(name); this.dataAccessFacade = dataAccessFacade; _supplierEntity = dataAccessFacade.CreateSupplier(name, note, type); //Calls party class to put supplierentity as a party. initializeParty(_supplierEntity); }
public IPaymentRule CreatePaymentRule(ISupplier supplierEntity, ICustomer customerEntity, BookingType bookingType, decimal percentage, int daysOffset, BaseDate baseDate, PaymentType paymentType) { PaymentRuleEntity paymentRule = new PaymentRuleEntity(supplierEntity, customerEntity, bookingType, percentage, daysOffset, baseDate, paymentType); SupplierEntity supplier = (SupplierEntity)supplierEntity; supplier.AddPaymentRule(paymentRule); return paymentRule; }
internal PaymentRuleEntity(ISupplier supplierEntity, ICustomer customerEntity, BookingType bookingType, decimal percentage, int daysOffset, BaseDate baseDate, PaymentType paymentType) { Supplier = supplierEntity; Customer = customerEntity; BookingType = bookingType; Percentage = percentage; DaysOffset = daysOffset; BaseDate = baseDate; PaymentType = paymentType; }
public Supplier(ISupplier iSupplier) { Id = iSupplier.Id; Deleted = iSupplier.Deleted; LastUpdated = iSupplier.LastUpdated; SupplierType = iSupplier.SupplierType; Name = iSupplier.Name; ContactPerson = iSupplier.ContactPerson; Email = iSupplier.Email; PhoneNumber = iSupplier.PhoneNumber; Skype = iSupplier.Skype; CreatedDate = iSupplier.CreatedDate; Comment = iSupplier.Comment; Website = iSupplier.Website; }
internal BookingEntity(ISupplier supplier, ICustomer customer, string sale, int bookingNumber, DateTime startDate, DateTime endDate) { Supplier = supplier; Customer = customer; Sale = sale; BookingNumber = bookingNumber; StartDate = startDate; EndDate = endDate; Note = ""; IVAExempt = 0; IVASubject = 0; Subtotal = 0; Service = 0; IVA = 0; ProductRetention = 0; SupplierRetention = 0; TransferAmount = 0; }
private void suppliersDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { selectedSupplier = (ISupplier)suppliersDataGrid.SelectedItem; setValuesInTextBoxes(); }
public void addNewSupplierToDB(ISupplier theSupplier) { try { DataSet ds = new DataSet(); string sql = "SELECT * From Suppliers"; SqlDataAdapter da = new SqlDataAdapter(sql, con); SqlCommandBuilder cb = new SqlCommandBuilder(da); //Generates da.Fill(ds, "SuppliersData"); totSuppliers = ds.Tables["SuppliersData"].Rows.Count; DataRow dRow = ds.Tables["SuppliersData"].NewRow(); dRow[0] = theSupplier.SupplierId; dRow[1] = theSupplier.Name; dRow[2] = theSupplier.Address; dRow[3] = theSupplier.Telephone; dRow[4] = theSupplier.Email; ds.Tables["SuppliersData"].Rows.Add(dRow); da.Update(ds, "SuppliersData"); } catch (System.Exception excep) { if (con.State.ToString() == "Open") con.Close(); Application.Exit(); //Environment.Exit(0); //Force the application to close } }
public void UpdateSupplier(ISupplier supplier) { //Calls the suppliercollection class for update supplierCollection.Update((Supplier) supplier); }
public void DeleteSupplier(ISupplier supplier) { //Calls the suppliercollection class for delete supplierCollection.Delete((Supplier) supplier); }
public void Save(ISupplier supplier) { if(supplier == null) { throw new ArgumentNullException("supplier"); } _inventoryService.Save(supplier.ToDao()); OnActivateSuppliersViewRequested(); }
public void Edit(ISupplier supplier) { ResolveAndActivateSupplierEditView(supplier); }
// This is the method that the underlying, free-threaded // asynchronous behavior will invoke. This will happen on // an arbitrary thread. private void CompletionMethod( List<AirItinerary> airItineraries, ISupplier supplier, Exception exception, bool canceled, AsyncOperation asyncOp) { // If the task was not previously canceled, // remove the task from the lifetime collection. if (!canceled) { lock (_userStateToLifetime.SyncRoot) { _userStateToLifetime.Remove(asyncOp.UserSuppliedState); } } // Package the results of the operation in a // SearchCompletedEventArgs. var e = new SearchCompletedEventArgs( airItineraries, supplier, exception, canceled, asyncOp.UserSuppliedState); // End the task. The asyncOp object is responsible // for marshaling the call. asyncOp.PostOperationCompleted(_onCompletedDelegate, e); // Note that after the call to OperationCompleted, // asyncOp is no longer usable, and any attempt to use it // will cause an exception to be thrown. }
public bool Save(ISupplier supplier) { return _inventoryService.SaveSupplier(supplier.ToDao()); }
private void ResolveAndActivateSupplierEditView(ISupplier supplier) { var region = _regionManager.Regions[RegionNames.MainRegion]; if (region == null) { _logger.Warn("InventoryController.ResolveAndActivateSupplierEditView(): MainRegion not returned from RegionManager."); return; } var viewModel = _container.Resolve<ISupplierEditViewModel>(); if (viewModel == null) { _logger.Warn("InventoryController.ResolveAndActivateSupplierEditView(): ISupplierEditViewModel not resolved by unity container."); return; } viewModel.Supplier = supplier; region.Activate(viewModel.View); }
public void Delete(ISupplier supplier) { if(supplier == null) { throw new ArgumentNullException("supplier"); } var inventoryItems = _inventoryService.GetInventoryItems(supplier.ToDao()); var items = inventoryItems; if (items == null || items.Count() <= 0) { _inventoryService.DeleteSupplier(supplier.Id); return; } //todo so: change after test... var itemSelectionModel = _container.Resolve<IItemSelectionViewModel>(); if (itemSelectionModel == null) { _logger.Warn("InventoryController.Delete(ISuplier): itemSelectionModel not resolved by unity container."); return; } //var region = _regionManager.Regions[RegionNames.MainRegion]; //if (region == null) //{ // _logger.Warn("InventoryController.Delete(ISuplier): MainRegion not returned from RegionManager."); // return; //} itemSelectionModel.InventoryItems = inventoryItems; var win = itemSelectionModel.View as Window; if(win == null) { throw new ApplicationException("Could not resolve ItemSelectionView."); } win.ShowDialog(); //var result = // MessageBox.Show( // String.Format("Diesem Lieferanten sind {0} Artikel zugeordnet. Mit dem Löschen fortfahren?", // inventoryItems.Count()),"Gateworld.Inventory", MessageBoxButton.YesNo); //if (result == MessageBoxResult.No) //{ // return; //} //_inventoryService.DeleteSupplier(supplier.Id); }
public ISupplier UpdateSupplier(ISupplier iSupplier) { iSupplier = supplierController.Update(iSupplier); dataAccessFacade.UpdateSupplier(iSupplier); return iSupplier; }
private void SearchWorker(FlightSearchParams searchParams, ISupplier supplier, AsyncOperation asyncOperation) { Exception exception = null; List<AirItinerary> itineraries = null; // Check that the task is still active. // The operation may have been canceled before // the thread was scheduled. if (!TaskCanceled(asyncOperation.UserSuppliedState)) { try { //DOWORK itineraries = supplier.Search(searchParams); } catch (Exception ex) { exception = ex; } } IsBusy = false; CompletionMethod( itineraries, supplier, exception, TaskCanceled(asyncOperation.UserSuppliedState), asyncOperation); }