public Guid Adjust(Guid userId, decimal amount, CategoryType type, DateTime payDate, string remark)
 {
     var personalAccount = new PersonalAccountDomain(userId);
     var water = new PersonalAccountWaterDomain(personalAccount, amount, type, payDate, remark);
     unitOfWork.Commit();
     return water.Entity.Id;
 }
        public Guid Add(string name, CategoryType type, int? num)
        {
            CategoryDomain domain = new CategoryDomain(name, type, num);
            unitOfWork.Commit();

            return domain.Entity.Id;
        }
        public List<CategoryDTO> GetAll(CategoryType type)
        {
            List<CategoryDTO> result = new List<CategoryDTO>();
            List<Category> data = _categoryRepository.GetAll(type);

            return ListToDTO<Category, CategoryDTO>(data);
        }
       public IList<CategoryInfo> GetCategory(CategoryType categoryType, int categoryID)
       {
           SqlHelper objSqlHelper = new SqlHelper();
           
           List<CategoryInfo> categorys = new List<CategoryInfo>();
           SqlParameter[] objParams = new SqlParameter[2];
           objParams[0] = new SqlParameter("@categoryType", SqlDbType.Int, 4);
           objParams[1] = new SqlParameter("@categoryID", SqlDbType.Int, 4);
           objParams[0].Value = (int)categoryType;
           objParams[1].Value = categoryID;

           SqlDataReader reader = objSqlHelper.ExecuteReader("je_Cat_GetCategory", objParams); ;
           while (reader.Read())
           {
               
               CategoryInfo item = new CategoryInfo();
               item.CategoryID = reader.GetInt32(reader.GetOrdinal("categoryID"));
               item.CategoryName = reader.GetString(reader.GetOrdinal("categoryName"));
               item.ParentID = reader.GetInt32(reader.GetOrdinal("parentID"));
               item.IsMain = reader.GetBoolean(reader.GetOrdinal("IsMain"));
               categorys.Add(item);
           }
           reader.Close();
           objSqlHelper.close();
           
           return categorys;
       }
Beispiel #5
0
 /// <summary>
 /// Gets the categories for the specified category type.
 /// </summary>
 /// <param name="catType">Type of the cat.</param>
 /// <param name="activeOnly">if set to <c>true</c> [active only].</param>
 /// <returns></returns>
 public override ICollection<LinkCategory> GetCategories(CategoryType catType, bool activeOnly)
 {
     using (IDataReader reader = _procedures.GetCategory(null, null, activeOnly, BlogId, (int)catType))
     {
         return reader.ReadCollection(r => r.ReadLinkCategory());
     }
 }
 public TerrainPaintBrushCatalogResource(int APIversion,
     uint version,
     uint brushVersion,
     Common common,
     BrushOperation normalOperation, BrushOperation oppositeOperation, TGIBlock profileTexture, BrushOrientation orientation,
     float width, float strength, byte baseTextureValue, float wiggleAmount,
     TGIBlock brushTexture,
     TerrainType terrain, CategoryType category
     )
     : base(APIversion,
         version,
         brushVersion,
         common,
         normalOperation,
         oppositeOperation,
         profileTexture,
         orientation,
         width,
         strength,
         baseTextureValue,
         wiggleAmount
     )
 {
     this.brushTexture = (TGIBlock)brushTexture.Clone(OnResourceChanged);
     this.terrain = terrain;
     this.category = category;
 }
 public TerrainPaintBrushCatalogResource(int APIversion, Stream unused, TerrainPaintBrushCatalogResource basis)
     : base(APIversion, null, basis)
 {
     this.brushTexture = (TGIBlock)basis.brushTexture.Clone(OnResourceChanged);
     this.terrain = basis.terrain;
     this.category = basis.category;
 }
 /// <summary>
 /// 
 /// </summary>
 public CategoryFeatureType getCategoryFeature(SiteCodeType site, CategoryType category)
 {
     Hashtable myCategoryMap = (Hashtable)_categoryFeaturesBySite[site];
      if(myCategoryMap != null) {
      return (CategoryFeatureType)myCategoryMap[category];
      }
      return null;
 }
