Example #1
0
        public void MetaData_AfterLink()
        {
            Meta = MetaData.GetMetaData(this);
            string filter = "(iddbdepartment = " + QueryCreator.quotedstrvalue(Meta.GetSys("userdb"), true) + ")";

            GetData.CacheTable(DS.dbaccess, filter, "login", true);
        }
Example #2
0
        public void MetaData_AfterGetFormData()
        {
            int flagins = 0;

            if (chkCanInsertFromParentToChild.Checked)
            {
                flagins = flagins + 1;
            }
            if (chkCanNavigateFromParentToChild.Checked)
            {
                flagins = flagins + 2;
            }
            if (chkCustomFilterForNavigation.Checked)
            {
                flagins = flagins + 4;
            }
            if (chkCustomFilterForInsert.Checked)
            {
                flagins = flagins + 8;
            }
            if (chkCustomDefaults.Checked)
            {
                flagins = flagins + 16;
            }

            DataRow Curr   = HelpForm.GetLastSelected(DS.customdirectrel);
            string  filtro = "(tabellaorigine=" + QueryCreator.quotedstrvalue(Curr["fromtable"], true) + "tabelladest=" + QueryCreator.quotedstrvalue(Curr["totable"], true) + ")";

            //	DataRow []DelChilds=DS.tipodocoperiva.Select(filtro,null,DataViewRowState.Deleted);
        }
Example #3
0
        private string GetMovimentoFilter()
        {
            object codicecreddeb = DS.assetunload.Rows[0]["idreg"];
            object eserccorrente = Conn.GetSys("esercizio");

            string MyFilter = QHS.CmpEq("nphase", codicefase);

            if (txtEsercizio.Text.Trim() != "")
            {
                MyFilter = QHS.AppAnd(MyFilter, QHS.CmpEq("ayear", eserccorrente));
            }
            //MyFilter += "AND (esercizio=" + QueryCreator.quotedstrvalue(txtEsercizio.Text.Trim(), true) + ")";

            if (flagcreddeb)
            {
                MyFilter = QHS.AppAnd(MyFilter, QHS.CmpEq("idreg", codicecreddeb));
            }

            if (DS.assetunloadincome.Rows.Count > 0)
            {
                foreach (DataRow R in DS.assetunloadincome.Rows)
                {
                    if (R.RowState == DataRowState.Deleted)
                    {
                        continue;
                    }
                    MyFilter += " AND (idinc <> " + QueryCreator.quotedstrvalue(R["idinc"], true) + ")";
                }
            }
            return(MyFilter);
        }
Example #4
0
        private void gridSpesa_DoubleClick(object sender, System.EventArgs e)
        {
            DataTable T;
            DataRow   R;
            bool      res = GetCurrentRow(DS, gridSpesa, out T, out R);

            if (!res)
            {
                return;
            }
            if (R == null)
            {
                return;
            }
            MetaData newSpesa = Meta.Dispatcher.Get("spesa");

            newSpesa.Edit(this.ParentForm, "gerarchico", false);
            string  idspesa = R["idexp"].ToString();
            DataRow R2      = newSpesa.SelectOne(newSpesa.DefaultListType,
                                                 "(esercizio='" + Meta.Conn.sys["esercizio"].ToString() + "')AND" +
                                                 "(idspesa=" + QueryCreator.quotedstrvalue(idspesa, true)
                                                 + ")", "spesa", null);

            if (R2 != null)
            {
                newSpesa.SelectRow(R2, newSpesa.DefaultListType);
            }
        }
Example #5
0
 private void cmbTipoRitenuta_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     //if (!Meta.DrawStateIsDone) return;
     DS.regionalrate.Clear();
     DS.regionalratebracket.Clear();
     cmbDataInizioStruttura.Items.Clear();
     if (!Meta.IsEmpty)
     {
         Meta.FreshForm();
         Meta.DoMainCommand("mainsetsearch");
     }
     if (txtGeoRegione.Text != "")
     {
         if (cmbTipoRitenuta.SelectedItem.ToString() == "")
         {
             return;
         }
         DataRow [] CodRiten = TipoRitenutaTable.Select("description=" +
                                                        QueryCreator.quotedstrvalue(cmbTipoRitenuta.SelectedItem, false));
         if (CodRiten.Length != 1)
         {
             return;
         }
         filterritenuta = "(taxcode=" +
                          QueryCreator.quotedstrvalue(CodRiten[0]["taxcode"], true) +
                          ") AND (idregion=" + QueryCreator.quotedstrvalue(lastidregione, true) + ")";
         MetaData.SetDefault(DS.regionalrate, "taxcode", CodRiten[0]["taxcode"]);
         PopolaComboDataInizioStruttura(filterritenuta);
         if (!Meta.IsEmpty)
         {
             DisableToolbar();
         }
     }
 }
