Exemplo n.º 1
0
        //-----------------------------------------------------------------------------------------------------------------------------
        /// Build Database Commands
        //-----------------------------------------------------------------------------------------------------------------------------
        private MsDatCommands buildCommands(DataSet dataset)
        {
            MsDatCommands _dbcs = new MsDatCommands();

            foreach (DataTable _table in dataset.Tables)
            {
                foreach (DataRow _row in _table.Rows)
                {
                    switch (_row.RowState)
                    {
                    case DataRowState.Added:
                        _dbcs.Add(_bldDataInsSQL(_row), (MsDatParameters)null);
                        break;

                    case DataRowState.Deleted:
                        _dbcs.Add(_bldDataDelSQL(_row), (MsDatParameters)null);
                        break;

                    case DataRowState.Modified:
                        _dbcs.Add(_bldDataUpdSQL(_row), (MsDatParameters)null);
                        break;
                    }
                }
            }

            return(_dbcs);
        }
Exemplo n.º 2
0
        public void PutXmlString(XmlPackage package)
        {
            MsDatCommands _dbcs = Serialization.SNG.ReadPackage <MsDatCommands>(package);

            foreach (MsDatCommand _dc in _dbcs)
            {
                Add(_dc.Name, _dc.Text, _dc.Value);
            }
        }
Exemplo n.º 3
0
        public int ExecuteText(string connection_string, MsDatCommands db_commands)
        {
            var _result = 0;

            foreach (MsDatCommand _dbc in db_commands)
            {
                MsSqlHelper.ExecuteNonQuery(connection_string, CommandType.Text, _dbc.Text, (SqlParameter[])_dbc.Value);

                _result++;
            }

            return(_result);
        }
Exemplo n.º 4
0
        public DataSet SelectDataSet(string connection_string, MsDatCommands db_commands)
        {
            var _result = new DataSet();

            using (SqlConnection _sqlconn = new SqlConnection(connection_string))
            {
                _sqlconn.Open();

                foreach (MsDatCommand _dbc in db_commands)
                {
                    _result.Merge(MsSqlHelper.SelectDataSet(_sqlconn, CommandType.Text, _dbc.Text, _dbc.Name));
                }
            }

            return(_result);
        }
Exemplo n.º 5
0
 public MsCmdEnumerator(MsDatCommands t)
 {
     _t = t.BaseGetAllValues();
 }