public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (TimeColumnSpecId.Length != 0) { hash ^= TimeColumnSpecId.GetHashCode(); } if (RowCount != 0L) { hash ^= RowCount.GetHashCode(); } if (ValidRowCount != 0L) { hash ^= ValidRowCount.GetHashCode(); } if (ColumnCount != 0L) { hash ^= ColumnCount.GetHashCode(); } hash ^= inputConfigs_.GetHashCode(); if (Etag.Length != 0) { hash ^= Etag.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (Page != 0) { hash ^= Page.GetHashCode(); } if (PageSize != 0) { hash ^= PageSize.GetHashCode(); } if (PageCount != 0) { hash ^= PageCount.GetHashCode(); } if (RowCount != 0) { hash ^= RowCount.GetHashCode(); } if (FirstRow != 0) { hash ^= FirstRow.GetHashCode(); } if (LastRow != 0) { hash ^= LastRow.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override NodeInfo Visit(CrossJoinOp op, Node n) { ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n); List <KeyVec> keyVecList = new List <KeyVec>(); RowCount maxRows = RowCount.Zero; RowCount minRows = RowCount.One; foreach (Node child in n.Children) { ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(child); extendedNodeInfo1.Definitions.Or(extendedNodeInfo2.Definitions); extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo2.ExternalReferences); keyVecList.Add(extendedNodeInfo2.Keys); extendedNodeInfo1.NonNullableDefinitions.Or(extendedNodeInfo2.NonNullableDefinitions); if (extendedNodeInfo2.MaxRows > maxRows) { maxRows = extendedNodeInfo2.MaxRows; } if (extendedNodeInfo2.MinRows < minRows) { minRows = extendedNodeInfo2.MinRows; } } extendedNodeInfo1.Keys.InitFrom(keyVecList); extendedNodeInfo1.SetRowCount(minRows, maxRows); return((NodeInfo)extendedNodeInfo1); }
protected override NodeInfo VisitApplyOp(ApplyBaseOp op, Node n) { ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n); ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(n.Child0); ExtendedNodeInfo extendedNodeInfo3 = this.GetExtendedNodeInfo(n.Child1); extendedNodeInfo1.Definitions.Or(extendedNodeInfo2.Definitions); extendedNodeInfo1.Definitions.Or(extendedNodeInfo3.Definitions); extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo2.ExternalReferences); extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo3.ExternalReferences); extendedNodeInfo1.ExternalReferences.Minus(extendedNodeInfo1.Definitions); extendedNodeInfo1.Keys.InitFrom(extendedNodeInfo2.Keys, extendedNodeInfo3.Keys); extendedNodeInfo1.NonNullableDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions); if (op.OpType == OpType.CrossApply) { extendedNodeInfo1.NonNullableDefinitions.Or(extendedNodeInfo3.NonNullableDefinitions); } extendedNodeInfo1.NonNullableVisibleDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions); extendedNodeInfo1.NonNullableVisibleDefinitions.Or(extendedNodeInfo3.NonNullableDefinitions); RowCount maxRows = extendedNodeInfo2.MaxRows > RowCount.One || extendedNodeInfo3.MaxRows > RowCount.One ? RowCount.Unbounded : RowCount.One; RowCount minRows = op.OpType == OpType.CrossApply ? RowCount.Zero : extendedNodeInfo2.MinRows; extendedNodeInfo1.SetRowCount(minRows, maxRows); return((NodeInfo)extendedNodeInfo1); }
private void CustomGridView_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e) { if (!IsGroupRow(e.RowHandle)) { if (e.Info.IsRowIndicator) { if (e.RowHandle < 0) { e.Info.ImageIndex = 0; e.Info.DisplayText = string.Empty; } else { e.Info.ImageIndex = -1; e.Info.DisplayText = (e.RowHandle + 1).ToString(); } var _Size = e.Graphics.MeasureString(e.Info.DisplayText, e.Appearance.Font); var n = RowCount.ToString().Length; } } else { e.Info.ImageIndex = -1; e.Info.DisplayText = string.Format("[{0}]", e.RowHandle * -1); var _Size = e.Graphics.MeasureString(e.Info.DisplayText, e.Appearance.Font); var _Width = Convert.ToInt32(_Size.Width) + 20; } //if (ShowIndexIndicator) //{ //if (e.Info.IsRowIndicator && e.RowHandle >= 0) // e.Info.DisplayText = (e.RowHandle + 1).ToString(); //} }
private void CustomGridView_RowCountChanged(object sender, EventArgs e) { if (ShowIndexIndicator) { var n = RowCount.ToString().Length; IndicatorWidth = 25 + n * 6; } }
public void CheckLetterReturnsCorrectAmountOfRowsForC() { // Any valid character to check rows var c = char.ToUpper('c'); // generate amount of rows from letter var rows = RowCount.GetRowCount(c); Assert.AreEqual(5, rows); }
private void ScrollDesiredRowsIntoView(int firstRow, int lastRow) { if (m_viewModel.CurrentReferenceTextMatchup != null) { // I think that the fix for PG-884 (to call this method asynchronously from OnRowHeightChanged) // is the "real" fix for PG-810. So most likely, this try-catch is no longer needed. But since // I was never able to reproduce PG-810, I'm leaving it in here for now. try { FirstDisplayedScrollingRowIndex = firstRow; } catch (Exception exception) { Analytics.ReportException(exception, new Dictionary <string, string> { { "firstRow", firstRow.ToString() }, { "lastRow", lastRow.ToString() }, { "RowCount", RowCount.ToString() }, { "existing FirstDisplayedScrollingRowIndex", FirstDisplayedScrollingRowIndex.ToString() }, { "m_viewModel.CurrentBookId", m_viewModel.CurrentBookId }, }); ErrorReport.ReportNonFatalExceptionWithMessage(exception, "Although this is not a fatal error, the Glyssen developers are trying to find the cause of this problem (PG-810) so it can be fixed." + " Please report this if possible." + Environment.NewLine + "firstRow = " + firstRow + Environment.NewLine + "lastRow = " + lastRow + Environment.NewLine + "RowCount = " + RowCount + Environment.NewLine + "existing FirstDisplayedScrollingRowIndex = " + FirstDisplayedScrollingRowIndex + Environment.NewLine + "m_viewModel.CurrentBookId = " + m_viewModel.CurrentBookId + Environment.NewLine + "IndexOfStartBlockInBook = " + m_viewModel.CurrentReferenceTextMatchup.IndexOfStartBlockInBook + Environment.NewLine + "CorrelatedBlocks.Count = " + m_viewModel.CurrentReferenceTextMatchup.CorrelatedBlocks.Count); } } else { int precedingContextRows = 4; int followingContextRows = Math.Min(2, RowCount - lastRow - 1); var lastRowLocation = GetCellDisplayRectangle(0, lastRow + followingContextRows, false); while (FirstDisplayedCell.RowIndex > firstRow || (lastRowLocation.Height == 0 || (firstRow != lastRow && lastRowLocation.Y + lastRowLocation.Height > ClientRectangle.Height) || GetCellDisplayRectangle(0, firstRow, true).Height < GetCellDisplayRectangle(0, firstRow, false).Height) && precedingContextRows >= 0) { var firstRowOfContextToMakeVisible = Math.Max(0, firstRow - precedingContextRows--); FirstDisplayedScrollingRowIndex = firstRowOfContextToMakeVisible; if (followingContextRows > 0) { followingContextRows--; } lastRowLocation = GetCellDisplayRectangle(0, lastRow + followingContextRows, false); } } }
internal override void Clear() { base.Clear(); m_definitions.Clear(); m_localDefinitions.Clear(); m_nonNullableDefinitions.Clear(); m_nonNullableVisibleDefinitions.Clear(); m_keys.Clear(); m_minRows = RowCount.Zero; m_maxRows = RowCount.Unbounded; }
internal ExtendedNodeInfo(Command cmd) : base(cmd) { m_localDefinitions = cmd.CreateVarVec(); m_definitions = cmd.CreateVarVec(); m_nonNullableDefinitions = cmd.CreateVarVec(); m_nonNullableVisibleDefinitions = cmd.CreateVarVec(); m_keys = new KeyVec(cmd); m_minRows = RowCount.Zero; m_maxRows = RowCount.Unbounded; }
/// <summary> /// 执行UPDATE、DELETE SQL语句或存储过程(可传递参数),并返回受影响的行数 /// </summary> /// <param name="conn"> 要使用的Connectiong对象</param> /// <param name="sql"> 要执行的SQL语句或存储过程</param> /// <param name="cmdParameters">要使用的参数集合(可选)</param> /// <param name="cmdType"></param> /// <param name="Result">函数的执行结果(Success Or Fail)及DataBase中受影响的记录行数或错误描述</param> public void ExecuteNonquery(DbConnection conn, string sql, DbParameter[] cmdParameters, CommandType cmdType, ref string Result) { DbCommand cmd = null; int RowCount; if (conn.State != ConnectionState.Open) { conn.Open(); } cmd = conn.CreateCommand(); cmd.Connection = conn; cmd.CommandTimeout = 30; cmd.CommandType = cmdType; cmd.CommandText = sql; DbTransaction tran = conn.BeginTransaction(); cmd.Transaction = tran; if (cmdParameters != null) { foreach (DbParameter sqlPar in cmdParameters) { cmd.Parameters.Add(sqlPar); } } try { //conn.BeginTransaction(); //RowCount =cmd.ExecuteNonQuery(); //Result = "Sueccess:" + RowCount.ToString() + " Rows Impact!"; 这个会报错不支持并行事务 //conn.BeginTransaction().Commit(); RowCount = cmd.ExecuteNonQuery(); Result = "Success:" + RowCount.ToString() + " Rows Impact!"; tran.Commit(); } catch (Exception er) { Result = "Fail:" + er.Message.ToString(); _result = "Fail:" + er.Message.ToString(); conn.BeginTransaction().Rollback(); throw; } finally { cmd.Dispose(); conn.Dispose(); } }
/// <summary> /// Returns true if PagedResultInventoryOrderAssetResource instances are equal /// </summary> /// <param name="other">Instance of PagedResultInventoryOrderAssetResource to be compared</param> /// <returns>Boolean</returns> public bool Equals(PagedResultInventoryOrderAssetResource other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Results == other.Results || Results != null && Results.SequenceEqual(other.Results) ) && ( CurrentPage == other.CurrentPage || CurrentPage != null && CurrentPage.Equals(other.CurrentPage) ) && ( PageCount == other.PageCount || PageCount != null && PageCount.Equals(other.PageCount) ) && ( PageSize == other.PageSize || PageSize != null && PageSize.Equals(other.PageSize) ) && ( RowCount == other.RowCount || RowCount != null && RowCount.Equals(other.RowCount) ) && ( FirstRowOnPage == other.FirstRowOnPage || FirstRowOnPage != null && FirstRowOnPage.Equals(other.FirstRowOnPage) ) && ( LastRowOnPage == other.LastRowOnPage || LastRowOnPage != null && LastRowOnPage.Equals(other.LastRowOnPage) )); }
public void SaveSettings(object sender, RoutedEventArgs e) { DataBase.SetSetting("WIDTH", WindowWidth.ToString()); DataBase.SetSetting("HEIGHT", WindowHeight.ToString()); DataBase.SetSetting("COLS", ColumnCount.ToString()); DataBase.SetSetting("ROWS", RowCount.ToString()); DataBase.SetSetting("TOPMOST", IsTopMost ? "TRUE" : "FALSE"); DataBase.SetSetting("STARTUP", StartUp ? "TRUE" : "FALSE"); InstallStartUp(StartUp); DataBase.SetTabs(Tabs); // 재시작 System.Diagnostics.Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); }
private void Page_Load(object sender, System.EventArgs e) { if (!this.Page.IsPostBack) { if (RowCount == 0) { this.EnablePrev(false); this.EnableNext(false); this.linkGo.Enabled = false; this.txtPageIndex.Text = "1"; this.txtPageIndex.ReadOnly = true; } } try { rowCountPrevText = this.languageComponent1.GetString("lblPrevRowCount"); rowCountNextText = this.languageComponent1.GetString("lblNextRowCount"); this.ltRowCount.Text = string.Format("{0} {1} {2}", rowCountPrevText, RowCount.ToString(), rowCountNextText); } catch { this.ltRowCount.Text = string.Format("¹² {0} ±Ê", RowCount.ToString()); } try { this.ltGo.Text = this.languageComponent1.GetString("lblGo"); } catch { this.ltGo.Text = "תµ½"; } this.ltPageIndex.Text = this.PageIndex.ToString(); this.ltPageCount.Text = this.PageCount.ToString(); this.txtPageIndex.Attributes["onkeydown"] = "if(event.keyCode==13){" + "document.getElementById('" + this.ID + "_lnkGo').click();" + "event.cancelBubble = true;" + "event.returnValue=false;}"; }
protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e) { string strRowNumber = (e.RowIndex + 1).ToString(); while (strRowNumber.Length < RowCount.ToString().Length) { strRowNumber = "0" + strRowNumber; } SizeF size = e.Graphics.MeasureString(strRowNumber, Font); if (RowHeadersWidth < (int)(size.Width + 20)) { RowHeadersWidth = (int)(size.Width + 20); } Brush b = SystemBrushes.ControlText; e.Graphics.DrawString(strRowNumber, Font, b, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + ((e.RowBounds.Height - size.Height) / 2)); base.OnRowPostPaint(e); }
// based on MVI's original editor, shows the row number on the header row protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e) { string text = e.RowIndex.ToString(); while (text.Length < RowCount.ToString().Length) { text = "0" + text; } SizeF sizeF = e.Graphics.MeasureString(text, this.Font); if (RowHeadersWidth < (int)(sizeF.Width + 20f)) { RowHeadersWidth = (int)(sizeF.Width + 20f); } Brush controlText = SystemBrushes.ControlText; e.Graphics.DrawString(text, this.Font, controlText, (float)(e.RowBounds.Location.X + 15), (float)e.RowBounds.Location.Y + ((float)e.RowBounds.Height - sizeF.Height) / 2f); base.OnRowPostPaint(e); }
public static RowCountComponentWrapper CreateComponent(RowCount rowCount, DataFlowTaskWrapper dataFlowTaskWrapper) { RowCountComponentWrapper rowCountComponentWrapper = new RowCountComponentWrapper(dataFlowTaskWrapper) { Name = rowCount.Name, VariableName = rowCount.VariableName }; dataFlowTaskWrapper.AddPath(rowCount.DataFlowInputPath.OutputPathName, rowCountComponentWrapper.Meta.InputCollection[0]); try { rowCountComponentWrapper.GetMetadata(); } catch (Exception e) { throw new Exception($"Failed to get metadata for data flow component {rowCount.Name}!", e); } return(rowCountComponentWrapper); }
private void ResizeOurself(int r, int c) { //adjust rows and cols, do nothing if they equal // while (c < ColumnCount) { Columns.RemoveAt(ColumnCount - 1); } while (c > ColumnCount) { AddColumn(ColumnCount.ToString()); } while (r < RowCount) { Rows.RemoveAt(RowCount - 1); } while (r > RowCount) { AddRow(RowCount.ToString()); } }
public System.Drawing.Point GetCoordinatesFromOrdinal(int Ordinal) { if (Ordinal > Capacity - 1) { throw new ApplicationException("Capacity of " + RowCount.ToString() + " x " + ColCount.ToString() + " Rack exceeded."); } int RowIndex, ColIndex; switch (Order) { case Mapping.FillOrder.TopBottomLeftRight: RowIndex = Ordinal % RowCount; ColIndex = Ordinal / RowCount; break; case Mapping.FillOrder.LeftRightTopBottom: RowIndex = Ordinal / ColCount; ColIndex = Ordinal % ColCount; break; case Mapping.FillOrder.BottomTopRightLeft: RowIndex = (Capacity - Ordinal - 1) % RowCount; ColIndex = (Capacity - Ordinal - 1) / RowCount; break; case Mapping.FillOrder.RightLeftBottomTop: RowIndex = (Capacity - Ordinal - 1) / ColCount; ColIndex = (Capacity - Ordinal - 1) % ColCount; break; default: throw new ApplicationException("Unhandled mapping enumeration"); } return(new System.Drawing.Point(ColIndex, RowIndex)); }
protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e) { //this method overrides the DataGridView's RowPostPaint event //in order to automatically draw numbers on the row header cells //and to automatically adjust the width of the column containing //the row header cells so that it can accommodate the new row //numbers. //store a string representation of the row number in 'strRowNumber' var rowNumber = (e.RowIndex + 1).ToString(CultureInfo.InvariantCulture); //prepend leading zeros to the string if necessary to improve //appearance. For example, if there are ten rows in the grid, //row seven will be numbered as "07" instead of "7". Similarly, if //there are 100 rows in the grid, row seven will be numbered as "007". while (rowNumber.Length < RowCount.ToString(CultureInfo.InvariantCulture).Length) { rowNumber = "0" + rowNumber; } //determine the display size of the row number string using //the DataGridView's current font. var rowNumberSize = e.Graphics.MeasureString(rowNumber, Font); //adjust the width of the column that contains the row header cells //if necessary if (RowHeadersWidth < (int)(rowNumberSize.Width + WidthAdjustment)) { RowHeadersWidth = (int)(rowNumberSize.Width + WidthAdjustment); } //draw the row number string on the current row header cell using //the brush defined above and the DataGridView's default font e.Graphics.DrawString(rowNumber, Font, SystemBrushes.ControlText, e.RowBounds.Location.X + RowXOffset, e.RowBounds.Location.Y + ((e.RowBounds.Height - rowNumberSize.Height) / 2)); //call the base object's OnRowPostPaint method base.OnRowPostPaint(e); }
public string SaveToString() { var buffer = new string[16]; buffer[0] = ((short)Address).ToString(CultureInfo.InvariantCulture); buffer[1] = ((int)SizeType).ToString(CultureInfo.InvariantCulture); buffer[2] = Mul.ToString(CultureInfo.InvariantCulture); buffer[3] = Div.ToString(CultureInfo.InvariantCulture); buffer[4] = Offset.ToString(CultureInfo.InvariantCulture); buffer[5] = Precision.ToString(CultureInfo.InvariantCulture); buffer[6] = ((int)ItemType).ToString(CultureInfo.InvariantCulture); buffer[7] = ColCount.ToString(CultureInfo.InvariantCulture); buffer[8] = RowCount.ToString(CultureInfo.InvariantCulture); buffer[9] = BitAddress.ToString(CultureInfo.InvariantCulture); buffer[10] = Reserve1.ToString(CultureInfo.InvariantCulture); buffer[11] = Reserve2.ToString(CultureInfo.InvariantCulture); buffer[12] = ReverseX ? "1" : "0"; buffer[13] = ReverseY ? "1" : "0"; buffer[14] = Min.ToString(CultureInfo.InvariantCulture); buffer[15] = Max.ToString(CultureInfo.InvariantCulture); return(String.Join(" ", buffer)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Results != null) { hashCode = hashCode * 59 + Results.GetHashCode(); } if (CurrentPage != null) { hashCode = hashCode * 59 + CurrentPage.GetHashCode(); } if (PageCount != null) { hashCode = hashCode * 59 + PageCount.GetHashCode(); } if (PageSize != null) { hashCode = hashCode * 59 + PageSize.GetHashCode(); } if (RowCount != null) { hashCode = hashCode * 59 + RowCount.GetHashCode(); } if (FirstRowOnPage != null) { hashCode = hashCode * 59 + FirstRowOnPage.GetHashCode(); } if (LastRowOnPage != null) { hashCode = hashCode * 59 + LastRowOnPage.GetHashCode(); } return(hashCode); } }
public void SetValue(Matrix[] value) { // FIXME: All Matrix sizes... this will get ugly. -flibit unsafe { float *dstPtr = (float *)values; int curOffset = 0; if (ColumnCount == 4 && RowCount == 4) { for (int i = 0; i < value.Length; i += 1) { dstPtr[curOffset++] = value[i].M11; dstPtr[curOffset++] = value[i].M12; dstPtr[curOffset++] = value[i].M13; dstPtr[curOffset++] = value[i].M14; dstPtr[curOffset++] = value[i].M21; dstPtr[curOffset++] = value[i].M22; dstPtr[curOffset++] = value[i].M23; dstPtr[curOffset++] = value[i].M24; dstPtr[curOffset++] = value[i].M31; dstPtr[curOffset++] = value[i].M32; dstPtr[curOffset++] = value[i].M33; dstPtr[curOffset++] = value[i].M34; dstPtr[curOffset++] = value[i].M41; dstPtr[curOffset++] = value[i].M42; dstPtr[curOffset++] = value[i].M43; dstPtr[curOffset++] = value[i].M44; } } else if (ColumnCount == 3 && RowCount == 3) { for (int i = 0; i < value.Length; i += 1) { dstPtr[curOffset++] = value[i].M11; dstPtr[curOffset++] = value[i].M12; dstPtr[curOffset++] = value[i].M13; dstPtr[curOffset++] = value[i].M21; dstPtr[curOffset++] = value[i].M22; dstPtr[curOffset++] = value[i].M23; dstPtr[curOffset++] = value[i].M31; dstPtr[curOffset++] = value[i].M32; dstPtr[curOffset++] = value[i].M33; } } else if (ColumnCount == 4 && RowCount == 3) { for (int i = 0; i < value.Length; i += 1) { dstPtr[curOffset++] = value[i].M11; dstPtr[curOffset++] = value[i].M12; dstPtr[curOffset++] = value[i].M13; dstPtr[curOffset++] = value[i].M21; dstPtr[curOffset++] = value[i].M22; dstPtr[curOffset++] = value[i].M23; dstPtr[curOffset++] = value[i].M31; dstPtr[curOffset++] = value[i].M32; dstPtr[curOffset++] = value[i].M33; dstPtr[curOffset++] = value[i].M41; dstPtr[curOffset++] = value[i].M42; dstPtr[curOffset++] = value[i].M43; } } else if (ColumnCount == 3 && RowCount == 4) { for (int i = 0; i < value.Length; i += 1) { dstPtr[curOffset++] = value[i].M11; dstPtr[curOffset++] = value[i].M12; dstPtr[curOffset++] = value[i].M13; dstPtr[curOffset++] = value[i].M14; dstPtr[curOffset++] = value[i].M21; dstPtr[curOffset++] = value[i].M22; dstPtr[curOffset++] = value[i].M23; dstPtr[curOffset++] = value[i].M24; dstPtr[curOffset++] = value[i].M31; dstPtr[curOffset++] = value[i].M32; dstPtr[curOffset++] = value[i].M33; dstPtr[curOffset++] = value[i].M34; } } else { throw new NotImplementedException( "Matrix Size: " + RowCount.ToString() + " " + ColumnCount.ToString() ); } } }
public void SetValue(Matrix4x4[] value) { // FIXME: All Matrix sizes... this will get ugly. -flibit unsafe { float *dstPtr = (float *)values; if (ColumnCount == 4 && RowCount == 4) { for (int i = 0; i < value.Length; i += 1, dstPtr += 16) { dstPtr[0] = value[i].M11; dstPtr[1] = value[i].M21; dstPtr[2] = value[i].M31; dstPtr[3] = value[i].M41; dstPtr[4] = value[i].M12; dstPtr[5] = value[i].M22; dstPtr[6] = value[i].M32; dstPtr[7] = value[i].M42; dstPtr[8] = value[i].M13; dstPtr[9] = value[i].M23; dstPtr[10] = value[i].M33; dstPtr[11] = value[i].M43; dstPtr[12] = value[i].M14; dstPtr[13] = value[i].M24; dstPtr[14] = value[i].M34; dstPtr[15] = value[i].M44; } } else if (ColumnCount == 3 && RowCount == 3) { for (int i = 0; i < value.Length; i += 1, dstPtr += 12) { dstPtr[0] = value[i].M11; dstPtr[1] = value[i].M21; dstPtr[2] = value[i].M31; dstPtr[4] = value[i].M12; dstPtr[5] = value[i].M22; dstPtr[6] = value[i].M32; dstPtr[8] = value[i].M13; dstPtr[9] = value[i].M23; dstPtr[10] = value[i].M33; } } else if (ColumnCount == 4 && RowCount == 3) { for (int i = 0; i < value.Length; i += 1, dstPtr += 12) { dstPtr[0] = value[i].M11; dstPtr[1] = value[i].M21; dstPtr[2] = value[i].M31; dstPtr[3] = value[i].M41; dstPtr[4] = value[i].M12; dstPtr[5] = value[i].M22; dstPtr[6] = value[i].M32; dstPtr[7] = value[i].M42; dstPtr[8] = value[i].M13; dstPtr[9] = value[i].M23; dstPtr[10] = value[i].M33; dstPtr[11] = value[i].M43; } } else if (ColumnCount == 3 && RowCount == 4) { for (int i = 0; i < value.Length; i += 1, dstPtr += 16) { dstPtr[0] = value[i].M11; dstPtr[1] = value[i].M21; dstPtr[2] = value[i].M31; dstPtr[4] = value[i].M12; dstPtr[5] = value[i].M22; dstPtr[6] = value[i].M32; dstPtr[8] = value[i].M13; dstPtr[9] = value[i].M23; dstPtr[10] = value[i].M33; dstPtr[12] = value[i].M14; dstPtr[13] = value[i].M24; dstPtr[14] = value[i].M34; } } else if (ColumnCount == 2 && RowCount == 2) { for (int i = 0; i < value.Length; i += 1, dstPtr += 8) { dstPtr[0] = value[i].M11; dstPtr[1] = value[i].M21; dstPtr[4] = value[i].M12; dstPtr[5] = value[i].M22; } } else { throw new NotImplementedException( "Matrix Size: " + RowCount.ToString() + " " + ColumnCount.ToString() ); } } }
/// <summary> /// Set the rowcount for this node /// </summary> /// <param name="minRows"> min rows produced by this node </param> /// <param name="maxRows"> max rows produced by this node </param> internal void SetRowCount(RowCount minRows, RowCount maxRows) { m_minRows = minRows; m_maxRows = maxRows; ValidateRowCount(); }
protected void Page_Load(object sender, EventArgs e) { SqlOperators CurOperator; CellCollection CellCol; SearchFilter sFilter; long? RowCount; DataTable dt; try { string BaseID = Request["BaseID"]; string Keyword = Request["Keyword"]; string Condition = Request["Condition"]; string FilterClm = Request["FilterClm"]; string SearchOperand = Request["SearchOperand"]; string RowsPerPage = "10"; string CurPage = "1"; string TempKey = Keyword; Keyword = Tools.PersianTextCorrection(Keyword); int aa; if (Keyword == TempKey) { aa = 1; } IBaseBOL BOLClass; BOLClass = UITools.GetBOLClass(BaseID, null); CellCol = BOLClass.GetCellCollection(); if (FilterClm == "" || FilterClm == null) { FilterClm = CellCol[1].FieldName; } #region Security check Tools tools = new Tools(); tools.AccessList = tools.GetAccessList(BaseID); if (!tools.HasAccess("View", BaseID)) { Response.Write("Message:" + " دسترسی " + BOLClass.PageLable + " برای این کاربر وجود ندارد "); Response.End(); } #endregion if (UITools.IsHardCode(BaseID)) { BOLClass.QueryObjName = BaseID; } int TopStr = 10; #region Generate SearchFilter SearchFilterCollection sfCols = new SearchFilterCollection(); if (FilterClm != null && FilterClm != "") { string[] FilterClmArray = FilterClm.Split(';'); string[] ConditionArray = Condition.Split(';'); string[] KeywordArray = Keyword.Split(';'); for (int c = 0; c < ConditionArray.Length; c++) { switch (ConditionArray[c]) { case "0": CurOperator = SqlOperators.Like; break; case "1": CurOperator = SqlOperators.Equal; break; case "2": CurOperator = SqlOperators.GreaterThan; break; case "3": CurOperator = SqlOperators.GreaterThanOrEqual; break; case "4": CurOperator = SqlOperators.LessThan; break; case "5": CurOperator = SqlOperators.LessThanOrEqual; break; case "6": CurOperator = SqlOperators.NotEqual; break; case "7": CurOperator = SqlOperators.DontHave; break; case "9": CurOperator = SqlOperators.StartsWith; break; default: CurOperator = SqlOperators.Like; break; } sFilter = new SearchFilter(FilterClmArray[c], CurOperator, KeywordArray[c]); if (SearchOperand != "" && SearchOperand != null) { if (SearchOperand == "AND") { sFilter.CurOperand = Operands.AND; } else { sFilter.CurOperand = Operands.OR; } } sfCols.Add(sFilter); } } #endregion if (BaseID == "Keywords") { dt = BOLClass.GetDataSource(sfCols, "Name", Convert.ToInt32(RowsPerPage), Convert.ToInt32(CurPage)); } else { dt = BOLClass.GetDataSource(sfCols, "Code", Convert.ToInt32(RowsPerPage), Convert.ToInt32(CurPage)); } RowCount = BOLClass.GetCount(sfCols); dt.ExtendedProperties.Add("RecCount", RowCount.ToString()); dt.ExtendedProperties.Add("CurPage", CurPage); dt.ExtendedProperties.Add("RowsPerPage", RowsPerPage); dt.ExtendedProperties.Add("FilterClm", FilterClm); int ColCount = dt.Columns.Count; string DelColList = ""; for (int i = 0; i < ColCount; i++) { if (!IsInSelectedList(dt.Columns[i], CellCol)) { if (DelColList == "") { DelColList = dt.Columns[i].ColumnName; } else { DelColList = DelColList + "," + dt.Columns[i].ColumnName; } } } if (DelColList != "") { string[] DelColListArray = DelColList.Split(','); for (int d = 0; d < DelColListArray.Length; d++) { dt.Columns.Remove(DelColListArray[d]); } } #region Removing Null Values foreach (DataRow loRow in dt.Rows) { foreach (DataColumn loColumn in dt.Columns) { if (loRow[loColumn.ColumnName] == DBNull.Value) { try { switch (loColumn.DataType.ToString()) { case "System.DateTime": loRow[loColumn.ColumnName] = ""; break; case "System.Int64": case "System.Int32": case "System.Int16": case "System.Single": case "System.Decimal": case "System.Byte": case "System.Double": loRow[loColumn.ColumnName] = 0; break; case "System.Boolean": loRow[loColumn.ColumnName] = true; break; default: loRow[loColumn.ColumnName] = ""; break; } } catch { } } } } #endregion for (int i = 0; i < dt.Columns.Count; i++) { dt.Columns[i].ExtendedProperties.Add("DataType", dt.Columns[i].DataType); } for (int i = 0; i < CellCol.Count; i++) { if (CellCol[i].DataBGCellCol.Name != "0") { dt.Columns[i].ExtendedProperties.Add("BgColor", CellCol[i].DataBGCellCol.Name); } if (CellCol[i].HeaderBGCellCol.Name != "0") { dt.Columns[i].ExtendedProperties.Add("HeaderBgColor", CellCol[i].HeaderBGCellCol.Name); } if (CellCol[i].Direction != Directions.None) { dt.Columns[i].ExtendedProperties.Add("Direction", CellCol[i].Direction.ToString()); } if (CellCol[i].Align != AlignTypes.None) { dt.Columns[i].ExtendedProperties.Add("Alignment", CellCol[i].Align.ToString()); } if (CellCol[i].Width != 0) { dt.Columns[i].ExtendedProperties.Add("Width", CellCol[i].Width.ToString()); } if (CellCol[i].IsListTitle != false) { dt.Columns[i].ExtendedProperties.Add("IsListTitle", "1"); } dt.Columns[i].ExtendedProperties.Add("DisplayMode", CellCol[i].DisplayMode.ToString()); if (CellCol[i].IsKey) { dt.Columns[i].ExtendedProperties.Add("IsKey", "1"); } dt.Columns[i].ExtendedProperties.Add("Caption", CellCol[i].CaptionName); } dt.ExtendedProperties.Add("LabelName", BOLClass.PageLable); dt.TableName = BaseID; dt.WriteXml(Response.OutputStream, XmlWriteMode.WriteSchema); } catch (Exception exp) { Response.Write("Message:" + " بروز خطای غیر منتظره " + exp.Message); Response.End(); } }
/// <summary> /// Initialize the rowcounts for this node from the source node /// </summary> /// <param name="source"> nodeinfo of source </param> internal void InitRowCountFrom(ExtendedNodeInfo source) { m_minRows = source.m_minRows; m_maxRows = source.m_maxRows; }
public void SetValueTranspose(Matrix value) { // FIXME: All Matrix sizes... this will get ugly. -flibit unsafe { float *dstPtr = (float *)values; if (ColumnCount == 4 && RowCount == 4) { dstPtr[0] = value.M11; dstPtr[1] = value.M21; dstPtr[2] = value.M31; dstPtr[3] = value.M41; dstPtr[4] = value.M12; dstPtr[5] = value.M22; dstPtr[6] = value.M32; dstPtr[7] = value.M42; dstPtr[8] = value.M13; dstPtr[9] = value.M23; dstPtr[10] = value.M33; dstPtr[11] = value.M43; dstPtr[12] = value.M14; dstPtr[13] = value.M24; dstPtr[14] = value.M34; dstPtr[15] = value.M44; } else if (ColumnCount == 3 && RowCount == 3) { dstPtr[0] = value.M11; dstPtr[1] = value.M21; dstPtr[2] = value.M31; dstPtr[3] = value.M12; dstPtr[4] = value.M22; dstPtr[5] = value.M32; dstPtr[6] = value.M13; dstPtr[7] = value.M23; dstPtr[8] = value.M33; } else if (ColumnCount == 4 && RowCount == 3) { dstPtr[0] = value.M11; dstPtr[1] = value.M21; dstPtr[2] = value.M31; dstPtr[3] = value.M41; dstPtr[4] = value.M12; dstPtr[5] = value.M22; dstPtr[6] = value.M32; dstPtr[7] = value.M42; dstPtr[8] = value.M13; dstPtr[9] = value.M23; dstPtr[10] = value.M33; dstPtr[11] = value.M43; } else if (ColumnCount == 3 && RowCount == 4) { dstPtr[0] = value.M11; dstPtr[1] = value.M21; dstPtr[2] = value.M31; dstPtr[3] = value.M12; dstPtr[4] = value.M22; dstPtr[5] = value.M32; dstPtr[6] = value.M13; dstPtr[7] = value.M23; dstPtr[8] = value.M33; dstPtr[9] = value.M14; dstPtr[10] = value.M24; dstPtr[11] = value.M34; } else { throw new NotImplementedException( "Matrix Size: " + RowCount.ToString() + " " + ColumnCount.ToString() ); } } }
public Matrix GetValueMatrixTranspose() { // FIXME: All Matrix sizes... this will get ugly. -flibit unsafe { float *resPtr = (float *)values; if (ColumnCount == 4 && RowCount == 4) { return(new Matrix( resPtr[0], resPtr[4], resPtr[8], resPtr[12], resPtr[1], resPtr[5], resPtr[9], resPtr[13], resPtr[2], resPtr[6], resPtr[10], resPtr[14], resPtr[3], resPtr[7], resPtr[11], resPtr[15] )); } else if (ColumnCount == 3 && RowCount == 3) { return(new Matrix( resPtr[0], resPtr[3], resPtr[6], 0.0f, resPtr[1], resPtr[4], resPtr[7], 0.0f, resPtr[2], resPtr[5], resPtr[8], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f )); } else if (ColumnCount == 4 && RowCount == 3) { return(new Matrix( resPtr[0], resPtr[4], resPtr[8], 0.0f, resPtr[1], resPtr[5], resPtr[9], 0.0f, resPtr[2], resPtr[6], resPtr[10], 0.0f, resPtr[3], resPtr[7], resPtr[11], 0.0f )); } else if (ColumnCount == 3 && RowCount == 4) { return(new Matrix( resPtr[0], resPtr[3], resPtr[6], resPtr[9], resPtr[1], resPtr[4], resPtr[7], resPtr[10], resPtr[2], resPtr[5], resPtr[8], resPtr[11], 0.0f, 0.0f, 0.0f, 0.0f )); } else { throw new NotImplementedException( "Matrix Size: " + RowCount.ToString() + " " + ColumnCount.ToString() ); } } }
public Matrix[] GetValueMatrixTransposeArray(int count) { // FIXME: All Matrix sizes... this will get ugly. -flibit Matrix[] result = new Matrix[count]; unsafe { float *resPtr = (float *)values; int curOffset = 0; if (ColumnCount == 4 && RowCount == 4) { for (int i = 0; i < count; i += 1) { result[i] = new Matrix( resPtr[curOffset + 0], resPtr[curOffset + 4], resPtr[curOffset + 8], resPtr[curOffset + 12], resPtr[curOffset + 1], resPtr[curOffset + 5], resPtr[curOffset + 9], resPtr[curOffset + 13], resPtr[curOffset + 2], resPtr[curOffset + 6], resPtr[curOffset + 10], resPtr[curOffset + 14], resPtr[curOffset + 3], resPtr[curOffset + 7], resPtr[curOffset + 11], resPtr[curOffset + 15] ); curOffset += 16; } } else if (ColumnCount == 3 && RowCount == 3) { for (int i = 0; i < count; i += 1) { result[i] = new Matrix( resPtr[curOffset], resPtr[curOffset + 3], resPtr[curOffset + 6], 0.0f, resPtr[curOffset + 1], resPtr[curOffset + 4], resPtr[curOffset + 7], 0.0f, resPtr[curOffset + 2], resPtr[curOffset + 5], resPtr[curOffset + 8], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f ); curOffset += 9; } } else if (ColumnCount == 4 && RowCount == 3) { for (int i = 0; i < count; i += 1) { result[i] = new Matrix( resPtr[curOffset], resPtr[curOffset + 4], resPtr[curOffset + 8], 0.0f, resPtr[curOffset + 1], resPtr[curOffset + 5], resPtr[curOffset + 9], 0.0f, resPtr[curOffset + 2], resPtr[curOffset + 6], resPtr[curOffset + 10], 0.0f, resPtr[curOffset + 3], resPtr[curOffset + 7], resPtr[curOffset + 11], 0.0f ); curOffset += 12; } } else if (ColumnCount == 3 && RowCount == 4) { for (int i = 0; i < count; i += 1) { result[i] = new Matrix( resPtr[curOffset], resPtr[curOffset + 3], resPtr[curOffset + 6], resPtr[curOffset + 9], resPtr[curOffset + 1], resPtr[curOffset + 4], resPtr[curOffset + 7], resPtr[curOffset + 10], resPtr[curOffset + 2], resPtr[curOffset + 5], resPtr[curOffset + 8], resPtr[curOffset + 11], 0.0f, 0.0f, 0.0f, 0.0f ); curOffset += 12; } } else { throw new NotImplementedException( "Matrix Size: " + RowCount.ToString() + " " + ColumnCount.ToString() ); } } return(result); }