Example #6
0
 public void MetaData_AfterRowSelect(DataTable T, DataRow rDepartment)
 {
     if (rDepartment["!password"] is DBNull)
     {
         string userAmmin   = (string)Meta.Conn.GetSys("user");
         byte[] alfa        = mainConn.sha256UserPassword();
         string filtroAmmin = "(login="******") and (iddbdepartment="
                              + QueryCreator.quotedstrvalue(rDepartment["iddbdepartment"], true)
                              + ")";
         object o = Meta.Conn.DO_READ_VALUE("dbaccess", filtroAmmin, "alpha1");
         if (o != null)
         {
             byte[] alfa1 = QueryCreator.StringToByteArray((string)o);
             byte[] up    = xor(alfa, alfa1);
             try {
                 rDepartment["!password"] = DataAccess.DecryptString(up);
             } catch (CryptographicException) {
             }
         }
     }
     btnPassword.Text = (rDepartment["!password"] is DBNull)
                         ? "Inserisci password"
                         : "Modifica password";
 }
Example #7
0
        private object GetInstallDate(DataRow R, string tipoupdate)
        {
            try {
                string filter = "code=" + QueryCreator.quotedstrvalue(R["code"], false);
                switch (tipoupdate.ToUpper())
                {
                case "S":
                    return(DS.ondemand.Select(filter)[0]["downloaddate"]);

                case "C":
                    return(DSclient.update.Select(filter)[0]["downloaddate"]);

                case "M":
                    DateTime objServer = (DateTime)DS.ondemand.Select(filter)[0]["downloaddate"];
                    DateTime objClient = (DateTime)DSclient.update.Select(filter)[0]["downloaddate"];
                    if (objServer.CompareTo(objClient) > 0)
                    {
                        return(objServer);
                    }
                    return(objClient);
                }
            }
            catch {
            }
            return(DBNull.Value);
        }
Example #8
0
        public bool DatiValidi()
        {
            int esercizio;

            try {
                esercizio = (int)HelpForm.GetObjectFromString(typeof(int),
                                                              txtEsercizio.Text.ToString(), "x.y.year");
                if ((esercizio < 0))
                {
                    MessageBox.Show("L'esercizio non può essere negativo");
                    txtEsercizio.Focus();
                    return(false);
                }
                //return true;
            }
            catch {
                MessageBox.Show("E' necessario inserire un esercizio");
                txtEsercizio.Focus();
                return(false);
            }

            string    filteresercizio = "(ayear=" + QueryCreator.quotedstrvalue(esercizio, true) + ")";
            DataTable EsercizioTable  =
                DataAccessLocale.RUN_SELECT("accountingyear", "*", null, filteresercizio, null, true);

            if (EsercizioTable.Rows.Count == 0)
            {
                MessageBox.Show("L'esercizio " + esercizio + " non è stato creato.");
                txtEsercizio.Focus();
                return(false);
            }
            txtEsercizio.Focus();
            return(true);
        }
Example #9
0
        bool CollegaUtenteADipartimento(string login, string iddbdepartment)
        {
            DataTable Utenti = Conn.RUN_SELECT("dbaccess", "*", null,
                                               QHS.AppAnd(QHS.CmpEq("iddbdepartment", iddbdepartment),
                                                          QHS.CmpEq("login", login)), null, false);

            if (Utenti != null && Utenti.Rows.Count > 0)
            {
                return(true);                                         //già presente
            }
            Conn.SQLRunner("exec sp_grantdbaccess " +
                           QueryCreator.quotedstrvalue(login, false) + ", " +
                           QueryCreator.quotedstrvalue(login, false));
            Conn.SQLRunner("exec sp_addrolemember  N'db_denydatawriter'," + QHS.quote(login));
            Conn.SQLRunner("GRANT  SELECT  ON [dbo].[dbaccess] TO [" + login + "]");
            Conn.SQLRunner("GRANT  SELECT  ON [" + iddbdepartment + "].[customobject] TO [" + login + "]");
            Conn.SQLRunner("GRANT  SELECT  ON [" + iddbdepartment + "].[columntypes] TO [" + login + "]");

            string err;

            Conn.linkUserToDepartment(login, out err);

            if (err != null && err != "")
            {
                MessageBox.Show("Errore associando l'utente " + login + ":" + err + "\r\n");
                return(false);
            }

            return(true);
        }
