本文整理汇总了C#中Categories类的典型用法代码示例。如果您正苦于以下问题:C# Categories类的具体用法?C# Categories怎么用?C# Categories使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Categories类属于命名空间,在下文中一共展示了Categories类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public ActionResult Add(string catTitle = "", int parentID = 0, string image = "", int isLifestyle = 0, string shortDesc = "", string longDesc = "", bool vehicleSpecific = false)
{
// Save the category
List<string> error_messages = new List<string>();
Categories cat = new Categories();
try {
cat = ProductCat.SaveCategory(0, catTitle, parentID, image, isLifestyle, shortDesc, longDesc, vehicleSpecific);
} catch (Exception e) {
error_messages.Add(e.Message);
}
// Make sure we didn't catch any errors
if (error_messages.Count == 0 && cat.catID > 0) {
return RedirectToAction("Index");
} else {
ViewBag.catTitle = catTitle;
ViewBag.parentID = parentID;
ViewBag.image = image;
ViewBag.isLifestyle = isLifestyle;
ViewBag.shortDesc = shortDesc;
ViewBag.longDesc = longDesc;
ViewBag.vehicleSpecific = vehicleSpecific;
ViewBag.error_messages = error_messages;
}
// Get the categories so this category can make the new one a subcategory if they choose
List<DetailedCategories> cats = ProductCat.GetCategories();
ViewBag.cats = cats;
return View();
}
示例2: ContainsCategory
public static int ContainsCategory(Categories category, Categories find)
{
if ((category & find) == find)
return 1;
else
return 0;
}
示例3: AddCategory
/// <summary>
/// AddCategory checks if the category name is not in use, if not in use it adds a new category
/// </summary>
/// <param name="category"></param>
/// <returns></returns>
public static string AddCategory(Categories category)
{
string query = string.Format("SELECT COUNT(*) FROM categories WHERE name = '{0}'", category.Name);
command.CommandText = query;
try
{
conn.Open();
int amountOfCategorys = (int)command.ExecuteScalar();
if (amountOfCategorys < 1) // Check if category does NOT exist
{
// Category does NOT exists, create a new category
query = string.Format(@"INSERT INTO categories VALUES ('{0}')", category.Name);
command.CommandText = query;
command.ExecuteNonQuery();
return "Categorie toegevoegd!";
}
else // Category exists, return error message
{
return "Deze categorie bestaat al, categorie niet toegevoegd.";
}
}
finally
{
conn.Close();
command.Parameters.Clear();
}
}
示例4: TimeMethod
public void TimeMethod(decimal elapsedMiliSeconds, Categories category, Layers layer)
{
if (IsEnabled())
{
WriteEvent(EventIds.TimeMethod, elapsedMiliSeconds, category, layer);
}
}
示例5: Track
public void Track(Categories category, string action, string label = null, int value = 0)
{
if (!_disabled)
_tracker.TrackEventAsync(category.ToString(), action, label, value);
System.Diagnostics.Debug.WriteLine("Analytics: {0}/{1}/{2}/{3}", category.ToString(), action, label, value);
}
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
dbOps = DBOperations.Instance;
links = Links.Instance;
general = General.Instance;
gui = GUIVariables.Instance;
categories = Categories.Instance;
engine = ProcessingEngine.Instance;
imageEngine = ImageEngine.Instance;
tagger = Tagger.Instance;
log = Logger.Instance;
seperator = gui.Seperator;
// QueryString Param Names.
// ratingID
// value
string iid = string.Empty;
string value = string.Empty;
#region CookieAlreadyExists
// START: If a getputsCookie with the Username already exists, do not show the Login Page.
if (Request.Cookies["getputsCookie"] != null)
{
HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
}
if (string.IsNullOrEmpty(UID))
{
}
else
{
}
// END: If a getputsCookie with the Username already exists, do not show the Login Page.
#endregion CookieAlreadyExists
if (Request.QueryString != null && Request.QueryString.Count > 0)
{
// ratingID is the Item IID.
if (!string.IsNullOrEmpty(Request.QueryString["ratingID"]))
{
iid = Request.QueryString["ratingID"];
}
// Value is the Rating given by the user. Value: [0, 1, 2, 3, 4]. So add +1 so as to convert Value: [1, 2, 3, 4, 5]
if (!string.IsNullOrEmpty(Request.QueryString["value"]))
{
int intValue = -1;
value = int.TryParse(Request.QueryString["value"], out intValue) ? (intValue + 1).ToString() : "-1";
}
}
if (!string.IsNullOrEmpty(UID) && !string.IsNullOrEmpty(iid) && !string.IsNullOrEmpty(value))
{
UpdateRatings(UID, iid, value);
}
}
示例7: AllDemoMVCBLL
public AllDemoMVCBLL()
{
Categories = new Categories();
Logins = new Logins();
SubCategories = new SubCategories();
Receipies = new Receipies();
}
示例8: GetWordShouldWorkPropperlyWhenValidInput
public void GetWordShouldWorkPropperlyWhenValidInput(Categories category)
{
var word = this.wordFactory.GetWord(category);
Assert.IsNotNull(word);
Assert.IsNotNull(word.Content);
}
示例9: GetCategories
/// <summary>
/// This function is used to get all the available
/// categories of possible events
/// </summary>
/// <param name="key">Key required to make the API call</param>
/// <returns>JSON in String Format containing all categories</returns>
public string GetCategories(string key)
{
String outputString = "";
int count = 0;
Category category = null;
Categories categories = new Categories();
using (WebClient wc = new WebClient())
{
string xml = wc.DownloadString("http://api.evdb.com/rest/categories/list?app_key=" + key);
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlNodeList root = doc.GetElementsByTagName("category");
count = root.Count;
string json = JsonConvert.SerializeXmlNode(doc);
JObject obj = JObject.Parse(json);
int temp = 0;
while (temp < count)
{
category = new Category();
category.categoryID = (string)obj["categories"]["category"][temp]["id"];
category.categoryName = (string)obj["categories"]["category"][temp]["name"];
categories.categories.Add(category);
temp++;
}
outputString = JsonConvert.SerializeObject(categories);
}
return outputString;
}
示例10: Search
public ViewResult Search(string name, Categories? categoty)
{
var lista = _business.GetActiveProducts();
var model = new ProductList();
if(lista != null)
{
if (!String.IsNullOrEmpty(name) && categoty != null)
model.Products =
lista.Where(
x =>
((!String.IsNullOrEmpty(name) && x.Name.ToLower().Contains(name.ToLower())) && (x.Category.Equals(categoty)))).
Select(x => new Models.Product.Product().InjectFrom(x)).Cast<Models.Product.Product>().ToList();
else if (!String.IsNullOrEmpty(name))
model.Products =
lista.Where(x => !String.IsNullOrEmpty(name) && x.Name.ToLower().Contains(name.ToLower())).Select(
x => new Models.Product.Product().InjectFrom(x)).Cast<Models.Product.Product>().ToList();
else if (categoty != null)
model.Products =
lista.Where(x => x.Category.Equals(categoty)).Select(x => new Models.Product.Product().InjectFrom(x)).Cast
<Models.Product.Product>().ToList();
else
model.Products = lista.Select(x => new Models.Product.Product().InjectFrom(x)).Cast<Models.Product.Product>().ToList();
}
else
{
model.Products = new List<Models.Product.Product>();
}
return View("Index",model);
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
links = Links.Instance;
gui = GUIVariables.Instance;
dbOps = DBOperations.Instance;
categories = Categories.Instance;
log = Logger.Instance;
engine = ProcessingEngine.Instance;
general = General.Instance;
imageEngine = ImageEngine.Instance;
seperator = gui.Seperator;
if (string.IsNullOrEmpty(Request.QueryString["UID"]))
{
}
else
{
queryStringUID = Request.QueryString["UID"].Trim().ToLower();
}
if (string.IsNullOrEmpty(queryStringUID))
{
}
else
{
LoadComments(queryStringUID);
}
}
示例12: Exit
public void Exit(Categories category, Layers layer, string className, string methodName, string message, string outArgs, long? elapsedMiliSeconds)
{
if (IsEnabled())
{
WriteEvent(EventIds.MethodEnd, category, layer, className, methodName, message, outArgs, elapsedMiliSeconds);
}
}
示例13: Enter
public void Enter(Categories category, Layers layer, string className, string methodName, string message, string inArgs)
{
if (IsEnabled())
{
WriteEvent(EventIds.MethodStart, category, layer, className, methodName, message, inArgs);
}
}
示例14: TraceCallGraphAspect
public TraceCallGraphAspect(Categories category, Layers layer, CallFlowType flowType=CallFlowType.Layer, bool logCallStack=false)
{
this.Category = category;
this.Layer = layer;
this.FlowType = flowType;
this.LogCallStack = logCallStack;
}
示例15: Demographic
public Demographic(int turn, Categories category, float value, float average, int rank)
{
Turn = turn;
Category = category;
Value = value;
Average = average;
Rank = rank;
}