Beispiel #9
0
 public long Add(string name, long parentId, CategoryType type)
 {
     string query = QueryBuilder.Insert("categories", GetNameColumnPair(name),
                                                           GetParentIdColumnPair(parentId),
                                                           GetTypeColumnPair(type));
     using (SQLiteCommand insert = new SQLiteCommand(query, m_conn))
         return (long) insert.ExecuteScalar();
 }
Beispiel #10
0
 public Category(string name, long categoryId, long parentId, CategoryType type, double seqNo)
 {
     this.categoryId = categoryId;
     this.name = name;
     this.parentId = parentId;
     this.type = type;
     this.seqNo = seqNo;
 }
Beispiel #11
0
        /// <summary>
        /// Basic ctor that recieves an indicator of which category group
        ///  the category is being added to
        /// </summary>
        /// <param name="categoryType">Category group indicator</param>
        public AddCategoryUI(CategoryType categoryType)
        {
            InitializeComponent();
            CategoryType = categoryType;

            _context = new AccountingDataContext();
            _categoryService = new CategoryService(_context);
        }
Beispiel #12
0
 private void Handle(CategoryUpdatedEvent evnt)
 {
     _name   = evnt.Name;
     _url    = evnt.Url;
     _thumb  = evnt.Thumb;
     _type   = evnt.Type;
     _isShow = evnt.IsShow;
     _sort   = evnt.Sort;
 }
Beispiel #13
0
        //
        // Note: All calls to this function should occur in administrator initiated
        // processes. No calls to this function should as a result of an HTTP request from
        // a SOAP API.
        // This is verified to be true on 3/1/2002 by creeves
        //
        public static void OperatorMail(SeverityType severity, CategoryType category, OperatorMessageType messageId, string message)
        {
            string mailTo = Config.GetString("Debug.MailTo", null);

            if (null == mailTo)
            {
                Debug.Write(
                    SeverityType.Info,
                    CategoryType.Config,
                    "Skipping send of operator mail.  Configuration setting 'Debug.MailTo' not set.");

                return;
            }

            Debug.VerifySetting("Debug.MailFrom");

            try
            {
                string mailCc      = Config.GetString("Debug.MailCc", null);
                string mailSubject = Config.GetString(
                    "Debug.MailSubject",
                    "Operator message from {0}.  Severity: {1}, Category: {2}");

                MailMessage mail = new MailMessage();

                mail.To      = mailTo;
                mail.From    = Config.GetString("Debug.MailFrom");
                mail.Subject = String.Format(
                    mailSubject,
                    System.Environment.MachineName,
                    severity.ToString(),
                    category.ToString(),
                    (int)messageId);

                if (null != mailCc)
                {
                    mail.Cc = mailCc;
                }

                mail.BodyFormat = MailFormat.Text;
                mail.Body       =
                    "SEVERITY: " + severity.ToString() + "\r\n" +
                    "CATEGORY: " + category.ToString() + "\r\n" +
                    "EVENT ID: " + (int)messageId + "\r\n\r\n" +
                    message;

                SmtpMail.Send(mail);
            }
            catch (Exception e)
            {
                Debug.OperatorMessage(
                    SeverityType.Error,
                    CategoryType.None,
                    OperatorMessageType.CouldNotSendMail,
                    "Could not send operator mail.\r\n\r\nDetails:\r\n\r\n" + e.ToString());
            }
        }
Beispiel #14
0
 public void ToModel(Category entity)
 {
     if (entity != null)
     {
         this.Id   = entity.Id;
         this.Name = entity.Name;
         this.Type = entity.Type;
     }
 }
Beispiel #15
0
        public void Reset()

        {   //Default values:
            this.name   = "No name";
            this.gender = GenderType.unknown;
            this.age    = 0;
            this.id     = "0000";
            category    = CategoryType.Mammal;
        }