Example #10
0
        public void MetaData_AfterFill()
        {
            if (!Meta.FirstFillForThisRow)
            {
                return;
            }
            string esercMov  = "";
            string numMov    = "";
            string descrFase = "";

            if (Meta.edit_type == "detail")
            {
                DataRow R = Meta.SourceRow.GetParentRow("incomeproceedspart");
                esercMov = R["ymov"].ToString();
                if (R.RowState == DataRowState.Added)
                {
                    numMov = "";
                }
                else
                {
                    numMov = R["nmov"].ToString();
                }

                object faseObj = Meta.Conn.DO_READ_VALUE("incomephase", QHS.CmpEq("nphase", Meta.GetSys("maxincomephase")), "description");
                if (faseObj != null)
                {
                    descrFase = faseObj.ToString();
                }

                //				DataRow fase = R.GetParentRow("incomephaseincome");
                //				if (fase!=null) descrFase = fase["description"].ToString();
            }
            if (Meta.edit_type == "variazione")
            {
                if (DS.proceedspart.Rows.Count == 0)
                {
                    return;
                }
                DataRow   Curr      = DS.proceedspart.Rows[0];
                string    filterMov = "(idinc = " + QueryCreator.quotedstrvalue(Curr["idinc"], true) + ")";
                DataTable movTable  = DataAccess.RUN_SELECT(Meta.Conn, "income", "ymov,nmov,nphase", null, filterMov, null, null, true);
                if (movTable == null)
                {
                    return;
                }
                esercMov = movTable.Rows[0]["ymov"].ToString();
                numMov   = movTable.Rows[0]["nmov"].ToString();
                object faseObj = Meta.Conn.DO_READ_VALUE("incomephase", QHS.CmpEq("nphase", movTable.Rows[0]["nphase"]), "description");
                if (faseObj != null)
                {
                    descrFase = faseObj.ToString();
                }
            }
            txtEsercEntrata.Text = esercMov;
            txtNumEntrata.Text   = numMov;
            if (descrFase != "")
            {
                grpAccertamento.Text = descrFase;
            }
        }
Example #11
0
        void FillTree(string tablename)
        {
            ClearTree();
            Tree.Nodes.Add(tablename);
            Tree.Nodes[0].Expand();

            DataTable RefTables = Conn.SQLRunner(
                "	SELECT object_name(rkeyid) FROM sysreferences "+
                " WHERE fkeyid = object_id(" + QueryCreator.quotedstrvalue(tablename, true) + ")" +
                " AND object_name(rkeyid) != " + QueryCreator.quotedstrvalue(tablename, true));

            foreach (DataRow Rtable in RefTables.Rows)
            {
                Tree.Nodes.Add(Rtable[0].ToString());
            }

            foreach (TreeNode N in Tree.Nodes)
            {
                string      currtable = N.Text;
                dbstructure DBS       = Conn.GetStructure(currtable);
                foreach (DataRow ColDesc in DBS.columntypes.Rows)
                {
                    N.Nodes.Add(ColDesc["field"].ToString());
                }
            }
        }
Example #12
0
 public override void DescribeColumns(DataTable T, string ListingType)
 {
     base.DescribeColumns(T, ListingType);
     if (ListingType.StartsWith("lista"))
     {
         string[]  splittedlistingtype = ListingType.Split(".".ToCharArray());
         string    idsorkind           = splittedlistingtype[1];
         DataTable TipoClass           = Conn.RUN_SELECT("sortingkind", "*", null,
                                                         "(idsorkind=" + QueryCreator.quotedstrvalue(idsorkind, true) + ")",
                                                         null, true);
         if (TipoClass.Rows.Count != 1)
         {
             return;
         }
         foreach (DataColumn C in T.Columns)
         {
             DescribeAColumn(T, C.ColumnName, "", -1);
         }
         int nPos = 1;
         DescribeAColumn(T, "codesorkind", "Tipo", nPos++);
         DescribeAColumn(T, "sortingkind", "Tipo", nPos++);
         DescribeAColumn(T, "sortcode", "Codice", nPos++);
         DescribeAColumn(T, "sorting", "Descrizione", nPos++);
         DescribeAColumn(T, "idsor", "", nPos++);
         DescribeAColumn(T, "finpart", "Parte Bil.", nPos++);
         DescribeAColumn(T, "codefin", "Codice Bil.", nPos++);
         DescribeAColumn(T, "quota", "Quota", nPos++);
         HelpForm.SetFormatForColumn(T.Columns["quota"], "p");
     }
 }
