private void SetDataSourcebySearchKey(String SearchPhrase) { ods.TypeName = typeof(CustomerDAC).FullName; ods.EnablePaging = true; ods.SelectParameters.Clear(); ods.SelectParameters.Add("providerID", ProviderID.ToString()); ods.SelectParameters.Add("searchKey", SearchPhrase); ods.SelectParameters.Add("ageFrom", AgeFrom.ToString()); ods.SelectParameters.Add("ageTo", AgeTo.ToString()); ods.SelectParameters.Add("RewardType", RewardType.ToString()); ods.SelectParameters.Add("categoryID", CategoryID.ToString()); ods.SelectMethod = "RetrieveAdminRewardsbySearchPhrase"; ods.SelectCountMethod = "RetrieveAdminRewardsbySearchPhraseCount"; ods.MaximumRowsParameterName = "amount"; ods.StartRowIndexParameterName = "startIndex"; ods.SortParameterName = "sortExpression"; ListViewRewards.DataSourceID = "ods"; SortProducts(); }
public AddCheeseViewModel(IEnumerable <CheeseCategory> cheeseCategories) { //CheeseTypes = new List<SelectListItem>(); //foreach (var cheeseType in Enum.GetValues(typeof(CheeseType))) //{ // CheeseTypes.Add(new SelectListItem // { // Value = ((int)cheeseType).ToString(), // Text = cheeseType.ToString() // }); ; //} cheeseCategory = new List <SelectListItem>(); if (!cheeseCategories.Any()) { cheeseCategory.Add(new SelectListItem { Value = '0'.ToString(), Text = "Empty" }); return; } foreach (var category in cheeseCategories) { cheeseCategory.Add(new SelectListItem { Value = CategoryID.ToString(), Text = Category.Name }); } }
/// <summary> /// Gets the SPDiagnosticsCategory corresponding to a specified CategoryID enum value. /// </summary> /// <param name="id">A CategoryID enum value.</param> /// <returns>A corresponding SPDiagnosticsCategory.</returns> public SPDiagnosticsCategory this[CategoryID id] { get { return(Areas[diagAreaName].Categories[id.ToString()]); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { //radCategories.DataTextField = "Title"; //radCategories.DataNavigateUrlField = "Url"; //radCategories.DataFieldID = "Id"; //radCategories.DataFieldParentID = "ParentId"; //radCategories.DataSource = //radCategories.DataBind(); //var currentItem = radCategories.FindItemByUrl(Request.Url.PathAndQuery); //if (currentItem != null) // currentItem.HighlightPath(); var categories = dataManager.ProductCategory.SelectHierarchy(SiteID); radProductCategoryTreeView.DataSource = GetCategories(); radProductCategoryTreeView.DataTextField = "Title"; radProductCategoryTreeView.DataFieldID = "Id"; radProductCategoryTreeView.DataValueField = "Id"; radProductCategoryTreeView.DataFieldParentID = "ParentId"; radProductCategoryTreeView.DataBind(); if (CategoryID != Guid.Empty) { RadTreeNode rtn = radProductCategoryTreeView.FindNodeByValue(CategoryID.ToString()); rtn.Expanded = true; rtn.Selected = true; rtn.ExpandParentNodes(); } }
protected void Page_Load(object sender, EventArgs e) { UTLUtilities.CL_ActiveModule = 7; this.CheckUserSession(); this.Page.Header.Title = "www.apnerdeal.com "; this.CheckQueryString(); if (!Page.IsPostBack) { string strSku = this.Get_Last_ProfileSpecificSKU(intProfileID, _ClassifiedSeller); this.Generate_ProfileSpecific_UniqueSKU(strSku); this.LoadRecord_Category(); if (CategoryID > 0 && SubcategoryID > 0) { ddlCategory.SelectedValue = CategoryID.ToString(); this.LoadRecord_Subcategory(CategoryID); ddlSubcategory.SelectedValue = SubcategoryID.ToString(); this.LoadRecord_2ndSubcategory(CategoryID, SubcategoryID); if (CategoryID == 1 || CategoryID == 8) { pnlModel.Visible = false; pnlModel.Enabled = false; } else { pnlModel.Visible = true; pnlModel.Enabled = true; } } } }
private void InitializeControls() { insideDhakaCtrl.CategoryID = CategoryID; outsideDhakaCtrl.CategoryID = CategoryID; rangeCtrl.CategoryID = CategoryID.ToString(); rangeCtrl.SubcategoryID = ddlSubcategory.SelectedValue; }
private void SetDataSourcebySearchKey(String SearchPhrase) { ods.TypeName = typeof(CustomerDAC).FullName; ods.EnablePaging = true; ods.SelectParameters.Clear(); ods.SelectParameters.Add("searchKey", SearchPhrase); ods.SelectParameters.Add("providerID", ProviderID.ToString()); ods.SelectParameters.Add("ageFrom", AgeFrom.ToString()); ods.SelectParameters.Add("ageTo", AgeTo.ToString()); ods.SelectParameters.Add("stFrom", dtFrom.ToString()); ods.SelectParameters.Add("stTo", dtTo.ToString()); ods.SelectParameters.Add("tmFrom", tmFrom.ToString()); ods.SelectParameters.Add("tmTo", tmTo.ToString()); ods.SelectParameters.Add("suburbID", SuburbID.ToString()); ods.SelectParameters.Add("categoryID", CategoryID.ToString()); ods.SelectParameters.Add("MonFilter", MonFilter.ToString()); ods.SelectParameters.Add("TueFilter", TueFilter.ToString()); ods.SelectParameters.Add("WedFilter", WedFilter.ToString()); ods.SelectParameters.Add("ThursFilter", ThursFilter.ToString()); ods.SelectParameters.Add("FriFilter", FriFilter.ToString()); ods.SelectParameters.Add("SatFilter", SatFilter.ToString()); ods.SelectParameters.Add("SunFilter", SunFilter.ToString()); ods.SelectMethod = "RetrieveProviderActivitiesbySearchPhrase"; ods.SelectCountMethod = "RetrieveProviderActivitiesbySearchPhraseCount"; ods.MaximumRowsParameterName = "amount"; ods.StartRowIndexParameterName = "startIndex"; ods.SortParameterName = "sortExpression"; ListViewActivities.DataSourceID = "ods"; SortProducts(); }
public override string ToString() { return(string.Concat(new string[] { "CategoryID: ", CategoryID.ToString(), "Description: ", Description })); }
private void SetDataSourceFromCategoryProvider() { ods.TypeName = typeof(CustomerDAC).FullName; ods.EnablePaging = true; ods.SelectParameters.Clear(); ods.SelectParameters.Add("categoryID", CategoryID.ToString()); ods.SelectParameters.Add("providerID", ProviderID.ToString()); ods.SelectParameters.Add("stFrom", dtFrom.ToString()); ods.SelectParameters.Add("stTo", dtTo.ToString()); ods.SelectParameters.Add("ageFrom", AgeFrom.ToString()); ods.SelectParameters.Add("ageTo", AgeTo.ToString()); ods.SelectParameters.Add("suburbID", SuburbID.ToString()); ods.SelectParameters.Add("MonFilter", MonFilter.ToString()); ods.SelectParameters.Add("TueFilter", TueFilter.ToString()); ods.SelectParameters.Add("WedFilter", WedFilter.ToString()); ods.SelectParameters.Add("ThursFilter", ThursFilter.ToString()); ods.SelectParameters.Add("FriFilter", FriFilter.ToString()); ods.SelectParameters.Add("SatFilter", SatFilter.ToString()); ods.SelectParameters.Add("SunFilter", SunFilter.ToString()); ods.SelectMethod = "RetrieveProviderActivities"; ods.SelectCountMethod = "RetrieveProviderActivitiesCount"; ods.MaximumRowsParameterName = "amount"; ods.StartRowIndexParameterName = "startIndex"; ods.SortParameterName = "sortExpression"; GridViewActivities.PageSize = PageSize; GridViewActivities.DataSourceID = "ods"; SortProducts(); //DataPager1.SetPageProperties(StartRow, DataPager1.MaximumRows, false); //ListViewProducts.DataBind(); }
public AddCheeseViewModel(IEnumerable <CheeseCategory> categories) { Categories = new List <SelectListItem>(); Categories.Add(new SelectListItem { Value = CategoryID.ToString(), Text = Name.ToString() }); }
protected void repProvince_ItemCommand(object source, RepeaterCommandEventArgs e) { if (LinkClicked != null) { MenuEventArgs mnuEvent = new MenuEventArgs(); mnuEvent.CategoryID = CategoryID.ToString(); mnuEvent.SubcategoryID = SubcategoryID.ToString(); mnuEvent.AreaID = e.CommandArgument.ToString(); this.LinkClicked(this, mnuEvent); } }
/// <summary> /// Override of the ToString method. /// </summary> /// <returns>Supplier ID, Type and Company Name</returns> public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("Product Name: "); sb.Append(ProductName); sb.Append("\tCategory ID: "); sb.Append(CategoryID.ToString()); sb.Append("\tSupplier ID "); sb.Append(SupplierID.ToString()); return(sb.ToString()); }
private void BindData() { DataTable dt = new DataTable(); dt.Columns.Add("code"); dt.Columns.Add("status"); foreach (int code in Enum.GetValues(typeof(ProductStatus))) { DataRow row = dt.NewRow(); row["code"] = code; row["status"] = Enum.GetName(typeof(ProductStatus), code); dt.Rows.Add(row); } drpStatus.DataSource = dt; drpStatus.DataTextField = "status"; drpStatus.DataValueField = "code"; drpStatus.DataBind(); DropDown_Brand.DataSource = new BrandCategoryRelationBll().GetCategoryBrandList(CategoryID); DropDown_Brand.DataTextField = "brandname"; DropDown_Brand.DataValueField = "brandid"; DropDown_Brand.DataBind(); Label_CategoryNamePath.Text = new CategoryModelBll().GetCategoryNamePath(CategoryID); txtCategoryID.Value = CategoryID.ToString(); DropDown_Packing.DataSource = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.包装清单)); DropDown_Packing.DataTextField = "title"; DropDown_Packing.DataValueField = "content"; DropDown_Packing.DataBind(); DropDown_Service.DataSource = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.售后服务)); DropDown_Service.DataTextField = "title"; DropDown_Service.DataValueField = "content"; DropDown_Service.DataBind(); DropDown_OfferSet.DataSource = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.优惠套装)); DropDown_OfferSet.DataTextField = "title"; DropDown_OfferSet.DataValueField = "content"; DropDown_OfferSet.DataBind(); DropDown_Specification.DataSource = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.规格参数)); DropDown_Specification.DataTextField = "title"; DropDown_Specification.DataValueField = "content"; DropDown_Specification.DataBind(); txtProductCode.Text = ProductID.ToString(); }
private void SetDataSourcebyProviderCategory() { ods.TypeName = typeof(ProviderDAC).FullName; ods.EnablePaging = true; ods.SelectParameters.Clear(); ods.SelectParameters.Add("categoryID", CategoryID.ToString()); ods.SelectParameters.Add("providerID", ProviderID.ToString()); ods.SelectMethod = "RetrieveProviderActivities"; ods.SelectCountMethod = "RetrieveProviderActivitiesCount"; ods.MaximumRowsParameterName = "amount"; ods.StartRowIndexParameterName = "startIndex"; ods.SortParameterName = "sortExpression"; ListViewActivities.DataSourceID = "ods"; SortProducts(); }
private void SetDataSourceFromCategoryProvider() { ods.TypeName = typeof(ProviderDAC).FullName; ods.EnablePaging = true; ods.SelectParameters.Clear(); ods.SelectParameters.Add("categoryID", CategoryID.ToString()); ods.SelectParameters.Add("providerID", ProviderID.ToString()); ods.SelectMethod = "RetrieveProviderActivities"; ods.SelectCountMethod = "RetrieveProviderActivitiesCount"; ods.MaximumRowsParameterName = "amount"; ods.StartRowIndexParameterName = "startIndex"; ods.SortParameterName = "sortExpression"; GridViewActivities.PageSize = PageSize; GridViewActivities.DataSourceID = "ods"; SortProducts(); //DataPager1.SetPageProperties(StartRow, DataPager1.MaximumRows, false); //ListViewProducts.DataBind(); }
private void setCategoryAndParent(string href) { string encCat = String.Empty; if (Page.RouteData.Values["cat"] != null) { encCat = Page.RouteData.Values["cat"].ToString(); aCategory.HRef = ""; aCategory.Style["color"] = "grey"; aCategory.Style["text-decoration"] = "none"; } else { encCat = Encryption.Encrypt(CategoryID.ToString()); aCategory.HRef = href + "cat/" + encCat + "/"; } sep2.Visible = true; CATEGORY cat = ApplicationContext.Current.Categories.GetById(CategoryID); if (Session["Culture"] == null || Session["Culture"].ToString() != "en-US") { CategoryName = cat.Name; } else { CategoryName = cat.NameEng; } if (cat.ParentID.HasValue) { string encParent = Encryption.Encrypt(cat.ParentID.Value.ToString()); if (Session["Culture"] == null || Session["Culture"].ToString() != "en-US") { ParentCategoryName = cat.CATEGORY2.Name; } else { ParentCategoryName = cat.CATEGORY2.NameEng; } aParentCategory.HRef = href + "cat/" + encParent + "/"; sep.Visible = true; } }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here if (Dynamicweb.Base.Request("_ID") != "") { int ID; ID = Dynamicweb.Base.ChkNumber(Dynamicweb.Base.Request("_ID")); int CategoryID; CategoryID = Dynamicweb.Base.ChkNumber(Dynamicweb.Base.Request("CategoryID")); Dealer objDealer; if (ID != 0) { //Saving changes objDealer = new Dealer(ID); } else { //Creating new objDealer = new Dealer(); } objDealer.Name = Base.ChkValue(Dynamicweb.Base.Request("Name")); objDealer.CategoryID = Base.ChkNumber(Dynamicweb.Base.Request("CategoryID")); objDealer.Name = Base.ChkValue(Dynamicweb.Base.Request("Name")); objDealer.Adress = Base.ChkValue(Dynamicweb.Base.Request("Adress")); objDealer.Adress2 = Base.ChkValue(Dynamicweb.Base.Request("Adress2")); objDealer.Zip = Base.ChkValue(Dynamicweb.Base.Request("Zip")); objDealer.City = Base.ChkValue(Dynamicweb.Base.Request("City")); objDealer.Country = Base.ChkValue(Dynamicweb.Base.Request("Country")); objDealer.Description = Base.ChkValueNoStrip(Dynamicweb.Base.Request("Description")); objDealer.Phone1 = Base.ChkValue(Dynamicweb.Base.Request("Phone1")); objDealer.Phone2 = Base.ChkValue(Dynamicweb.Base.Request("Phone2")); objDealer.Fax1 = Base.ChkValue(Dynamicweb.Base.Request("Fax1")); objDealer.Fax2 = Base.ChkValue(Dynamicweb.Base.Request("Fax2")); objDealer.Email = Base.ChkValue(Dynamicweb.Base.Request("Email")); objDealer.Website = Base.ChkValue(Dynamicweb.Base.Request("Website")); objDealer.Save(); Response.Redirect("DealerList.aspx?ID=" + CategoryID.ToString()); } }
/// <summary> /// Returns values in the collections. /// </summary> /// <returns>IEnumerator object</returns> public IEnumerator PropertyAndValuesCollection() { yield return("Product ID: " + ID.ToString()); yield return("Product Name: " + ProductName); yield return("Supplier ID: " + SupplierID.ToString()); yield return("Category ID: " + CategoryID.ToString()); yield return("Quantity Per Unit: " + QuantityPerUnit); yield return("Unit Price: " + UnitPrice.ToString("c")); yield return("Units in Stock: " + UnitsInStock.ToString()); yield return("Units On Order: " + UnitsOnOrder.ToString()); yield return("ReOrder Level: " + ReOrderLevel.ToString()); }
public void Open() { this.Visible = true; ddlState.DataSource = Forum.GetItemStates(ItemType, IsAdmin); ddlState.DataTextField = "Text"; ddlState.DataValueField = "Value"; ddlState.DataBind(); if (ItemType == Forum.ItemType.Article) { ddlCategory.DataSource = Forum.GetCategories(Forum.CategoryStatus.All); ddlCategory.DataTextField = "CategoryName"; ddlCategory.DataValueField = "CategoryID"; ddlCategory.DataBind(); ddlCategory.SelectedValue = CategoryID.ToString(); } if (IsMember) { lblLoggedUser.Text = SessRoot.NickName; } if (!IsAdmin) { ddlCategory.Enabled = false; } //else // Forum.GotoDefaultPage(this.Response); SetTitle(); if (ItemID != -1) { BindItem(); } }
public override string ToString() { return(String.Concat("Category ID:", CategoryID.ToString(), " Description: ", Description)); }
public override string ToString() { return(CategoryID.ToString()); }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { switch (ItemType) { case Forum.ItemType.Category: { Forum.CategoryStatus state = Forum.CategoryStatus.Active; if (ddlState.SelectedIndex == -1) { state = (Forum.CategoryStatus) int.Parse(ddlState.Items[0].Value); } else { state = (Forum.CategoryStatus) int.Parse(ddlState.SelectedValue); } if (ItemID == -1) { Forum.InsertCategory(txtSubject.Text.Trim(), ForumTextBox1.Text, state, SessRoot.UserID); } else { Forum.UpdateCategory(ItemID, txtSubject.Text.Trim(), ForumTextBox1.Text, state); } break; } case Forum.ItemType.Article: { Forum.ArticleStatus state = Forum.ArticleStatus.Active; if (ddlState.SelectedIndex == -1) { state = (Forum.ArticleStatus) int.Parse(ddlState.Items[0].Value); } else { state = (Forum.ArticleStatus) int.Parse(ddlState.SelectedValue); } if (ItemID == -1) { int UserID = SessRoot.UserID; if (IsAdmin) { UserID = -1; } Forum.InsertArticle(txtSubject.Text.Trim(), ForumTextBox1.Text, state, CategoryID, UserID, SessRoot.NickName); } else { Forum.UpdateArticle(ItemID, txtSubject.Text.Trim(), ForumTextBox1.Text, state, int.Parse(ddlCategory.SelectedValue)); } } break; case Forum.ItemType.ArticleItem: { Forum.ArticleItemStatus state = Forum.ArticleItemStatus.Active; if (ddlState.SelectedIndex == -1) { state = (Forum.ArticleItemStatus) int.Parse(ddlState.Items[0].Value); } else { state = (Forum.ArticleItemStatus) int.Parse(ddlState.SelectedValue); } if (ItemID == -1) { int UserID = SessRoot.UserID; if (IsAdmin) { UserID = -1; } Forum.InsertArticleItem(CategoryID, ArticleID, txtSubject.Text.Trim(), ForumTextBox1.Text, state, UserID, SessRoot.NickName); } else { if (isMainArticleItem) { Forum.UpdateArticleItem(ItemID, ArticleID, txtSubject.Text.Trim(), ForumTextBox1.Text, state); } else { Forum.UpdateArticleItem(ItemID, txtSubject.Text.Trim(), ForumTextBox1.Text, state); } } } break; } if (RefreshData != null) { RefreshData(null, EventArgs.Empty); } this.Visible = false; if (ItemType == Forum.ItemType.Article && ArticleID != -1) { Response.Redirect("Category.aspx?CategoryID=" + CategoryID.ToString()); } }
private void BindData() { DataTable dt = new DataTable(); dt.Columns.Add("code"); dt.Columns.Add("status"); foreach (int code in Enum.GetValues(typeof(ProductStatus))) { DataRow row = dt.NewRow(); row["code"] = code; row["status"] = Enum.GetName(typeof(ProductStatus), code); dt.Rows.Add(row); } ProductModel product = ProductMainImageRule.GetMainImageUrl(bll.GetModel(ProductID)); drpStatus.DataSource = dt; drpStatus.DataTextField = "status"; drpStatus.DataValueField = "code"; drpStatus.DataBind(); DropDown_Brand.DataSource = new BrandCategoryRelationBll().GetCategoryBrandList(CategoryID == -1 ? product.CateId : CategoryID); DropDown_Brand.DataTextField = "brandname"; DropDown_Brand.DataValueField = "brandid"; DropDown_Brand.DataBind(); DropDown_Specification.DataSource = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.规格参数)); DropDown_Specification.DataTextField = "title"; DropDown_Specification.DataValueField = "content"; DropDown_Specification.DataBind(); DropDown_Packing.DataSource = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.包装清单)); DropDown_Packing.DataTextField = "title"; DropDown_Packing.DataValueField = "content"; DropDown_Packing.DataBind(); DropDown_Service.DataSource = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.售后服务)); DropDown_Service.DataTextField = "title"; DropDown_Service.DataValueField = "content"; DropDown_Service.DataBind(); DropDown_OfferSet.DataSource = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.优惠套装)); DropDown_OfferSet.DataTextField = "title"; DropDown_OfferSet.DataValueField = "content"; DropDown_OfferSet.DataBind(); if (product != null) { txtProductName.Text = product.ProductName; txtProductCode.Text = product.ProductCode; txtTradePrice.Text = product.TradePrice.ToString(); txtScore.Text = product.Score.ToString(); txtMerchantPrice.Text = product.MerchantPrice.ToString(); txtReducePrice.Text = product.ReducePrice.ToString(); drpStatus.SelectedValue = product.Status.ToString(); txtKeywords.Text = product.Keywords; TextBox_Brief.Text = product.Brief; imgProduct.ImageUrl = product.SmallImage; TextBox_Specification.Text = product.Specifications; TextBox_Packing.Text = product.PackingList; TextBox_Service.Text = product.AfterSaleService; TextBox_OfferSet.Text = product.OfferSet; txtWeight.Text = product.Weight.ToString("0.00"); SetStockTip(product.StockTip); txtRelateProduct.Text = product.RelateProducts; ProductNewsModel newsModel = new ProductNewsBll().GetModel(product.ProductId); txtNewsID.Text = newsModel == null?"":newsModel.NewsID.ToString(); if (CategoryID != -1) { Label_CategoryNamePath.Text = new CategoryModelBll().GetCategoryNamePath(CategoryID); txtCategoryID.Value = CategoryID.ToString(); } else { txtCategoryID.Value = product.CateId.ToString(); Label_CategoryNamePath.Text = new CategoryModelBll().GetCategoryNamePath(product.CateId); } DropDown_Brand.SelectedValue = product.BrandID.ToString(); BindParameterData(product.CateId); BindSpecificationData(product.CateId); ReselectCategory.HRef = String.Format("CategorySelect.aspx?cid={0}&pid={1}", product.CateId, product.ProductId); } }
public void Dispose() { _AllList.Remove(this); _AllByPrimaryKey.Remove(CategoryID.ToString()); }
internal static string ParseArgs(string[] args) { for (long i = 0; i < args.LongLength; i++) { if (CurrState == null) { FSM_ArgParser NextState; if (!Enum.TryParse(args[i].TrimStart('-'), out NextState)) { return("Unexpected argument:" + args[i]); } else { CurrState = NextState; } } else { switch (CurrState) { case FSM_ArgParser.Mode: Modes Mode = Modes.None; if (Enum.TryParse(args[i], out Mode)) { Configuration[(FSM_ArgParser)CurrState] = Mode; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.Operation: Operations Operation = Operations.None; if (Enum.TryParse(args[i], out Operation)) { Configuration[(FSM_ArgParser)CurrState] = Operation; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.VideoIDs: List <string> VideoIDs = new List <string>(args[i].Split('/')); foreach (string VideoID in VideoIDs) { if (VideoID.Length < 11) { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } } Configuration[(FSM_ArgParser)CurrState] = VideoIDs; break; case FSM_ArgParser.PlaylistID: Configuration[(FSM_ArgParser)CurrState] = args[i]; break; case FSM_ArgParser.Title: Configuration[(FSM_ArgParser)CurrState] = args[i]; break; case FSM_ArgParser.Description: Configuration[(FSM_ArgParser)CurrState] = args[i]; break; case FSM_ArgParser.Tags: Configuration[(FSM_ArgParser)CurrState] = new List <string>(args[i].Split(',')); break; case FSM_ArgParser.CategoryID: int CategoryID; if (int.TryParse(args[i], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out CategoryID)) { Configuration[(FSM_ArgParser)CurrState] = CategoryID.ToString(); } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.PrivacyStatus: if (args[i] == "unlisted" || args[i] == "private" || args[i] == "public") { Configuration[(FSM_ArgParser)CurrState] = args[i]; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.PublicStatsViewable: bool PublicStatsViewable; if (bool.TryParse(args[i], out PublicStatsViewable)) { Configuration[(FSM_ArgParser)CurrState] = PublicStatsViewable; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.Dimension: if (args[i].ToUpper() == "2D" || args[i].ToUpper() == "3D") { Configuration[(FSM_ArgParser)CurrState] = args[i].ToUpper(); } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.Definition: if (args[i].ToLower() == "hd" || args[i].ToLower() == "sd") { Configuration[(FSM_ArgParser)CurrState] = args[i].ToLower(); } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.LocationDescription: Configuration[(FSM_ArgParser)CurrState] = args[i]; break; case FSM_ArgParser.Location_Latitude: double Location_Latitude; if (double.TryParse(args[i], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out Location_Latitude)) { Configuration[(FSM_ArgParser)CurrState] = Location_Latitude; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.Location_Longitude: double Location_Longitude; if (double.TryParse(args[i], System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out Location_Longitude)) { Configuration[(FSM_ArgParser)CurrState] = Location_Longitude; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.RecordingDate: DateTime RecordingDate; if (DateTime.TryParse(args[i], out RecordingDate)) { Configuration[(FSM_ArgParser)CurrState] = RecordingDate; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.DisableComment: bool DisableComment; if (bool.TryParse(args[i], out DisableComment)) { Configuration[(FSM_ArgParser)CurrState] = DisableComment; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.DisableRating: bool DisableRating; if (bool.TryParse(args[i], out DisableRating)) { Configuration[(FSM_ArgParser)CurrState] = DisableRating; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.DisableVideoRespond: bool DisableVideoRespond; if (bool.TryParse(args[i], out DisableVideoRespond)) { Configuration[(FSM_ArgParser)CurrState] = DisableVideoRespond; } else { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } break; case FSM_ArgParser.File: Configuration[(FSM_ArgParser)CurrState] = Path.GetFullPath(args[i]); break; case FSM_ArgParser.VideoID: if (args[i].Length < 11) { return("Unexpected value for " + CurrState.ToString() + ": " + args[i]); } else { Configuration[(FSM_ArgParser)CurrState] = args[i]; } break; default: return("Unexpected FSM_state: " + CurrState.ToString()); } CurrState = null; } } if (!Configuration.ContainsKey(FSM_ArgParser.Mode) || (Modes)Configuration[FSM_ArgParser.Mode] == Modes.None) { return(FSM_ArgParser.Mode.ToString() + " must be specified."); } if (!Configuration.ContainsKey(FSM_ArgParser.Operation) || (Operations)Configuration[FSM_ArgParser.Operation] == Operations.None) { return(FSM_ArgParser.Operation.ToString() + " must be specified."); } switch ((Modes)Configuration[FSM_ArgParser.Mode]) { case Modes.Playlist: if ((Operations)Configuration[FSM_ArgParser.Operation] == Operations.Add) { if (!Configuration.ContainsKey(FSM_ArgParser.Title)) { return(FSM_ArgParser.Title.ToString() + " must be specified."); } if (!Configuration.ContainsKey(FSM_ArgParser.VideoIDs)) { return(FSM_ArgParser.VideoIDs.ToString() + " must be specified."); } } else if ((Operations)Configuration[FSM_ArgParser.Operation] == Operations.Remove) { if (!Configuration.ContainsKey(FSM_ArgParser.PlaylistID)) { return(FSM_ArgParser.PlaylistID.ToString() + " must be specified."); } } else { return(FSM_ArgParser.Operation.ToString() + " must be specified."); } break; case Modes.Video: if ((Operations)Configuration[FSM_ArgParser.Operation] == Operations.Add) { if (!Configuration.ContainsKey(FSM_ArgParser.Title)) { return(FSM_ArgParser.Title.ToString() + " must be specified."); } if (!Configuration.ContainsKey(FSM_ArgParser.CategoryID)) { return(FSM_ArgParser.CategoryID.ToString() + " must be specified."); } if (!Configuration.ContainsKey(FSM_ArgParser.File)) { return(FSM_ArgParser.File.ToString() + " must be specified."); } FileInfo Fi = new FileInfo(Configuration[FSM_ArgParser.File] as string); if (!Fi.Exists) { return("Video file does not exist under given file path."); } FileSize = Fi.Length; } else if ((Operations)Configuration[FSM_ArgParser.Operation] == Operations.Remove) { if (!Configuration.ContainsKey(FSM_ArgParser.VideoID)) { return(FSM_ArgParser.VideoID.ToString() + " must be specified."); } } else { return(FSM_ArgParser.Operation.ToString() + " must be specified."); } break; default: return(FSM_ArgParser.Mode.ToString() + " must be specified."); } return(null); }
/// <summary> /// This method gets the hash code of the category ID /// </summary> /// <returns>int hash code</returns> public override int GetHashCode() { return(CategoryID.ToString().GetHashCode()); }
public override string ToString() { var sb = new StringBuilder("Square("); bool __first = true; if (Mid != null && __isset.mid) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Mid: "); Mid.ToString(sb); } if (Name != null && __isset.name) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Name: "); Name.ToString(sb); } if (WelcomeMessage != null && __isset.welcomeMessage) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("WelcomeMessage: "); WelcomeMessage.ToString(sb); } if (ProfileImageObsHash != null && __isset.profileImageObsHash) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ProfileImageObsHash: "); ProfileImageObsHash.ToString(sb); } if (Desc != null && __isset.desc) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Desc: "); Desc.ToString(sb); } if (__isset.searchable) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Searchable: "); Searchable.ToString(sb); } if (__isset.type) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Type: "); Type.ToString(sb); } if (__isset.categoryID) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("CategoryID: "); CategoryID.ToString(sb); } if (InvitationURL != null && __isset.invitationURL) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("InvitationURL: "); InvitationURL.ToString(sb); } if (__isset.revision) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Revision: "); Revision.ToString(sb); } if (__isset.ableToUseInvitationTicket) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("AbleToUseInvitationTicket: "); AbleToUseInvitationTicket.ToString(sb); } if (__isset.state) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("State: "); State.ToString(sb); } sb.Append(")"); return(sb.ToString()); }