private void LoadColumnIntoGrid() { // create HeaderRow Ext.Net.HeaderRow row = new HeaderRow(); int i = 0; foreach (var item in new SalaryBoardConfigController().GetSalaryColumnList(MenuID)) { // set editor Ext.Net.TextField txtEditor = new TextField(); txtEditor.MaskRe = "/[0-9.-]/"; txtEditor.ID = "txtEditor" + i; item.Editor.Add(txtEditor); grpSalaryBoard.ColumnModel.Columns.Add(item); #region Tạo GroupHeader // create HeaderColumn Ext.Net.HeaderColumn column = new HeaderColumn(); column.AutoWidthElement = false; // tạo DisplayField để hiển thị Ext.Net.DisplayField dpf = new DisplayField(); dpf.ID = "dpf" + item.ColumnID; dpf.Text = ""; // add DisplayField to ColumnHeader column.Component.Add(dpf); row.Columns.Add(column); #endregion i++; } lkv.HeaderRows.Add(row); }
public override string Get() { StringBuilder grid = new StringBuilder(); using (DataTable table = this.GetTable()) { if (table.Rows.Count.Equals(0)) { return("<div class='ui message'>No record found</div>"); } TagBuilder.Begin(grid, "table"); TagBuilder.AddId(grid, "FormGridView"); TagBuilder.AddClass(grid, ConfigBuilder.GetGridViewCssClass(this.Config)); TagBuilder.AddStyle(grid, ConfigBuilder.GetGridViewWidth(this.Config) + ";white-space: nowrap;"); TagBuilder.Close(grid); List <Column> columns = GetColumns(table).ToList(); HeaderRow header = new HeaderRow(this.Config, columns); grid.Append(header.Get()); using (Body body = new Body(this.Config, table, columns)) { grid.Append(body.Get()); } TagBuilder.EndTag(grid, "table"); } return(grid.ToString()); }
protected override IList <Tuple <string, ContactProp?, IList <string> > > CreateMapping() { Debug.Assert(Analyzer.HasHeaderRow == true); Debug.Assert(Analyzer.ColumnNames != null); IList <Tuple <string, ContactProp?, IList <string> > >?mapping = HeaderRow.GetMappingEN(); if (Analyzer.ColumnNames.Where(s => mapping.Any(tpl => tpl.Item2.HasValue && StringComparer.OrdinalIgnoreCase.Equals(tpl.Item3[0], s))).Count() > 3) { return(mapping); } else { // Spaltenreihenfolge var end = Math.Min(mapping.Count, Analyzer.ColumnNames.Count); for (int i = 0; i < end; i++) { mapping[i].Item3[0] = Analyzer.ColumnNames[i]; } for (int i = end; i < mapping.Count; i++) { Tuple <string, ContactProp?, IList <string> >?currentTpl = mapping[i]; mapping[i] = new Tuple <string, ContactProp?, IList <string> >(currentTpl.Item1, null, EmptyStringArray); } } return(mapping); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if ((ControlId != null) && (HeaderRow != null)) { ((Image)(HeaderRow.FindControl(ControlId))).ImageUrl = ImageUrl; } if (Controls.Count > 0) { var scripTag = new HtmlGenericControl("input"); scripTag.Attributes.Add("class", "resetToDefaultValue"); scripTag.Attributes.Add("type", "hidden"); scripTag.Attributes.Add("value", _resetToDefaultValueOnRowEditCancel.ToString()); Controls.Add(scripTag); scripTag = new HtmlGenericControl("input"); scripTag.Attributes.Add("class", "readOnlyRowInInit"); scripTag.Attributes.Add("type", "hidden"); scripTag.Attributes.Add("value", _readOnlyRowInInit.ToString()); Controls.Add(scripTag); //ReadOnlyRowInInit scripTag = new HtmlGenericControl("input"); scripTag.Attributes.Add("class", "readOnlyGrid"); scripTag.Attributes.Add("type", "hidden"); scripTag.Attributes.Add("value", _readOnly.ToString()); Controls.Add(scripTag); } }
public void SelectAllCheckBoxes() { for (var i = 0; i < Rows.Count; i++) { ((CheckBox)HeaderRow.FindControl("selectAllCheckBox")).Checked = true; ((CheckBox)Rows[i].Cells[0].FindControl("selectCheckBox")).Checked = true; } }
public HeaderRow Convert(int second) { var secondIsEven = second % OddNumberDivider == 0; var hours = new HeaderRow { RoundBlinker = secondIsEven ? YellowLightEnum.Active : YellowLightEnum.InActive }; return(hours); }
private void AdjustRowLocations() { HeaderRow.AdjustLocation(Style.Common.GridPadding.Top); Row prevRow = HeaderRow; foreach (Row currentRow in Rows) { currentRow.AdjustLocation(prevRow.Bottom); prevRow = currentRow; } FooterRow.AdjustLocation(prevRow.Bottom); }
protected override IList <Tuple <string, ContactProp?, IList <string> > > CreateMapping() { IList <Tuple <string, ContactProp?, IList <string> > >?mapping = HeaderRow.GetMapping(); mapping.Add( // Dummy-Property, die am Ende von <see cref="CsvRecordWrapper"/> eingefügt wird, um beim Lesen von CSV am Ende der Initialisierung von <see cref="Contact"/> // AddressHome und AddressWork sowie HomePagePersonal und HomePageWork ggf. zu vertauschen: new Tuple <string, ContactProp?, IList <string> >(nameof(AdditionalProp.Swap), (ContactProp)AdditionalProp.Swap, EmptyStringArray)); return(mapping); }
public string GetHeader() { var output = new StringBuilder(); var header = new HeaderRow { WorkstationID = "All", BusinessDate = DateTime.Today.ToString(), ReportOn = DateTime.Today.ToString(), Page = "1" }; return(output.ToString()); }
/// <summary> /// This is provided to make unit testing easier. Now you can create the object and then ToString it. /// </summary> /// <returns></returns> public override string ToString() { var stringBuilder = new StringBuilder(); if (HeaderRow != null) { stringBuilder.AppendLine(HeaderRow.ToString()); } foreach (var row in Rows) { stringBuilder.AppendLine(row.ToString()); } return(stringBuilder.ToString()); }
void SetupPage() { StackLayout.Children.Clear(); _footer = AddTitleRow("Title"); _serviceNodeButton = null; if (!ServiceNodeManager.Current.HadUnlockedServiceNode) { AddHeaderRow("Auth"); AddButtonRow("Authorize", Authorize); AddInfoRow("AutorhizeInfo"); AddFooterRow(); } else { AddHeaderRow("MiscHeader"); var button = AddButtonRow("Search", Search); button.SetDetailViewIcon(Icons.Search); button = AddButtonRow("Pending", Pending); button.SetDetailViewIcon(Icons.UserClock); button = AddButtonRow("YourContact", YourContact); button.SetDetailViewIcon(Icons.User); if (UIApp.CanShare) { button = AddButtonRow("Share", Share); button.SetDetailViewIcon(Icons.Share); } button = AddButtonRow("Copy", Copy); button.SetDetailViewIcon(Icons.Copy); AddInfoRow("MiscInfo"); AddFooterRow(); AddHeaderRow("Common.ServiceNode"); _serviceNodeButton = AddRow(new ServiceNodeButtonRow(this, ServiceNodesPageSelectionFlags.ActiveRequired | ServiceNodesPageSelectionFlags.UnlockedAccountRequired, "contacts")); _serviceNodeButton.SelectionChanged = ServiceNodeChanged; AddInfoRow("Common.ServiceNodeInfo"); AddFooterRow(); } }
protected void GenerateHeaderRow() { string[] headerarr = HeaderRow.Split(';'); if (headerarr.Count() != Columns && !string.IsNullOrEmpty(HeaderRow)) { throw new Exception("Invalid Header Row for ammount of Columns"); } else { TableHeaderRow row = new TableHeaderRow(); for (int i = 0; i < Columns; i++) { row.Cells.Add(GenerateHeaderCell(headerarr[i])); } row.Style.Add(HtmlTextWriterStyle.BackgroundColor, HeaderRowColor.ToString()); Rows.Add(row); DataBind(); } }
public static RowX CreateFrom(HeaderRow headerRow) { if (headerRow == null) { throw new ArgumentNullException(nameof(headerRow)); } RowX headerRowX = new() { Border = headerRow.ParentDataGrid?.Border?.IsVisible == true ? DataGridBorderX.CreateFrom(headerRow.ParentDataGrid.Border) : null, Cells = headerRow .Select(CellX.CreateFrom) .ToList() }; headerRowX.CalculateLayout(); return(headerRowX); }
public static string HeaderToString(this HeaderRow value) { return(((char)value.RoundBlinker).ToString()); }
public NoteListView(StackPage page, HeaderRow header) : base(page, header) { }
/*Unit Implementation in Web Services - End*/ //Method to fetch the table module details /*Unit Implementation in Web Services - Begin*/ //Added a new parameter - strUnit public List<table> getTableData(double dStnLat, double dStnLong, int iAtl, int iMaxDist, int iMaxAltDiff, IRuleSets objIRuleset, string strNode, string strNodeName, string strCultureCode, string strServiceName, string strModuleName, string strLangID,string strUnit) { DataSet dsTbl = new DataSet(); objTableSvc.setTableWebServiceValues(dStnLat, dStnLong, iAtl, iMaxDist, iMaxAltDiff); /*Unit Implementation in Web Services - Begin*/ dsTbl = objTblPre.getTableDataForService(strNode, strNodeName, objIRuleset, strServiceName, strModuleName, strCultureCode, strUnit); /*Unit Implementation in Web Services - End*/ List<table> tablelist = new List<table>(); table tbl; tableRow tr = new tableRow(); tableCell tc; HeaderRow hr1 = new HeaderRow(); HeaderRow hr2 = new HeaderRow(); HeaderCell hc; if (dsTbl.Tables[0].TableName.ToLower().Contains("header") && dsTbl.Tables.Count == 2) { tbl = new table(); tbl.HeaderRows = new List<HeaderRow>(); tbl.TableName = dsTbl.Tables[1].TableName; hr1.HeaderCells = new List<HeaderCell>(); hr2.HeaderCells = new List<HeaderCell>(); int count = 0; string day = ""; string prevVal = ""; foreach (DataRow dr in dsTbl.Tables[0].Rows) { if (count == 0) { hc = new HeaderCell(); hc.Value = ""; hc.Colspan = "1"; hr1.HeaderCells.Add(hc); hc = new HeaderCell(); hc.Value = ""; hc.Colspan = "1"; hr2.HeaderCells.Add(hc); } if (prevVal != dr[0].ToString().Split(',')[0] && !(dr[0].ToString().Split(',')[1].EndsWith("0"))) { hc = new HeaderCell(); day = DateTime.Parse(dr[0].ToString().Split(',')[0].ToString()).DayOfWeek.ToString(); hc.Value = day; hc.Colspan = dr[1].ToString(); hr1.HeaderCells.Add(hc); prevVal = dr[0].ToString().Split(',')[0]; } HeaderCell hc1 = new HeaderCell(); hc1.Value = dr[0].ToString().Split(',')[1].ToString(); hc1.Colspan = "1"; hr2.HeaderCells.Add(hc1); count++; } tbl.HeaderRows.Add(hr1); tbl.HeaderRows.Add(hr2); tbl.tableRows = new List<tableRow>(); foreach (DataRow dr in dsTbl.Tables[1].Rows) { tr = new tableRow(); tr.tableCells = new List<tableCell>(); for (int i = 0; i < (dsTbl.Tables[1].Columns.Count/3); i++) { tc = new tableCell(); tc.Value = dr[0 + (i * 3)].ToString(); tc.ToolTip = dr[1 + (i * 3)].ToString(); tc.bgColor = dr[2 + (i * 3)].ToString(); if (i == 0) { tc.Color = ""; tc.CellImage = ""; } else { Color bgColor = new Color(); bgColor = ColorTranslator.FromHtml(tc.bgColor); tc.Color = ColorTranslator.FromHtml("#" + objCommonUtil.ContrastColor(bgColor).Name).Name; /********IM01144144 - New Agricast Webservices - icons URL - BEGIN ***************************/ //tc.CellImage = objCommonUtil.toBase64(GetImage(tc.Value, tc.Color, tc.bgColor)); tc.CellImage = GetImage(tc.Value, tc.Color, tc.bgColor); /********IM01144144 - New Agricast Webservices - icons URL - END ***************************/ } if (i == 0) tc.Header = "true"; else tc.Header = ""; tr.tableCells.Add(tc); } tbl.tableRows.Add(tr); } tablelist.Add(tbl); } else { foreach (DataTable dt in dsTbl.Tables) { tbl = new table(); tbl.HeaderRows = new List<HeaderRow>(); tbl.TableName = dt.TableName.ToString(); hr1.HeaderCells = new List<HeaderCell>(); for (int i = 0; i < (dt.Columns.Count / 3);i++ ) { hc = new HeaderCell(); if (i == 0) hc.Value = objLocSearchSvc.getTranslatedText("hour", strLangID); else hc.Value = (i-1).ToString(); hc.Colspan = "1"; hr1.HeaderCells.Add(hc); } tbl.HeaderRows.Add(hr1); tbl.tableRows = new List<tableRow>(); foreach (DataRow dr in dt.Rows) { tr = new tableRow(); tr.tableCells = new List<tableCell>(); for (int i = 0; i < (dr.Table.Columns.Count/3); i++) { tc = new tableCell(); tc.Value = dr[0 + (i * 3)].ToString(); tc.ToolTip = dr[1 + (i * 3)].ToString(); tc.bgColor = dr[2 + (i * 3)].ToString(); if (i == 0) { tc.Color = ""; tc.CellImage = ""; } else { Color bgColor = new Color(); bgColor = ColorTranslator.FromHtml(tc.bgColor); tc.Color = ColorTranslator.FromHtml("#" + objCommonUtil.ContrastColor(bgColor).Name).Name; /********IM01144144 - New Agricast Webservices - icons URL - BEGIN ***************************/ //tc.CellImage = objCommonUtil.toBase64(GetImage(tc.Value, tc.Color, tc.bgColor)); tc.CellImage = GetImage(tc.Value, tc.Color, tc.bgColor); /********IM01144144 - New Agricast Webservices - icons URL - END ***************************/ } if (i == 0) tc.Header = "true"; else tc.Header = ""; tr.tableCells.Add(tc); } tbl.tableRows.Add(tr); } tablelist.Add(tbl); } } return tablelist; }
public IActionResult CreateTameplate([FromBody] ReviewTameplateModel model) { var identity = HttpContext.User.Identity as ClaimsIdentity; string email = identity.FindFirst("UserEmail").Value; ReviewTameplate tameplate = new ReviewTameplate() { Name = model.Name, Description = model.Descritpion, UsersEmail = email }; foreach (var row in model.Header) { if (row.ColumnName == null) { HeaderRow headerRow = new HeaderRow() { Function = row.Fcn, Parameter = row.Parameter, Name = row.Name }; tameplate.HeaderRow.Add(headerRow); } } foreach (string s in model.Role) { ReviewRole role = new ReviewRole() { Name = s }; tameplate.ReviewRole.Add(role); } foreach (ReviewTameplateViewModel m in model.Model) { ReviewColumn column = new ReviewColumn() { Name = m.ColumnName, Type = m.Type }; ReviewHeader row = model.Header.Where(x => x.ColumnName == m.ColumnName).FirstOrDefault(); if (row != null) { HeaderRow headerRow = new HeaderRow() { Function = row.Fcn, Parameter = row.Parameter, Name = row.Name }; column.HeaderRow.Add(headerRow); tameplate.HeaderRow.Add(headerRow); } tameplate.ReviewColumn.Add(column); if (m.Option != null) { foreach (string s in m.Option) { ReviewColumnTypeEnum en = new ReviewColumnTypeEnum() { Name = s }; column.ReviewColumnTypeEnum.Add(en); } } } context.ReviewTameplate.Add(tameplate); context.SaveChanges(); return(Ok()); }
protected override CellBase GetHeaderRowCell(HeaderRow row) { return(row.ValueHeaderCell); }
public static bool Generate(Entities.ReportInfo info) { bool res = false; try { string title = DomainModel.Application. ResourceManager.GetText("rep_monthly_bill_title"); int colnum = 0; int rownum = -1; Sheet sheet; Row row; Cell head; TypeDic typeDic = new TypeDic(); ServiceDic srvDic = new ServiceDic(); HeaderRow headRow = new HeaderRow(); // Create header int index = 0; // Create first col: day# HeaderCell hc = new HeaderCell(index); hc.Text = DomainModel. Application.ResourceManager.GetText("rep_monthly_bill_col_day"); headRow.Add(hc); index++; // create service type cols srvDic.Clear(); foreach (Entities.Service srv in DomainModel.Services.GetAll()) { hc = new HeaderCell(index); hc.Text = string.Format(" {0} {1} ({2}) ", srv.ServiceType.Name, srv.Name, srv.PricePerPerson.FormattedValue); headRow.Add(hc); srvDic.Add(srv, new ServiceCell(index)); index++; } // Create payment type columns foreach (Entities.GeneralType type in DomainModel.PaymentTypes.GetAll()) { hc = new HeaderCell(index); hc.Text = " " + type.Name + " "; headRow.Add(hc); typeDic.Add(type, new ServiceCell(index)); index++; } HSSFWorkbook hssfworkbook = new HSSFWorkbook(); // Create theme Font headFont = hssfworkbook.CreateFont(); headFont.Color = HSSFColor.WHITE.index; headFont.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.BOLD; CellStyle headstyle = hssfworkbook.CreateCellStyle(); headstyle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.BLACK.index; headstyle.FillPattern = FillPatternType.SOLID_FOREGROUND; headstyle.SetFont(headFont); //// Create a entry of DocumentSummaryInformation DocumentSummaryInformation dsi = PropertySetFactory.CreateDocumentSummaryInformation(); dsi.Company = "Ms. Anke Maass"; hssfworkbook.DocumentSummaryInformation = dsi; //// Create a entry of SummaryInformation SummaryInformation si = PropertySetFactory.CreateSummaryInformation(); si.Subject = "Tour monthly bill"; hssfworkbook.SummaryInformation = si; // For each month in report inf for (DateTime date = info.StartTime; date.Month <= info.EndTime.Month; date = date.AddMonths(1)) { colnum = 0; string month = date.ToString("MMMM"); string sheetTitle = string.Format("{0} {1:00} {2:0000}", title, month, DateTime.Now.Year); // Create sheet sheet = hssfworkbook.CreateSheet(month); //sheet.DefaultColumnWidth = 25; rownum = -1; row = sheet.CreateRow(++rownum); // Title row = sheet.CreateRow(++rownum); // Space row = sheet.CreateRow(++rownum); // Col. headers // Set columns titles foreach (HeaderCell headCell in headRow) { row.CreateCell(colnum).SetCellValue(headCell.Text); row.GetCell(colnum).CellStyle = headstyle; sheet.AutoSizeColumn(colnum); colnum++; } // Set sheet title (After columns for autowidth calculations) row = sheet.GetRow(0); head = HSSFCellUtil.CreateCell(row, 0, sheetTitle); head.CellStyle = headstyle; sheet.AddMergedRegion(new CellRangeAddress(0, 0, 0, 6)); row = sheet.GetRow(1); head = HSSFCellUtil.CreateCell(row, 0, ""); head.CellStyle = headstyle; sheet.AddMergedRegion(new CellRangeAddress(1, 1, 0, 6)); // Create count rows for (DateTime dt = date; dt.Month <= date.Month; dt = dt.AddDays(1)) { row = sheet.CreateRow(++rownum); row.CreateCell(0).SetCellValue(dt.Day); row.GetCell(0).CellStyle = headstyle; Entities.TourCollection tours = new Entities.TourCollection(); DomainModel.Tours.LoadByDate(dt, tours); // Reset counters foreach (Entities.Service key in srvDic.Keys) { srvDic[key].Count = 0; } foreach (Entities.GeneralType key in typeDic.Keys) { typeDic[key].Value = 0; } // calc columns foreach (Entities.Tour tour in tours) { foreach (Entities.TourGroup group in tour.Groups) { foreach (Entities.Abstract.ITourService srv in group.Services) { srvDic[srv.Detail].Count += srv.CostDetails.ServiceCount; foreach (Entities.TourPayment payment in srv.Payments) { typeDic[payment.Type].Value += payment.Amount.Value; } } } } // Set row cells foreach (Entities.Service key in srvDic.Keys) { if (srvDic[key].Count != 0) { row.CreateCell(srvDic[key].Index).SetCellValue(srvDic[key].Count); } } foreach (Entities.GeneralType key in typeDic.Keys) { if (typeDic[key].Value > 0.0M) { row.CreateCell(typeDic[key].Index).SetCellValue( (double)typeDic[key].Value); } } } } // Create footer //Write the stream data of workbook to the root directory FileStream file = new FileStream(info.Path, FileMode.Create); hssfworkbook.Write(file); file.Close(); res = true; } catch (Exception ex) { } return(res); }
public HeaderRowChangeEvent(HeaderRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public virtual void SetRowLists() { RowList = new List <SNGridRow>(); List <IWebElement> rows = new List <IWebElement>(); //get pagination rows try { WebElementPaginationRows = PaginationRows.WaitForElements(5); if (WebElementPaginationRows != null) { HasPaginationRows = true; //get the pagination links WebElementPaginationLinks = PaginationLinks.WaitForElements(5); } else { HasPaginationRows = false; } if (Driver.WrappedDriver.GetType() == typeof(DummyDriver)) { if (DummyElementPaginationRowList == null) { DummyElementPaginationRowList = GetDummyElementsPaginationRows(); } WebElementPaginationRows = new ReadOnlyCollection <IWebElement>(DummyElementPaginationRowList); } //set the top pagination row as the 1st row rows.Add(WebElementPaginationRows[0]); } catch (Exception e) { //or else the pagination rows do not exist, so do nothing HasPaginationRows = false; } //get the header row try { WebElementHeaderRows = HeaderRow.WaitForElements(5); if (WebElementHeaderRows != null) { HasHeaderRow = true; } else { HasHeaderRow = false; } if (Driver.WrappedDriver.GetType() == typeof(DummyDriver)) { if (DummyElementHeaderRowList == null) { DummyElementHeaderRowList = GetDummyElementsHeaderRows(); } WebElementHeaderRows = new ReadOnlyCollection <IWebElement>(DummyElementHeaderRowList); } //add the header row rows.AddRange(WebElementHeaderRows); } catch (Exception e) { //or else the header row does not exist, so do nothing HasHeaderRow = false; } //get the data rows WebElementDataRows = Rows.WaitForElements(5); if (Driver.WrappedDriver.GetType() == typeof(DummyDriver)) { if (DummyElementDataRowList == null) { DummyElementDataRowList = GetDummyElementsDataRows(); } WebElementDataRows = new ReadOnlyCollection <IWebElement>(DummyElementDataRowList); } //add the data rows rows.AddRange(WebElementDataRows); //if the pagination rows exist if (WebElementPaginationRows != null) { //if there are a top and bottom pagination rows if (WebElementPaginationRows.Count == 2) { //set the bottom pagination row as the last row rows.Add(WebElementPaginationRows[1]); } } //if the pagination links exist if (WebElementPaginationLinks != null) { //get the pagination link count PaginationLinkCount = WebElementPaginationLinks.Count; } else { PaginationLinkCount = 0; } Report.Write("Grid Pagination link count: " + PaginationLinkCount); //create the IWebElement row collection WebElementRows = new ReadOnlyCollection <IWebElement>(rows); /* EXTEND GridRow WITH YOUR OWN CLASS, * THEN CALL THIS BASE METHOD FIRST, * THEN OVERRIDE THIS METHOD IN YOUR OWN CODE * base.SetRowLists(); * int rowIndex = 0; * foreach (var webElement in WebElementRows) * { * GridRowType rowType = GetGridRowType(rowIndex); * var lineItem = new GridRow(Driver, gridCssSelector, webElement, rowIndex, rowType, ColumnList, ControlPrefix); * RowList.Add(lineItem); * rowIndex++; * } */ }
protected override IList <Tuple <string, ContactProp?, IList <string> > > CreateMapping() => HeaderRow.GetMappingEN();
protected override string[] CreateColumnNames() => HeaderRow.GetColumnNamesEn();
private static string HeaderConverter(HeaderRow headerRow) { var header = headerRow.HeaderToString(); return(header); }
private static void ADOShowAndManageQuoteDetails(int OrdHeaderID) { bool next_opt = true; ADOM9Dataset.SalesOrderDetailRow [] RelatedOrderDetails; ADOM9Dataset.SalesOrderHeaderRow HeaderRow; //Optimización, no hace falta traer todo. Lo integramos al preguntar //if(DataADO.SalesOrderDetail.Rows.Count == 0) //{ // using (SalesOrderDetailTableAdapter OrderDetailTabAdpt = new SalesOrderDetailTableAdapter()) // { // OrderDetailTabAdpt.Fill(DataADO.SalesOrderDetail); // } //} do { //Recuperamos cabecera y mostramos información de sus detalles HeaderRow = DataADO.SalesOrderHeader.FindBySalesOrderID(OrdHeaderID); Console.WriteLine("Información de detalle asociado a la cabecera escogida (ID {0} - Total acumulado {1})", OrdHeaderID, HeaderRow.TotalDue); //Recuperamos de BD los Order Details asociados y los buscamos a partir del Header para mostrar y seleccionar en métodos posteriores //Siempre encontraremos, aunque un no esta de mas controlar excepción por fallo de conexión //IMPORTANTE: Recalculamos a cada iteración puesto que se reinstancian los objetos al pasar por FILL... try { using (SalesOrderDetailTableAdapter OrderDetailTblAdpt = new SalesOrderDetailTableAdapter()) { OrderDetailTblAdpt.FillBySalesOrderID(DataADO.SalesOrderDetail, OrdHeaderID); } } catch (Exception e) { Console.WriteLine("ERROR recuperando OrderDetails del Header seleccionado. Detalles {0}", e.Message); return; } RelatedOrderDetails = HeaderRow.GetSalesOrderDetailRows(); foreach (ADOM9Dataset.SalesOrderDetailRow OrderDetailRow in RelatedOrderDetails) { Console.WriteLine("ID: {0}" + "\n\t- Producto: {1} " + "\n\t- Cantidad: {2} " + "\n\t- Importe unitario: {3} ", OrderDetailRow.SalesOrderDetailID, OrderDetailRow.ProductID, OrderDetailRow.OrderQty, OrderDetailRow.UnitPrice); } switch (ManageOrderDetailMenu()) { case 0: next_opt = false; break; case 1: ADOEditQuantityQuoteDetail(RelatedOrderDetails); break; case 2: ADOEditUnitCostQuoteDetail(RelatedOrderDetails); break; case 3: ADODeleteQuoteDetail(RelatedOrderDetails); break; case 4: ADOAddQuoteDetail(OrdHeaderID); break; default: Console.WriteLine("\n--- ERROR: Opción incorrecta. Reintentelo --\n"); break; } }while (next_opt); }
public IActionResult UpdateTemplate([FromBody] ReviewTameplateForForm model) { var review = context.ReviewTameplate.Where(x => x.Id == model.Id).Include(x => x.ReviewColumn).Include(x => x.HeaderRow).Include(x => x.ReviewRole).FirstOrDefault(); review.ReviewColumn = review.ReviewColumn.Select(x => { x.Deleted = true; return(x); }).ToList(); review.HeaderRow = review.HeaderRow.Select(x => { x.Deleted = true; return(x); }).ToList(); review.ReviewRole = review.ReviewRole.Select(x => { x.Deleted = true; return(x); }).ToList(); review.Name = model.Name; review.Description = model.Descritpion; foreach (var r in model.Roles) { ReviewRole role = review.ReviewRole.Where(x => x.Id == r.Id).FirstOrDefault(); if (role != null) { role.Name = r.Name; role.Deleted = false; } else { ReviewRole rl = new ReviewRole() { Name = r.Name }; review.ReviewRole.Add(rl); } } foreach (var c in model.Columns) { ReviewColumn column = review.ReviewColumn.Where(x => x.Id == c.Id).FirstOrDefault(); if (column != null) { var enums = context.ReviewColumnTypeEnum.Where(x => x.ReviewColumnId == column.Id).ToList(); context.ReviewColumnTypeEnum.RemoveRange(enums);//delete all enum and create new column.Type = c.Type; column.Name = c.ColumnName; column.Deleted = false; //var isHeaderMakeSense = context.ReviewColumn.Where(x => x.Id == column.Id).Include(x => x.HeaderRow).FirstOrDefault(); //bool sense = isHeaderMakeSense.HeaderRow. if (enums != null && c.Option != null) { foreach (string s in c.Option) { ReviewColumnTypeEnum t = new ReviewColumnTypeEnum() { Name = s }; column.ReviewColumnTypeEnum.Add(t); } } } else { ReviewColumn cl = new ReviewColumn() { Name = c.ColumnName, Type = c.Type }; if (c.Option != null) { foreach (string s in c.Option) { ReviewColumnTypeEnum t = new ReviewColumnTypeEnum() { Name = s }; cl.ReviewColumnTypeEnum.Add(t); } } review.ReviewColumn.Add(cl); } } foreach (var h in model.Header) { if (h.Id != null) { review.HeaderRow.Where(x => x.Id == h.Id).FirstOrDefault().Deleted = false; } else { var col = review.ReviewColumn.Where(x => x.Name == h.ColumnName).FirstOrDefault(); if (col != null) { HeaderRow header = new HeaderRow() { Function = h.Fcn, ReviewColumnId = col.Id, Name = h.Name, Parameter = h.Parameter, ReviewTameplateId = review.Id }; context.HeaderRow.Add(header); } else { HeaderRow header = new HeaderRow() { Name = h.Name, ReviewTameplateId = review.Id }; context.HeaderRow.Add(header); } } } context.SaveChanges(); return(Ok()); }
public ContactsListView(MessageNode node, StackPage page, HeaderRow header) : base(page, header) { Node = node; }
void Update(SubscriptionInfo[] updates, StackRow addIndex, string headerName, ref HeaderRow header, List <StatusProfileButtonRow> rows, ref ButtonRow more, int max, bool recent) { var count = updates.Length; if (count == 0) { RemoveHeaderSection(header); rows.Clear(); header = null; return; } if (header == null) { AddIndex = addIndex; AddIndex = header = AddHeaderRow(headerName); var footer = AddFooterRow(); footer.Identifier = $"{headerName}Footer"; } var modCount = Math.Min(count, max); var requiresMore = count >= max; var rowCount = rows.Count; if (!requiresMore && more != null) { RemoveView(more); more = null; } for (var i = 0; i < Math.Min(rowCount, modCount); i++) { var info = updates[i]; var row = rows[i]; row.Update(info.AccountId, ProfileManager.Current.GetCachedProfileData(info.AccountId), info.Profile); row.UpdateMessagesCount(info); row.Tag = info; } AddIndexBefore = false; var newRows = modCount - rowCount; if (newRows >= 0) { if (rowCount == 0) { AddIndex = header; } else { AddIndex = rows[rowCount - 1]; } for (var i = 0; i < newRows; i++) { var info = updates[rowCount + i]; var row = new StatusProfileButtonRow(info.Subscriptions.Status.ServiceNode, info.AccountId, info.Profile, ProfileManager.Current.GetCachedProfileData(info.AccountId), ViewMessages, recent); row.UpdateMessagesCount(info); row.Tag = info; AddRow(row); AddIndex = row; rows.Add(row); } } else { for (var i = rowCount - 1; i >= modCount; i--) { RemoveView(rows[i]); rows.RemoveAt(i); } } if (requiresMore && more == null) { AddIndexBefore = false; AddIndex = rows[rows.Count - 1]; more = AddButtonRow("More", More); more.RowLayout.Children.Remove(more.FontIcon); more.SetDetailViewIcon(Icons.AngleDoubleRight); more.Margin = new Thickness(20, 0, 0, 0); } if (more != null) { more.Tag = new Tuple <bool, SubscriptionInfo[]>(recent, updates); } }
public TodoTaskPage(TodoList todoList, TodoTask task) : base("TodoTaskPage") { Subscribe <NewTodoTaskEvent>(TodoItem); Subscribe <TodoTaskStatusEvent>(TodoItemStatus); _todoList = todoList; _task = task; AddTitleRow("Title"); AddHeaderRow("StatusHeader"); var statusItems = new SelectionItemList <TodoTaskStatusTypes> { new SelectionItem <TodoTaskStatusTypes>(TodoTaskStatusTypes.Open, Tr.Get("ItemStatusTypes.Open")), new SelectionItem <TodoTaskStatusTypes>(TodoTaskStatusTypes.Closed, Tr.Get("ItemStatusTypes.Closed")) }; _status = AddSelectionRows(statusItems, task.Status); _status.SelectionChanged = StatusChanged; _statusButton = AddSubmitButtonRow("SubmitStatus", StatusButton); _statusButton.RowStyle = Theme.SubmitButton; _statusButton.IsEnabled = false; _status.Buttons[0].SetDetailViewIcon(Icons.Circle); _status.Buttons[1].SetDetailViewIcon(Icons.CircleCheck); foreach (var b in _status.Buttons) { Status.AddBusyView(b); } Status.AddBusyView(_statusButton); AddFooterRow(); if (task.Status == TodoTaskStatusTypes.Open) { AddHeaderRow("ItemHeader"); _text = AddEditorRow(task.Text, "Text"); _text.SetDetailViewIcon(Icons.Pencil); _text.Edit.TextChanged += Edit_TextChanged; _textButton = AddSubmitButtonRow("SubmitText", Submit); _textButton.RowStyle = Theme.SubmitButton; _textButton.IsEnabled = false; Status.AddBusyView(_text.Edit); Status.AddBusyView(_textButton); AddFooterRow(); } _history = AddHeaderRow("HistoryHeader"); AddFooterRow(); _transactionInfo = AddHeaderRow("TransactionInfo"); AddFooterRow(); AddHeaderRow("Common.SubmitAccount"); _submitAccount = AddRow(new SubmitAccountButtonRow <GroupSubmitAccount>(this, () => todoList.ServiceNode.GetSubmitAccounts <GroupSubmitAccount>(todoList.Index), todoList.ListId.ToString())); AddInfoRow("Common.SubmitAccountInfo"); AddFooterRow(); AddHeaderRow("DeleteHeader"); var delete = AddButtonRow("SubmitDelete", Delete); delete.RowStyle = Theme.CancelButton; delete.SetDetailViewIcon(Icons.TrashAlt); Status.AddBusyView(delete); AddFooterRow(); _ = BuildHistory(); }
public void ParseRow(string markdown, string expected) { var headerRow = HeaderRow.Parse(markdown); Assert.AreEqual(expected, headerRow.ToString()); }
public MessagePageHandler(StackPage page, HeaderRow header) { _page = page; _header = header; }