Example #13
0
        // Passo 4.
        private bool riempiAssetUnload()
        {
            string testo = "Buono Scarico Inventario";

            aggiornaForm(testo);
            string listaCampi = "A.idassetunloadkind, A.yassetunload, A.nassetunload,  "
                                + "TBC.codeassetunloadkind AS '!codeassetunloadkind', "
                                + "A.idmot, M.codemot AS '!codemot', A.doc, A.docdate, A.ratificationdate, A.transmitted, "
                                + "A.description, A.enactment, A.enactmentdate, A.adate, A.printdate, "
                                + "A.txt, A.rtf, I.codeinventory AS 'I.codeinventory'";

            if (esportaAnagrafica)
            {
                listaCampi += ", A.idreg";
            }

            // Attenzione per i buoni di scarico non viene considerata la data di ratifica
            string stringaSQL = "SELECT " + listaCampi
                                + " FROM assetunload A"
                                + " LEFT OUTER JOIN assetunloadmotive M "
                                + " ON M.idmot = A.idmot "
                                + " JOIN assetunloadkind TBC ON A.idassetunloadkind = TBC.idassetunloadkind "
                                + " JOIN inventory I ON I.idinventory = TBC.idinventory "
                                + " WHERE (ISNULL(A.transmitted,'N') = 'N') "
                                + " AND (I.idinventoryagency = " + QueryCreator.quotedstrvalue(enteScelto, true) + ")";

            return(scriviInTabella(stringaSQL, "assetunload"));
        }
Example #14
0
        // Passo 8.
        private bool riempiAsset()
        {
            string testo = "Bene Inventariabile";

            aggiornaForm(testo);

            string listaCampi = "b.idasset, b.idpiece, b.idassetunloadkind AS '!idassetunloadkind', b.lifestart, "
                                + " b.nassetacquire, b.nassetunload, "
                                + " b.ninventory, b.yassetunload, b.flag, b.flagunload, b.transmitted, k.codeassetunloadkind, "
                                + " b.idinventory AS '!idinventory', i.codeinventory AS '!codeinventory', b.idassetunload ";
            string stringaSQL = "SELECT " + listaCampi
                                + " FROM assetview b "
                                + " LEFT OUTER JOIN assetunloadkind k "
                                + " ON k.idassetunloadkind = b.idassetunloadkind "
                                + " JOIN inventory i "
                                + " ON i.idinventory = b.idinventory "
                                + " WHERE ((b.transmitted = 'N') OR "
                                + " (ISNULL((SELECT au.transmitted FROM assetunload au "
                                + " WHERE au.idassetunload = b.idassetunload),'N') = 'N' "
                                + " AND b.idassetunload IS NOT NULL) OR "
                                + " ((b.transmitted IS NULL) AND "
                                + " (((b.idassetunload IS NOT NULL) OR ((b.idassetunload IS NULL) AND (b.flagunload = 'N'))) "
                                + " OR ((b.idassetload IS NOT NULL) OR (b.idassetload IS NULL AND b.flagload = 'N'))))) "
                                + " AND i.idinventoryagency = " + QueryCreator.quotedstrvalue(enteScelto, true);

            return(scriviInTabella(stringaSQL, "asset"));
        }
Example #15
0
        private void aggiornaDataGrid()
        {
            string   filtro        = "";
            DateTime dataContabile = (DateTime)Meta.GetSys("datacontabile");

            if (rbArretrati.Checked)
            {
                filtro = ".(start < "
                         + QueryCreator.quotedstrvalue(dataContabile.AddMonths(-1), true) + ")";
            }
            if (rbMese.Checked)
            {
                filtro = ".(start between ("
                         + QueryCreator.quotedstrvalue(dataContabile.AddMonths(-1), true) + ") and ("
                         + QueryCreator.quotedstrvalue(dataContabile, true) + "))";
            }
            txtCedoliniSelezionati.Text = null;
            Meta.DoMainCommand("maindosearch.calcolomultiplo" + filtro);
            string          dataMember = dgCedolini.DataMember;
            CurrencyManager cm         = dgCedolini.BindingContext[DS, dataMember] as CurrencyManager;

            if (cm == null)
            {
                return;
            }
            for (int i = 0; i < cm.Count; i++)
            {
                dgCedolini.UnSelect(i);
            }
            new formatgrids(dgCedolini).AutosizeColumnWidth();
        }
