void RecupererCompteTVASchema(string pCentre, string pNum, string pCompteTVA, string pCompteAnal)
 {
     try
     {
         CsSchema _schema = LSchema.FirstOrDefault(s => s.NUM == pNum && s.CENTRE == pCentre);
         if (!string.IsNullOrEmpty(_schema.GENE5))
         {
             pCompteTVA = _schema.GENE5;
             if (pCompteTVA.ToArray()[0].ToString() == Enumere.CPTCONST4.ToString())
             {
                 foreach (CsJournal journal in LJournal)
                 {
                     if (journal.CodeAgence == pCentre)
                     {
                         pCompteAnal = "T" + journal.CodeService;
                         break;
                     }
                 }
             }
         }
         else
         {
             pCompteAnal = string.Empty;
         }
     }
     catch (Exception ex)
     {
         string error = ex.Message;
     }
 }
示例#2
0
        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(NewTableName) || string.IsNullOrWhiteSpace(NewColumnName) || projectionDims.SelectedItems.Count == 0)
            {
                return;
            }

            CsSchema schema = SourceTable.Top;

            // Initialize a list of selected dimensions (from the whole list of all greater dimensions
            List <CsColumn> projDims = new List <CsColumn>();

            foreach (var item in projectionDims.SelectedItems)
            {
                projDims.Add((CsColumn)item);
            }

            // Remove all existing greater dims (clean the target table before defining new structure)
            foreach (CsColumn dim in TargetTable.GreaterDims.ToList())
            {
                if (dim.IsSuper)
                {
                    continue;
                }
                dim.Remove();
            }

            // 1. Create a mapping object from the selected projection dimensions
            // 2. Create identity dimensions for the extracted set and their mapping to the projection dimensions
            Mapping mapping = new Mapping(SourceTable, TargetTable);

            foreach (CsColumn projDim in projDims)
            {
                CsTable  idSet = projDim.GreaterSet;
                CsColumn idDim = schema.CreateColumn(projDim.Name, TargetTable, idSet, true);
                idDim.Add();

                mapping.AddMatch(new PathMatch(new DimPath(projDim), new DimPath(idDim)));
            }
            Column.Definition.DefinitionType = ColumnDefinitionType.LINK;
            Column.Definition.Mapping        = mapping;
            Column.Definition.IsGenerating   = true;
            Column.Name = NewColumnName;

            TargetTable.Definition.DefinitionType = TableDefinitionType.PROJECTION;

            TargetTable.Name = NewTableName;

            // If new then add objects to the schema (or do it outside?)
            if (IsNew)
            {
                schema.AddTable(TargetTable, SourceTable.SuperSet, null);
                Column.Add();
            }

            this.DialogResult = true;
        }