Beispiel #16
0
 public void Populate()
 {
     if (Owner != null)
     {
         List <MultimediaLink> data = Service.GetMultimediaItems(CategoryType.ToString(), Owner.ObjectID.Value);
         ReloadMultimediaPanel(data);
         IsPopulated = true;
     }
 }
Beispiel #17
0
        /// <summary>
        /// Ugly method for adding a new animal to the list, too many parameters
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="age">Age</param>
        /// <param name="gender">Gender</param>
        /// <param name="category">Category</param>
        /// <param name="species">Species</param>
        /// <param name="categorySpecific">Specific information for the category</param>
        /// <param name="animalSpecific">Specific information for the species</param>
        public void AddNewAnimal(string name, double age, GenderType gender, CategoryType category, string species, string categorySpecific, string animalSpecific)
        {
            var animal = AnimalFactory.CreateAnimal(category, species, ++_numberOfAnimals, categorySpecific, animalSpecific);

            animal.Name   = name;
            animal.Age    = age;
            animal.Gender = gender;
            _animalList.Add(animal);
        }
Beispiel #18
0
        public Task ChangeCategoryType(CategoryType categoryType)
        {
            if (categoryType != CategoryType)
            {
                CategoryType = categoryType;
            }

            return(this);
        }
Beispiel #19
0
        public void ChangeType(CategoryType type)
        {
            if (type == CategoryType.None)
            {
                throw new ArgumentNullException(nameof(type));
            }

            Type = type;
        }
Beispiel #20
0
        private static void AddNewTransactions(object sender, CategoryType categoryType)
        {
            Button button  = (Button)sender;
            var    project = (ProjectViewModel)button.DataContext;

            var monthVm = project.CurrentYear.CurrentMonthVm;

            monthVm.AddNewTransaction(categoryType);
        }
Beispiel #21
0
 public Product(int quantity, decimal price, string description, string productName, bool isImported, CategoryType category)
 {
     Quantity    = quantity;
     Price       = price * quantity;
     Description = description;
     ProductName = productName;
     IsImported  = isImported;
     Category    = category;
 }
 public IEnumerable <Category> GetCategoriesWithType(CategoryType type)
 {
     using (var db = new ApplicationContext())
     {
         return(db.Categories
                .Where(category => category.Type == type)
                .ToList());
     }
 }
Beispiel #23
0
        public RepositoryKW(ApplicationDbContext ctx, IOptions <AppSettings> settings) : base(ctx)
        {
            categoryType = settings.Value.CategoryType;

            countOfSimilarArticlesOnArticlePage = Convert.ToInt32(settings.Value.CountOfSimilarArticlesOnArticlePage);
            pageSize       = Convert.ToInt32(settings.Value.PageSize);
            pageAdminSize  = Convert.ToInt32(settings.Value.PageAdminSize);
            pageSearchSize = Convert.ToInt32(settings.Value.PageSearchSize);
        }
Beispiel #24
0
 public AccountItem(string Name, CategoryType Category, Money Amount, DateTime OccuredTime, string Content = "", string Note = "")
 {
     this.Name        = Name;
     this.Category    = Category;
     this.Amount      = Amount;
     this.OccuredTime = OccuredTime;
     this.Content     = Content;
     this.Note        = Note;
 }
Beispiel #25
0
 private void lvFoodCategory_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lvFoodCategory.SelectedIndex != -1)
     {
         currentCategorytype = e.AddedItems.Cast <CategoryType>().ToList()[0];
         RefreshFoodCollectionView();
         // RefreshCategory(e.AddedItems.Cast<CategoryType>().ToList()[0]);
     }
 }
