private void InitVericalGrid(BarItemLinkCollection menuItemLinks) { menuEditoGrid.CloseEditor(); menuEditoGrid.Rows.Clear(); var cRow = new CategoryRow("Menu items"); menuEditoGrid.OptionsView.AutoScaleBands = true; foreach (BarItemLink link in menuItemLinks) { if (link.Item.Tag == menuItemLinks) { continue; } var eRow = new EditorRow(); var a = link.Item.Tag as MenuAction; string caption; if (a != null && a.ItemsStorage != null) { caption = a.ItemsStorage.GetString(a.ResourceKey, null, Localizer.lngEn); } else { caption = link.Caption; } eRow.Properties.Caption = caption; eRow.Properties.Value = link.Caption; eRow.Tag = link; cRow.ChildRows.Add(eRow); } menuEditoGrid.Rows.Add(cRow); }
private void FillNewRow(SchemaObject schemaObject, Func <SchemaObject, BaseRow> rowConstructor) { CategoryRow categoryRow = null; if (!string.IsNullOrEmpty(schemaObject.ParentPath)) { categoryRow = PropertyGridControl.GetRowByName(schemaObject.ParentPath) as CategoryRow; } if (categoryRow != null) { var row = rowConstructor(schemaObject); if (row != null) { categoryRow.ChildRows.Add(row); } } else { var row = rowConstructor(schemaObject); if (row != null) { PropertyGridControl.Rows.Add(row); } } }
protected void grvCategories_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow editRow = grvCategories.Rows[grvCategories.EditIndex]; CategoryRow category = CategoryHelper.getCatInfoAsCategoryRow((int)grvCategories.DataKeys[grvCategories.EditIndex].Value); category.Cat_Name = (editRow.FindControl("txtCatName") as TextBox).Text; category.Cat_KeyWords = (editRow.FindControl("txtCatKeyWords") as TextBox).Text; category.Cat_Order = int.Parse((editRow.FindControl("txtCatOrder") as TextBox).Text); category.Cat_isHidden = (editRow.FindControl("chkIsHidden") as CheckBox).Checked; category.Cat_DisplayURL = (editRow.FindControl("txtCatDisplayURL") as TextBox).Text; category.Cat_ParentID = int.Parse((editRow.FindControl("cboParentCat") as DropDownList).SelectedValue); if (Session["EditionType"] != null && Session["EditionType"] != "") { category.EditionType_ID = int.Parse(Session["EditionType"].ToString()); } else { Response.Redirect("/login.aspx"); } CategoryHelper.UpdateCategoryRow(category); grvCategories.EditIndex = -1; bindData(); }
protected void btnSearch_Click(object sender, EventArgs e) { DFISYS.BO.SearchHelper objhelp = new DFISYS.BO.SearchHelper(); string keyword = txtKeyword.Text.Trim().Replace("'", ""); string[] strKeys = keyword.Split(" ".ToCharArray()); string strKey = objhelp.getAndCond("News_Title,News_Source", strKeys); string strCat = cboCategory.SelectedValue; string strAndCat = ""; if (strCat != "0") { CategoryRow objCat = CategoryHelper.getCatInfoAsCategoryRow(Convert.ToInt32(strCat)); if (objCat.Cat_ParentID == 0) { strCat = CategoryHelper.GetChildCatIdByCatParentId(Convert.ToInt32(strCat)); if (strCat.Trim() != "") { strCat += "," + cboCategory.SelectedValue; } else { strCat = cboCategory.SelectedValue; } } strAndCat = " AND Category.Cat_ID IN (" + strCat + ")"; } objListNewsSource.SelectParameters[0].DefaultValue = " News_Status=3 AND " + strKey + strAndCat; }
public Form1() { InitializeComponent(); var categoryRow = new CategoryRow("CategoryRow1"); vGridControl.Rows.Add(categoryRow); var editRow1 = new EditorRow { Name = "EditorRow1" }; editRow1.Properties.Caption = "EditorRow1"; editRow1.Properties.Value = 1; editRow1.Properties.RowEdit = new RepositoryItemTextEdit(); categoryRow.ChildRows.Add(editRow1); var editRow2 = new EditorRow { Name = "EditorRow2" }; editRow2.Properties.Caption = "EditorRow2"; editRow2.Properties.Value = 2; editRow2.Properties.RowEdit = new RepositoryItemTextEdit(); categoryRow.ChildRows.Add(editRow2); var editRow3 = new EditorRow { Name = "EditorRow3" }; editRow3.Properties.Caption = "EditorRow3"; editRow3.Properties.Value = 3; editRow3.Properties.RowEdit = new RepositoryItemTextEdit(); categoryRow.ChildRows.Add(editRow3); }
/// <summary> /// Thủ tục thay đổi thứ tự của Category đã chọn /// </summary> /// <param name="_intCategoryID">Mã của Category cần thay đổi thứ tự</param> /// <param name="_intOrderChangeValue">Giá trị thay đổi 1 : Lên, -1 : Xuống</param> private void ChangeCatOrder(int _intCategoryID, int _intOrderChangeValue) { CategoryRow _objCurrentCategory = null; CategoryRow _objBesideCategory = null; using (MainDB _objDB = new MainDB()) { _objCurrentCategory = _objDB.CategoryCollection.GetByPrimaryKey(_intCategoryID); if (_objCurrentCategory != null) { // Lấy thông tin về Category nằm trên hoặc dưới Category hiện thời _objBesideCategory = _objDB.CategoryCollection.GetRow("EditionType_ID = " + _objCurrentCategory.EditionType_ID + (_objCurrentCategory.IsCat_ParentIDNull ? "" : " AND Cat_ParentID = " + _objCurrentCategory.Cat_ParentID) + " And Cat_Order = " + (_objCurrentCategory.Cat_Order + _intOrderChangeValue).ToString()); } } if (_objCurrentCategory != null && _objBesideCategory != null) { _objCurrentCategory.Cat_Order = _objCurrentCategory.Cat_Order + _intOrderChangeValue; _objBesideCategory.Cat_Order = _objBesideCategory.Cat_Order - _intOrderChangeValue; using (MainDB _objDB = new MainDB()) { // Cập nhật lại thứ tự mới _objDB.CategoryCollection.Update(_objCurrentCategory); _objDB.CategoryCollection.Update(_objBesideCategory); } } }
/// <summary> /// Method to Initialize and Populate the <see cref="vGridControl1"/> (which displays to the user the range of all SELECTED Adjustable Coordinates) at Run Timi /// Done this way because creating the <see cref="vGridControl1"/> at Design is too complicated as there any many bugs /// </summary> private void InitializePropertyGrid() { Inboard_CategoryRows = new List <CategoryRow>(); Outboard_CategoryRows = new List <CategoryRow>(); ///<summary>Inboard Point GUI Row Creation</summary> c_LowerFront = CreateRows("Lower Front", out mr_LowerFront_UpperLimits, out mr_LowerFront_LowerLimits, out er_LowerFront_Upper, out er_LowerFront_Lower); vGridControl1.Rows.Add(c_LowerFront); c_LowerRear = CreateRows("Lower Rear", out mr_LowerRear_UpperLimits, out mr_LowerRear_LowerLimits, out er_LowerRear_Upper, out er_LowerRear_Lower); vGridControl1.Rows.Add(c_LowerRear); c_UpperFront = CreateRows("Upper Front", out mr_UpperFront_UpperLimits, out mr_UpperFront_LowerLimits, out er_UpperFront_Upper, out er_UpperFront_Lower); vGridControl1.Rows.Add(c_UpperFront); c_UpperRear = CreateRows("Upper Rear", out mr_UpperRear_UpperLimits, out mr_UpperRear_LowerLimits, out er_UpperRear_Upper, out er_UpperRear_Lower); vGridControl1.Rows.Add(c_UpperRear); c_PushrodInboard = CreateRows("Pushrod Inboard", out mr_PushrodInboard_UpperLimits, out mr_PushrodInboard_LowerLimits, out er_PushrodInboard_Upper, out er_PushrodInboard_Lower); vGridControl1.Rows.Add(c_PushrodInboard); c_ToeLinkInboard = CreateRows("Toe Link Inboard", out mr_ToeLinkInboard_UpperLimits, out mr_ToeLinkInboard_LowerLimits, out er_ToeLinkInboard_Upper, out er_ToeLinkInboard_Lower); vGridControl1.Rows.Add(c_ToeLinkInboard); ///<summary>Outboard Point GUI Row Creation</summary> c_UBJ = CreateRows("UBJ", out mr_UBJ_UpperLimits, out mr_UBJ_LowerLimits, out er_UBJ_Upper, out er_UBJ_Lower); vGridControl1.Rows.Add(c_UBJ); c_LBJ = CreateRows("LBJ", out mr_LBJ_UpperLimits, out mr_LBJ_LowerLimits, out er_LBJ_Upper, out er_LBJ_Lower); vGridControl1.Rows.Add(c_LBJ); c_PushrodOutboard = CreateRows("Pushrod Upright", out mr_PushrodOutboard_UpperLimits, out mr_PushrodOutboard_LowerLimits, out er_PushrodOutboard_Upper, out er_PushrodOutboard_Lower); vGridControl1.Rows.Add(c_PushrodOutboard); c_ToeLinkOutboard = CreateRows("ToeLinkOoutboard", out mr_ToeLinkOoutboard_UpperLimits, out mr_ToeLinkOoutboard_LowerLimits, out er_ToeLinkOoutboard_Upper, out er_ToeLinkOoutboard_Lower); vGridControl1.Rows.Add(c_ToeLinkOutboard); c_WheelCenter = CreateRows("Wheel Center", out mr_WheelCenter_UpperLimits, out mr_WheelCenter_LowerLimits, out er_WheelCenter_Upper, out er_WheelCenter_Lower); vGridControl1.Rows.Add(c_WheelCenter); vGridControl1.Refresh(); vGridControl1.CellValueChanged += VGridControl1_CellValueChanged; Inboard_CategoryRows.AddRange(new CategoryRow[] { c_LowerFront, c_LowerRear, c_UpperFront, c_UpperRear, c_PushrodInboard, c_ToeLinkInboard }); Outboard_CategoryRows.AddRange(new CategoryRow[] { c_UBJ, c_LBJ, c_PushrodOutboard, c_ToeLinkOutboard, c_WheelCenter }); }
private void InitializeUI() { SuspendLayout(); // Set up the main form. AllowDrop = true; BackColor = Color.White; ClientSize = new Size(1000, 560); DoubleBuffered = true; Font = SystemFonts.MessageBoxFont; base.Icon = Icon; StartPosition = FormStartPosition.CenterScreen; Text = Title; // Set up category rows. _categoryRows = new CategoryRow[CategoryRowCount]; for (int i = 0; i < _categoryRows.Length; i++) { CategoryRow categoryRow = new CategoryRow(i, AccentColor); categoryRow.SelectedCategoryChanged += CategoryRow_SelectedCategoryChanged; _categoryRows[i] = categoryRow; Controls.Add(categoryRow); } // Set up the file section. _fbOpen = new FlatButton("Open", _fbOpen_Click); _fbSave = new FlatButton("Save", _fbSave_Click); _fbSaveAs = new FlatButton("Save As", _fbSaveAs_Click); _tlpFile = new TableLayoutPanel(); _tlpFile.Margin = new Padding(0); _tlpFile.Dock = DockStyle.Fill; for (int i = 0; i < 3; i++) { _tlpFile.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); } _tlpFile.Controls.Add(_fbOpen); _tlpFile.Controls.Add(_fbSave); _tlpFile.Controls.Add(_fbSaveAs); Controls.Add(_tlpFile); // Set up the data grid. _binDataGrid = new BinDataGrid(); _binDataGrid.MinimumColumnWidth = 95; Controls.Add(_binDataGrid); UpdateCategoriesInternal(0, 0, 0); UpdateUI(); ResumeLayout(); }
public CategoryRow AddCategoryRow(string Name, bool AllowDelete, int ParentID, bool HasChildren) { CategoryRow rowCategoryRow = ((CategoryRow)(this.NewRow())); rowCategoryRow.ItemArray = new object[] { null, Name, AllowDelete, ParentID, HasChildren }; this.Rows.Add(rowCategoryRow); return(rowCategoryRow); }
private void FilterInterestCombo(object sender, EventArgs e) { PInterestCategoryTable CategoryTable; PInterestCategoryRow CategoryRow; string SelectedCategory = cmbPPartnerInterestInterestCategory.GetSelectedString(); string SelectedInterest = cmbPPartnerInterestInterest.GetSelectedString(); cmbPPartnerInterestInterest.Filter = PInterestTable.GetCategoryDBName() + " = '" + SelectedCategory + "'"; // reset text to previous value or (if not found) empty text field if (cmbPPartnerInterestInterest.GetSelectedString() != String.Empty) { if (!cmbPPartnerInterestInterest.SetSelectedString(SelectedInterest)) { cmbPPartnerInterestInterest.SetSelectedString("", -1); } } CategoryTable = (PInterestCategoryTable)TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.InterestCategoryList); CategoryRow = (PInterestCategoryRow)CategoryTable.Rows.Find(new object[] { SelectedCategory }); // reset list of levels cmbPPartnerInterestLevel.Text = ""; cmbPPartnerInterestLevel.Items.Clear(); if ((CategoryRow != null) && !CategoryRow.IsLevelRangeLowNull() && !CategoryRow.IsLevelRangeHighNull()) { // fill the combobox with valid values for (int ii = CategoryRow.LevelRangeLow; ii <= CategoryRow.LevelRangeHigh; ii++) { cmbPPartnerInterestLevel.Items.Add(ii); } txtInterestLevelExplanation.Text = CategoryRow.LevelDescriptions; } else { txtInterestLevelExplanation.Text = ""; } if ((GetSelectedDetailRow() != null) && !GetSelectedDetailRow().IsLevelNull()) { cmbPPartnerInterestLevel.SetSelectedInt32(GetSelectedDetailRow().Level); } }
private void CreateRows() { EditorRow rowLastName = new EditorRow("LastName"); rowLastName.Properties.Caption = "Last name"; propertyGridControl1.Rows.Add(rowLastName); CategoryRow rowCategory = new CategoryRow("Address"); propertyGridControl1.Rows.Add(rowCategory); EditorRow rowAddressLine1 = new EditorRow("AddressLine1"); rowAddressLine1.Properties.Caption = "Address Line 1"; rowCategory.ChildRows.Add(rowAddressLine1); EditorRow rowZip = new EditorRow("Zip"); rowZip.Properties.Caption = "Zip Code"; rowCategory.ChildRows.Add(rowZip); }
private void VGridControl1_CellValueChanged(object sender, DevExpress.XtraVerticalGrid.Events.CellValueChangedEventArgs e) { int mainIndex = 0; if (vGridControl1.FocusedRow is MultiEditorRow) { MultiEditorRow row = vGridControl1.FocusedRow as MultiEditorRow; EditorRow eRow = row.ParentRow as EditorRow; CategoryRow cRow = eRow.ParentRow as CategoryRow; string coordName = ""; if (Inboard_CategoryRows.Contains(cRow)) { mainIndex = Inboard_CategoryRows.IndexOf(cRow); coordName = clb_InboardAdjPoints.Items[mainIndex].Value as string; } else if (Outboard_CategoryRows.Contains(cRow)) { mainIndex = Outboard_CategoryRows.IndexOf(cRow); coordName = clb_OutboardAdjPoints.Items[mainIndex].Value as string; } if (KO_CV.KO_MasterAdjs.ContainsKey(coordName)) { if (row.Name == ("UpperLimit" + mainIndex)) { KO_CV.KO_MasterAdjs[coordName].UpperCoordinateLimit = new Point3D((double)row.PropertiesCollection[0].Value, (double)row.PropertiesCollection[1].Value, (double)row.PropertiesCollection[2].Value); } else if (row.Name == ("LowerLimit" + mainIndex)) { KO_CV.KO_MasterAdjs[coordName].LowerCoordinateLimit = new Point3D((double)row.PropertiesCollection[0].Value, (double)row.PropertiesCollection[1].Value, (double)row.PropertiesCollection[2].Value); } } } }
/// <summary> /// 加载库位和商品属性 /// </summary> /// <param name="repositoryItemComboBoxLayout"></param> /// <param name="houseCode"></param> /// <param name="skuOuterID"></param> /// <param name="outerID"></param> /// <param name="categoryRowKeyProps"></param> /// <param name="categoryRowSaleProps"></param> /// <param name="categoryRowNotKeyProps"></param> /// <param name="categoryRowStockProps"></param> public void LoadLayoutAndProps(RepositoryItemComboBox repositoryItemComboBoxLayout, GridView gridView , CategoryRow categoryRowKeyProps, CategoryRow categoryRowSaleProps, CategoryRow categoryRowNotKeyProps, CategoryRow categoryRowStockProps) { DataRow row = gridView.GetFocusedDataRow(); if (row == null) { return; } string houseCode = row["HouseCode"] == null ? string.Empty : row["HouseCode"].ToString(); string outerID = row["OuterID"] == null ? string.Empty : row["OuterID"].ToString(); string skuOuterID = row["SkuOuterID"] == null ? string.Empty : row["SkuOuterID"].ToString(); repositoryItemComboBoxLayout.Items.Clear(); if (!string.IsNullOrEmpty(houseCode)) { LoadLayout(repositoryItemComboBoxLayout, houseCode); } /*点击显示商品属性*/ if (!string.IsNullOrEmpty(outerID) && !string.IsNullOrEmpty(skuOuterID)) { StockItem stockItem = StockItemService.GetStockItemByOutId(outerID); StockProduct stockProduct = StockProductService.GetStockProduct(skuOuterID); if (stockItem != null && stockProduct != null) { View_ShopItem item = new View_ShopItem(); item.props = stockItem.Props; item.input_pids = stockItem.InputPids; item.input_str = stockItem.InputStr; item.property_alias = stockProduct.PropsAlias; item.cid = stockItem.Cid; UIHelper.LoadItemPropValue(item, categoryRowKeyProps, categoryRowSaleProps, categoryRowNotKeyProps, categoryRowStockProps); } } }
// GET: Categories public ActionResult Index() { var ViewModel = new IndexCategoryViewModel(); var categories = ( from node in db.Categories orderby node.LftId ascending select new { LftId = node.LftId, RgtId = node.RgtId, Name = node.Name, Id = node.Id, //find all when left < myleft and right > myright will give you all parents Depth = ( from parent in db.Categories where parent.LftId <node.LftId && parent.RgtId> node.RgtId select(parent.Id) ).Count() } ).ToList(); List <CategoryRow> CategoryList = new List <CategoryRow>(); //Create new viemodel, which will be named 'IndexCategoryViewModel foreach (var cat in categories) { CategoryRow category = new CategoryRow(); category.Name = cat.Name; category.Id = cat.Id; category.Depth = cat.Depth; category.LftId = cat.LftId; category.RgtId = cat.RgtId; CategoryList.Add(category); } ViewModel.categories = CategoryList; return(View(ViewModel)); }
public MainForm() { InitializeComponent(); _dateTimeFormatInfo = new DateTimeFormatInfo { ShortDatePattern = "yyyy.dd.MM", LongDatePattern = "yyyy.dd.MM H:mm:ss", ShortTimePattern = "H:mm", LongTimePattern = "H:mm:ss" }; var categoryRow = new CategoryRow("CategoryRow1"); vGridControl.Rows.Add(categoryRow); var editRow1 = new EditorRow { Name = "EditorRow1" }; editRow1.Properties.Caption = "EditorRow1"; editRow1.Properties.Value = 2; editRow1.Properties.RowEdit = GetLookUpEditor(); categoryRow.ChildRows.Add(editRow1); var editRow2 = new EditorRow { Name = "EditorRow2" }; editRow2.Properties.Caption = "EditorRow2"; editRow2.Properties.Value = 3; editRow2.Properties.RowEdit = GetLookUpEditor(); editRow2.Properties.RowEdit.EditValueChanged += RowEditOnEditValueChanged; categoryRow.ChildRows.Add(editRow2); var editRow3 = new EditorRow { Name = "EditorRow3" }; editRow3.Properties.Caption = "EditorRow3"; editRow3.Properties.Value = 4; editRow3.Properties.RowEdit = GetLookUpEditor(); categoryRow.ChildRows.Add(editRow3); var editRowDateOnly = new EditorRow { Name = "EditorRowDateOnly" }; editRowDateOnly.Properties.Caption = "EditorRowDateOnly"; editRowDateOnly.Properties.RowEdit = GetDateOnlyEditor(); categoryRow.ChildRows.Add(editRowDateOnly); var editRowTimeOnly = new EditorRow { Name = "EditorRowTimeOnly" }; editRowTimeOnly.Properties.Caption = "EditorRowTimeOnly"; editRowTimeOnly.Properties.RowEdit = GetTimeOnlyEditor(); categoryRow.ChildRows.Add(editRowTimeOnly); var editRowDateTime = new EditorRow { Name = "EditorRowDateTime" }; editRowDateTime.Properties.Caption = "EditorRowDateTime"; editRowDateTime.Properties.RowEdit = GetDateTimeEditor(); categoryRow.ChildRows.Add(editRowDateTime); }
/// <summary> /// Allows custom logic to be applied when switching between categories. /// </summary> /// <param name="categoryRows">The <see cref="CategoryRow"/> controls.</param> /// <param name="changedRow">The changed category row index in the array.</param> /// <param name="previous">The previously selected category index.</param> /// <param name="current">The newly selected category index.</param> protected override void UpdateCategories(CategoryRow[] categoryRows, int changedRow, int previous, int current) { CategoryRow crMain = categoryRows[0]; CategoryRow crSecondary = categoryRows[1]; if (changedRow == 0) { // Update the main categories. bool fileOpen = BinFile != null; CategoryMain category = (CategoryMain)current; CategoryMain categoryPrevious = (CategoryMain)previous; crMain.ClearCategories(); crMain.AddCategory("File"); crMain.AddCategory("Points", fileOpen); crMain.AddCategory("Physics", fileOpen); crMain.AddCategory("Speed", fileOpen); crMain.AddCategory("Handling", fileOpen); // Update the secondary categories. crSecondary.Visible = category != CategoryMain.File; crSecondary.ClearCategories(); switch (category) { case CategoryMain.Points: crSecondary.AddCategory("Drivers"); crSecondary.AddCategory("Karts"); crSecondary.AddCategory("Tires"); crSecondary.AddCategory("Gliders"); crSecondary.SelectedCategory = _categoryPoints; break; case CategoryMain.Physics: crSecondary.AddCategory("Weight"); crSecondary.AddCategory("Acceleration"); crSecondary.AddCategory("On-Road Slip"); crSecondary.AddCategory("Off-Road Slip"); crSecondary.AddCategory("Off-Road Brake"); crSecondary.AddCategory("Turbo"); crSecondary.SelectedCategory = _categoryPhysics; break; case CategoryMain.Speed: case CategoryMain.Handling: crSecondary.AddCategory("Ground"); crSecondary.AddCategory("Water"); crSecondary.AddCategory("Anti-Gravity"); crSecondary.AddCategory("Gliding"); crSecondary.SelectedCategory = _categorySpeedHandling; break; } } else { // Remember the newly selected secondary category. switch ((CategoryMain)crMain.SelectedCategory) { case CategoryMain.Points: _categoryPoints = current; break; case CategoryMain.Physics: _categoryPhysics = current; break; case CategoryMain.Speed: case CategoryMain.Handling: _categorySpeedHandling = current; break; } } }
/// <summary> /// Hàm trợ giúp lấy mã của Category trong Tab hiện thời khi người sử dụng chọn xem một Category /// </summary> /// <returns>Mã tham chiếu đến Category hiện thời</returns> public static string GetCurrentCategoryID() { Cache cache = new Cache(HttpContext.Current.Application); // Biến lưu trữ mã của chuyên san hiện thời int _intCurrentCategoryID = 0, _intCurrParent = 0; string _strCurrentTabRef = HttpContext.Current.Request.QueryString["TabRef"]; if (HttpContext.Current.Request.QueryString["RealRef"] != null) { _strCurrentTabRef = HttpContext.Current.Request.QueryString["RealRef"]; } string mrs = Config.GetPortalUniqueCacheKey() + "CurrentCategoryID_" + (_strCurrentTabRef == null ? "" : _strCurrentTabRef); string nrs = Config.GetPortalUniqueCacheKey() + "CurrentParentID_" + (_strCurrentTabRef == null ? "" : _strCurrentTabRef); // Tìm kiếm trong Cache if (cache[mrs] != null && cache[nrs] != null) { _intCurrentCategoryID = (int)cache[mrs]; _intCurrParent = (int)cache[nrs]; } if (_intCurrentCategoryID > 0) { return(_intCurrParent + "," + _intCurrentCategoryID); } // Lấy thông tin về Tab hiện thời PortalDefinition.Tab _objCurrentTab = PortalDefinition.getTabByRef(_strCurrentTabRef);//PortalDefinition.GetCurrentTab(); if (_objCurrentTab != null) { // Lấy mã tham chiếu của Tab string _strTabRef = _objCurrentTab.reference; string _strCategoryRef = "", _strParentRef = ""; // Tìm vị trí dấu chấm cuối int _intLastDotPos = _strTabRef.LastIndexOf('.'); if (_intLastDotPos > 0) { // Cắt lấy phần tên đại diện trên URL của Category _strCategoryRef = _objCurrentTab.reference.Substring(_intLastDotPos + 1); _strParentRef = _objCurrentTab.reference.Substring(0, _intLastDotPos); // Lấy thông tin về Category đã chọn CategoryRow _objCurrentCategory = null; using (MainDB _objDB = new MainDB()) { _objCurrentCategory = _objDB.CategoryCollection.GetRow("Cat_DisplayURL = '" + _strCategoryRef + "'"); } if (_objCurrentCategory != null) { _intCurrentCategoryID = _objCurrentCategory.Cat_ID; _intCurrParent = _objCurrentCategory.Cat_ParentID; } else { _intLastDotPos = _strParentRef.LastIndexOf('.'); _strParentRef = _strParentRef.Substring(_intLastDotPos + 1); using (MainDB _objDB = new MainDB()) { _objCurrentCategory = _objDB.CategoryCollection.GetRow("Cat_DisplayURL = '" + _strParentRef + "'"); } if (_objCurrentCategory != null) { _intCurrentCategoryID = _objCurrentCategory.Cat_ID; _intCurrParent = _objCurrentCategory.Cat_ParentID; } } } } // Lưu mã của chuyên san hiện thời vào Cache cache[mrs] = _intCurrentCategoryID; cache[nrs] = _intCurrParent; // Trả về 0 nếu không tìm thấy Category return(_intCurrParent + "," + _intCurrentCategoryID);//0 }
/// <summary> /// Allows custom logic to be applied when switching between categories. /// </summary> /// <param name="categoryRows">The <see cref="CategoryRow"/> controls.</param> /// <param name="changedRow">The changed category row index in the array.</param> /// <param name="previous">The previously selected category index.</param> /// <param name="current">The newly selected category index.</param> protected override void UpdateCategories(CategoryRow[] categoryRows, int changedRow, int previous, int current) { CategoryRow crMain = categoryRows[0]; CategoryRow crSecondary = categoryRows[1]; CategoryRow crTertiary = categoryRows[2]; if (changedRow == 0) { // Update the main categories. bool fileOpen = BinFile != null; CategoryMain category = (CategoryMain)current; CategoryMain categoryPrevious = (CategoryMain)previous; crMain.ClearCategories(); crMain.AddCategory("File"); crMain.AddCategory("Versus Races", fileOpen); crMain.AddCategory("Battle Mode", fileOpen); // Update the secondary categories. crSecondary.ClearCategories(); switch (category) { case CategoryMain.Versus: crSecondary.AddCategory("All Items"); crSecondary.AddCategory("Mushrooms Only"); crSecondary.AddCategory("Shells Only"); crSecondary.AddCategory("Bananas Only"); crSecondary.AddCategory("Bob-ombs Only"); crSecondary.AddCategory("Frantic Mode"); crSecondary.AddCategory("Grand Prix"); crSecondary.AddCategory("Distances"); break; case CategoryMain.Battle: crSecondary.AddCategory("All Items"); crSecondary.AddCategory("Mushrooms Only"); crSecondary.AddCategory("Shells Only"); crSecondary.AddCategory("Bananas Only"); crSecondary.AddCategory("Bob-ombs Only"); crSecondary.AddCategory("Frantic Mode"); break; } if ((CategoryMain)crMain.SelectedCategory == CategoryMain.Battle) { _itemSet = Math.Min((int)CategorySecond.Frantic, _itemSet); } crSecondary.SelectedCategory = _itemSet; } else if (changedRow == 1) { // Update the tertiary categories. crTertiary.Visible = (CategorySecond)current != CategorySecond.Distances; crTertiary.ClearCategories(); crTertiary.AddCategory("Human Player"); crTertiary.AddCategory("Software Player"); crTertiary.SelectedCategory = _playerType; // Remember the newly selected secondary category. _itemSet = current; } else if (changedRow == 2) { // Remember the newly selected tertiary category. _playerType = current; } crSecondary.Visible = (CategoryMain)crMain.SelectedCategory != CategoryMain.File; crTertiary.Visible = crSecondary.Visible && (CategorySecond)crSecondary.SelectedCategory != CategorySecond.Distances; }
private void StatisticsAndChartForm_Load(object sender, EventArgs e) { //更改窗体名称 this.Text = "Statistics And Chart For " + tablename; //生成统计表格 for (int i = 0; i < gridview.Columns.Count; i++) { CategoryRow field = new CategoryRow(gridview.Columns[i].FieldName); EditorRow row_count = new EditorRow(); row_count.Properties.Caption = "Count"; row_count.Properties.Value = gridview.RowCount; row_count.Appearance.Options.UseTextOptions = true; row_count.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; field.ChildRows.Add(row_count); //当列类型为数值时 if (gridview.Columns[i].ColumnType.IsValueType) { var data = new double[gridview.RowCount]; int count = 0;//计算空值数 //将该列的数据存储进数组 for (int j = 0; j < gridview.RowCount; j++) { if (gridview.GetRowCellValue(j, field.Properties.Caption).ToString() == "" || gridview.GetRowCellValue(j, field.Properties.Caption) == null || gridview.GetRowCellValue(j, field.Properties.Caption).ToString() == " ") { count++; } data[j] = (double)gridview.GetRowCellValue(j, field.Properties.Caption); } //存储列数据 field.Tag = data; //获取统计数据 //设置属性 EditorRow row_Minimum = new EditorRow(); row_Minimum.Properties.Caption = "Minimum"; row_Minimum.Properties.Value = data.Minimum(); row_Minimum.Appearance.Options.UseTextOptions = true; row_Minimum.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; EditorRow row_Maximum = new EditorRow(); row_Maximum.Properties.Caption = "Maximum"; row_Maximum.Properties.Value = data.Maximum(); row_Maximum.Appearance.Options.UseTextOptions = true; row_Maximum.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; EditorRow row_Sum = new EditorRow(); row_Sum.Properties.Caption = "Sum"; row_Sum.Properties.Value = data.Sum(); row_Sum.Appearance.Options.UseTextOptions = true; row_Sum.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; EditorRow row_Mean = new EditorRow(); row_Mean.Properties.Caption = "Mean"; row_Mean.Properties.Value = data.Mean().ToString("0.000000"); row_Mean.Appearance.Options.UseTextOptions = true; row_Mean.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; EditorRow row_Standard_Deviation = new EditorRow(); row_Standard_Deviation.Properties.Caption = "Standard Deviation"; row_Standard_Deviation.Properties.Value = data.StandardDeviation().ToString("0.000000"); row_Standard_Deviation.Appearance.Options.UseTextOptions = true; row_Standard_Deviation.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; field.ChildRows.Add(row_Minimum); field.ChildRows.Add(row_Maximum); field.ChildRows.Add(row_Sum); field.ChildRows.Add(row_Mean); field.ChildRows.Add(row_Standard_Deviation); EditorRow row_Nulls = new EditorRow(); row_Nulls.Properties.Caption = "Nulls"; row_Nulls.Properties.Value = count; row_Nulls.Appearance.Options.UseTextOptions = true; row_Nulls.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; field.ChildRows.Add(row_Nulls); //将数值类型字段添加到combox中 comboBoxEdit1.Properties.Items.Add(gridview.Columns[i].FieldName); } //列类型不为数值型 else { //将该列的数据存储进数组 var data = new string[gridview.RowCount]; EditorRow row_Nulls = new EditorRow(); row_Nulls.Properties.Caption = "Nulls"; //计算空值个数 int count = 0; for (int n = 0; n < gridview.RowCount; n++) { if (gridview.GetRowCellValue(n, field.Properties.Caption).ToString() == "" || gridview.GetRowCellValue(n, field.Properties.Caption) == null || gridview.GetRowCellValue(n, field.Properties.Caption).ToString() == " ") { count++; } data[n] = (string)gridview.GetRowCellValue(n, field.Properties.Caption); } //将列数据存入CategoryRow中 field.Tag = data; //设置属性 row_Nulls.Properties.Value = count; row_Nulls.Appearance.Options.UseTextOptions = true; row_Nulls.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; field.ChildRows.Add(row_Nulls); } StatisticsAndChart_vGridControl.Rows.AddRange(new BaseRow[] { field }); } }
public void AddCategoryRow(CategoryRow row) { this.Rows.Add(row); }
public static void deletefitphase(DevExpress.XtraVerticalGrid.VGridControl vGridControl1, CategoryRow rowMain, int removeid) { rowMain.ChildRows.RemoveAt(removeid); }
public CategoryRowChangeEvent(CategoryRow row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }
/// <summary> /// Method to an Adjustbile Coordinate Row SET. That is each call of this method creates 2 MultiEditorRows with 3 Rows (for X/Y/Z), 2 Editor Rows which represenet Upper and Lower Range of the Adjustible /// Coordinate and 1 category row which houses all the above mentioned rows /// </summary> /// <param name="_name">Caption of the Category</param> /// <param name="mr_Upper">Multi-EditorRow which will house the Upper Range of the Adjustible Coordinate</param> /// <param name="mr_Lower">Multi-EditorRow which will house the Lower Range of the Adjustible Coordinate</param> /// <param name="er_Upper">Editor Row which will house the Upper <paramref name="mr_Upper"/></param> /// <param name="er_Lower">Editor Row which will house the Upper <paramref name="mr_Lower"/></param> /// <returns><see cref="CategoryRow"/> containing all the Rows passed as parameters</returns> private CategoryRow CreateRows(string _name, out MultiEditorRow mr_Upper, out MultiEditorRow mr_Lower, out EditorRow er_Upper, out EditorRow er_Lower) { ///<summary>Creating the Upper Limit's Multi-Editor Row</summary> mr_Upper = new MultiEditorRow(); mr_Upper.Name = "UpperLimit"; MultiEditorRowProperties m1 = new MultiEditorRowProperties(); m1.Caption = "X"; m1.Value = (double)0; MultiEditorRowProperties m2 = new MultiEditorRowProperties(); m2.Caption = "Y"; m2.Value = (double)0; MultiEditorRowProperties m3 = new MultiEditorRowProperties(); m3.Caption = "Z"; m3.Value = (double)0; mr_Upper.PropertiesCollection.AddRange(new MultiEditorRowProperties[] { m1, m2, m3 }); mr_Upper.Enabled = false; ///<summary>Creating the Lower Limit's Multi-Editor Row</summary> mr_Lower = new MultiEditorRow(); mr_Lower.Name = "LowerLimit"; MultiEditorRowProperties m4 = new MultiEditorRowProperties(); m4.Caption = "X"; m4.Value = (double)0; MultiEditorRowProperties m5 = new MultiEditorRowProperties(); m5.Caption = "Y"; m5.Value = (double)0; MultiEditorRowProperties m6 = new MultiEditorRowProperties(); m6.Caption = "Z"; m6.Value = (double)0; mr_Lower.PropertiesCollection.AddRange(new MultiEditorRowProperties[] { m4, m5, m6 }); mr_Lower.Enabled = false; ///<summary>Creating the Upper Limit's Editor Row which will house the Upper Multi-Editor Row</summary> er_Upper = new EditorRow(); er_Upper.Properties.Caption = "Upper"; er_Upper.Properties.AllowEdit = false; er_Upper.ChildRows.Add(mr_Upper); er_Upper.Enabled = false; ///<summary>Creating the Lower Limit's Editor Row which will house the Lower Multi-Editor Row</summary> er_Lower = new EditorRow(); er_Lower.Properties.Caption = "Lower"; er_Lower.Properties.AllowEdit = false; er_Lower.ChildRows.Add(mr_Lower); er_Lower.Enabled = false; ///<summary>The Category which will house all the above rowss</summary> CategoryRow category = new CategoryRow(_name); category.Name = _name; category.ChildRows.AddRange(new BaseRow[] { er_Upper, er_Lower }); return(category); }
public ExcelImportResponse ExcelImport(IUnitOfWork uow, ExcelImportRequest request) { request.CheckNotNull(); Check.NotNullOrWhiteSpace(request.FileName, "filename"); UploadHelper.CheckFileNameSecurity(request.FileName); if (!request.FileName.StartsWith("temporary/")) { throw new ArgumentOutOfRangeException("filename"); } ExcelPackage ep = new ExcelPackage(); using (var fs = new FileStream(UploadHelper.DbFilePath(request.FileName), FileMode.Open, FileAccess.Read)) ep.Load(fs); var p = ProductRow.Fields; var s = SupplierRow.Fields; var c = CategoryRow.Fields; var response = new ExcelImportResponse(); response.ErrorList = new List <string>(); var worksheet = ep.Workbook.Worksheets[1]; for (var row = 2; row <= worksheet.Dimension.End.Row; row++) { try { // var product = uow.Connection.TryFirst < ProductRow >(q => q.Select(p.ProductID) // .Where(p.ProductName == productName)); // var product = new ProductRow // { // }; var product = new ProductRow(); var supplierName = Convert.ToString(worksheet.Cells[row, 4].Value ?? ""); if (!string.IsNullOrWhiteSpace(supplierName)) { var supplier = uow.Connection.TryFirst <SupplierRow>(q => q .Select(s.SupplierID) .Where(s.CompanyName == supplierName)); if (supplier == null) { var suppliernew = new SupplierRow(); suppliernew.CompanyName = supplierName; new SupplierRepository().Create(uow, new SaveRequest <SupplierRow> { Entity = suppliernew, }); // product.CategoryID = categorynew.CategoryID.Value; var suppl = uow.Connection.TryFirst <SupplierRow>(q => q .Select(s.SupplierID) .Where(s.CompanyName == suppliernew.CompanyName)); product.SupplierID = supplier.SupplierID.Value; } product.SupplierID = supplier.SupplierID.Value; } else { product.SupplierID = null; } var categoryName = Convert.ToString(worksheet.Cells[row, 5].Value ?? ""); if (!string.IsNullOrWhiteSpace(categoryName)) { var category = uow.Connection.TryFirst <CategoryRow>(q => q .Select(c.CategoryID) .Where(c.CategoryName == categoryName)); if (category == null) { var categorynew = new CategoryRow(); categorynew.CategoryName = categoryName; new CategoryRepository().Create(uow, new SaveRequest <CategoryRow> { Entity = categorynew, }); // product.CategoryID = categorynew.CategoryID.Value; var categoryy = uow.Connection.TryFirst <CategoryRow>(q => q .Select(c.CategoryID) .Where(c.CategoryName == categorynew.CategoryName)); product.CategoryID = categoryy.CategoryID.Value; } else { product.CategoryID = category.CategoryID.Value; } } else { product.CategoryID = null; } product.ProductName = Convert.ToString(worksheet.Cells[row, 3].Value ?? ""); product.UnitPrice = Convert.ToDecimal(worksheet.Cells[row, 6].Value ?? 0); product.UnitsInStock = Convert.ToDecimal(worksheet.Cells[row, 7].Value ?? 0); product.Product2ID = Convert.ToString(worksheet.Cells[row, 2].Value ?? ""); product.ProductID = Convert.ToString(worksheet.Cells[row, 1].Value ?? ""); var producto = uow.Connection.TryFirst <ProductRow>(q => q .Select(p.ProductID) .Where(p.ProductID == product.ProductID)); if (producto == null) { new ProductRepository().Create(uow, new SaveRequest <MyRow> { Entity = product, }); response.Inserted = response.Inserted + 1; } else { new ProductRepository().Update(uow, new SaveRequest <MyRow> { Entity = product, EntityId = product.ProductID }); response.Updated = response.Updated + 1; } } catch (Exception ex) { response.ErrorList.Add("Exception on Row " + row + ": " + ex.Message); } } return(response); }
public CategoryRowChangeEvent(CategoryRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public ExcelImportResponse ExcelImport(IUnitOfWork uow, ExcelImportRequest request) { request.CheckNotNull(); Check.NotNullOrWhiteSpace(request.FileName, "Filename"); UploadHelper.CheckFileNameSecurity(request.FileName); if (!request.FileName.StartsWith("temporary/")) { throw new ArgumentOutOfRangeException("filename"); } ExcelPackage ep = new ExcelPackage(); using (var fs = new FileStream(UploadHelper.DbFilePath(request.FileName), FileMode.Open, FileAccess.Read)) ep.Load(fs); var c = CategoryRow.Fields; var t = CategoryTypeRow.Fields; var response = new ExcelImportResponse(); response.ErrorList = new List <string>(); var worksheet = ep.Workbook.Worksheets[1]; for (var row = 2; row <= worksheet.Dimension.End.Row; row++) { try { var categoryName = Convert.ToString(worksheet.Cells[row, 3].Value ?? ""); if (categoryName.IsTrimmedEmpty()) { continue; } var category = uow.Connection.TryFirst <CategoryRow>(q => q .Select(c.CategoryID) .Where(c.CategoryName == categoryName)); if (category == null) { category = new CategoryRow { CategoryName = categoryName } } ; else { category.TrackWithChecks = false; } #region Type var typeName = Convert.ToString(worksheet.Cells[row, 1].Value ?? ""); if (!string.IsNullOrWhiteSpace(typeName)) { var type = uow.Connection.TryFirst <CategoryTypeRow>(q => q .Select(t.CategoryTypeID) .Where(t.CategoryType == typeName)); if (type == null) { response.ErrorList.Add("Error On Row" + row + ": Category with name '" + typeName + "' is not found!"); continue; } category.CategoryTypeID = Convert.ToInt16(type.CategoryTypeID.Value); } else { category.CategoryTypeID = null; } #endregion Type category.CategoryCode = Convert.ToString(worksheet.Cells[row, 2].Value ?? ""); category.Description = Convert.ToString(worksheet.Cells[row, 4].Value ?? ""); if (category.CategoryID == null) { new CategoryRepository().Create(uow, new SaveWithLocalizationRequest <MyRow> { Entity = category }); response.Inserted = response.Inserted + 1; } else { new CategoryRepository().Update(uow, new SaveWithLocalizationRequest <MyRow> { Entity = category, EntityId = category.CategoryID.Value }); response.Updated = response.Updated + 1; } } catch (Exception ex) { response.ErrorList.Add("Exception on Row " + row + ": " + ex.Message); } } return(response); }
private void InitGrid(EditorRow[] RowList) { foreach (ParamGroup pg in ParamGroupList) { CategoryRow cr = new CategoryRow(pg.NAME); foreach (EditorRow er in RowList) if (GetParamGroupID(er.Properties.FieldName).Equals(pg.ID)) if (frmAppParamsHelp.TonTaiThamSo(er.Properties.FieldName)) { er.Properties.Caption = GetParamEndUser(er.Properties.FieldName); ; cr.ChildRows.Add(er); } vGridMain.Rows.Add(cr); } ShowGrid(false); }
private Dictionary<int, CategoryRow> MakeHierarchy() { Dictionary<int, CategoryRow> categories = new Dictionary<int, CategoryRow>(); foreach (ListCategoriesRow row in Categories.row) { if(row.parentid > 0) { CategoryRow child = new CategoryRow(); child.Data = row; if(categories.ContainsKey(row.parentid)) { categories[row.parentid].Children.Add(child); } else { CategoryRow parent = new CategoryRow(); parent.Children.Add(child); categories.Add(row.parentid, parent); } } else { if(categories.ContainsKey(row.categoryid)) { categories[row.categoryid].Data = row; } else { CategoryRow parent = new CategoryRow(); parent.Data = row; categories.Add(row.categoryid, parent); } } } return categories; }
/// <summary> /// 单击VGridview生成图表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StatisticsAndChart_vGridControl_MouseClick(object sender, MouseEventArgs e) { DevExpress.XtraVerticalGrid.VGridControl gridcontrol = new DevExpress.XtraVerticalGrid.VGridControl(); gridcontrol = sender as DevExpress.XtraVerticalGrid.VGridControl; VGridHitInfo info = gridcontrol.CalcHitInfo(new Point(e.X, e.Y)); //当左键单击HeaderCell时 if (info.HitInfoType == HitInfoTypeEnum.HeaderCell && info.Row.HasChildren && e.Button == MouseButtons.Left && info.Row.Properties.Caption.IndexOf('*') != 0) { BaseRow baserow = gridcontrol.FocusedRow; CategoryRow gr = baserow as CategoryRow; //根据tag加载列数据 if (gr != null && gr.Tag != null) { string[] data = null; //判断字段类型是否为数值型 if (gridview.Columns[gr.Properties.Caption].ColumnType.IsValueType) { //读取tag中的数据至数组 double[] doubledata = gr.Tag as double[]; List <double> doublelist = doubledata.ToList(); //计算唯一值及唯一值个数 List <double> d_uniquevalue = doubledata.Distinct().ToList(); int d_uniquecount = d_uniquevalue.Count; //当唯一值个数大于30时,执行分组处理 if (d_uniquecount > 30) { //计算分组间距 double interval = (d_uniquevalue.Max() - d_uniquevalue.Min()) / 25; //计算图表中加入点的值 List <string> chart_uniquevalue = new List <string>(); for (int n = 0; n < 26; n++) { if (n == 25) { chart_uniquevalue.Add((interval * n).ToString("0.0") + "-" + d_uniquevalue.Max().ToString("0.0")); } else { chart_uniquevalue.Add((interval * n).ToString("0.0") + "-" + (interval * (n + 1)).ToString("0.0")); } } double max = d_uniquevalue.Max(); //chart_uniquevalue.Add((d_uniquevalue.Max()).ToString()); //声明26个list类型的数组 List <double>[] findlist = new List <double> [26]; for (int n = 0; n < 26; n++) { findlist[n] = new List <double>(); } //根据分组间距,将所有数据存放到对应的26个list中 for (int n = 0; n < doublelist.Count; n++) { findlist[(int)(doublelist[n] / interval)].Add(doublelist[n]); } //完成分组 //清除图表数据,重新载入数据 for (int i = 0; i < StatisticsChart_chart1.Series.Count; i++) { StatisticsChart_chart1.Series.RemoveAt(i); } //创建图表 Series series = new Series(gr.Properties.Caption + "_Count", ViewType.Bar); for (int n = 0; n < 26; n++) { series.Points.Add(new SeriesPoint(chart_uniquevalue[n].ToString(), findlist[n].Count)); } StatisticsChart_chart1.Series.Add(series); } else { data = new string[gridview.RowCount]; for (int i = 0; i < doubledata.Count(); i++) { data[i] = doubledata[i].ToString(); } } } else { data = new string[gridview.RowCount]; data = gr.Tag as string[]; } if (data != null) { List <string> datalist = data.ToList(); //获取唯一值 List <string> UniqueValue = data.Distinct().ToList(); int uniquecount = UniqueValue.Count; if ((uniquecount <= 300) || (uniquecount > 300 && (MessageBox.Show("分类数较多,是否继续?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes))) { //清除图表数据,重新载入数据 for (int i = 0; i < StatisticsChart_chart1.Series.Count; i++) { StatisticsChart_chart1.Series.RemoveAt(i); } //创建图表 Series series1 = new Series("", ViewType.Bar); for (int i = 0; i < uniquecount; i++) { series1.Points.Add(new SeriesPoint(UniqueValue[i], (datalist.FindAll(value => value.Contains(UniqueValue[i]))).Count)); } StatisticsChart_chart1.Series.Add(series1); } } //生成X坐标轴名称 XYDiagram diagram = (XYDiagram)StatisticsChart_chart1.Diagram; diagram.AxisX.Title.Visible = true; diagram.AxisX.Title.Alignment = StringAlignment.Center; diagram.AxisX.Title.Text = info.Row.Properties.Caption; //生成Y坐标轴名称 diagram.AxisY.Title.Visible = true; diagram.AxisY.Title.Alignment = StringAlignment.Center; diagram.AxisY.Title.Text = "Count"; } } }
protected virtual void WriteItem(HtmlTextWriter writer, CategoryRow row, string link, int level) { if (Catalog.CategoryId == row.Data.categoryid || (Catalog.CategoryId == -1 && row.Data.categoryid == 1)) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "guayaquil_categoryitem_selected"); writer.AddAttribute(HtmlTextWriterAttribute.Style, string.Format("margin-left:{0}px", level*20)); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, String.Format("window.location='{0}'", link)); writer.RenderBeginTag(HtmlTextWriterTag.Div); WriteItemValue(writer, row.Data); writer.RenderEndTag(); } else { writer.AddAttribute(HtmlTextWriterAttribute.Class, "guayaquil_categoryitem"); writer.AddAttribute(HtmlTextWriterAttribute.Style, string.Format("margin-left:{0}px", level * 20)); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, String.Format("window.location='{0}'", link)); writer.AddAttribute("onmouseout", "this.className='guayaquil_categoryitem';"); writer.AddAttribute("onmouseover", "this.className='guayaquil_categoryitem_selected';"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Href, link); writer.RenderBeginTag(HtmlTextWriterTag.A); WriteItemValue(writer, row.Data); writer.RenderEndTag(); writer.RenderEndTag(); } foreach (CategoryRow child in row.Children) { string childLink = FormatLink("unit", child.Data); WriteItem(writer, child, childLink, level + 1); } }
public void RemoveCategoryRow(CategoryRow row) { this.Rows.Remove(row); }
public static void addfitphase(DevExpress.XtraVerticalGrid.VGridControl vGridControl1, CategoryRow rowMain, int phasei, string AprsType, DateTime BeginDate, DateTime EndDate, double QiValue, double DiValue, double niValue) { CategoryRow fitphase = new CategoryRow("拟合阶段" + phasei.ToString()); rowMain.ChildRows.Add(fitphase); // creating and modifying the Category row EditorRow rowCategory2 = new EditorRow("拟合模型"); rowCategory2.Properties.Caption = "拟合模型"; // adding the Category row to the Model row's child collection fitphase.ChildRows.Add(rowCategory2); RepositoryItemComboBox riCombo = new RepositoryItemComboBox(); riCombo.Items.AddRange(new string[] { "指数递减", "双曲递减", "调和递减" }); //Add a repository item to the repository items of grid control vGridControl1.RepositoryItems.Add(riCombo); //Now you can define the repository item as an inplace editor of columns // populating the combo box with data rowCategory2.Properties.Value = "指数递减"; rowCategory2.Properties.RowEdit = riCombo; // vGridControl1.SetCellValue(rowCategory2, vGridControl1.FocusedRecord, "customText"); // creating and modifying the Category row EditorRow startdate = new EditorRow("开始时间"); startdate.Properties.Caption = "开始时间"; // adding the Category row to the Model row's child collection RepositoryItemDateEdit ridate = vGridControl1.RepositoryItems.Add("DateEdit") as RepositoryItemDateEdit; fitphase.ChildRows.Add(startdate); startdate.Properties.Value = BeginDate; vGridControl1.RepositoryItems.Add(ridate); //Now you can define the repository item as an inplace editor of columns // populating the combo box with data startdate.Properties.RowEdit = ridate; EditorRow enddate = new EditorRow("结束时间"); enddate.Properties.Caption = "结束时间"; // adding the Category row to the Model row's child collection fitphase.ChildRows.Add(enddate); enddate.Properties.Value = 232; enddate.Properties.Value = EndDate; enddate.Properties.RowEdit = ridate; DateTime discount = Convert.ToDateTime(enddate.Properties.Value); //Create a repository item corresponding to a combo box editor to the persistent repository EditorRow Qi = new EditorRow("初始递减产量"); Qi.Properties.Caption = "初始递减产量"; // adding the Category row to the Model row's child collection fitphase.ChildRows.Add(Qi); Qi.Properties.Value = string.Format("{0} Km", QiValue); //double discoun2t = Convert.ToDouble(Qi.Properties.Value); //double dd = discoun2t; //Qi.Properties.ShowUnboundExpressionMenu = true; EditorRow di = new EditorRow("初始递减率"); di.Properties.Caption = "初始递减率"; // adding the Category row to the Model row's child collection fitphase.ChildRows.Add(di); di.Properties.Value = DiValue; EditorRow ni = new EditorRow("递减指数"); ni.Properties.Caption = "递减指数"; // adding the Category row to the Model row's child collection fitphase.ChildRows.Add(ni); ni.Properties.Value = niValue; RepositoryItemButtonEdit rib = new RepositoryItemButtonEdit();//Button按钮 //rib.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;//隐藏文字 rib.Buttons[0].Caption = "Km"; rib.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;//按钮样式 ni.Properties.RowEdit = rib; }