Example #16
0
        private void cmbDataInizioStruttura_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Meta.DoMainCommand("mainsetsearch");
            if (!Meta.IsEmpty && DS.HasChanges())
            {
                MetaDataDetail.Focus();
                return;
            }
            if (cmbDataInizioStruttura.SelectedItem.ToString() == "")
            {
                cmbDataInizioStruttura.Items.Clear();
                cmbTipoRitenuta.SelectedItem = "";
                txtGeoRegione.Text           = "";
                Meta.FreshForm();
                DisableToolbar();
                return;
            }

            filterdatainiziostruttura = "(validitystart=" +
                                        QueryCreator.quotedstrvalue(cmbDataInizioStruttura.SelectedItem, true) +
                                        ")";
            MetaData.SetDefault(DS.regionalrate, "validitystart", Convert.ToDateTime(cmbDataInizioStruttura.SelectedItem));
            DS.regionalratebracket.Clear();
            string filter = GetData.MergeFilters(filterritenuta, filterdatainiziostruttura);

            Meta.DoMainCommand("maindosearch.default." + filter);
            MetaData.SetDefault(DS.regionalrate, "idregion", lastidregione);
            PopolaComboScaglione(filter);
            EnableToolbar();
        }
Example #17
0
        public void MetaData_AfterGetFormData()
        {
            if (Meta.EditMode)
            {
                return;
            }
            DataRow CurrentRow       = HelpForm.GetLastSelected(DS.regionalrate);
            int     CurrentScaglione = Convert.ToInt16(cmbScaglione.SelectedValue);
            string  filter           = "(ratestart=" + QueryCreator.quotedstrvalue(
                CurrentRow["ratestart"], false) +
                                       ") AND (nbracket = " + QueryCreator.quotedstrvalue(
                CurrentScaglione, false) + ")";

            // verifica se lo scaglione è già stato inserito
            // sulla datainizioaliquota corrente
            DataRow [] res = DS.regionalrate.Select(filter);
            if (res.Length == 0)
            {
                CurrentRow["nbracket"] = cmbScaglione.SelectedValue;
            }
            else
            {
                CurrentRow["nbracket"] = 0;
            }
        }
Example #18
0
        /// <summary>
        /// Funzione che controlla se il comune o la nazione passata non siano validi con rispettiva visualizzazione
        /// del bottone "Aggiorna Comune", "Aggiorna Stato Estero"
        /// Il parametro comune_stato può assumere i seguenti valori: C - Comune; S - Stato
        /// </summary>
        /// <param name="codice"></param>
        /// <param name="comune_stato"></param>
        private void VisualizzaBottoneComune(int codice, string comune_stato)
        {
            bool visible = false;

            // Controllo sul Comune
            if (comune_stato == "C")
            {
                object val = Meta.Conn.DO_READ_VALUE("geo_cityusable", "idcity=" +
                                                     QueryCreator.quotedstrvalue(codice, true), "idcity");
                if (val == null)
                {
                    btnAggiornaComune.Text = "Aggiorna Comune";
                    visible = true;
                }
            }
            // Controllo sulla Nazione
            if (comune_stato == "S")
            {
                object val = Meta.Conn.DO_READ_VALUE("geo_nationusable", "idnation=" +
                                                     QueryCreator.quotedstrvalue(codice, true), "idnation");
                if (val == null)
                {
                    btnAggiornaComune.Text = "Aggiorna Stato estero";
                    visible = true;
                }
            }
            btnAggiornaComune.Visible = visible;
        }
Example #19
0
        public bool DatiValidi()
        {
            try {
                DateTime TT = (DateTime)HelpForm.GetObjectFromString(typeof(DateTime),
                                                                     txtDataContabile.Text.ToString(), "x.y");
            }
            catch {
                MessageBox.Show("E' necessario inserire una data valida");
                txtDataContabile.Focus();
                return(false);
            }
            DateTime T = (DateTime)HelpForm.GetObjectFromString(typeof(DateTime),
                                                                txtDataContabile.Text.ToString(), "x.y");
            int       esercizio       = T.Year;
            string    filteresercizio = "(ayear=" + QueryCreator.quotedstrvalue(esercizio, true) + ")";
            DataTable EsercizioTable  =
                DataAccessLocale.RUN_SELECT("accountingyear", "*", null, filteresercizio, null, true);

            if (EsercizioTable.Rows.Count == 0)
            {
                MessageBox.Show("L'esercizio " + esercizio + " non è stato creato.");
                txtDataContabile.Focus();
                return(false);
            }
            return(true);
        }