示例#3
0
        public List <CsSchema> RetourneDonneesTableSchema()
        {
            CsSchema        _ta;
            List <CsSchema> ListeTA = new List <CsSchema>();

            ConnectionString = Session.GetSqlConnexionStringAbo07();
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = EnumProcedureStockee.SelectSCHEMAS;
            cmd.Parameters.Clear();

            DBBase.SetDBNullParametre(cmd.Parameters);
            try
            {
                if (this.cn.State == ConnectionState.Closed)
                {
                    this.cn.Open();
                }

                SqlDataReader reader = cmd.ExecuteReader();
                if (!reader.HasRows)
                {
                    reader.Close();
                    throw new Exception(EnumProcedureStockee.SelectSCHEMAS + ":" + "n'a retourné aucun jeu de caractère");
                }
                while (reader.Read())
                {
                    _ta        = new CsSchema();
                    _ta.CENTRE = string.IsNullOrEmpty(reader.GetValue(0).ToString()) ? string.Empty : reader.GetValue(0).ToString().Trim();
                    _ta.NUM    = string.IsNullOrEmpty(reader.GetValue(1).ToString()) ? string.Empty : reader.GetValue(1).ToString().Trim();
                    _ta.GENE0  = string.IsNullOrEmpty(reader.GetValue(2).ToString()) ? string.Empty : reader.GetValue(2).ToString().Trim();
                    _ta.ANAL0  = string.IsNullOrEmpty(reader.GetValue(3).ToString()) ? string.Empty : reader.GetValue(3).ToString().Trim();
                    _ta.GENE1  = string.IsNullOrEmpty(reader.GetValue(4).ToString()) ? string.Empty : reader.GetValue(4).ToString().Trim();
                    _ta.ANAL1  = string.IsNullOrEmpty(reader.GetValue(5).ToString()) ? string.Empty : reader.GetValue(5).ToString().Trim();
                    _ta.SENS1  = string.IsNullOrEmpty(reader.GetValue(6).ToString()) ? string.Empty : reader.GetValue(6).ToString().Trim();
                    _ta.SIGN1  = string.IsNullOrEmpty(reader.GetValue(7).ToString()) ? string.Empty : reader.GetValue(7).ToString().Trim();
                    _ta.GENE2  = string.IsNullOrEmpty(reader.GetValue(8).ToString()) ? string.Empty : reader.GetValue(8).ToString().Trim();
                    _ta.ANAL2  = string.IsNullOrEmpty(reader.GetValue(9).ToString()) ? string.Empty : reader.GetValue(9).ToString().Trim();
                    _ta.SENS2  = string.IsNullOrEmpty(reader.GetValue(10).ToString()) ? string.Empty : reader.GetValue(10).ToString().Trim();
                    _ta.SIGN2  = string.IsNullOrEmpty(reader.GetValue(11).ToString()) ? string.Empty : reader.GetValue(11).ToString().Trim();
                    _ta.GENE3  = string.IsNullOrEmpty(reader.GetValue(12).ToString()) ? string.Empty : reader.GetValue(12).ToString().Trim();
                    _ta.ANAL3  = string.IsNullOrEmpty(reader.GetValue(13).ToString()) ? string.Empty : reader.GetValue(13).ToString().Trim();
                    _ta.SENS3  = string.IsNullOrEmpty(reader.GetValue(14).ToString()) ? string.Empty : reader.GetValue(14).ToString().Trim();
                    _ta.SIGN3  = string.IsNullOrEmpty(reader.GetValue(15).ToString()) ? string.Empty : reader.GetValue(15).ToString().Trim();
                    _ta.GENE4  = string.IsNullOrEmpty(reader.GetValue(16).ToString()) ? string.Empty : reader.GetValue(16).ToString().Trim();
                    _ta.ANAL4  = string.IsNullOrEmpty(reader.GetValue(17).ToString()) ? string.Empty : reader.GetValue(17).ToString().Trim();
                    _ta.SENS4  = string.IsNullOrEmpty(reader.GetValue(18).ToString()) ? string.Empty : reader.GetValue(18).ToString().Trim();
                    _ta.SIGN4  = string.IsNullOrEmpty(reader.GetValue(19).ToString()) ? string.Empty : reader.GetValue(19).ToString().Trim();
                    _ta.GENE5  = string.IsNullOrEmpty(reader.GetValue(20).ToString()) ? string.Empty : reader.GetValue(20).ToString().Trim();
                    _ta.ANAL5  = string.IsNullOrEmpty(reader.GetValue(21).ToString()) ? string.Empty : reader.GetValue(21).ToString().Trim();
                    _ta.SENS5  = string.IsNullOrEmpty(reader.GetValue(22).ToString()) ? string.Empty : reader.GetValue(22).ToString().Trim();
                    _ta.SIGN5  = string.IsNullOrEmpty(reader.GetValue(23).ToString()) ? string.Empty : reader.GetValue(23).ToString().Trim();
                    _ta.GENE6  = string.IsNullOrEmpty(reader.GetValue(24).ToString()) ? string.Empty : reader.GetValue(24).ToString().Trim();
                    _ta.ANAL6  = string.IsNullOrEmpty(reader.GetValue(25).ToString()) ? string.Empty : reader.GetValue(25).ToString().Trim();
                    _ta.SENS6  = string.IsNullOrEmpty(reader.GetValue(26).ToString()) ? string.Empty : reader.GetValue(26).ToString().Trim();
                    _ta.SIGN6  = string.IsNullOrEmpty(reader.GetValue(27).ToString()) ? string.Empty : reader.GetValue(27).ToString().Trim();
                    ListeTA.Add(_ta);
                }
                //Fermeture reader
                reader.Close();
                return(ListeTA);
            }
            catch (Exception ex)
            {
                throw new Exception(EnumProcedureStockee.SelectSCHEMAS + ":" + ex.Message);
            }
            finally
            {
                if (this.cn.State == ConnectionState.Open)
                {
                    this.cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }