コード例 #1
0
        public static List <TipoStruttura> getAllStrutture(UtilityMaietta.genSettings s)
        {
            TipoStruttura        ts;
            List <TipoStruttura> grp;
            XElement             po = XElement.Load(s.TipoStruttureFile);
            var query =
                from item in po.Elements()
                select item;

            grp = new List <TipoStruttura>();
            List <int> apid;
            int        a;

            foreach (XElement item in query)
            {
                apid = new List <int>();
                foreach (string api in item.Element("allowedParentTypeId").Value.ToString().Split(','))
                {
                    if (int.TryParse(api, out a))
                    {
                        apid.Add(a);
                    }
                }

                ts = new TipoStruttura(int.Parse(item.Element("id").Value.ToString()), item.Element("nome").Value.ToString(), item.Element("sigla").Value.ToString(),
                                       bool.Parse(item.Element("askMapFoto").Value.ToString()), bool.Parse(item.Element("askParent").Value.ToString()),
                                       bool.Parse(item.Element("askPosition").Value.ToString()), bool.Parse(item.Element("mobile").Value.ToString()),
                                       bool.Parse(item.Element("unallowedInsertWithSameChilds").Value.ToString()), bool.Parse(item.Element("hasRipiano").Value.ToString()), apid, s);
                grp.Add(ts);
            }

            return(grp);
        }
コード例 #2
0
 public TipoStruttura(TipoStruttura ts)
 {
     this.id          = ts.id;
     this.nome        = ts.nome;
     this.sigla       = ts.sigla;
     this.askMapFoto  = ts.askMapFoto;
     this.askParent   = ts.askParent;
     this.askPosition = ts.askPosition;
     this.mobile      = ts.mobile;
     this.deniedInsertWithSameChilds = ts.deniedInsertWithSameChilds;
     this.hasRipiano = ts.hasRipiano;
 }
コード例 #3
0
        public static int SaveStruttura(OleDbConnection cnn, string _nome, string _sigla, int?_ripiano, TipoStruttura ts, Struttura _parent, int?_livello, Posizione _posizione)
        {
            string parentid = (_parent == null) ? " null " : _parent.id.ToString();
            string nome     = "'" + _nome.Trim() + "'";
            string sigla    = "'" + _sigla.Trim() + "'";
            //string livello = _livello.ToString();
            string livello = (_livello.HasValue) ? _livello.Value.ToString() : " null ";
            string pos     = (_posizione != null) ? "'" + (_posizione.X.ToString() + "," + _posizione.Y.ToString()) + "'" : " null ";
            string ripiano = (_ripiano.HasValue) ? _ripiano.ToString() : " null ";

            string str = "INSERT INTO  MapStruttura (parentID, nome, sigla, tipostrutturaID, livello, posizione, ripiano) " +
                         " VALUES (" + parentid + ", " + nome + ", " + sigla + ", " + ts.id + ", " + livello + ", " + pos + ", " + ripiano + ")";
            string       str2 = "Select @@Identity";
            int          ID   = 7;
            OleDbCommand cmd  = new OleDbCommand(str, cnn);

            cmd.ExecuteNonQuery();
            cmd.CommandText = str2;
            ID = int.Parse(((object)cmd.ExecuteScalar()).ToString());
            return(ID);
        }
コード例 #4
0
 public bool needPosition(TipoStruttura tipoStrutturaParent)
 {
     return(this.askPosition && !tipoStrutturaParent.askPosition);
 }