Beispiel #26
0
        // Adds an animal to the list in AnimalManager(via ListManager).
        private void addAnimal(object sender, EventArgs e)
        {
            Animal animalObject;

            if (listBoxCategories.SelectedItem != null)
            {
                if (listBoxAnimalObjects.SelectedItem != null)
                {
                    CategoryType selectedCategory = getSelectedCategory();

                    /* Depending on the category selected, an animal object
                     * will be created of type Mammal or Bird, by calling either
                     * the MammalFactory or the BirdFactory. */
                    switch (selectedCategory)
                    {
                    case CategoryType.Mammal:
                        MammalSpecies mammalSpecie = (MammalSpecies)Enum.Parse(typeof(MammalSpecies), listBoxAnimalObjects.SelectedItem.ToString());
                        animalObject = MammalFactory.CreateMammal(mammalSpecie);
                        break;

                    case CategoryType.Bird:
                        BirdSpecies birdSpecie = (BirdSpecies)Enum.Parse(typeof(BirdSpecies), listBoxAnimalObjects.SelectedItem.ToString());
                        animalObject = BirdFactory.CreateBird(birdSpecie);
                        break;

                    default:
                        animalObject = null;
                        break;
                    }

                    // If validation of entered data is successful. (validateInput returns true)
                    if (validateInput(animalObject))
                    {
                        // Generates a unique id for the animal
                        animalManager.generateUniqueId(animalObject);
                        // Adds the validated animal object to the list in ListManager.
                        animalManager.Add(animalObject);
                        listViewAnimals.Items.Add(createListViewItem(animalObject));
                        // Informs the user that everything succeeded.
                        MessageBox.Show(animalObject.Name + " has been added to the list!", "Animal has been added successfully", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        // Resets graphical elements to their initial state.
                        initInterface();
                        unsavedChanges = true;
                    }
                }
                // If trying to add an animal with no specific animal selected.
                else
                {
                    validationNotSuccessful("Please select an animal to add");
                }
            }
            // If trying to add an animal with no category selected.
            else
            {
                validationNotSuccessful("Please select a category");
            }
        }
        void Add()
        {
            if (this.transfer != null)
            {
                return;
            }

            money.Categories.BeginUpdate(true);
            try
            {
                IntelliComboBoxItem item = (IntelliComboBoxItem)this.comboBoxCategory.SelectedItem;
                string cat = this.comboBoxCategory.Text;
                if (item != null)
                {
                    if (cat == item.ToString())
                    {
                        cat = item.EditValue.ToString();
                    }
                }

                CategoryType type = (CategoryType)StringHelpers.ParseEnum(typeof(CategoryType), this.comboBoxType.Text, (int)CategoryType.None);
                string       text = cat;
                if (text != null && text.Length > 0)
                {
                    this.category = this.categories.GetOrCreateCategory(text, type);
                }

                TaxCategory tc = this.comboTaxCategory.SelectedItem as TaxCategory;
                if (tc != null)
                {
                    this.category.TaxRefNum = tc.RefNum;
                }
                else
                {
                    this.category.TaxRefNum = 0;
                }

                this.category.Description = this.textBoxDescription.Text;
                if (this.category.Type != type)
                {
                    this.category.Type = type;
                    PropagateCategoryTypeToChildren(this.category);
                }

                this.category.Budget = StringHelpers.ParseDecimal(this.textBoxBudget.Text, 0);

                var   picker = this.ColorPicker;
                Color color  = picker.Color;
                this.category.Color = color.ToString();
                ColorAndBrushGenerator.SetNamedColor(this.category.GetFullName(), color);
            }
            finally
            {
                // if parent categories were added then set their type & color also.
                money.Categories.EndUpdate();
            }
        }
 public ICollection <Size> GetSizes(CategoryType type, Sex sex)
 {
     return(type == CategoryType.Clothes
         ? sizesRepository.All().Where(s => s is ClothesSize).ToList()
         : sizesRepository.All()
            .Where(s => s is ShoesSize && s.Sex != null && s.Sex == sex)
            .OrderBy(s => int.Parse(s.Name))
            .ToList());
 }
Beispiel #29
0
 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
 {
     if (value is CategoryType)
     {
         CategoryType type = (CategoryType)value;
         return(type.ToString()[0].ToString());
     }
     return("");
 }
Beispiel #30
0
        internal static StatusArgs Log(CategoryType category, StatusType statusType, string fmt, params object[] args)
        {
            StatusArgs statusArgs = new StatusArgs(category, statusType, fmt, args);

            lock (mLogLock)
            {
                return(Log(statusArgs));
            }
        }
Beispiel #31
0
        public Category(CategoryType categoryType)
        {
            Validator.CheckIfNull(categoryType, string.Format(GlobalConstants.ObjectCannotBeNull, "Category type"));

            this.categoryType    = categoryType;
            this.easyQuestions   = new List <IQuestion>();
            this.normalQuestions = new List <IQuestion>();
            this.hardQuestions   = new List <IQuestion>();
        }
        private async Task AuthorizeCategory(Transaction resource, CategoryType type)
        {
            var category = resource.Category ?? await _categoryService.Get(resource.CategoryId);

            if (category.Type != type)
            {
                throw new NotCorrectCategoryException($"The type of the category was not correct, expected {type}, but was {category.Type}");
            }
        }
Beispiel #33
0
 public CategoryUpdatedEvent(string name, string url, string thumb, CategoryType type, bool isShow, int sort)
 {
     Name   = name;
     Url    = url;
     Thumb  = thumb;
     Type   = type;
     IsShow = isShow;
     Sort   = sort;
 }
Beispiel #34
0
 public MenuItem(string itemName, string itemDescription, double itemPrice, CategoryType itemCategory)
 {
     ItemID = Accumulator;
     Accumulator++;
     ItemName        = itemName;
     ItemPrice       = itemPrice;
     ItemDescription = itemDescription;
     Category        = itemCategory;
 }
        public async Task <ActionResult> DeleteConfirmed(long id)
        {
            CategoryType ward = await db.CategoryTypes.FindAsync(id);

            db.CategoryTypes.Remove(ward);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
 public static BootstrapSelectVm ToBootstrapSelectVm(this CategoryType category)
 {
     return(new BootstrapSelectVm()
     {
         SelectedItem = category.ToString(),
         SelectedItemText = category.GetDescriptionOfEnum(),
         SourceList = CategoryType.Incoming.ToList()
     });
 }
        public IActionResult Create(string productId, CategoryType type, Sex sex)
        {
            var model = new CreateSizeViewModel
            {
                AllSizes = service.GetSizes(type, sex).Select(s => s.Map <Size, SizeListItemViewModel>()).ToList()
            };

            return(View(model));
        }
        public IncomeExpenseCategory(Data.Models.Category data, DateTime startDate, DateTime endDate, int averageDividend)
        {
            var transactions = new SqlDataServices <Data.Models.Transactions>().GetAll(data.ID, typeof(Data.Models.Category)).Where(e => e.Date >= startDate && e.Date <= endDate);

            this.Name            = data.Name;
            this.Total           = transactions.Select(e => e.Amount).Sum();
            this.Average         = this.Total / averageDividend;
            this.IncomeOrExpense = data.Type;
        }
Beispiel #39
0
        private List <Question> ChooseQuestion(CategoryType categoryType, int difficulty)
        {
            List <Question> availableQuestions = Current.Instance.Telemetry[categoryType].Questions[difficulty];
            Question        chosenQuestion     = availableQuestions[Rand.Next(availableQuestions.Count)];
            List <Question> question           = new List <Question>();

            question.Add(chosenQuestion.Clone());
            return(question);
        }
Beispiel #40
0
 public FetchManyExpression(CategoryType type, IExpression predicate, IExpression first, IExpression last, List <string> include, OrderByClauseList orderBy)
 {
     this.type      = type;
     this.predicate = predicate;
     this.first     = first;
     this.last      = last;
     this.include   = include;
     this.orderBy   = orderBy;
 }
Beispiel #41
0
 public MenuItem(string name, double price, string description, CategoryType category)
 {
     Id = idCounter;
     idCounter++;
     Name        = name;
     Price       = price;
     Description = description;
     Category    = category;
 }
Beispiel #42
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="nickName"></param>
 /// <param name="age"></param>
 /// <param name="category"></param>
 /// <param name="gender"></param>
 /// <param name="canFly"></param>
 public Insect(string ID, string nickName, int age, CategoryType category, GenderType gender, bool canFly)
 {
     // TODO: Complete member initialization
     this.ID = ID;
     this.NickName = nickName;
     this.Age = age;
     this.Category = category;
     this.Gender = gender;
     this.canFly = canFly;
 }
Beispiel #43
0
 private void Add(CodeBaseActionProxy action, CategoryType categoryType)
 {
     Category category;
     if(_categoriesByType.ContainsKey(categoryType))
         category = _categoriesByType[categoryType];
     else {
         category = new Category(categoryType);
         _categoriesByType[categoryType] = category;
     }
     category.Items.Add(action);
 }
Beispiel #44
0
 /// <summary>
 /// Translates the enumerated ValueType into the string prefixed used within the dictionary
 /// </summary>
 /// <param name="valueType">Enumeration value of the type</param>
 /// <returns>Enumerated ValueType into the string prefixed used within the dictionary</returns>
 private static string GetPrefix(CategoryType valueType)
 {
     switch (valueType)
     {
         case CategoryType.AlarmStates:          return AlarmStatesPrefix;
         case CategoryType.FaultCodes:           return FaultCodesPrefix;
         case CategoryType.BooleanTypes:         return BooleanTypesPrefix;
         case CategoryType.ConditionStates:      return ConditionStatePrefix;
         default: return InvalidPrefix;
     }
 }
        public List<Product> GetProductByPage(int Page, int PageSize, CategoryType ct, bool IsDESC)
        {
            SqlParameter[] sprms = new SqlParameter[] {
                                        new SqlParameter("@CategoryType", ct.ToString()),
                                        new SqlParameter("@PageNumber",Page),
                                        new SqlParameter("@PageSize",PageSize)
            };

            DataTable dt = _dataAccess.Query("ProductAPI_GetProductsByPage", sprms);
            return EntityHelper<Product>.ConvertToList(dt);
        }
Beispiel #46
0
 /// <summary>
 /// Constructor overloaded
 /// </summary>
 /// <param name="p"></param>
 /// <param name="p_2"></param>
 /// <param name="category"></param>
 /// <param name="gender"></param>
 /// <param name="wingSpan"></param>
 /// <param name="quaranteen"></param>
 /// <param name="numberOfDays"></param>
 public Bird(string p, string p_2, CategoryType category, GenderType gender, double wingSpan, bool quaranteen, int numberOfDays)
 {
     // TODO: Complete member initialization
     this.p = p;
     this.p_2 = p_2;
     this.Category = category;
     this.Gender = gender;
     this.wingSpan = wingSpan;
     this.quaranteen = quaranteen;
     this.NumberOfDays = numberOfDays;
 }
Beispiel #47
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.1 SCHEMA                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="CategoryCore"/> class.
        /// </summary>
        /// <param name="parent">
        /// The parent. 
        /// </param>
        /// <param name="category">
        /// The sdmxObject. 
        /// </param>
        public CategoryCore(IIdentifiableObject parent, CategoryType category)
            : base(category, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Category), parent)
        {
            this._categories = new List<ICategoryObject>();
            if (category.Item != null)
            {
                foreach (Category currentCat in category.Item)
                {
                    this._categories.Add(new CategoryCore(this, currentCat.Content));
                }
            }
        }
Beispiel #48
0
 public static Category BuildCategory(AccountingUser user, CategoryType catType = null, TransactionType transType = null, Category parentCategory = null)
 {
     return new Category
     {
         AccountingUser = user,
         CategoryType = catType == null ? new CategoryType
         {
             Name = "TestCategoryType"
         } : catType,
         ParentCategory = parentCategory,
     };
 }
Beispiel #49
0
 public CMS(AEvent aDevice, CategoryType type, System.Collections.Hashtable ht, DeviceType devType, System.Collections.Hashtable DevRange, Degree degree)
 {
     Initialize(aDevice, type, ht, devType, DevRange, degree);
     this.GetMessRuleData += new GetMessRuleDataHandler(CMS_GetMessRuleData);
     List<object> messColors = (List<object>)com.select(DBConnect.DataType.MessColor, Command.GetSelectCmd.getMessColor());
     messColorsHT = new System.Collections.Hashtable();
     foreach (object obj in messColors)
     {
         MessColor mess = (MessColor)obj;
         messColorsHT.Add(mess.ID, mess);
     }
 }
 internal RssLink CreateCategory(string name, string url, string thumbUrl, CategoryType categoryType, string description, Category parentCategory)
 {
     RssLink category = new RssLink();
     category.Name = name;
     category.Url = url;
     category.Thumb = thumbUrl;
     category.Other = categoryType;
     category.Description = description;
     category.HasSubCategories = categoryType != CategoryType.None;
     category.SubCategoriesDiscovered = false;
     category.ParentCategory = parentCategory;
     return category;
 }
Beispiel #51
0
 public static bool IsPositive(CategoryType type)
 {
     switch (type)
     {
         case CategoryType.Expense:
         case CategoryType.TransferOut:
             return false;
         case CategoryType.Income:
         case CategoryType.TransferIn:
             return true;
     }
     Debug.Assert(false);
     return false;
 }
Beispiel #52
0
 public static int Sign(CategoryType type)
 {
     switch (type)
     {
         case CategoryType.Expense:
         case CategoryType.TransferOut:
             return -1;
         case CategoryType.Income:
         case CategoryType.TransferIn:
             return 1;
     }
     Debug.Assert(false);
     return 0;
 }
Beispiel #53
0
        public ICategory CreateCategory(CategoryType categoryType)
        {
            switch(categoryType)
            {
                case CategoryType.BusinessIdeas:
                    return new BusinessIdeasCategory(_questionRepository);
                case CategoryType.Friendly:
                    return new FriendlyCategory(_questionRepository);
                case CategoryType.Misc:
                    return new MiscCategory(_questionRepository);
            }

            return new BusinessIdeasCategory(_questionRepository);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //Viewstate access is lost on postback for this control, so catType defaults to PostCollection.
         //So check if the catType is available in the query string and set this.catType's value to
         //the querystring's category type enumeration
         if (!String.IsNullOrEmpty(Request.QueryString[Keys.QRYSTR_CATEGORYTYPE]))
         {
             CategoryType =
                 (CategoryType)Enum.Parse(typeof(CategoryType), Request.QueryString[Keys.QRYSTR_CATEGORYTYPE]);
         }
         BindCategoriesRepeater();
     }
 }
Beispiel #55
0
 public static string CategoryTypeToString(CategoryType type)
 {
     switch (type)
     {
         case CategoryType.Expense:
             return "Exp";
         case CategoryType.Income:
             return "Inc";
         case CategoryType.TransferIn:
             return "Tri";
         case CategoryType.TransferOut:
             return "Tro";
     }
     Debug.Assert(false);
     return string.Empty;
 }
Beispiel #56
0
        /// <summary>
        /// Returns the string representation of the specified value of the specified valueType, localized to the specified localeId
        /// </summary>
        /// <param name="valueType">Enumeration value of the type</param>
        /// <param name="value">Integer value to be translated</param>
        /// <param name="culture"></param>
        /// <returns>String representation of the specified value of the specified valueType, localized to the specified localeId</returns>
        public static string GetString(CategoryType valueType, int value, CultureInfo culture)
        {
            var localeId = culture.LCID;

            lock (Lock)
            {
                if (!P2000Enums.ContainsKey(localeId))
                {
                    LoadTranslations(localeId);
                }
            }

            var key = GenerateKey(valueType, value);
            
            return P2000Enums[localeId].ContainsKey(key) ? P2000Enums[localeId][key] : key;
        }
Beispiel #57
0
        /// <summary>
        /// Converts a LinkCategoryCollection into a single LinkCategory with its own LinkCollection.
        /// </summary>
        public static LinkCategory MergeLinkCategoriesIntoSingleLinkCategory(string title, CategoryType catType,
                                                                             IEnumerable<LinkCategory> links,
                                                                             BlogUrlHelper urlHelper, Blog blog)
        {
            if (!links.IsNullOrEmpty())
            {
                var mergedLinkCategory = new LinkCategory { Title = title };

                var merged = from linkCategory in links
                             select GetLinkFromLinkCategory(linkCategory, catType, urlHelper, blog);
                mergedLinkCategory.Links.AddRange(merged);
                return mergedLinkCategory;
            }

            return null;
        }
