コード例 #1
0
        public ImplPagedGridExtender(MobDataGrid pGrid, IPagedSource pSource, string pGlobalId)
        {
            globalId = pGlobalId;
            //
            grid   = pGrid;
            source = pSource;
            //
            source.getBuilder().reset();
            int indx = -1;

            try
            {
                indx = source.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableDUMMY.ID, ToolLRef.dummyLRef));
                DataTable tab_ = source.getAll();
                initTable(tab_);
                grid.DataSource = tab_;
                tab_.DefaultView.ListChanged += DefaultView_ListChanged;
            }
            finally
            {
                if (indx > 0)
                {
                    source.getBuilder().deletePreparer(indx);
                }
            }

            //grid.KeyPress += new KeyPressEventHandler(grid_KeyPress_Search);
            //grid.KeyDown += new KeyEventHandler(grid_KeyDown_Search);
        }
コード例 #2
0
        void init(DataTable pTableSource, DataTable pTableDest, IPagedSource pSource, string[] pBindChildCol, string[] pBindParentCol, string[] pChildCol, string[] pParentCol, UpdateTypeFlags pFlags, IRowValidator pValidator, string[] pTriggerCols)
        {
            validator   = (pValidator == null) ? new RowValidatorTrue() : pValidator;
            tableSource = pTableSource;
            tableDest   = pTableDest;
            flags.flagEnable(pFlags);
            source = pSource;

            triggerCols   = pTriggerCols;
            bindChildCol  = pBindChildCol;
            bindParentCol = pBindParentCol;
            childCol      = pChildCol;
            parentCol     = pParentCol;
            allChildCol   = childCol;
            allParentCol  = parentCol;

            //
            for (int i = 0; i < bindChildCol.Length; ++i)
            {
                addColForMapBind(bindChildCol[i], bindParentCol[i]);
            }
            for (int i = 0; i < childCol.Length; ++i)
            {
                addColForMapData(childCol[i], parentCol[i]);
            }

            //

            if (flags.isFlagEnabled(UpdateTypeFlags.activeOnRelColumn))
            {
                columns = bindChildCol;
            }
            else
            {
                int len = allChildCol.Length;
                if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast1DrivedChilCols))
                {
                    len -= 1;
                }
                else
                if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast1DrivedChilCols))
                {
                    len -= 2;
                }
                else
                if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast1DrivedChilCols))
                {
                    len -= 3;
                }
                columns = new string[len];
                Array.Copy(allChildCol, columns, len);
            }
            columns = ToolArray.merge <string>(columns, triggerCols);
            //
            // if (flags.isFlagEnabled(UpdateTypeFlags.updateIgnoreRelColumn))
            updateChildCol = childCol;
            // else
            //     updateChildCol = allChildCol;
            //!!!!!!!!!!!!!!!!!!!!!!!!!!!
        }
コード例 #3
0
        public ImplAdapterTableExt(IEnvironment pEnv, IPagedSource pSource, string[] pCol, String pSqlNewIdTable, ISqlBuilderPreparer[] preps)
        {
            environment = pEnv;
            source      = pSource;
            columns     = pCol;
            newIdTable  = pSqlNewIdTable;
            //
            if (preps != null)
            {
                for (int i = 0; i < preps.Length; ++i)
                {
                    source.getBuilder().addPereparer(preps[i]);
                }
            }
            //
            //adapter = new SqliteDataAdapter();
            //adapter.AcceptChangesDuringUpdate = false;


            //source.getBuilder().reset();
            //source.getBuilder().setCountMin();
            //for (int i = 0; i < columns.Length; ++i)
            //    source.getBuilder().addParameterValue(columns[i], DBNull.Value);
            //adapter.SelectCommand = source.getBuilder().get();


            //builder = new SqliteCommandBuilder(adapter);

            // builder.ConflictOption = ConflictOption.CompareAllSearchableValues;
            // builder.SetAllValues = true;
            //
            // adapter.RowUpdating += new SqliteRowUpdatingEventHandler(adapter_RowUpdating);
        }