Example #20
0
        private void GetParamfromDB()
        {
            DataRow MR = Session["ExportRow"] as DataRow;

            if (MR == null)
            {
                return;
            }
            TitoloExp.Text = MR["Description"].ToString();
            DataAccess Conn = GetVars.GetUserConn(this);

            if (Conn == null)
            {
                return;
            }
            string filterpar = "(" +
                               "procedurename=" + QueryCreator.quotedstrvalue(MR["procedurename"], true) + ")";
            DataTable Params = Conn.RUN_SELECT("exportfunctionparam", "*", "number asc", filterpar, null, true);

            if (Params == null)
            {
                return;
            }
            Params.Columns.Add("__WebControlID", typeof(string));
            //Dataset di Sessione
            Session["Paramdata"] = Params;
            //Crea la tabella per inserire i parametri dell'utente
            CreatePrimaryTable(Params.Select(null, "number asc"));
            //Aggiunge la colonna ParamValue che mi servirà per conservare il valore inserito dall'utente
            //Params.Columns.Add("ParamValue",GetTypeFromUserFormat(Params["userformat"].ToString()));
        }
Example #21
0
        private void btnBilancio_Click(object sender, System.EventArgs e)
        {
            string filter;

            int    esercizio   = (int)Meta.GetSys("esercizio");
            string filterpart  = (E_S == "E") ? QHS.BitClear("flag", 0) : QHS.BitSet("flag", 0);
            string filteridfin = QHS.AppAnd(QHS.CmpEq("ayear", esercizio), filterpart);

            //filter= filter_upb;
            filter = currfilter_upb;

            filter = GetData.MergeFilters(filteridfin, filter);

            //Aggiunge eventualmente il filtro sul disponibile
            if (chkFilterAvailable.Checked)
            {
                decimal currval = importo;
                filter = GetData.MergeFilters(filter, QHS.CmpGe("availableprevision", currval));
            }

            string filteroperativo = "(idfin in (SELECT idfin from finusable where ayear = '"
                                     + esercizio + "'))";

            if (chkListManager.Checked)
            {
                if (cmbResponsabile.SelectedIndex > 0)
                {
                    filter = GetData.MergeFilters(filter, QHS.CmpEq("idman", cmbResponsabile.SelectedValue));
                }
                else
                {
                    filter = GetData.MergeFilters(filter, QHS.IsNull("idman"));
                }
                Meta.FilterLocked = true;
                filter            = GetData.MergeFilters(filter, filteroperativo);
                Selected          = Meta.SelectOne("default", filter, "finview", null);
                riempiTextBox(Selected);
                return;
            }

            if (chkListTitle.Checked)
            {
                FrmAskDescr  FR = new FrmAskDescr(0);
                DialogResult D  = FR.ShowDialog(this);
                if (D != DialogResult.OK)
                {
                    return;
                }
                filter = GetData.MergeFilters(filter,
                                              "(title like " + QueryCreator.quotedstrvalue(
                                                  "%" + FR.txtDescrizione.Text + "%", true)) + ")";
                Meta.FilterLocked = true;
                filter            = GetData.MergeFilters(filter, filteroperativo);
                Selected          = Meta.SelectOne("default", filter, "finview", null);
                riempiTextBox(Selected);
                return;
            }

            chiamaFormBilancio(filter);
        }
Example #22
0
        void SetCodice()
        {
            MetaData Meta = MetaData.GetMetaData(this);

            if (Meta.EditMode)
            {
                return;
            }
            btnCodice.Enabled  = (cmbTipo.SelectedIndex > 0);
            txtCodice.ReadOnly = (cmbTipo.SelectedIndex <= 0);
            if (cmbTipo.SelectedIndex <= 0)
            {
                txtCodice.Text      = "";
                txtDescrizione.Text = "";
            }
            else
            {
                string filter = "(idsorkind=" +
                                QueryCreator.quotedstrvalue(cmbTipo.SelectedValue, false) + ")";
                btnCodice.Tag = "manage.sorting.tree." + filter;
                //label per il form di selezione della voce di classificazione +"."+ filtro
                DS.sorting.ExtendedProperties[MetaData.ExtraParams] = filter;
                //AutoManage.txtCodiceClass.tree
                gboxclass.Tag = "AutoManage.txtCodice.tree." + filter;
                MetaData.GetMetaData(this).SetAutoMode(gboxclass);
            }
        }