Beispiel #58
0
        public static LinkCategory Links(CategoryType catType, UrlFormats formats)
        {
            switch(catType)
            {
                case CategoryType.PostCollection:
                    return Transformer.BuildLinks(UIText.PostCollection, CategoryType.PostCollection, formats);

                case CategoryType.ImageCollection:
                    return Transformer.BuildLinks(UIText.ImageCollection, CategoryType.ImageCollection, formats);

                case CategoryType.StoryCollection:
                    return Transformer.BuildLinks(UIText.ArticleCollection, CategoryType.StoryCollection, formats);

                default:
                    throw new InvalidOperationException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Invalid CategoryType: {0} via Subtext.Web.UI.UIData.Links",catType));
            }
        }
Beispiel #59
0
        /// <summary>
        /// return an item
        /// </summary>
        /// <returns></returns>
        public static ItemType BuildItem()
        {
            ItemType item = new ItemType();
            item.Site = SiteCodeType.US;
            item.Currency = CurrencyCodeType.USD;
            item.ListingType = ListingTypeCodeType.Chinese;
            String t = "eBay SDK SanityTest " + DateTime.Now + " DO NOT BID!";

            item.ApplicationData="this is an application data";
            item.Title = t;
            item.Description = "This is a test item created by eBay SDK SanityTest.";
            item.StartPrice = new AmountType();
            item.StartPrice.Value = 1.01;
            item.StartPrice.currencyID = item.Currency;
            item.ListingDuration = "Days_7";
            item.Location = "San Jose, CA";
            item.Country = CountryCodeType.US;
            BestOfferDetailsType bo = new BestOfferDetailsType();
            bo.BestOfferEnabled = false;
            item.BestOfferDetails = bo;
            CategoryType cat = new CategoryType();
            cat.CategoryID = "14111";
            item.PrimaryCategory = cat;
            item.Quantity = 1;
            item.QuantitySpecified = true;
            //handling time
            item.DispatchTimeMax =1;
            // Payment
            BuyerPaymentMethodCodeTypeCollection arrPaymentMethods =
                new BuyerPaymentMethodCodeTypeCollection();
            arrPaymentMethods.Add(BuyerPaymentMethodCodeType.PayPal);
            item.PaymentMethods = arrPaymentMethods;
            item.PayPalEmailAddress = "*****@*****.**";
            //shipping service
            item.ShippingDetails = getShippingDetails();
            // Set item picture
            PictureDetailsType pictureDetails = new PictureDetailsType();
            pictureDetails.PictureURL = new StringCollection();
            pictureDetails.PictureURL.Add( "http://pics.ebaystatic.com/aw/pics/navbar/eBayLogoTM.gif");

            item.ReturnPolicy=GetPolicyForUS();

            item.PictureDetails = pictureDetails;
            return item;
        }
Beispiel #60
0
        public bool Add(CategoryType newCategoryType)
        {
            try
            {
                this.db.CategoryTypes.Add(newCategoryType);
                this.db.SaveChanges();

                return true;
            }
            catch (DataException)
            {
                return false;
            }
            catch (Exception)
            {
                return false;
            }
        }