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 override void OnResume() { base.OnResume(); if (inited) { var firmName_ = environment.getSysSettings().getString(SettingsSysMob.MOB_SYS_FIRMNAME) ?? ""; var agentId_ = environment.getSysSettings().getString(SettingsSysMob.MOB_SYS_AGENT_ID) ?? ""; firmName_ = ToolString.left(firmName_, 15); var newLabel_ = string.Format( "{0} - {1} ({2})", ToolMobile.Name, string.IsNullOrEmpty(firmName_) ? "*" : firmName_, string.IsNullOrEmpty(agentId_) ? "000" : agentId_ ); var oldLabel_ = this.Title; if (oldLabel_ != newLabel_) { this.Title = newLabel_; } } /////////////////////////////////////////////////////////////////////////////////////////// //var _nfcAdapter = Android.Nfc.NfcAdapter.DefaultAdapter; //// Create an intent filter for when an NFC tag is discovered. When //// the NFC tag is discovered, Android will u //var tagDetected = new IntentFilter(Android.Nfc.NfcAdapter.ActionTagDiscovered); //var filters = new[] { tagDetected }; //// When an NFC tag is detected, Android will use the PendingIntent to come back to this activity. //// The OnNewIntent method will invoked by Android. //var intent = new Intent(this, GetType()).AddFlags(ActivityFlags.SingleTop); //var pendingIntent = PendingIntent.GetActivity(this, 0, intent, 0); //_nfcAdapter.EnableForegroundDispatch(this, pendingIntent, filters, null); if (errMessageOnResume != null) { var err = errMessageOnResume; errMessageOnResume = null; ToolMsg.show(this, err, null); } }
void _setException(Exception exc, String msg, object[] vars, Action pAction) { try { { var agg_ = exc as AggregateException; if (agg_ != null && agg_.InnerExceptions != null && agg_.InnerExceptions.Count > 0) { log.set(exc.ToString()); foreach (Exception e in agg_.InnerExceptions) { setException(e); } return; } } if (msg != null && msg != string.Empty) { string text = ToolException.unwrap(exc); #if DEBUG Console.WriteLine(exc.ToString()); #endif log.set(text); log.set(exc.ToString()); if (exc.InnerException != null) { log.set(exc.InnerException.ToString()); } // log.flush(); if (showUser) { ToolMsg.show(null, text, pAction); } } } catch (Exception err) { } }
/////////////////////////////////////////////////////////////////////////////////////////// #region Start void MobFormMain_Creating(object sender, EventArgs e) { addActivityExt(this);//dontwait resume //ToolMobile.setContext(this); // MobEnvironment.startEnv(); // if (inited) { if (ToolMobile.getEnvironment() == null) { ToolMsg.show(this, "Cant start", delegate() { Close(); }); } } }
protected override void returnData(DataRow pRow) { reset(); if (pRow != null) { string barcode = pRow[TableDUMMY.VALUE].ToString().Trim(); if (barcode != string.Empty) { var p = new PARSER(barcode, CurrentVersion.ENV.getEnvString("WEIGHTBARCODE", "")); barcode = p.CODE1; IPagedSource ps = reference.getPagedSource(); ps.getBuilder().reset(); ps.getBuilder().beginWhereGroup(); ps.getBuilder().addParameterValue(TableITEMS.BARCODE1, barcode, SqlTypeRelations.equal, SqlTypeRelations.boolOr); if (CurrentVersion.ENV.getEnvBool("BARCODEMULTI", false)) { ps.getBuilder().addParameterValue(TableITEMS.BARCODE2, barcode, SqlTypeRelations.equal, SqlTypeRelations.boolOr); ps.getBuilder().addParameterValue(TableITEMS.BARCODE3, barcode, SqlTypeRelations.equal, SqlTypeRelations.boolOr); } ps.getBuilder().endWhereGroup(); DataTable matTab = ps.getAll(); if (matTab != null && matTab.Rows.Count > 0) { DataRow matRow = matTab.Rows[0]; DataRow matRowExt = selectUnit(matRow, barcode, p.WEIGHT); base.returnData(matRowExt); } else { ToolMobile.playAlarmAndVibrate(); ToolMsg.show(this, MessageCollection.T_MSG_INVALID_BARCODE, null); } } } }