コード例 #1
0
        private void dgrid_DoubleClick(object sender, System.EventArgs e)
        {
            DataRow Curr = CurrentSelectedRow();

            if (Curr == null)
            {
                return;
            }
            DataTable Dest = Meta.Conn.CreateTableByName(table, "*");

            string [] cols = new string[Dest.PrimaryKey.Length];
            for (int i = 0; i < Dest.PrimaryKey.Length; i++)
            {
                cols[i] = Dest.PrimaryKey[i].ColumnName;
            }

            string filter;

            try {
                filter = QueryCreator.WHERE_COLNAME_CLAUSE(
                    Curr, cols, DataRowVersion.Default, true);
            }
            catch {
                string collist = "";
                for (int i = 0; i < cols.Length; i++)
                {
                    if (collist != "")
                    {
                        collist += ",";
                    }
                    collist += cols[i];
                }
                MessageBox.Show("Nelle colonne selezionate non era presente la chiave primaria della " +
                                "tabella " + Dest.TableName + ".\r" +
                                " Le colonne sono " + collist, "Errore");
                return;
            }

            MetaData DestM = Meta.Dispatcher.Get(table);

            if (listtype == "")
            {
                listtype = DestM.DefaultListType;
            }
            bool    res = DestM.Edit(this, edittype.ToString(), false);
            DataRow RR  = DestM.SelectOne(listtype, filter, null, null);

            if (RR != null)
            {
                DestM.SelectRow(RR, listtype);
            }
        }
コード例 #2
0
        private int ottieniIdCedolinoConguaglio(DataRow rCedolino, DataTable tCedolino)
        {
            string filtroConguaglio = QueryCreator.WHERE_COLNAME_CLAUSE(rCedolino,
                                                                        new string [] { "npayroll", "fiscalyear", "idcon" }, DataRowVersion.Current, false);

            filtroConguaglio = GetData.MergeFilters(filtroConguaglio, QHC.CmpEq("flagbalance", 'S'));
            DataRow [] rCedolinoConguaglio = tCedolino.Select(filtroConguaglio);
            if (rCedolinoConguaglio.Length == 0)
            {
                return(-1);
            }
            return((int)rCedolinoConguaglio[0]["idpayroll"]);
        }
コード例 #3
0
        private ArrayList valoriDistinti(DataTable t, string filtro, string[] colonne)
        {
            ArrayList al = new ArrayList();

            foreach (DataRow r in t.Select(filtro))
            {
                string condizione = QueryCreator.WHERE_COLNAME_CLAUSE(r, colonne, DataRowVersion.Current, false);
                int    pos        = al.BinarySearch(condizione);
                if (pos < 0)
                {
                    al.Insert(-pos - 1, condizione);
                }
            }
            return(al);
        }
コード例 #4
0
        private void CollegaTipoDoc(DataGrid G, int count)
        {
            bool messaggiovisualizzato = false;

            DataRow R       = DS.assetunload.Rows[0];
            object  idbuono = R["idassetunload"];

            for (int i = 0; i < count; i++)
            {
                if (G.IsSelected(i))
                {
                    DataRow CurrRow = GetDetailRow(G, i);
                    CurrRow["idassetunload"] = idbuono;

                    string filterpiece = QHS.AppAnd(QHS.CmpEq("idasset", CurrRow["idasset"]),
                                                    QHS.CmpGt("idpiece", 1), QHS.IsNull("idassetunload"), QHS.BitSet("flag", 0));
                    DataTable DaCollegare = Meta.Conn.RUN_SELECT("assetpieceview",
                                                                 "*", null, filterpiece, null, true);

                    string keyfilter = QueryCreator.WHERE_COLNAME_CLAUSE(CurrRow,
                                                                         new string[] { "idasset", "idpiece" }, DataRowVersion.Default, false);
                    //verifico se presente nel dataSet del form
                    DataRow[] Found = DS.assetpieceview.Select(keyfilter);
                    if (Found.Length > 0)
                    {
                        //Se presente viene ricollegato
                        if (Found[0]["idassetunload"] == DBNull.Value)
                        {
                            Found[0]["idassetunload"] = CurrRow["idassetunload"];
                            messaggiovisualizzato     = true;
                        }
                    }
                    else   //se non presente, viene aggiunto
                    {
                        DataRow NewR = DS.assetpieceview.NewRow();
                        foreach (DataColumn C in CurrRow.Table.Columns)
                        {
                            NewR[C.ColumnName] = CurrRow[C.ColumnName];
                        }
                        DS.assetpieceview.Rows.Add(NewR);
                        NewR.AcceptChanges();
                        NewR["idassetunload"] = CurrRow["idassetunload"];
                        messaggiovisualizzato = true;
                    }
                    foreach (DataRow Riga in DS.assetpieceview.Select(filterpiece))
                    {
                        Riga.BeginEdit();
                        Riga["idassetunload"] = CurrRow["idassetunload"];
                        Riga.EndEdit();
                        messaggiovisualizzato = true;
                    }

                    Meta.MarkTableAsNotEntityChild(DS.assetpieceview);
                }
                if (messaggiovisualizzato)
                {
                    MessageBox.Show("Insieme al cespiti selezionati saranno scaricati anche i relativi AUMENTI DI VALORE",
                                    "Avviso");
                }
                Meta.FreshForm();
            }
        }