コード例 #4
0
 protected virtual void setSource(IPagedSource pSource)
 {
     getGrid().initForPaging(pSource, globalStoreName());
     extender = getGrid().getPagingExtender();
     extender.startigDataLoad += extender_startigDataLoad;
     //
 }
コード例 #5
0
        public void Dispose()
        {
            if (source != null)
            {
                source.Dispose();
            }

            source = null;
        }
コード例 #6
0
        public ImplDataReference(string pCmd, string pName)
        {
            //if null
            cmd  = pCmd;
            name = pName;

            if (pName != null)
            {
                source = new ImplPagedSourceFromDs(environment, pName, ToolObjectName.getName(pCmd));
            }
        }
コード例 #7
0
 public void setDataSource(object pDataSource)
 {
     _sourcePs = null;
     _sourceDs = null;
     if (typeof(IPagedSource).IsAssignableFrom(pDataSource.GetType()))
     {
         _sourcePs = (IPagedSource)pDataSource;
     }
     else
     if (typeof(DataSet).IsAssignableFrom(pDataSource.GetType()))
     {
         _sourceDs = (DataSet)pDataSource;
     }
     else
     if (typeof(DataTable).IsAssignableFrom(pDataSource.GetType()))
     {
         (_sourceDs = new DataSet()).Tables.Add((DataTable)pDataSource);
     }
 }
コード例 #8
0
        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);
                    }
                }
            }
        }
コード例 #9
0
 protected override void setSource(IPagedSource pSource)
 {
     base.setSource(pSource);
     pSource.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableINVOICE.GRPCODE, ConstDocGroupCode.materialManagement));
     pSource.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableINVOICE.TRCODE, ConstDocTypeMaterial.marerialDefinedInput15));
 }
コード例 #10
0
        void init(DataTable pTable, IPagedSource pSource, string[] pBindChildCol, string[] pBindParentCol, string[] pChildCol, string[] pParentCol, UpdateTypeFlags pFlags, IRowValidator pValidator, string[] pTriggerCols)
        {
            flags.flagEnable(pFlags);
            source = pSource;
            for (int i = pChildCol.Length; i < pParentCol.Length; ++i)
            {
                pChildCol = ToolArray.resize <string>(pChildCol, pChildCol.Length + 1);

                pChildCol[pChildCol.Length - 1] = string.Empty;
            }
            for (int i = 0; i < pParentCol.Length; ++i)
            {
                if ((pChildCol[i] == string.Empty) || (pChildCol[i] == null))
                {
                    pChildCol[i] = ToolColumn.getColumnFullName(source.getBuilder().getName(), pParentCol[i]);
                }
            }
            triggerCols   = pTriggerCols;
            bindChildCol  = pBindChildCol;
            bindParentCol = pBindParentCol;
            childCol      = pChildCol;
            parentCol     = pParentCol;
            allChildCol   = new string[bindChildCol.Length + childCol.Length];
            bindChildCol.CopyTo(allChildCol, 0);
            childCol.CopyTo(allChildCol, bindChildCol.Length);
            allParentCol = new string[bindParentCol.Length + parentCol.Length];
            bindParentCol.CopyTo(allParentCol, 0);
            parentCol.CopyTo(allParentCol, bindParentCol.Length);
            //

            for (int i = 0; i < bindChildCol.Length; ++i)
            {
                addColForMap(bindChildCol[i], bindParentCol[i]);
            }
            for (int i = 0; i < childCol.Length; ++i)
            {
                addColForMap(childCol[i], parentCol[i]);
            }

            //

            if (flags.isFlagEnabled(UpdateTypeFlags.activeOnRelColumn))
            {
                columns = bindChildCol;
            }
            else
            {
                int len = allChildCol.Length;
                if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast1DrivedChilCols))
                {
                    len -= 1;
                }
                else
                if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast2DrivedChilCols))
                {
                    len -= 2;
                }
                else
                if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast3DrivedChilCols))
                {
                    len -= 3;
                }
                columns = new string[len];
                Array.Copy(allChildCol, columns, len);
            }
            columns = ToolArray.merge <string>(columns, triggerCols);
            //
            if (flags.isFlagEnabled(UpdateTypeFlags.updateIgnoreRelColumn))
            {
                updateChildCol = childCol;
            }
            else
            {
                updateChildCol = allChildCol;
            }
            //!!!!!!!!!!!!!!!!!!!!!!!!!!!

            //

            for (int i = 0; i < allChildCol.Length; ++i)
            {
                if (!tableSource.Columns.Contains(allChildCol[i]))
                {
                    tableSource.Columns.Add(allChildCol[i], ToolTypeSet.helper.tObject);//check// source.getBuilder().getColumnType(allParentCol[i]));
                }
            }
            //

            try
            {
                flags.flagEnable(UpdateTypeFlags.__spe__updateIfDrived);
                for (int i = 0; i < tableSource.Rows.Count; ++i)
                {
                    refresh(tableSource.Rows[i]);
                }
            }
            finally
            {
                flags.flagDisable(UpdateTypeFlags.__spe__updateIfDrived);
            }
            //
            tableSource.ColumnChanged += new DataColumnChangeEventHandler(table_ColumnChanged);
        }
コード例 #11
0
        protected override void setSource(IPagedSource pSource)
        {
            base.setSource(pSource);

            pSource.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableKSLINES.TRCODE, ConstCashDocType.clientToCash));
        }
コード例 #12
0
 protected virtual void setSource(IPagedSource pSource)
 {
 }
コード例 #13
0
 protected override void setSource(IPagedSource pSource)
 {
     base.setSource(pSource);
     extender = new ImplPagedGridExtender(DATAGRIDMAIN, source);
 }
コード例 #14
0
 protected override void setSource(IPagedSource pSource)
 {
     base.setSource(pSource);
     pSource.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableINVOICE.GRPCODE, ConstDocGroupCode.purchasing));
     pSource.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableINVOICE.TRCODE, ConstDocTypeMaterial.materialPurchase));
 }
コード例 #15
0
 public CellAutomationSpaceDB(DataTable pTableSource, DataTable pTableDest, IPagedSource pSource, string[] pBindChildCol, string[] pBindParentCol, string[] pChildCol, string[] pParentCol, UpdateTypeFlags pFlags, IRowValidator pValidator)
 {
     init(pTableSource, pTableDest, pSource, pBindChildCol, pBindParentCol, pChildCol, pParentCol, pFlags, pValidator, new string[0]);
 }
コード例 #16
0
 public RowColumnsBindingDBRelations(DataTable pTable, IPagedSource pSource, string[] pBindChildCol, string[] pBindParentCol, string[] pChildCol, string[] pParentCol, string[] pTriggerCols, UpdateTypeFlags pFlags, IRowValidator pValidator)
     : base(pTable, null, pValidator)
 {
     init(pTable, pSource, pBindChildCol, pBindParentCol, pChildCol, pParentCol, pFlags, pValidator, pTriggerCols);
 }
コード例 #17
0
ファイル: DataSend.cs プロジェクト: rualb/ava-agent-xamarin
        void doneAsync()
        {
            lock (environment)
            {
                bool ok = false;
                try
                {
                    //

                    log.set(MessageCollection.T_MSG_OPERATION_STARTING);
                    //
                    makeDbReadonly();

                    //
                    string fileWorkDir = ToolMobile.getFullPath("data");
                    ToolMobile.createDir(fileWorkDir);
                    string fileOutputZip = Path.Combine(fileWorkDir, "toava.zip");
                    string fileOutputXml = Path.Combine(fileWorkDir, "toava.xml");
                    // bool res = false;

                    //Source
                    //if (environment.getAppSettings().getBool(AvaExt.Settings.SettingsAvaAgent.MOB_USE_LOCAL_EXPIMP_B))
                    //{
                    //    //SaveFileDialog sfd = new SaveFileDialog();
                    //    //if (sfd.ShowDialog() == DialogResult.OK)
                    //    //    fileOutputXml = sfd.FileName;
                    //    //else
                    //    //    throw new Exception(string.Empty);
                    //}

                    //
                    log.set(MessageCollection.T_MSG_DATA_READING);
                    //
                    XmlDocument doc = new XmlDocument();

                    string docID = "LOGICALREF";

                    AdapterUserDocument[] adapters = new AdapterUserDocument[]
                    {
                        new AdapterUserWholesaleSlip(environment, new ImplAdapterDataSetStub(environment, new AdapterDataSetWholesaleSlip(environment))),
                        new AdapterUserWholesaleOrder(environment, new ImplAdapterDataSetStub(environment, new AdapterDataSetWholesaleOrder(environment))),
                        new AdapterUserCashClient(environment, new ImplAdapterDataSetStub(environment, new AdapterDataSetCashClient(environment)))
                    };
                    IPagedSource[] sources = new IPagedSource[]
                    {
                        new PagedSourceSlip(environment),
                        new PagedSourceOrder(environment),
                        new PagedSourceCashTrans(environment)
                    };
                    string[] arrDesc = new string[]
                    {
                        environment.translate(WordCollection.T_DOC_STOCK_TRANS),
                        environment.translate(WordCollection.T_DOC_STOCK_ORDERS),
                        environment.translate(WordCollection.T_DOC_FINANCE)
                    };
                    bool hasData = false;
                    for (int i = 0; i < sources.Length; ++i)
                    {
                        IPagedSource source = sources[i];
                        source.getBuilder().addParameterValue(TableDUMMY.CANCELLED, ConstBool.not);
                        AdapterUserDocument adapter = adapters[i];
                        log.set(MessageCollection.T_MSG_DATA_READING, new object[] { arrDesc[i] });
                        DataTable table = source.getAll();
                        log.set(MessageCollection.T_MSG_DATA_EXPORT, new object[] { arrDesc[i] });
                        foreach (DataRow row in table.Rows)
                        {
                            hasData = true;
                            adapter.edit(row[docID]);
                            adapter.export(doc);
                        }
                    }

                    if (!hasData)
                    {
                        throw new Exception(MessageCollection.T_MSG_ERROR_NO_DATA);
                    }
                    //
                    string[] expSettings = environment.getSysSettings().getAllSettings();
                    foreach (string settingsName in expSettings)
                    {
                        if (settingsName.StartsWith("MOB_SYS_"))
                        {
                            XmlAttribute attr = doc.CreateAttribute(settingsName);
                            attr.Value = environment.getSysSettings().getString(settingsName);
                            doc.DocumentElement.Attributes.Append(attr);
                        }
                    }


                    //
                    log.set(MessageCollection.T_MSG_DATA_WRITING);
                    //
                    doc.Save(fileOutputXml);
                    ToolZip.compress(fileOutputZip, fileOutputXml);
                    // if (!environment.getAppSettings().getBool(AvaExt.Settings.SettingsAvaAgent.MOB_USE_LOCAL_EXPIMP_B))
                    //  {
                    if (ToolMobile.existsFile(fileOutputZip))
                    {
                        //
                        log.set(MessageCollection.T_MSG_DATA_SENDING);
                        //
                        AgentData ad = new AgentData(environment);
                        ad.chackOperationResult(ad.sendData(ToolMobile.readFileData(fileOutputZip)));
                    }
                    // }
                    ok = true;
                }
                catch (Exception exc)
                {
                    log.error(ToolException.unwrap(exc));
                    environment.getExceptionHandler().setException(exc);
                }
                finally
                {
                    log.set(MessageCollection.T_MSG_OPERATION_FINISHING);

                    Thread.Sleep(1000);
                    log.hide();
                }
            }
        }
コード例 #18
0
 protected override void setSource(IPagedSource pSource)
 {
     base.setSource(pSource);
     pSource.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableINVOICE.GRPCODE, ConstDocGroupCode.sales));
     pSource.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableINVOICE.TRCODE, ConstDocTypeMaterial.wholeSaleReturn));
 }
コード例 #19
0
 protected override void setSource(IPagedSource pSource)
 {
     base.setSource(pSource);
     pSource.getBuilder().addPereparer(new SqlBuilderPreparerFixedCondition(TableSTFICHE.GRPCODE, ConstDocGroupCode.materialManagement));
 }