Example #23
0
        /// <summary>
        /// "Si" se il codice presente nella riga si trova nel DataTable, altrimenti "No"
        /// </summary>
        /// <param name="T"></param>
        /// <param name="ToFind"></param>
        /// <returns></returns>
        private string IsInstalled(DataRow R, string tipoupdate)
        {
            try {
                string filter = "code=" + QueryCreator.quotedstrvalue(R["code"], false);
                switch (tipoupdate.ToUpper())
                {
                case "S":
                    if (DS.ondemand.Select(filter).Length == 1)
                    {
                        return("Si");
                    }
                    return("No");

                case "C":
                    if (DSclient.update.Select(filter).Length == 1)
                    {
                        return("Si");
                    }
                    return("No");

                case "M":
                    if ((DS.ondemand.Select(filter).Length == 1) &&
                        (DSclient.update.Select(filter).Length == 1))
                    {
                        return("Si");
                    }
                    return("No");
                }
            }
            catch {}
            return("No");
        }
Example #24
0
//		void EnableToolbar(bool enable) {
//			Meta.CanInsert=enable;
//			Meta.CanInsertCopy=enable;
//			Meta.FreshToolBar();
//			this.SendToBack();
//			MetaDataToolBar.BringToFront();
//		}

        private void cmbTipoRitenuta_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (!Meta.DrawStateIsDone)
            {
                return;
            }
            DS.taxrate.Clear();
            DS.ratebracket.Clear();             //
            Meta.FreshForm();
            cmbDataInizioStruttura.Items.Clear();
            if (cmbTipoRitenuta.SelectedIndex <= 0)
            {
                return;
            }
            //if (cmbTipoRitenuta.SelectedItem.ToString()=="") return;
            object taxcode = cmbTipoRitenuta.SelectedValue;

            if (taxcode == null)
            {
                return;
            }
            filterritenuta = "(taxcode=" +
                             QueryCreator.quotedstrvalue(taxcode, true) +
                             ")";
            MetaData.SetDefault(DS.taxrate, "taxcode", taxcode);
            PopolaComboDataInizioStruttura(filterritenuta);
            if (!Meta.IsEmpty)
            {
                DisableToolbar();
            }
        }
Example #25
0
        override public DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            DataTable Levels = T.DataSet.Tables["flowchartlevel"];

            if (Levels == null)
            {
                return(null);
            }
            int    level;
            string codprefix;
            string ordinestampaprefix;

            if (ParentRow != null)
            {
                level              = Convert.ToInt32(ParentRow["nlevel"]) + 1;
                codprefix          = ParentRow["codeflowchart"].ToString();
                ordinestampaprefix = ParentRow["printingorder"].ToString();
            }
            else
            {
                level              = 1;
                codprefix          = "";
                ordinestampaprefix = "";
                SetDefault(T, "paridflowchart", GetSys("esercizio").ToString().Substring(2, 2));
            }
            if (level > (Levels.Rows.Count - 1))
            {
                MessageBox.Show("Non è possibile inserire un livello inferiore a quello selezionato");
                return(null);
            }
            string kind = "A"; //corresponding to "flagreset"

            DataRow[] levrow = Levels.Select("(nlevel=" + QueryCreator.quotedstrvalue(level, false) + ") AND " +
                                             "(ayear=" + QueryCreator.quotedstrvalue(esercizio, false) + ")");

            if (levrow.Length != 1)
            {
                return(null);
            }

            SetDefault(T, "nlevel", level);

            RowChange.MarkAsAutoincrement(T.Columns["idflowchart"],
                                          "paridflowchart", null, 4);

            if (kind.ToLower() == "a")
            {
                SetDefault(T, "codeflowchart", codprefix);
                SetDefault(T, "printingorder", ordinestampaprefix);
            }

            DataRow R = base.Get_New_Row(ParentRow, T);

            if (kind.ToLower() == "a")
            {
                RowChange.ClearAutoIncrement(T.Columns["printingorder"]);
            }
            return(R);
        }
Example #26
0
        /// <summary>
        /// Filtro da usarsi per diarie
        /// </summary>
        /// <param name="Missione"></param>
        /// <param name="Tappa"></param>
        /// <returns></returns>
        public static string GetQualificaClasseFilter(object idposition, object incomeclass)
        {
            string codicequalifica = idposition.ToString();
            object classe          = incomeclass;

            return("(idposition=" + QueryCreator.quotedstrvalue(codicequalifica, true) + ")" +
                   " AND (" + QueryCreator.quotedstrvalue(classe, true) + " between minincomeclass and maxincomeclass)");
        }
