void refreshVal(double pValue, double pCf, string pCol, bool pReverse) { if (_blockPoint.block()) { try { if (pCf < ConstValues.minPositive) { pCf = 1.0; } DataRow rowMain = ToolRow.getFirstRealRow(_tableSchema); double mCf = (double)rowMain[TableDUMMY.CONVFACT]; double mAmount = pValue * (pReverse ? (mCf / pCf) : (pCf / mCf)); foreach (DataRow curRow in _tableSchema.Rows) { double curCf = (double)curRow[TableDUMMY.CONVFACT]; if (curCf < ConstValues.minPositive) { curCf = 1.0; } ToolCell.set(curRow, pCol, mAmount * (pReverse ? (curCf / mCf) : (mCf / curCf))); } } finally { _blockPoint.unblock(); } } }
protected override void prepareBeforeUpdate(DataSet pData) { DataSet dataSet = (DataSet)pData; DataTable tab; DataRow row; tab = dataSet.Tables[TableKSLINES.TABLE]; for (int i = 0; i < tab.Rows.Count; ++i) { row = tab.Rows[i]; if (row.RowState != DataRowState.Deleted) { if (row.RowState == DataRowState.Added) { docId = row[TableKSLINES.LOGICALREF]; ToolCell.set(row, TableKSLINES.FICHENO, getDocNr()); } else { docId = row[TableKSLINES.LOGICALREF]; } ToolCell.set(row, TableKSLINES.TRCODE, docTrCode); ToolCell.set(row, TableKSLINES.SIGN, docSign); } } }
protected bool startSave() { try { FinishDataEditing(); if (_checkLevel) { DataRow row = ToolRow.getFirstRealRow(_tableSchema); double amount = (double)ToolCell.isNull(row[TableDUMMY.AMOUNT], 0.0); double onhand = (double)ToolCell.isNull(_curMatRecord[TableDUMMY.ONHAND], 0.0); if ((amount - onhand) > ConstValues.minPositive) { ToolMsg.show(this, MessageCollection.T_MSG_INVALID_QUANTITY, null); return(false); } } DataRow _rowActiveUnit = this.BindingContext.getBindingItemRecord(cUnit); // if (_rowActiveUnit != null) { switch (handler.converCol(handler.column)) { case TableDUMMY.AMOUNT: ToolCell.set(handler.row, TableSTLINE.AMOUNT, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.AMOUNT]); // if (_rowActiveUnit != null) { ToolCell.set(handler.row, TableSTLINE.UNIT, _rowActiveUnit[TableDUMMY.UNIT]); ToolCell.set(handler.row, TableSTLINE.UNITREF, _rowActiveUnit[TableDUMMY.UNITREF]); ToolCell.set(handler.row, TableSTLINE.UINFO1, _rowActiveUnit[TableDUMMY.UNITCF01]); ToolCell.set(handler.row, TableSTLINE.UINFO2, _rowActiveUnit[TableDUMMY.UNITCF02]); } // return(true); case TableDUMMY.PRICE: ToolCell.set(handler.row, TableSTLINE.PRICE, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.PRICE]); return(true); case TableDUMMY.DISCPER: ToolCell.set(handler.row, TableSTLINE.DISCPER, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.DISCPER]); return(true); case TableDUMMY.TOTAL: ToolCell.set(handler.row, TableSTLINE.TOTAL, ToolRow.getFirstRealRow(_tableSchema)[TableDUMMY.TOTAL]); return(true); } } } catch (Exception exc) { ToolMobile.setException(exc); } return(false); }
protected void table_DistributeValues(DataRow[] topRows, DataRow[] subRows) { object topTotal = topOperDef; for (int i = 0; i < topRows.Length; ++i) { evalOnTopAny.setVarAll(ToolRow.copyRowToArr(columnsVars, topRows[i])); object tmpRes = evalOnTopAny.getResult(); evalOnTopAnyResult.setVarAll(new object[] { topTotal, tmpRes }); topTotal = evalOnTopAnyResult.getResult(); } for (int i = 0; i < subRows.Length; ++i) { object[] vals; object tmp; DataRow row = subRows[i]; string oldest = toucher.getOldest(columnsCalc, row); IEvaluator eval = evalOnSubCalc[Array.IndexOf <string>(columnsCalc, oldest)]; vals = ToolRow.copyRowToArr(columnsVars, row); vals = ToolArray.resize <object>(vals, vals.Length + 1); vals[vals.Length - 1] = topTotal; eval.setVarAll(vals); tmp = eval.getResult(); ToolCell.set(row, oldest, tmp); vals = ToolRow.copyRowToArr(columnsVars, row); vals = ToolArray.resize <object>(vals, vals.Length + 1); vals[vals.Length - 1] = topTotal; evalOnSubCorrect.setVarAll(vals); topTotal = evalOnSubCorrect.getResult(); } }
protected virtual void tableSTLINEColumnChanged(object sender, DataColumnChangeEventArgs e) { DataTable tab = (DataTable)sender; DataSet dataSet = tab.DataSet; if (e.Row.RowState != DataRowState.Detached) { switch (e.Column.ColumnName) { case TableSTLINE.LINETYPE: ToolCell.set(e.Row, TableSTLINE.DISCPER, (double)(ToolStockLine.isLinePromotion(e.Row) ? 100 : 0)); break; case TableSTLINE.DISCPER: if (ToolStockLine.isLinePromotion(e.Row)) { ToolCell.set(e.Row, TableSTLINE.DISCPER, (double)100); } break; case TableSTLINE.AMOUNT: case TableSTLINE.PRICE: case TableSTLINE.TOTAL: break; } } }
void calcColumn(DataRow pRow, string pCol) { IEvaluator eval = evals[Array.IndexOf <string>(columnsCalc, pCol)]; object[] vals = ToolRow.copyRowToArr(columnsVars, pRow); eval.setVarAll(vals); ToolCell.set(pRow, pCol, eval.getResult()); }
public void set(DataRow pRow) { if (pRow != null && validator.check(pRow)) { for (int i = 0; i < cols.Length; ++i) { ToolCell.set(pRow, cols[i], vals[i]); } } }
public virtual void resetRefs() { foreach (DataTable tab in getDataSet().Tables) { foreach (DataRow row in tab.Rows) { ToolCell.set(row, TableDUMMY.ID, ToolCell.getCellTypeDefaulValue(tab.Columns[TableDUMMY.ID].DataType)); } } }
public static void setRecordEditor(DataRow row, IEnvironment env) { DateTime date = DateTime.Now; ToolCell.set(row, TableDUMMY.CAPIBLOCK_MODIFIEDBY, env.getInfoApplication().userId); ToolCell.set(row, TableDUMMY.CAPIBLOCK_MODIFIEDDATE, date.Date); ToolCell.set(row, TableDUMMY.CAPIBLOCK_MODIFIEDHOUR, date.Hour); ToolCell.set(row, TableDUMMY.CAPIBLOCK_MODIFIEDMIN, date.Minute); ToolCell.set(row, TableDUMMY.CAPIBLOCK_MODIFIEDSEC, date.Second); }
public void setVar(string name, object val) { try { ToolCell.set(evalData, name, ToolCell.isNull(val, DBNull.Value)); } catch (Exception exc) { throw new MyException.MyExceptionError(MessageCollection.T_MSG_ERROR_DYNAMIC_EXPRESSION, exc); } }
public static void setReportingCurrInfo(DataRow row, double rate, String colRate, String colTotal, String colCurTotal) { if (colRate != null) { ToolCell.set(row, colRate, rate); } if ((colTotal != null) && (colCurTotal != null) && (rate > ConstValues.minPositive) && (ToolCell.isNull(row[colTotal], null) != null)) { ToolCell.set(row, colCurTotal, (double)row[colTotal] / rate); } }
public virtual void setAdded() { getDataSet().AcceptChanges(); foreach (DataTable tab in getDataSet().Tables) { foreach (DataRow row in tab.Rows) { row.SetAdded(); ToolCell.set(row, TableDUMMY.ID, ToolCell.getCellTypeDefaulValue(tab.Columns[TableDUMMY.ID].DataType)); } } }
public void set(DataRow pRow) { if (pRow != null) { foreach (DataColumn col in pRow.Table.Columns) { if (Array.IndexOf <string>(cols, col.ColumnName) < 0) { ToolCell.set(pRow, col.ColumnName, ToolCell.getCellTypeDefaulValue(col.DataType)); } } } }
private void saveSpeCols(DataRow dataRow, DataRow rowInDb) { if (rowInDb != null && dataRow != null) { foreach (DataColumn col in dataRow.Table.Columns) { if (col.ColumnName.StartsWith("SPE_")) { ToolCell.set(rowInDb, col.ColumnName, dataRow[col]); } } } }
public object done() { reference.begin(filterName, filterDataSource.get(), false, delegate(object o, EventArgs a) { DataRow row = rowSource.get(); if (row != null && row.RowState != DataRowState.Deleted) { for (int i = 0; i < colSource.Length; ++i) { ToolCell.set(row, colDest[i], reference.getSelected()[colSource[i]]); } } }); return(null); }
protected override void prepareBeforeUpdate(DataSet pData) { DataSet dataSet = (DataSet)pData; DataTable tab; DataRow row; tab = dataSet.Tables[TableINVOICE.TABLE]; for (int i = 0; i < tab.Rows.Count; ++i) { row = tab.Rows[i]; if (row.RowState != DataRowState.Deleted) { if (row.RowState == DataRowState.Added) { docId = row[TableINVOICE.LOGICALREF]; ToolCell.set(row, TableINVOICE.FICHENO, getDocNr()); } else { docId = row[TableINVOICE.LOGICALREF]; } ToolCell.set(row, TableINVOICE.GRPCODE, docGroupCode); ToolCell.set(row, TableINVOICE.TRCODE, docTrCode); ToolCell.set(row, TableINVOICE.IOCODE, docIOCode); } } tab = dataSet.Tables[TableSTLINE.TABLE]; for (int i = 0; i < tab.Rows.Count; ++i) { row = tab.Rows[i]; if ((row.RowState != DataRowState.Deleted)) // || isSlipLinesRow(row)) { if (row.RowState == DataRowState.Added) { ToolCell.set(row, TableSTLINE.STDOCREF, docId); } else { } //ToolSlip.setLineMaterialInfo(row, environment); ToolCell.set(row, TableSTLINE.TRCODE, lineTrCode); ToolCell.set(row, TableSTLINE.IOCODE, lineIOCode); ToolCell.set(row, TableSTLINE.STDOCLNNO, i + 1); } } }
void distribute(DataRow row, string[] cols) { if (needUpdate(row, cols)) { //getData source.getBuilder().reset(); for (int i = 0; i < cols.Length; ++i) { string col = ToolColumn.extractColumnName(getColMapBind(cols[i])); string tab = ToolColumn.extractTableName(getColMapBind(cols[i])); object val = row[cols[i]]; if ((tab != string.Empty) && (col != string.Empty)) { source.getBuilder().addParameterValueTable(tab, col, val); } else if (col != string.Empty) { source.getBuilder().addParameterValue(col, val); } else if (col == string.Empty) { source.getBuilder().addFreeParameterValue(val); } } emptyDest(); DataTable tabData = source.getAll(); // if (tabData != null) { //Has data foreach (DataRow rowData in tabData.Rows) { DataRow nRow = tableDest.NewRow(); ToolRow.initTableNewRow(nRow); tableDest.Rows.Add(nRow); for (int i = 0; i < updateChildCol.Length; ++i) { ToolCell.set(nRow, getColMapData(updateChildCol[i]), rowData[updateChildCol[i]]); } } } } }
private void initCommands(DbDataAdapter pAdp, DataTable pData, ITableDescriptor pTabDesc) { if (CurrentVersion.ENV.isDebugMode()) { ToolMobile.setRuntimeMsg("ImplAdapterTableExt:initCommands:beg"); } DataColumn colV_ = pData.Columns[TableDUMMY.RECVERS]; foreach (DataRow row in pData.Rows) { switch (row.RowState) { case DataRowState.Added: if (pAdp.InsertCommand == null) { initCommandInsert(pAdp, pTabDesc); } break; case DataRowState.Deleted: if (pAdp.DeleteCommand == null) { initCommandDelete(pAdp, pTabDesc); } break; case DataRowState.Modified: if (colV_ != null) { short rv_ = Convert.ToInt16(ToolCell.isNull(row[colV_, DataRowVersion.Original], 0)); ++rv_; ToolCell.set(row, colV_, rv_); } if (pAdp.UpdateCommand == null) { initCommandUpdate(pAdp, pTabDesc); } break; } } }
protected override void prepareBeforeUpdate(DataSet pDataSet) { base.prepareBeforeUpdate(pDataSet); DataTable tab; DataRow row; tab = pDataSet.Tables[TableINVOICE.TABLE]; for (int i = 0; i < tab.Rows.Count; ++i) { row = tab.Rows[i]; if (isUsedRow(row)) { if (row.RowState == DataRowState.Added) { } else { } //ToolGeneral.setReportingCurrInfo(row, reportCurencyExchange, TableINVOICE.REPORTRATE, TableINVOICE.NETTOTAL, TableINVOICE.REPORTNET); } } tab = pDataSet.Tables[TableSTLINE.TABLE]; for (int i = 0; i < tab.Rows.Count; ++i) { row = tab.Rows[i]; if (isUsedRow(row)) // || isSlipLinesRow(row)) { if (row.RowState == DataRowState.Added) { } else { } ToolCell.set(row, TableSTLINE.MONTH_, getDateTime().Month); ToolCell.set(row, TableSTLINE.YEAR_, getDateTime().Year); //ToolGeneral.setReportingCurrInfo(row, reportCurencyExchange, TableSTLINE.REPORTRATE, null, null); } } }
public static void syncWithClTran(DataTable tabPayTrans, DataTable tabClTrans) { DataRow rowTran = ToolRow.getFirstRealRow(tabClTrans); if (rowTran != null) { DataRow rowPay = ToolRow.getFirstRealRow(tabPayTrans); if (rowPay == null) { tabPayTrans.Rows.Add(rowPay = ToolRow.initTableNewRow(tabPayTrans.NewRow())); } ToolCell.set(rowPay, TablePAYTRANS.PAYNO, 1); ToolCell.set(rowPay, TablePAYTRANS.PROCDATE, rowTran[TableCLFLINE.DATE_]); ToolCell.set(rowPay, TablePAYTRANS.DISCDUEDATE, rowTran[TableCLFLINE.DATE_]); ToolCell.set(rowPay, TablePAYTRANS.DATE_, rowTran[TableCLFLINE.DATE_]); ToolCell.set(rowPay, TablePAYTRANS.TOTAL, rowTran[TableCLFLINE.AMOUNT]); ToolCell.set(rowPay, TablePAYTRANS.REPORTRATE, rowTran[TableCLFLINE.REPORTRATE]); ToolCell.set(rowPay, TablePAYTRANS.CARDREF, rowTran[TableCLFLINE.CLIENTREF]); ToolCell.set(rowPay, TablePAYTRANS.DISCDUEDATE, rowTran[TableCLFLINE.DATE_]); ToolCell.set(rowPay, TablePAYTRANS.TRCURR, rowTran[TableCLFLINE.TRCURR]); ToolCell.set(rowPay, TablePAYTRANS.TRNET, rowTran[TableCLFLINE.TRNET]); } }
public virtual void reinitEditingForData() { _checkLevel = handler.stockLevelControl; cPanelUnit.Visible = cPanelTotal.Visible = cPanelDiscount.Visible = cPanelAmount.Visible = cPanelPrice.Visible = false; _tableSchema.Clear(); cTotal.Value = cDiscount.Value = cAmount.Value = cPrice.Value = 0.0; MobNumEdit numEdit = null; switch (handler.converCol(handler.column)) { case TableSTLINE.AMOUNT: cPanelUnit.Visible = true; cPanelAmount.Visible = true; numEdit = cAmount; break; case TableSTLINE.PRICE: cPanelUnit.Visible = true; cPanelPrice.Visible = true; numEdit = cPrice; break; case TableSTLINE.TOTAL: cPanelTotal.Visible = true; numEdit = cTotal; break; case TableSTLINE.DISCPER: cPanelDiscount.Visible = true; numEdit = cDiscount; break; default: return; } cNumInput.setNumEdit(numEdit); numEdit.RequestFocus(); object cancelState = handler.row[TableSTLINE.CANCELLED]; try { handler.row[TableSTLINE.CANCELLED] = ConstBool.yes; fillSchema(handler.row); refreshReport(); } finally { ToolCell.set(handler.row, TableSTLINE.CANCELLED, cancelState); } cBtnUnit.Click += cBtnUnit_Click; }
void distribute(DataRow row, string[] cols) { if (needUpdate(row, cols)) { bool drivedUpdateMode = flags.isFlagEnabled(UpdateTypeFlags.__spe__updateIfDrived); if (drivedUpdateMode) { bool hasFull = false; for (int i = 0; i < allChildCol.Length; ++i) { if (ToolColumn.isColumnFullName(allChildCol[i])) { hasFull = true; } } if (!hasFull) { return; } } //getData source.getBuilder().reset(); for (int i = 0; i < cols.Length; ++i) { string col = ToolColumn.extractColumnName(getColMap(cols[i])); string tab = ToolColumn.extractTableName(getColMap(cols[i])); object val = row[cols[i]]; if ((tab != string.Empty) && (col != string.Empty)) { source.getBuilder().addParameterValueTable(tab, col, val); } else if (col != string.Empty) { source.getBuilder().addParameterValue(col, val); } else if (col == string.Empty) { source.getBuilder().addFreeParameterValue(val); } } IDictionary dicData = ToolRow.convertFirstToDictionary(source.getAll()); // if (dicData != null) { //Has data string[] tmpChildCol = (drivedUpdateMode ? ToolColumn.selectFullNameCols(updateChildCol) : updateChildCol); for (int i = 0; i < tmpChildCol.Length; ++i) { ToolCell.set(row, tmpChildCol[i], dicData[getColMap(tmpChildCol[i])]); } } else { //No data if (!flags.isFlagEnabled(UpdateTypeFlags.disableEditCancel)) { row.CancelEdit(); } else { if (flags.isFlagEnabled(UpdateTypeFlags.setTypeDefaultToDrivedChild)) { ToolRow.initTableNewRow(row, (drivedUpdateMode ? ToolColumn.selectFullNameCols(childCol) : childCol)); } if (flags.isFlagEnabled(UpdateTypeFlags.setTypeDefaultToRelChild)) { ToolRow.initTableNewRow(row, (drivedUpdateMode ? ToolColumn.selectFullNameCols(bindChildCol) : bindChildCol)); } } } } }
private void fillSchema(DataRow rowDocLine) { _curMatRecord = ToolStockLine.getItemData(environment, rowDocLine[TableSTLINE.STOCKREF]); // //if (_checkLevel) { //object docLRef = rowDocHeader[TableINVOICE.LOGICALREF]; object lref = rowDocLine[TableSTLINE.STOCKREF]; double onhand = (double)ToolCell.isNull(_curMatRecord[TableITEMS.ONHAND], 0.0); onhand += environment.getMatIOAmount(lref); //onhand += ToolStockLine.itemAmountInDoc(lref, rowDocLine.Table); //onhand += ToolStockLine.itemAmountInDB(environment, lref, docLRef); ToolCell.set(_curMatRecord, TableITEMS.ONHAND, onhand); } // if (handler.report != null) { handler.report.setDataSource(_curMatRecord.Table); handler.report.refreshSource(); } // _tableSchema.Clear(); string unit = string.Empty; double amount = (double)ToolCell.isNull(rowDocLine[TableSTLINE.AMOUNT], 0.0); if (ToolDouble.isZero(amount) && CurrentVersion.ENV.getEnvBool("STOCKAMOUNTONE", false)) { amount = 1.0; } double price = (double)ToolCell.isNull(rowDocLine[TableSTLINE.PRICE], 0.0); double total = (double)ToolCell.isNull(rowDocLine[TableSTLINE.TOTAL], 0.0); double disperc = (double)ToolCell.isNull(rowDocLine[TableSTLINE.DISCPER], 0.0); double uinfo1 = 0.0; double uinfo2 = 0.0; DataRow newRow; // newRow = ToolRow.initTableNewRow(_tableSchema.NewRow()); newRow[TableDUMMY.UNIT] = unit = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNIT1], string.Empty); newRow[TableDUMMY.UNITREF] = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNITREF1], string.Empty); newRow[TableDUMMY.UNITCF01] = uinfo1 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF1], 0.0); newRow[TableDUMMY.UNITCF02] = uinfo2 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF1], 0.0); newRow[TableDUMMY.CONVFACT] = (uinfo1 > ConstValues.minPositive ? uinfo2 / uinfo1 : 1.0); newRow[TableDUMMY.AMOUNT] = amount; newRow[TableDUMMY.PRICE] = price; newRow[TableDUMMY.TOTAL] = total; newRow[TableDUMMY.DISCPER] = disperc; _tableSchema.Rows.Add(newRow); // newRow = ToolRow.initTableNewRow(_tableSchema.NewRow()); newRow[TableDUMMY.UNIT] = unit = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNIT2], string.Empty); newRow[TableDUMMY.UNITREF] = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNITREF2], string.Empty); newRow[TableDUMMY.UNITCF01] = uinfo1 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF1], 0.0); newRow[TableDUMMY.UNITCF02] = uinfo2 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF2], 0.0); newRow[TableDUMMY.CONVFACT] = (uinfo1 > ConstValues.minPositive ? uinfo2 / uinfo1 : 1.0); if ((unit != string.Empty)) { _tableSchema.Rows.Add(newRow); } // newRow = ToolRow.initTableNewRow(_tableSchema.NewRow()); newRow[TableDUMMY.UNIT] = unit = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNIT3], string.Empty); newRow[TableDUMMY.UNITREF] = (string)ToolCell.isNull(_curMatRecord[TableITEMS.UNITREF3], string.Empty); newRow[TableDUMMY.UNITCF01] = uinfo1 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF1], 0.0); newRow[TableDUMMY.UNITCF02] = uinfo2 = (double)ToolCell.isNull(_curMatRecord[TableITEMS.UNITCF3], 0.0); newRow[TableDUMMY.CONVFACT] = (uinfo1 > ConstValues.minPositive ? uinfo2 / uinfo1 : 1.0); if ((unit != string.Empty)) { _tableSchema.Rows.Add(newRow); } // refreshVal(); // //check //string userUnitRef = (string)ToolCell.isNull(rowDocLine[TableSTLINE.UNITREF], string.Empty); //for (int i = 0; i < _tableSchema.Rows.Count; ++i) //{ // DataRow row = _tableSchema.Rows[i]; // string unitRef = (string)row[TableDUMMY.UNITREF]; // if (userUnitRef == unitRef) // cBoxUnits.SelectedIndex = i; //} }