Exemplo n.º 1
0
        private void btnCasuale_Click(object sender, EventArgs e)
        {
            object idpccdebitstatus = DBNull.Value;
            string filter           = "";

            if (cmbStatodelDebito.SelectedIndex > 0)
            {
                idpccdebitstatus = cmbStatodelDebito.SelectedValue;
            }
            if (idpccdebitstatus != DBNull.Value)
            {
                int maskorder = CfgFn.GetNoNullInt32(DS.pccdebitstatus.Select(QHC.CmpEq("idpccdebitstatus", idpccdebitstatus))[0]["flag"]);
                filter = "( flagstatus & " + QueryCreator.unquotedstrvalue(maskorder, true) + " <>0 )";
            }

            MetaData MCausali = MetaData.GetMetaData(this, "pccdebitmotive");

            MCausali.FilterLocked = true;
            MCausali.DS           = DS.Clone();

            DataRow Choosen = MCausali.SelectOne("default", filter, "pccdebitmotive", null);

            if (Choosen == null)
            {
                return;
            }
            txtCodiceCasualePcc.Text = Choosen["idpccdebitmotive"].ToString();
            txtCausale.Text          = Choosen["description"].ToString();
        }