Example #27
0
        private void Esegui()
        {
            string   filter_auto = "";
            DateTime Datainizio, Datafine;

            int taxkind = 0;

            foreach (DataRow R in DS.tax.Rows)
            {
                taxkind = CfgFn.GetNoNullInt32(R["taxkind"]);
                switch (taxkind)
                {
                case 1: R["!taxcategory"] = "Fiscale"; break;

                case 2: R["!taxcategory"] = "Assistenziale"; break;

                case 3: R["!taxcategory"] = "Previdenziale"; break;

                case 4: R["!taxcategory"] = "Assicurativa"; break;

                case 5: R["!taxcategory"] = "Arretrati"; break;

                case 6: R["!taxcategory"] = "Altro"; break;
                }
            }

            foreach (DataRow R in DS.tax.Rows)
            {
                filter_auto = "(taxcode = " + QueryCreator.quotedstrvalue(R["taxcode"], false) + ") AND " + filter_eserc;
                DataTable Ttaxsetup = meta.Conn.RUN_SELECT("taxsetup", "*", null, filter_auto, null, true);
                DataRow[] Rauto     = Ttaxsetup.Select(filter_auto, null);

                if (Rauto.Length == 0)
                {
                    continue;
                }
                if (!ControllaConfRitenuta(Rauto[0]))
                {
                    continue;
                }
                Datainizio = new DateTime(1, 1, 1);
                Datafine   = new DateTime(1, 1, 1);
                CalcolaDateDaPeriodo(Rauto[0], out Datainizio, out Datafine);
                if (!CallStoredProcedure(R["taxcode"], Datainizio, Datafine))
                {
                    continue;
                }
                else
                {
                    MessageBox.Show("Ci sono ritenute da pagare", "Informazioni", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MetaData Metataxpay = MetaData.GetMetaData(this, "taxpay");
                    Metataxpay.Edit(meta.LinkedForm.ParentForm, "ritenutedapagare", true);

                    return;
                }
            }
        }
Example #28
0
        private void btnListino_Click(object sender, EventArgs e)
        {
            Meta = Disp.Get("listview");
            string filter = QHS.DoPar(QHS.AppOr(QHS.IsNull("validitystop"),
                                                QHS.CmpGe("validitystop", Meta.GetSys("datacontabile"))));
            MetaData Mlistino = Disp.Get("listview");

            Mlistino.FilterLocked = true;
            Mlistino.DS           = new DataSet();
            int nFilter = 0;

            //Filtro sulla classificazione merceologica
            if (chkFilterClass.Checked)
            {
                nFilter = 1;
            }

            //Filtro sulla descrizione
            if (chkListDescription.Checked)
            {
                nFilter = nFilter + 2;
            }

            if (nFilter > 0)
            {
                FrmAskDescr  FR = new FrmAskDescr(Meta.Dispatcher, nFilter);
                DialogResult D  = FR.ShowDialog(this);
                if (D != DialogResult.OK)
                {
                    return;
                }
                if (FR.Selected != null)
                {
                    object idlistclass = FR.Selected["idlistclass"];
                    filter = GetData.MergeFilters(filter,
                                                  "(idlistclass =  " + QueryCreator.quotedstrvalue(FR.Selected["idlistclass"], true) + ")");
                }

                filter = GetData.MergeFilters(filter,
                                              "(description like "
                                              + QueryCreator.quotedstrvalue("%" + FR.txtDescrizione.Text + "%", true) + ")");
            }

            DataRow Choosen = Mlistino.SelectOne("default", filter, "listview", null);

            if (Choosen == null)
            {
                return;
            }



            riempiOggetti(Choosen);

            return;
        }
Example #29
0
        /// <summary>
        /// Resituisce True se il codice aggiornamento esiste nel Datatable che
        /// rappresenta l'indice client o server
        /// </summary>
        private bool RowExists(DataTable T, object codice)
        {
            if (T == null)
            {
                return(false);
            }
            string filter = "code=" + QueryCreator.quotedstrvalue(codice, false);

            return(T.Select(filter).Length > 0);
        }
Example #30
0
        string CalcolaCheckBackup2(DataRow R)
        {
            string S = "2" + QueryCreator.quotedstrvalue(R["iddb"], true) +
                       QueryCreator.quotedstrvalue(R["serverbackup2"].ToString().ToUpper(), true) +
                       QueryCreator.quotedstrvalue(R["dbname"], true) +
                       QueryCreator.quotedstrvalue(R["swmoreflag"], true) +
                       QueryCreator.quotedstrvalue(R["swmorecode"], true);
            string Check = CheckFlags.GetCheck(S);

            return(Check);
        }