public IQueryable <Employee> MyDepartmentalColleagues()
        {
            var me = CurrentUserAsEmployee();

            if (me == null)
            {
                Container.WarnUser("Current user unknown");
                return(null);
            }
            else
            {
                return(me.ColleaguesInSameDept());
            }
        }
 public void AddNewSalesReason(SalesReason reason)
 {
     if (SalesOrderHeaderSalesReason.All(y => y.SalesReason != reason))
     {
         var link = Container.NewTransientInstance <SalesOrderHeaderSalesReason>();
         link.SalesOrderHeader = this;
         link.SalesReason      = reason;
         Container.Persist(ref link);
         SalesOrderHeaderSalesReason.Add(link);
     }
     else
     {
         Container.WarnUser(string.Format("{0} already exists in Sales Reasons", reason.Name));
     }
 }
        public SalesOrderDetail AddNewDetail(Product product,
                                             [DefaultValue((short)1), Range(1, 999)] short quantity)
        {
            int stock = product.NumberInStock();

            if (stock < quantity)
            {
                var t = Container.NewTitleBuilder();
                t.Append("Current inventory of").Append(product).Append(" is").Append(stock);
                Container.WarnUser(t.ToString());
            }
            var sod = Container.NewTransientInstance <SalesOrderDetail>();

            sod.SalesOrderHeader    = this;
            sod.SalesOrderID        = SalesOrderID;
            sod.OrderQty            = quantity;
            sod.SpecialOfferProduct = product.BestSpecialOfferProduct(quantity);
            sod.Recalculate();

            return(sod);
        }
 public void GenerateInfoAndWarning()
 {
     Container.InformUser("Inform User of something");
     Container.WarnUser("Warn User of something else ");
 }
Beispiel #5
0
 /// <summary>
 ///     Warn the user about a situation with the specified message. The container should guarantee to display
 ///     this warning to the user.
 /// </summary>
 /// <seealso cref="InformUser" />
 /// <seealso cref="RaiseError" />
 protected static void WarnUser(string message)
 {
     Container.WarnUser(message);
 }