예제 #1
0
        public override DataRow SelectByCondition(string filter, string searchtable)
        {
            if (edit_type == "treealle" || edit_type == "treealls" ||
                edit_type == "treeallenew" || edit_type == "treeallsnew"
                )
            {
                return(base.SelectByCondition(filter, "finview"));
            }

            //string filternoupb= removefilterupb(filter);
            //int ResultCount = Conn.RUN_SELECT_COUNT("finusable", filternoupb, true);

            int ResultCount = Conn.RUN_SELECT_COUNT("finview", QHS.AppAnd(filter, QHS.CmpEq("flagusable", "S")), true);

            if (ResultCount != 1)
            {
                return(null);
            }

            DataTable T2 = Conn.RUN_SELECT("finview", null, null, filter, null, true);

            if (T2 == null)
            {
                return(null);
            }
            if (T2.Rows.Count == 0)
            {
                return(null);
            }
            return(CheckSelectRow(T2.Rows[0]));
        }
예제 #2
0
        public override DataRow SelectByCondition(string filter, string searchtable)
        {
            if (edit_type == "treeall")
            {
                return(base.SelectByCondition(filter, "account"));
            }
            int ResultCount = 0;

            if (edit_type == "treeminusable")
            {
                string filterenablebudgetprev = QHS.NullOrEq("flagenablebudgetprev", "S");
                filter      = QHS.AppAnd(filter, filterenablebudgetprev);
                ResultCount = Conn.RUN_SELECT_COUNT("accountminusable", filter, true);
            }
            else
            {
                ResultCount = Conn.RUN_SELECT_COUNT("accountusable", filter, true);
            }

            if (ResultCount != 1)
            {
                return(null);
            }
            DataTable T2 = Conn.RUN_SELECT("account", null, null, filter, null, true);

            if (T2 == null)
            {
                return(null);
            }
            if (T2.Rows.Count == 0)
            {
                return(null);
            }
            return(CheckSelectRow(T2.Rows[0]));
        }
예제 #3
0
        //string[] mykey = new string[] { "idcsa_import", "idcsa_agency"};
        //public override string[] primaryKey() {
        //    return mykey;
        //}
        public override string GetStaticFilter(string ListingType)
        {
            string filteresercizio;
            string filtertipo = "";

            filteresercizio = QHS.CmpEq("yimport", GetSys("esercizio"));
            if (ListingType == "versamentiannuali")
            {
                return(filteresercizio);
            }
            //switch (ListingType) {
            //    case "ritenuta":
            //        filtertipo = QHS.CmpEq("kind", "Ritenuta");
            //        break;
            //    case "contributo":
            //        filtertipo = QHS.CmpEq("kind", "Contributo");
            //        break;
            //    case "recupero":
            //        filtertipo = QHS.CmpEq("kind","Recupero");
            //        break;
            //    case "versamentiannuali":
            //        filtertipo = QHS.CmpEq("kind", "Voce CSA");
            //        break;
            //}

            if (ListingType == "versamentiannuali")
            {
                return(QHS.AppAnd(filteresercizio));
            }

            return(base.GetStaticFilter(ListingType));
        }
예제 #4
0
        public void FillRegistryData()
        {
            string idregistryreference = Request.Form["txtidregistryreference"];

            if (idregistryreference == null || idregistryreference == "")
            {
                lblError.Text = "";
                return;
            }
            string filter;

            string[] arr = idregistryreference.Split('|');

            string idreg    = arr[0];
            string idregref = arr[1];

            DataAccess  Conn = (DataAccess)Session["DBUserConn"];
            QueryHelper QHS;

            QHS = Conn.GetQueryHelper();

            filter = QHS.AppAnd(QHS.CmpEq("idregistryreference", idregref), QHS.CmpEq("idreg", idreg));

            DataTable DT = Conn.RUN_SELECT("registryreference", "*", null, filter, null, false);

            if (DT == null || DT.Rows.Count == 0)
            {
                lblError.Text = "Problema sul DB di sistema.";
                return;
            }

            txtlogin.Text = DT.Rows[0]["userweb"].ToString();
            txtidregistryreference.Text = "";
            return;
        }
예제 #5
0
        public override string GetStaticFilter(string ListingType)
        {
            string filteresercizio;
            string filtertipo = "";

            filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));
            if (ListingType == "elenco")
            {
                return(filteresercizio);
            }
            switch (ListingType)
            {
            case "ritenuta":
                filtertipo = QHS.CmpEq("kind", "Ritenuta");
                break;

            case "contributo":
                filtertipo = QHS.CmpEq("kind", "Contributo");
                break;

            case "recupero":
                filtertipo = QHS.CmpEq("kind", "Recupero");
                break;
            }

            if ((ListingType == "ritenuta") || (ListingType == "contributo") || (ListingType == "recupero"))
            {
                return(QHS.AppAnd(filteresercizio, filtertipo));
            }

            return(base.GetStaticFilter(ListingType));
        }
예제 #6
0
        public override void DescribeTree(System.Windows.Forms.TreeView tree, DataTable T, string ListingType)
        {
            bool all = false;

            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "tree" || ListingType == "treeall" || ListingType == "treenew" || ListingType == "treeminusable")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "!livello", "Livello", "accountlevel.description");
                DescribeAColumn(T, "codeacc", "Codice");
                DescribeAColumn(T, "title", "Denominazione");
            }

            base.DescribeTree(tree, T, ListingType);
            int    esercizio       = Convert.ToInt32(GetSys("esercizio"));
            int    esercizionew    = esercizio + 1;
            string filteresercizio = QHC.CmpEq("ayear", GetSys("esercizio"));
            string filterc         = QHC.CmpEq("nlevel", "1");
            string filtersql       = QHS.CmpEq("nlevel", "1");

            int    maxlevel = 0;
            object o        = Conn.DO_READ_VALUE("accountlevel", filteresercizio, "max(nlevel)");

            if ((o != null) && (o != DBNull.Value))
            {
                maxlevel = Convert.ToInt32(o);
            }
            int    minlevelop         = CfgFn.GetNoNullInt32(GetSys("accountusablelevel"));
            string filterAccountLevel = filteresercizio;

            if (ListingType == "treeminusable")
            {
                maxlevel = minlevelop;
                string filterenablebudgetprev = QHS.NullOrEq("flagenablebudgetprev", "S");
                filterAccountLevel = QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.CmpLe("nlevel", minlevelop), filterenablebudgetprev);
            }

            //		TreeViewAccount M = new TreeViewAccount(Conn, T, tree, filter, maxlevel);
            //		myGetData.SetStaticFilter("accountevel","(ayear='"+GetSys("esercizio").ToString()+"')");
            //
            if (ListingType == "treeall")
            {
                all = true;
            }
            if (ListingType == "treenew")
            {
                //string livsupid = esercizionew.ToString().Substring(2);
                //filter = "(paridacc is null + QueryCreator.quotedstrvalue(livsupid, true) + ")";
                filterAccountLevel = QHS.CmpEq("ayear", esercizionew);
                all = true;
            }
            TreeViewAccount M = new TreeViewAccount(Conn, T, tree, filterc, filtersql, all, maxlevel);

            myGetData.SetStaticFilter("accountlevel", filterAccountLevel);
        }
예제 #7
0
        override public DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            if (edit_type == "default")
            {
                if (ParentRow != null)
                {
                    SetDefault(T, "idfin", ParentRow["idfin"]);
                    SetDefault(T, "paridfin", ParentRow["paridfin"]);
                    SetDefault(T, "codefin", ParentRow["codefin"]);
                    SetDefault(T, "finance", ParentRow["finance"]);
                }
            }
            if (edit_type == "previsionupb")
            {
                if (ParentRow != null)
                {
                    SetDefault(T, "idfin", ParentRow["idfin"]);
                    SetDefault(T, "paridfin", ParentRow["paridfin"]);
                    SetDefault(T, "codefin", ParentRow["codefin"]);
                    SetDefault(T, "finance", ParentRow["title"]);
                    SetDefault(T, "flag", ParentRow["flag"]);
                    SetDefault(T, "nlevel", ParentRow["nlevel"]);

                    int    flag    = CfgFn.GetNoNullInt32(ParentRow["flag"]);
                    object finpart = DBNull.Value;
                    if ((flag & 1) == 1)
                    {
                        finpart = "S";
                    }
                    else
                    {
                        finpart = "E";
                    }
                    SetDefault(T, "finpart", finpart);

                    string filterfinlevel = QHS.AppAnd(QHS.CmpEq("ayear", Conn.GetSys("esercizio")), QHS.CmpEq("nlevel", ParentRow["nlevel"]));
                    object leveldescr     = Conn.DO_READ_VALUE("finlevel", filterfinlevel, "description");
                    SetDefault(T, "leveldescr", leveldescr);
                }
            }

            if (edit_type == "previsionfin")
            {
                if (ParentRow != null)
                {
                    SetDefault(T, "idupb", ParentRow["idupb"]);
                    SetDefault(T, "paridupb", ParentRow["paridupb"]);
                    SetDefault(T, "codeupb", ParentRow["codeupb"]);
                    SetDefault(T, "upb", ParentRow["title"]);
                }
            }

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

            return(R);
        }
예제 #8
0
        private static int GetMaxNpro_Treasurer(DataRow R, DataAccess Conn)
        {
            QueryHelper QHS;

            QHS = Conn.GetQueryHelper();
            var    qhc         = new CQueryHelper();
            object idtreasurer = R["idtreasurer"];

            if ((idtreasurer == DBNull.Value) || (CfgFn.GetNoNullInt32(idtreasurer) == 0))
            {
                return(-1);
            }
            object flagautondoc_treasurer = null;

            if (enable_ndoc_treasurers.ContainsKey((int)idtreasurer))
            {
                flagautondoc_treasurer = enable_ndoc_treasurers[(int)idtreasurer];
            }
            else
            {
                if (R.Table.DataSet.Tables.Contains("treasurer") &&
                    R.Table.DataSet.Tables["treasurer"].Columns.Contains("enable_ndoc_treasurer")
                    )
                {
                    DataTable ttr     = R.Table.DataSet.Tables["treasurer"];
                    var       foundTr = ttr.Select(qhc.CmpEq("idtreasurer", idtreasurer));
                    if (foundTr.Length > 0)
                    {
                        flagautondoc_treasurer = foundTr[0]["enable_ndoc_treasurer"];
                        enable_ndoc_treasurers[(int)idtreasurer] = flagautondoc_treasurer;
                    }
                }
            }

            if (flagautondoc_treasurer == null)
            {
                flagautondoc_treasurer = Conn.DO_READ_VALUE("treasurer", QHS.CmpEq("idtreasurer", idtreasurer),
                                                            "enable_ndoc_treasurer");
                enable_ndoc_treasurers[(int)idtreasurer] = flagautondoc_treasurer;
            }

            if ((flagautondoc_treasurer != null) && (flagautondoc_treasurer != DBNull.Value) &&
                (flagautondoc_treasurer.ToString().ToUpper() == "S"))
            {
                int numiniziale = 0;

                string sqlmax = "SELECT ISNULL(MAX(npro_treasurer)," + numiniziale.ToString() +
                                ") + 1 FROM proceeds WHERE "
                                + QHS.AppAnd(QHS.CmpEq("idtreasurer", idtreasurer), QHS.CmpEq("ypro", R["ypro"]));

                DataTable t = Conn.SQLRunner(sqlmax, true, 0);
                return(CfgFn.GetNoNullInt32(t.Rows[0][0]));
            }

            return(-1);
        }
예제 #9
0
        public override string GetStaticFilter(string ListingType)
        {
            string filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));
            string basefilter      = base.GetStaticFilter(ListingType);

            if (string.IsNullOrEmpty(basefilter))
            {
                return(filteresercizio);
            }
            return(QHS.AppAnd(basefilter, filteresercizio));
        }
예제 #10
0
    public void FillShowcases()
    {
        DataTable TStore = Conn.RUN_SELECT("store", "*", null,
                                           QHS.AppAnd(QHS.NullOrEq("active", "S"), Conn.Security.SelectCondition("store", true)),
                                           null, false);

        //DataTable DT = DataAccess.RUN_SELECT(Conn, "showcase", "*", "title asc", null, false);
        string Query = " SELECT showcase.idshowcase as idshowcase, showcase.idstore as idstore, showcase.title as title FROM showcase JOIN store ";

        Query += " on (showcase.idstore = store.idstore) WHERE store.active='S'";

        DataTable DT = Conn.SQLRunner(Query);

        if (DT == null || DT.Rows.Count == 0)
        {
            return;
        }

        //Cancella le vetrine non associate a magazzini autorizzati
        foreach (DataRow r in DT.Select())
        {
            string search = QHS.CmpEq("idstore", r["idstore"]);
            if (TStore.Select(search).Length > 0)
            {
                continue;
            }
            r.Delete();
        }
        DT.AcceptChanges();


        foreach (DataRow DR in DT.Rows)
        {
            string   Label   = DR["title"].ToString();
            string   id      = DR["idshowcase"].ToString();
            string   idstore = DR["idstore"].ToString();
            hwButton HB      = new hwButton();
            HB.ID       = "btnShowcase_" + id + "_" + idstore;
            HB.CssClass = "showcasebutton";

            /*
             * HB.Style.Add("border", "0px");
             * HB.Style.Add("background-color", "white");
             * HB.Style.Add("cursor", "hand");
             * HB.Style.Add();
             */
            HB.Tag  = "showcase." + id + "." + idstore;
            HB.Text = Label;

            showcases.Controls.Add(HB);
            HtmlGenericControl br = new HtmlGenericControl("br");
            showcases.Controls.Add(br);
        }
    }
예제 #11
0
        public override DataRow CheckSelectRow(DataRow R)
        {
            int ResultCount = Conn.RUN_SELECT_COUNT("accmotivedetail",
                                                    QHS.AppAnd(QHS.CmpEq("idaccmotive", R["idaccmotive"]), QHS.CmpEq("ayear", GetSys("esercizio"))), true);

            if (ResultCount == 0)
            {
                ShowClientMsg("Causale non associata a Conto.", "Errore", MessageBoxButtons.OK);
                return(null);
            }
            return(base.CheckSelectRow(R));
        }
예제 #12
0
 public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
 {
     // Listing Type chiamato dal form di gestione di budgetprevision (fissato l'IDFIN)
     if (ListingType == "tree")
     {
         object idSorting = T.ExtendedProperties["idsor"];
         base.DescribeTree(tree, T, ListingType);
         string          filterC         = QHC.AppAnd(QHC.CmpEq("idsor", idSorting), QHC.IsNull("paridupb"));
         string          filterSql       = QHS.AppAnd(QHS.CmpEq("idsor", idSorting), QHS.IsNull("paridupb"));
         string          filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));
         TreeViewManager M = new TreeViewbudgetprevision(T, tree, filterC, filterSql, null);
         myGetData.SetStaticFilter("sortinglevel", filteresercizio);
     }
 }
예제 #13
0
 public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
 {
     // Listing Type chiamato dal form di gestione di ACCOUNTYEAR (fissato l'IDACC)
     if (ListingType == "tree")
     {
         string idAcc = T.ExtendedProperties["idacc"].ToString();
         base.DescribeTree(tree, T, ListingType);
         string          filterc         = QHC.AppAnd(QHC.CmpEq("idacc", idAcc), QHC.IsNull("paridupb"));
         string          filtersql       = QHS.AppAnd(QHS.CmpEq("idacc", idAcc), QHS.IsNull("paridupb"));
         string          filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));
         TreeViewManager M = new TreeViewAccountYear(Conn, T, tree, filterc, filtersql, null, 10);
         myGetData.SetStaticFilter("accountlevel", filteresercizio);
     }
 }
예제 #14
0
        public override DataRow SelectByCondition(string filter, string searchtable)
        {
            if (edit_type == "treealle" || edit_type == "treealls")
            {
                return(base.SelectByCondition(filter, "fin"));
            }
            int maxlev = 0;

            for (int i = 1; i <= 5; i++)
            {
                if (edit_type == "treee" + i)
                {
                    maxlev    = i;
                    edit_type = "treee";
                }
                if (edit_type == "trees" + i)
                {
                    maxlev    = i;
                    edit_type = "trees";
                }
            }
            if (maxlev > 0)
            {
                filter = filter.Replace("nlevel<=", "nlevel=");
                return(base.SelectByCondition(filter, "fin"));
            }
            //string filternoupb=removefilterupb(filter);
            //int ResultCount = Conn.RUN_SELECT_COUNT("finusable", filternoupb, true);

            int ResultCount = Conn.RUN_SELECT_COUNT("finview", QHS.AppAnd(filter, QHS.CmpEq("flagusable", "S")), true);

            if (ResultCount != 1)
            {
                return(null);
            }

            DataTable T2 = Conn.RUN_SELECT("fin", null, null, filter, null, true);

            if (T2 == null)
            {
                return(null);
            }
            if (T2.Rows.Count == 0)
            {
                return(null);
            }
            return(CheckSelectRow(T2.Rows[0]));
        }
예제 #15
0
        override public DataRow Get_New_Row(DataRow ParentRow, DataTable T)
        {
            if (edit_type == "default")
            {
                if (ParentRow != null)
                {
                    SetDefault(T, "idacc", ParentRow["idacc"]);
                    SetDefault(T, "paridacc", ParentRow["paridacc"]);
                    SetDefault(T, "codeacc", ParentRow["codeacc"]);
                    SetDefault(T, "account", ParentRow["account"]);
                    SetDefault(T, "idsorkind", ParentRow["idsorkind"]);
                    SetDefault(T, "sorkind", ParentRow["sorkind"]);
                    SetDefault(T, "paridsor", ParentRow["paridsor"]);
                    SetDefault(T, "nlevel", ParentRow["nlevel"]);
                    SetDefault(T, "leveldescr", ParentRow["leveldescr"]);
                }
            }
            if (edit_type == "previsionaccount")
            {
                if (ParentRow != null)
                {
                    SetDefault(T, "idupb", ParentRow["idupb"]);
                    SetDefault(T, "paridupb", ParentRow["paridupb"]);
                    SetDefault(T, "codeupb", ParentRow["codeupb"]);
                    SetDefault(T, "upb", ParentRow["title"]);
                }
            }
            if (edit_type == "previsionupb")
            {
                if (ParentRow != null)
                {
                    SetDefault(T, "idacc", ParentRow["idacc"]);
                    SetDefault(T, "paridacc", ParentRow["paridacc"]);
                    SetDefault(T, "codeacc", ParentRow["codeacc"]);
                    SetDefault(T, "account", ParentRow["title"]);
                    SetDefault(T, "nlevel", ParentRow["nlevel"]);
                    string filterfinlevel = QHS.AppAnd(QHS.CmpEq("ayear", Conn.GetSys("esercizio")), QHS.CmpEq("nlevel", ParentRow["nlevel"]));
                    object leveldescr     = Conn.DO_READ_VALUE("accountlevel", filterfinlevel, "description");
                    SetDefault(T, "leveldescr", leveldescr);
                }
            }
            DataRow R = base.Get_New_Row(ParentRow, T);

            return(R);
        }
예제 #16
0
        /*
         *      public override bool IsValid (DataRow R, out string errmess, out string errfield){
         *              if (!base.IsValid(R, out errmess, out errfield))
         *                      return false;
         *              if (R.RowState!=DataRowState.Added) return true;
         *              int lunghezza =(int)PrimaryDataTable.Columns["sortcode"].ExtendedProperties["length"];
         *              if (lunghezza>0 &&  R["sortcode"].ToString().Length != lunghezza){
         *                      errmess="Attenzione! Il campo 'codice' deve avere lunghezza "+lunghezza+".";
         *                      errfield="sortcode";
         *                      return false;
         *              }
         *              return true;
         *      }
         */

        public override DataRow SelectByCondition(string filter, string searchtable)
        {
            filter = QHS.AppAnd(filter,
                                QHS.NullOrLe("start", GetSys("esercizio")),
                                QHS.NullOrGe("stop", GetSys("esercizio")));
            if (edit_type == "treeall")
            {
                return(base.SelectByCondition(filter, "sorting"));
            }

            if (edit_type == "tree5")
            {
                filter = QHS.AppAnd(filter, QHS.CmpEq("nlevel", 5));
                return(base.SelectByCondition(filter, "sortingview"));
            }

            return(base.SelectByCondition(filter, "sortingusable"));
        }
예제 #17
0
 public override DataRow SelectOne(string ListingType, string filter, string searchtable, DataTable Exclude)
 {
     if (ListingType == "treenew")
     {
         return(base.SelectOne(ListingType, filter, "sortingyearview", Exclude));
     }
     if (ListingType == "treeusable")
     {
         return(base.SelectOne(ListingType, filter, "sortingusable", Exclude));
     }
     if (ListingType == "treeall")
     {
         return(base.SelectOne(ListingType, filter, "sortingall", Exclude));
     }
     if (ListingType == "tree5")
     {
         filter = QHS.AppAnd(filter, QHS.CmpEq("nlevel", 5));
     }
     return(base.SelectOne(ListingType, filter, "sorting", Exclude));
 }
예제 #18
0
        /// <summary>
        /// Elimina la parte di filtro costituita da esercizio='yyyy' poiché
        /// la vista classmovimentioperativo non contiene il campo esercizio
        /// </summary>
        /// <param name="filter">filtro da purificare</param>
        /// <returns>filtro purificato</returns>
        //private string PurificaFiltro(string filter) {
        //    string tofind="(ayear='"+GetSys("esercizio").ToString()+"')";
        //    int lentofind=tofind.Length;
        //    //se non contiene la stringa non faccio nulla
        //    if (!(filter.IndexOf(tofind)>0)) return filter;
        //    //cerco il punto di inizio
        //    int begin=filter.IndexOf(tofind);
        //    int end=begin+lentofind;
        //    //elimino la stringa
        //    string newfilter=filter.Substring(0,begin)+filter.Substring(end);
        //    //si trova in prima posizione?
        //    if (newfilter.Trim().StartsWith("AND"))
        //        return newfilter.Trim().Substring(3);
        //    //si trova in ultima posizione?
        //    if (newfilter.Trim().EndsWith("AND"))
        //        return newfilter.Trim().Substring(0, newfilter.Length - newfilter.LastIndexOf("AND"));
        //    //si trova al centro
        //    return newfilter.Replace("ANDAND","AND");
        //}

        public override DataRow SelectByCondition(string filter, string searchtable)
        {
            //filter=PurificaFiltro(filter);
            DataRow R = base.SelectByCondition(filter, "sortingusableyear");

            if (R == null)
            {
                return(null);
            }
            string newfilter = QHS.AppAnd(QHS.CmpEq("ayear", GetSys("esercizio")),
                                          QHS.MCmp(R, "idsorkind", "idsor"),
                                          QHS.NullOrLt("start", GetSys("esercizio")),
                                          QHS.NullOrGe("stop", GetSys("esercizio")));

            int count = Conn.RUN_SELECT_COUNT("sortingview", newfilter, true);

            if (count == 1)
            {
                return(R);
            }
            return(null);
        }
예제 #19
0
        protected void btnrespforn_Click(object sender, EventArgs e)
        {
            DataAccess  Conn = (DataAccess)Session["DBUserConn"];
            QueryHelper QHS;

            QHS = Conn.GetQueryHelper();
            string filter;

            if (userkind.SelectedValue == "1")
            {
                // Responsabili

                filter = QHS.AppAnd(QHS.CmpEq("active", "S"), QHS.IsNotNull("userweb"), QHS.CmpNe("userweb", ""));
                DataTable DT = Conn.RUN_SELECT("manager", "idman,title,userweb", "title asc", filter, null, false);
                if (DT == null || DT.Rows.Count == 0)
                {
                    return;
                }
                RenderManagersTable(DT);
            }
            if (userkind.SelectedValue == "2")
            {
                // Fornitori


                string query = "select registryreference.idregistryreference as idregistryreference, registry.idreg as idreg,registry.title as Anagrafica, registryreference.referencename as Riferimento, registryreference.userweb as Login ";
                query += " from registry join registryreference on (registry.idreg=registryreference.idreg) where registry.active='S' ";
                query += " and userweb is not null and userweb <>''";

                DataTable DT = Conn.SQLRunner(query);
                if (DT == null || DT.Rows.Count == 0)
                {
                    return;
                }

                RenderRegistryTable(DT);
            }
        }
예제 #20
0
        public override string GetStaticFilter(string ListingType)
        {
            string filteresercizio;
            string filtertipo = "";

            filteresercizio = QHS.CmpEq("yimport", GetSys("esercizio"));
            if (ListingType == "default" || ListingType == "versamentiannuali" || ListingType == "pagamentiposticipati")
            {
                return(filteresercizio);
            }
            switch (ListingType)
            {
            case "ritenuta":
                filtertipo = QHS.CmpEq("kind", "Ritenuta");
                break;

            case "contributo":
                filtertipo = QHS.CmpEq("kind", "Contributo");
                break;

            case "recupero":
                filtertipo = QHS.CmpEq("kind", "Recupero");
                break;

            case "vocecsa":
                filtertipo = QHS.CmpEq("kind", "Voce CSA");
                break;
            }

            if ((ListingType == "ritenuta") || (ListingType == "contributo") || (ListingType == "recupero") || (ListingType == "vocecsa"))
            {
                return(QHS.AppAnd(filteresercizio, filtertipo));
            }

            return(base.GetStaticFilter(ListingType));
        }
예제 #21
0
    public override void DoCommand(string command)
    {
        string cmd = HelpForm.GetFieldLower(command, 0);

        if (!cmd.EndsWith("showcase"))
        {
            return;
        }
        object idshowcase = CfgFn.GetNoNullInt32(HelpForm.GetFieldLower(command, 1));
        object idstore    = CfgFn.GetNoNullInt32(HelpForm.GetFieldLower(command, 2));
        string Query;

        Query  = "SELECT stocktotalview.idstore as idstore, list.idlist as idlist,list.intcode as intcode, list.description as description, ";
        Query += " stocktotalview.number as number, stocktotalview.ordered as ordered, stocktotalview.booked as booked,listclass.title as listclasstitle,";
        Query += " listclass.authrequired as authorizationrequired ";
        Query += " FROM showcasedetail join list on (showcasedetail.idlist=list.idlist) ";
        Query += " join stocktotalview on (list.idlist=stocktotalview.idlist) ";
        Query += " join listclass on (list.idlistclass=listclass.idlistclass) ";
        Query += " WHERE showcasedetail.idshowcase=" + idshowcase + " and stocktotalview.idstore=" + idstore;
        Query += " AND list.active='S'";
        //Query += " AND (stocktotalview.number - stocktotalview.booked)>0";  //Solo la merce disponibile
        Query += " order by description asc ";


        //string Query = "select S.idlist,S.idstore, S.intcode,S.list as description,	ST.number,ST.ordered,ST.booked, " +
        //        "S.listclass as listclasstitle,S.authrequired as authorizationrequired," +
        //        "convert(  decimal(19,2),	ROUND(	 ( SUM ( S.residual * S.amount	) /ST.number)	,2	 ))	as avgprice " +
        //        "FROM showcasedetail SC join  stockview S on S.idlist=SC.idlist " +
        //        "join stocktotal ST on S.idlist=ST.idlist and S.idstore=ST.idstore " +
        //        "where "+
        //        QHS.AppAnd(QHS.CmpGt("S.amount",0),QHS.CmpGt("residual",0),QHS.CmpEq("S.idstore",idstore),QHS.CmpEq("SC.idshowcase",idshowcase))+
        //        " group by S.idlist,S.idstore, S.intcode,S.list,ST.number,ST.ordered,ST.booked, S.listclass,S.authrequired " +
        //        " order by description asc";

        if (booking_on_invoice())
        {
            Query = "select S.idlist,S.idstore, S.intcode,S.list as description,	S.available, S.idstock,"+
                    "S.listclass as listclasstitle,S.authrequired as authorizationrequired," +
                    "convert(decimal(19,2),ROUND(S.amount/ S.number,2))	as price " +
                    "FROM showcasedetail SC join  stockview S on S.idlist=SC.idlist " +
                    "where " +
                    QHS.AppAnd(QHS.CmpGt("S.amount", 0), QHS.CmpGt("S.available", 0), QHS.CmpEq("S.idstore", idstore), QHS.CmpEq("SC.idshowcase", idshowcase)) +
                    " order by description asc";
        }



        DataTable DT = Conn.SQLRunner(Query);

        if (DT != null && DT.Rows.Count != 0)
        {
            if (booking_on_invoice())
            {
                foreach (DataRow R1 in DT.Select(null, "idstock"))
                {
                    if (R1.RowState == DataRowState.Deleted)
                    {
                        continue;
                    }
                    string flt2 = QHS.AppAnd(QHC.MCmp(R1, "idlist", "idstore"), QHC.CmpGt("idstock", R1["idstock"]));
                    foreach (DataRow R2 in DT.Select(flt2))
                    {
                        R2.Delete();
                    }
                }

                DT.AcceptChanges();
            }

            RenderCategoryTable(DT);
        }

        string filter;

        filter = QHS.CmpEq("idshowcase", idshowcase);
        DT     = Conn.RUN_SELECT("showcase", "title", null, filter, null, false);
        if (DT == null)
        {
            return;
        }
        titoloVetrina.Text = "<strong>Vetrina attualmente selezionata:</strong>&nbsp;" + DT.Rows[0]["title"].ToString();

        filter = QHS.CmpEq("idstore", idstore);
        DT     = Conn.RUN_SELECT("store", "description,deliveryaddress", null, filter, null, false);
        if (DT == null)
        {
            return;
        }
        lblStore.Text   = "<strong>Magazzino:&nbsp;</strong>" + DT.Rows[0]["description"];
        LabAddress.Text = "<strong>Indirizzo:&nbsp;</strong>" + DT.Rows[0]["deliveryaddress"];
    }
예제 #22
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }
            string topublish  = "";
            string totransmit = "";

            if (R["idreg"] == DBNull.Value)
            {
                errmess  = "Specificare l'incaricato";
                errfield = "idreg";
                return(false);
            }
            if (R["idserviceregistrykind"] != DBNull.Value)
            {
                topublish  = Conn.DO_READ_VALUE("serviceregistrykind", QHS.CmpEq("idserviceregistrykind", R["idserviceregistrykind"]), "topublish").ToString();
                totransmit = Conn.DO_READ_VALUE("serviceregistrykind", QHS.CmpEq("idserviceregistrykind", R["idserviceregistrykind"]), "totransmit").ToString();
            }
            if ((totransmit == "") || (totransmit == "S"))
            {
                if (R["employkind"] == DBNull.Value)
                {
                    errmess  = "Specificare il Tipo Incaricato";
                    errfield = "employkind";
                    return(false);
                }
                ///tipologia società impostata
                if (R["idconsultingkind"] != DBNull.Value)
                {
                    #region  tipologia società impostata
                    string tipcons = (string)R["idconsultingkind"];


                    // x un consulente con Tipologia Persona fisica
                    if ((R["flaghuman"].ToString() == "S") && (R["employkind"].ToString().ToUpper() != "D"))
                    {
                        if ((R["cf"] == DBNull.Value) && (R["flagforeign"].ToString().ToUpper() != "S"))
                        {
                            errmess  = "Per un Consulente (con tipolgia Persona Fisica) il Codice fiscale è obbligatorio. Inserirlo nel modulo Anagrafica.";
                            errfield = "cf";
                            return(false);
                        }
                        if (R["surname"] == DBNull.Value)
                        {
                            errmess  = "Per un Consulente (con tipolgia Persona Fisica) il Cognome è obbligatorio. Inserirlo nel modulo Anagrafica.";
                            errfield = "surname";
                            return(false);
                        }
                        if (R["forename"] == DBNull.Value)
                        {
                            errmess  = "Per un Consulente (con tipolgia Persona Fisica) il Nome è obbligatoro. Inserirlo nel modulo Anagrafica.";
                            errfield = "forename";
                            return(false);
                        }
                        if ((R["flagforeign"].ToString().ToUpper() != "S") && (R["p_iva"] == DBNull.Value) && (R["cf"] == DBNull.Value))
                        {
                            errmess = "Per un Consulente (con tipolgia Persona Fisica) è necessario specificare " +
                                      "o la Partita IVA o il Codice Fiscale";
                            errfield = "p_iva" + "cf";
                            return(false);
                        }
                        if ((R["flagforeign"].ToString().ToUpper() == "S") && (R["birthdate"] == DBNull.Value))
                        {
                            errmess  = "Per i consulenti esteri la Data di Nascita è obbligatoria. Inserirla nel modulo Anagrafica.";
                            errfield = "birthdate";
                            return(false);
                        }
                    }


                    // x un consulente con Tipologia Società
                    if ((R["flaghuman"].ToString() != "S") && (R["employkind"].ToString().ToUpper() != "D"))
                    {
                        // Per un consulente Persona giuridica, non estero, il CF è obbligatorio task 5972
                        if ((R["cf"] == DBNull.Value) && (R["flagforeign"].ToString().ToUpper() != "S"))
                        {
                            errmess  = "Per un Consulente (Persona Giuridica) il Codice fiscale è obbligatorio. Inserirlo nel modulo Anagrafica.";
                            errfield = "cf";
                            return(false);
                        }

                        if (R["title"] == DBNull.Value)
                        {
                            errmess  = "Per una Società la Denominazione è obbligatorio";
                            errfield = "title";
                            return(false);
                        }
                        if ((R["flagforeign"].ToString().ToUpper() != "S") && (R["codcity"] == DBNull.Value))
                        {
                            errmess  = "Per una Società italiana il Codice Comune Sede è obbligatorio";
                            errfield = "title";
                            return(false);
                        }
                        if ((R["p_iva"] == DBNull.Value) && (R["flagforeign"].ToString().ToUpper() != "S"))
                        {
                            errmess  = "Per una Società la Partita IVA è obbligatoria. Inserirla nel modulo Anagrafica.";
                            errfield = "p_iva";
                            return(false);
                        }
                    }

                    #endregion
                }
                // x un consulente
                if (R["employkind"].ToString().ToUpper() != "D")
                {
                    if (R["idconsultingkind"] == DBNull.Value && R["flaghuman"].ToString() == "N")
                    {
                        errmess  = "Per un Consulente è obbligatorio specificare la Tipologia";
                        errfield = "idconsultingkind";
                        return(false);
                    }
                    if (R["description"] == DBNull.Value)
                    {
                        errmess  = "Per un Consulente è obbligatorio specificare la descrizione dell'incarico";
                        errfield = "description";
                        return(false);
                    }
                    if (R["referencesemester"] == DBNull.Value)
                    {
                        errmess  = "Per un Consulente è obbligatorio specificare il semestre di Riferimento";
                        errfield = "referencesemester";
                        return(false);
                    }
                    if (R["expectedamount"] == DBNull.Value)
                    {
                        errmess  = "Per un Consulente è obbligatorio specificare l'importo previsto";
                        errfield = "expectedamount";
                        return(false);
                    }
                    if ((!R["referencesemester"].Equals(1)) && (!R["referencesemester"].Equals(2)))
                    {
                        errmess  = "Il Semestre di Riferimento deve avere valore '1' o '2' ";
                        errfield = "referencesemester";
                        return(false);
                    }
                    if (R["idacquirekind"] == DBNull.Value)//
                    {
                        errmess  = "Per un Consulente è obbligatorio specificare la Modalità di acquisizione";
                        errfield = "idacquirekind";
                        return(false);
                    }
                    else
                    {
                        string active = Conn.DO_READ_VALUE("acquirekind",
                                                           QHS.AppAnd(QHS.CmpEq("idacquirekind", R["idacquirekind"]),
                                                                      QHS.CmpEq("ayear", R["yservreg"])), "active").ToString();
                        if (active != "S")
                        {
                            errmess  = "La Modalità di acquisizione deve essere attiva nell'esercizio dell'incarico";
                            errfield = "idacquirekind";
                            return(false);
                        }
                    }

                    if (R["idapcontractkind"] == DBNull.Value)
                    {
                        errmess  = "Per un Consulente è obbligatorio specificare il Tipo Rapporto";
                        errfield = "idapcontractkind";
                        return(false);
                    }
                    else
                    {
                        string active = Conn.DO_READ_VALUE("apcontractkind",
                                                           QHS.AppAnd(QHS.CmpEq("idapcontractkind", R["idapcontractkind"]),
                                                                      QHS.CmpEq("ayear", R["yservreg"])), "active").ToString();
                        if (active != "S")
                        {
                            errmess  = "Il Tipo Rapporto deve essere attivo nell'esercizio dell'incarico";
                            errfield = "idapcontractkind";
                            return(false);
                        }
                    }
                    if (CfgFn.GetNoNullInt32(R["yservreg"]) < 2011)
                    {
                        if (R["idfinancialactivity"] == DBNull.Value)
                        {
                            errmess  = "Per un Consulente è obbligatorio specificare l'Attività economica";
                            errfield = "idfinancialactivity";
                            return(false);
                        }
                        else
                        {
                            string active = Conn.DO_READ_VALUE("financialactivity",
                                                               QHS.AppAnd(QHS.CmpEq("idfinancialactivity", R["idfinancialactivity"]),
                                                                          QHS.CmpEq("ayear", R["yservreg"])), "active").ToString();
                            if (active != "S")
                            {
                                errmess  = "l'Attività economica deve essere attiva nell'esercizio dell'incarico";
                                errfield = "idfinancialactivity";
                                return(false);
                            }
                        }
                    }

                    if ((R["idapfinancialactivity"] == DBNull.Value) && (R["idfinancialactivity"] == DBNull.Value))
                    {
                        errmess = "Per un Consulente è obbligatorio scegliere l'Attività economica in base alla data di affidamento dell'Incarico";
                        return(false);
                    }

                    if ((R["idapfinancialactivity"] == DBNull.Value) && (CfgFn.GetNoNullInt32(R["yservreg"]) >= 2013))
                    {
                        errmess  = "Per un Consulente è obbligatorio specificare l'Attività economica";
                        errfield = "idapfinancialactivity";
                        return(false);
                    }

                    if (R["regulation"] == DBNull.Value)
                    {
                        errmess = "Per un Consulente è obbligatorio specificare se per la modalità di selezione "
                                  + "si è fatto riferimento ad un regolamento all'uopo adottato dall'amministrazione";
                        errfield = "regulation";
                        return(false);
                    }
                    //Task 4828
                    //if (R["expectationsdate"] == DBNull.Value) {
                    //    errmess = "Per un Consulente è necessario specificare la Data Affidamento incarico";
                    //    errfield = "expectationsdate";
                    //    return false;
                    //}
                }
                // x un dipendente
                if (R["employkind"].ToString().ToUpper() == "D")
                {
                    if ((R["idconsultingkind"] == DBNull.Value) &&
                        ((R["idapregistrykind"].ToString() == "5") || (R["idapregistrykind"].ToString() == "6")))
                    {
                        errmess  = "Per un conferente ( se Persona Giuridica ) è obbligatorio la Tipologia Azienda.";
                        errfield = "idconsultingkind";
                        return(false);
                    }

                    if (R["annotation"] == DBNull.Value)
                    {
                        errmess  = "Per un Dipendente la Relazione Accompagnatoria è obbligatoria";
                        errfield = "annotation";
                        return(false);
                    }

                    if (R["idapmanager"] == DBNull.Value)
                    {
                        errmess  = "Per un Dipendente la Qualifica è obbligatoria";
                        errfield = "idapmanager";
                        return(false);
                    }

                    if (R["surname"] == DBNull.Value)
                    {
                        errmess  = "Per un Dipendente il Cognome è obbligatorio. Inserirlo nel modulo Anagrafica.";
                        errfield = "surname";
                        return(false);
                    }
                    if (R["forename"] == DBNull.Value)
                    {
                        errmess  = "Per un Dipendente il Nome è obbligatorio. Inserirlo nel modulo Anagrafica.";
                        errfield = "forename";
                        return(false);
                    }
                    if (R["cf"] == DBNull.Value)
                    {
                        errmess  = "Per un Dipendente il Codice fiscale è obbligatorio. Inserirlo nel modulo Anagrafica.";
                        errfield = "cf";
                        return(false);
                    }
                    //Vedi task 4830
                    //if (R["authorizationdate"] == DBNull.Value) {
                    //    errmess = "Per un Dipendente la Data autorizzazione è obbligatoria";
                    //    errfield = "authorizationdate";
                    //    return false;
                    //}

                    if (R["idapregistrykind"] == DBNull.Value)
                    {
                        errmess  = "Per un Dipendente la Tipologia dell'ente Conferente è obbligatorio.";
                        errfield = "idapregistrykind";
                        return(false);
                    }

                    if (R["idapactivitykind"] == DBNull.Value)
                    {
                        errmess  = "Per un Dipendente l'Oggetto dell'incarico è obbligatorio";
                        errfield = "idapactivitykind";
                        return(false);
                    }

                    //Controlli sul Conferente del dipendente:

                    //1	PUBBLICO
                    //3	PRIVATO - PERSONA FISICA CON CF RILASCIATO IN ITALIA
                    //4	PRIVATO - PERSONA FISICA SENZA CF RILASCIATO IN ITALIA
                    //5	PRIVATO - PERSONA GIURIDICA CON CF RILASCIATO IN ITALIA
                    //6	PRIVATO - PERSONA GIURIDICA SENZA CF RILASCIATO IN ITALIA
                    if ((R["idapregistrykind"].ToString() == "1") || (R["idapregistrykind"].ToString() == "5") || (R["idapregistrykind"].ToString() == "6"))
                    {
                        //Persona giuridica
                        if (R["pa_title"] == DBNull.Value)
                        {
                            errmess  = "Per un Dipendente la Denominazione dell'ente Conferente è obbligatoria. Inserirlo nel modulo Anagrafica.";
                            errfield = "pa_title";
                            return(false);
                        }
                        if ((R["conferring_flagforeign"].ToString().ToUpper() != "S") && (R["conferring_codcity"] == DBNull.Value))
                        {
                            errmess  = "Per Conferente/Persona Giuridica (non estero) il Codice Comune Sede è obbligatorio";
                            errfield = "title";
                            return(false);
                        }
                    }
                    if ((R["idapregistrykind"].ToString() == "1") || (R["idapregistrykind"].ToString() == "3") || (R["idapregistrykind"].ToString() == "5"))
                    {
                        if (R["pa_cf"] == DBNull.Value)
                        {
                            errmess  = "E' necessario specificare il Codice Fiscale dell'Ente Conferente";
                            errfield = "pa_cf";
                            return(false);
                        }
                    }
                    if ((R["idapregistrykind"].ToString() == "3") || (R["idapregistrykind"].ToString() == "4"))
                    {
                        if (R["conferring_surname"] == DBNull.Value)
                        {
                            errmess  = "Per un Conferente/Persona fisica il Cognome è obbligatorio. Inserirlo nel modulo Anagrafica.";
                            errfield = "conferring_surname";
                            return(false);
                        }
                        if (R["conferring_forename"] == DBNull.Value)
                        {
                            errmess  = "Per un Conferente/Persona fisica il Nome è obbligatorio. Inserirlo nel modulo Anagrafica.";
                            errfield = "conferring_forename";
                            return(false);
                        }
                        if (R["conferring_birthdate"] == DBNull.Value)
                        {
                            errmess  = "Per un Conferente/Persona fisica la Data di nascita è obbligatoria. Inserirla nel modulo Anagrafica.";
                            errfield = "conferring_birthdate";
                            return(false);
                        }
                        if (R["conferring_flagforeign"] == DBNull.Value)
                        {
                            errmess  = "Per un Conferente/Persona fisica è necessario specificare se Estero o meno.";
                            errfield = "conferring_flagforeign";
                            return(false);
                        }
                        if (R["conferring_gender"] == DBNull.Value)
                        {
                            errmess  = "Per un Conferente/Persona fisica è necessario specificare il sesso. Inserirlo nel modulo Anagrafica.";
                            errfield = "conferring_gender";
                            return(false);
                        }
                    }
                }//Fine dipendenti
                 // x entrambi

                if (R["rulespecifics"].ToString().ToUpper() == "S")
                {
                    if (R["idreferencerule"] == DBNull.Value)
                    {
                        errmess  = "E' necessario specificare il Riferimento Normativo";
                        errfield = "idreferencerule";
                        return(false);
                    }
                    if (R["articlenumber"] == DBNull.Value)
                    {
                        errmess  = "E' necessario specificare il numero dell'articolo del Riferimento Normativo";
                        errfield = "articlenumber";
                        return(false);
                    }

                    if (R["referencedate"] == DBNull.Value)
                    {
                        errmess  = "E' necessario specificare la data del Riferimento Normativo";
                        errfield = "referencedate";
                        return(false);
                    }

                    if (R["article"] == DBNull.Value)
                    {
                        errmess  = "E' necessario specificare l'Articolo del Riferimento Normativo";
                        errfield = "article";
                        return(false);
                    }
                }
                //Solo per i Dipendenti la data inizio è obbligatoria, per i consulente è stata resa facoltativa in seguito al task 4872.
                if ((R["employkind"].ToString().ToUpper() == "D") && (R["start"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare la Data inizio";
                    errfield = "start";
                    return(false);
                }
                if (R["stop"] != DBNull.Value && R["start"] != DBNull.Value)
                {
                    DateTime dataInizio = (DateTime)R["start"];
                    DateTime dataFine   = (DateTime)R["stop"];
                    if (dataInizio > dataFine)
                    {
                        errmess  = "La data di fine deve essere identica o successiva a quella di inizio";
                        errfield = "stop";
                        return(false);
                    }
                }

                if (R["pa_code"] == DBNull.Value)
                {
                    errmess  = "E' necessario specificare il Codice Ente. Andare in Compensi - Anagrafe delle Prestazioni - Ente";
                    errfield = "pa_code";
                    return(false);
                }
                // Data autorizzazione o data affidamento devono essere precedenti o uguali alla data inizio.
                if ((R["authorizationdate"] != DBNull.Value) && (R["start"] != DBNull.Value))
                {
                    DateTime dataInizio         = (DateTime)R["start"];
                    DateTime dataAutorizzazione = (DateTime)R["authorizationdate"];
                    if (dataAutorizzazione > dataInizio)
                    {
                        errmess  = "La Data Conferimento/Autorizzazione deve essere precedente o uguale alla Data inizio.";
                        errfield = "stop";
                        return(false);
                    }
                }
                if ((R["expectationsdate"] != DBNull.Value) && (R["start"] != DBNull.Value))
                {
                    DateTime dataInizio         = (DateTime)R["start"];
                    DateTime dataAutorizzazione = (DateTime)R["expectationsdate"];
                    if (dataAutorizzazione > dataInizio)
                    {
                        errmess  = "La Data Affidamento deve essere precedente o uguale alla Data inizio.";
                        errfield = "stop";
                        return(false);
                    }
                }
            }//Fine controllo sulla trasmissione

            if (topublish == "S")
            {
                if ((R["employkind"].ToString().ToUpper() == "D") && (R["description"] == DBNull.Value))
                {
                    errmess  = "Per un Dipendente è obbligatorio specificare la descrizione dell'incarico, per la pubblicazione dei dati sul sito Web Istituzionale";;
                    errfield = "description";
                    return(false);
                }
                DataTable Tserviceregistrykind = Conn.RUN_SELECT("serviceregistrykind", "*", null, QHS.CmpEq("idserviceregistrykind", R["idserviceregistrykind"]), null, true);

                byte flagconferringstructure = 0;
                flagconferringstructure = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagconferringstructure"]);
                if (((flagconferringstructure & 2) != 0) && (R["conferringstructure"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare la Struttura Conferente,  per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "conferringstructure";
                    return(false);
                }

                byte flagordinancelink = 0;
                flagordinancelink = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagordinancelink"]);
                if (((flagordinancelink & 2) != 0) && (R["ordinancelink"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare il Link al decreto di conferimento dell’incarico,  per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "ordinancelink";
                    return(false);
                }

                byte flagauthorizingstructure = 0;
                flagauthorizingstructure = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagauthorizingstructure"]);
                if (((flagauthorizingstructure & 2) != 0) && (R["authorizingstructure"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare la Struttura che autorizza,  per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "authorizingstructure";
                    return(false);
                }

                byte flagauthorizinglink = 0;
                flagauthorizinglink = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagauthorizinglink"]);
                if (((flagauthorizinglink & 2) != 0) && (R["authorizinglink"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare il Link all’atto di autorizzazione,  per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "authorizinglink";
                    return(false);
                }

                byte flagactreference = 0;
                flagactreference = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagactreference"]);
                if (((flagactreference & 2) != 0) && (R["actreference"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare il Riferimento dell’atto di conferimento,  per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "actreference";
                    return(false);
                }

                byte flagannouncementlink = 0;
                flagannouncementlink = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagannouncementlink"]);
                if (((flagannouncementlink & 2) != 0) && (R["announcementlink"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare il Link al bando,  per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "announcementlink";
                    return(false);
                }
                byte flagotherservice = 0;
                flagotherservice = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagotherservice"]);
                if (((flagotherservice & 2) != 0) && (R["otherservice"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare Altri incarichi o cariche in enti di diritto privato finanziati da P.A.,  per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "otherservice";
                    return(false);
                }
                byte flagprofessionalservice = 0;
                flagprofessionalservice = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagprofessionalservice"]);
                if (((flagprofessionalservice & 2) != 0) && (R["professionalservice"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare Eventuali attività professionali per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "professionalservice";
                    return(false);
                }

                byte flagcomponentsvariable = 0;
                flagcomponentsvariable = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagcomponentsvariable"]);
                if (((flagcomponentsvariable & 2) != 0) && (R["componentsvariable"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare le eventuali componenti variabili del compenso per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "componentsvariable";
                    return(false);
                }

                byte flagemploytime = 0;
                flagemploytime = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagemploytime"]);
                if (((flagemploytime & 2) != 0) && (R["employtime"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare la Durata incarica per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "employtime";
                    return(false);
                }
                byte flagcertinterestconflicts = 0;
                flagcertinterestconflicts = CfgFn.GetNoNullByte(Tserviceregistrykind.Rows[0]["flagcertinterestconflicts"]);
                if (((flagcertinterestconflicts & 2) != 0) && (R["certinterestconflicts"] == DBNull.Value))
                {
                    errmess  = "E' necessario specificare l' Attestazione conflitti di interesse per la pubblicazione dei dati sul sito Web Istituzionale";
                    errfield = "certinterestconflicts";
                    return(false);
                }
                //Vedi task 4830
                //if (R["authorizationdate"] == DBNull.Value) {
                //    errmess = "Inserire la Data autorizzazione per la pubblicazione dei dati.";
                //    errfield = "authorizationdate";
                //    return false;
                //}
                if (R["idapactivitykind"] == DBNull.Value)
                {
                    errmess  = "Inserire l'Oggetto dell'incarico per la pubblicazione dei dati sul sito Web Istituzionale.";
                    errfield = "idapactivitykind";
                    return(false);
                }
                //Vedi task 4828
                //if (R["expectationsdate"] == DBNull.Value) {
                //    errmess = "Inserire la Data Affidamento incarico per la publicazione dei dati.";
                //    errfield = "expectationsdate";
                //    return false;
                //}

                //task 6234: si richiede che il controllo non scatti per dipendenti dello stesso ente
                if (R["idapcontractkind"] == DBNull.Value && (R["employkind"].ToString().ToUpper() != "D"))
                {
                    errmess  = "Specificare il Tipo Rapporto per la pubblicazione dei dati sul sito Web Istituzionale.";
                    errfield = "idapcontractkind";
                    return(false);
                }
            }//fine pubblicazione

            return(true);
        }//IsValid
예제 #23
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            string flagvalue = "S";

            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }

            //if (R.RowState != DataRowState.Added) return true;

            if (CfgFn.GetNoNullInt32(R["variationkind"]) == 0)
            {
                errmess  = "Attenzione! Selezionare un Tipo Variazione";
                errfield = "";
                return(false);
            }

            if (R["flagprevision"].ToString() != flagvalue && R["flagsecondaryprev"].ToString() != flagvalue &&
                R["flagcredit"].ToString() != flagvalue && R["flagproceeds"].ToString() != flagvalue)
            {
                errmess  = "Attenzione! Selezionare un Tipo Previsione/Dotazione";
                errfield = "";
                return(false);
            }

            if (R.RowState == DataRowState.Modified && R["official"].ToString() == "S" && R["nofficial"] == DBNull.Value)
            {
                errmess  = "Attenzione! Inserire un numero ufficiale per la variazione";
                errfield = "nofficial";
                return(false);
            }

            if (R.RowState == DataRowState.Added && R["official"].ToString() == "N" && R["flagprevision"].ToString() == flagvalue)
            {
                // Verifico che non si tratta di storni tra articoli di uno stesso capitolo o nell'ambito di uno stesso
                // capitolo tra diversi UPB
                Dictionary <int, decimal> h = new Dictionary <int, decimal>();
                DataTable Details           = R.Table.DataSet.Tables["finvardetail"];
                object    finusablelevel    = GetSys("finusablelevel");
                foreach (DataRow RD in Details.Select())
                {
                    string filter      = QHS.AppAnd(QHS.CmpEq("idchild", RD["idfin"]), QHS.CmpEq("nlevel", finusablelevel));
                    int    idfinParent = CfgFn.GetNoNullInt32(Conn.DO_READ_VALUE("finlink", filter, "idparent"));
                    if (h.ContainsKey(idfinParent))
                    {
                        h[idfinParent] += CfgFn.GetNoNullDecimal(RD["amount"]);
                    }
                    else
                    {
                        h[idfinParent] = CfgFn.GetNoNullDecimal(RD["amount"]);
                    }
                }
                foreach (KeyValuePair <int, decimal> coppia in h)
                {
                    if (coppia.Value != 0)
                    {
                        string message = "Si sta inserendo una variazione NON ufficiale " +
                                         "con saldo su qualche capitolo diverso da 0. Continuare lo stesso? ";
                        if (this.ShowClientMsg(message, "Attenzione!", MessageBoxButtons.OKCancel))
                        {
                            continue;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                return(true);
            }
            return(true);
        }
예제 #24
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }

//parasubcon§06000011
            string filter_idrelated = "parasubcontract§" + R["idcon"].ToString();

            filter_idrelated = QHS.CmpEq("idrelated", filter_idrelated);

            bool IsAdmin = (GetSys("manage_prestazioni") != null)
                ? GetSys("manage_prestazioni").ToString() == "S"
                : false;


            DataTable Tserviceregistry = Conn.RUN_SELECT("serviceregistry", "*", null, filter_idrelated, null, null,
                                                         true);

            if ((Tserviceregistry.Rows.Count > 0) && (R.RowState == DataRowState.Modified))
            {
                bool   error   = false;
                string message = "";
                if (R["idreg", DataRowVersion.Current].ToString() != R["idreg", DataRowVersion.Original].ToString())
                {
                    message = "Percipiente \n\r ";
                    error   = true;
                }

                if (R["duty", DataRowVersion.Current].ToString() != R["duty", DataRowVersion.Original].ToString())
                {
                    message = message + "Mansione \n\r ";
                    error   = true;
                }

                if (R["start", DataRowVersion.Current].ToString() != R["start", DataRowVersion.Original].ToString())
                {
                    message = message + "Data Inizio \n\r ";
                    error   = true;
                }

                if (R["stop", DataRowVersion.Current].ToString() != R["stop", DataRowVersion.Original].ToString())
                {
                    message = message + "Data Fine \n\r ";
                    error   = true;
                }

                if (R["grossamount", DataRowVersion.Current].ToString() !=
                    R["grossamount", DataRowVersion.Original].ToString())
                {
                    message = message + "Lordo al beneficiario \n\r ";
                    error   = true;
                }

                if (error)
                {
                    if (IsAdmin)
                    {
                        errmess =
                            "L'Anagrafe delle Prestazioni è stata già generata, e risultano modificati i seguenti dati: \n\r" +
                            message + "Adeguare anche i dati dell'Incarico.";
                        MessageBox.Show(errmess, "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        errmess = "Risultano modificati i seguenti dati: \n\r" + message +
                                  "La modifica non è consentita perché l'Anagrafe delle Prestazioni è stata già generata.\r\n" +
                                  "Contattare il servizio assistenza o un utente con ruolo 'manage_prestazioni' ";
                        return(false);
                    }
                }
            }
//

            if (Convert.ToInt32(R["grossamount"]) <= 0)
            {
                errmess  = "L'importo del contratto deve essere maggiore di zero";
                errfield = "grossamount";
                return(false);
            }

            if (CfgFn.GetNoNullInt32(R["idser"]) != 0)
            {
                string q = "SELECT * FROM servicetax JOIN tax " +
                           "ON servicetax.taxcode = tax.taxcode WHERE " +
                           QHS.AppAnd(QHS.CmpEq("tax.taxkind", 4), QHS.CmpEq("servicetax.idser", R["idser"]));
                DataTable prestazione = Conn.SQLRunner(q, -1, out errmess);
                if (prestazione == null)
                {
                    errfield = null;
                    return(false);
                }

                if (prestazione.Rows.Count != 0)
                {
                    if (CfgFn.GetNoNullInt32(R["idpat"]) <= 0)
                    {
                        errmess  = "Scegliere una Posizione Assicurativa Territoriale";
                        errfield = "idpat";
                        return(false);
                    }
                }
            }
            else
            {
                errmess  = "Inserire la prestazione";
                errfield = "idser";
                return(false);
            }

            if (!(R["start"] is DateTime))
            {
                errmess  = "Inserire la data di inizio del contratto";
                errfield = "start";
                return(false);
            }

            if (!(R["stop"] is DateTime))
            {
                errmess  = "Inserire la data di fine del contratto";
                errfield = "stop";
                return(false);
            }

            DateTime dataInizio = (DateTime)R["start"];
            DateTime dataFine   = (DateTime)R["stop"];

            if (dataInizio.Year > (int)GetSys("esercizio"))
            {
                errmess  = "L'anno di inizio del contratto deve essere minore o uguale all'esercizio";
                errfield = "start";
                return(false);
            }

            if (dataInizio > dataFine)
            {
                errmess  = "La data di fine del contratto deve essere successiva alla data di inizio del contratto";
                errfield = "stop";
                return(false);
            }

            if (CfgFn.GetNoNullInt32(R["idreg"]) <= 0)
            {
                errmess  = "Inserire il Percipiente";
                errfield = "registry.title";
                return(false);
            }

            //Se il DS contiene la tabella registry, controlla che l'idreg abbia il CF,se SI chiama il metodo.
            if (R.Table.DataSet.Tables.Contains("registry") && (R.Table.DataSet.Tables["registry"].Rows.Count > 0))
            {
                DataRow Registry = R.Table.DataSet.Tables["registry"].Rows[0];
                if (Registry["cf"] != DBNull.Value)
                {
                    string errori;
                    if (!CalcolaCodiceFiscale.CodiceFiscaleValido(this.Conn, Registry, out errori))
                    {
                        errmess  = "Il Codice Fiscale non è valido!\n" + errori;
                        errfield = "idreg";
                        return(false);
                    }
                }
            }
            else
            {
                //Se il DS non contiene la tabella registry,controlla che l'idreg abbia il CF se SI legge la riga dal DB
                // e chiama il metodo.
                object CF = Conn.DO_READ_VALUE("registry", QHS.CmpEq("idreg", R["idreg"]), "cf");
                if (CF != DBNull.Value)
                {
                    DataTable TRegistry = Conn.RUN_SELECT("registry", "*", null, QHS.CmpEq("idreg", R["idreg"]), null,
                                                          null, true);
                    if (TRegistry.Rows.Count > 0)
                    {
                        DataRow Registry = TRegistry.Rows[0];
                        string  errori;
                        if (!CalcolaCodiceFiscale.CodiceFiscaleValido(this.Conn, Registry, out errori))
                        {
                            errmess  = "Il Codice Fiscale non è valido!\n" + errori;
                            errfield = "idreg";
                            return(false);
                        }
                    }
                }
                else
                {
                    errmess  = "E' necessario che il percipiente abbia il codice fiscale";
                    errfield = "idreg";
                    return(false);
                }
            }

            return(true);
        }
예제 #25
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            //Aggiorno le intestazioni del DataGrid
            int esercizio = Convert.ToInt32(GetSys("esercizio"));

            if (ListingType == "tree" || ListingType == "treee" || ListingType == "treesupbnew" || ListingType == "treeeupbnew" ||
                ListingType == "trees" || ListingType == "treees" ||
                ListingType == "treeenew" || ListingType == "treesnew" ||
                ListingType == "treeeupb" || ListingType == "treesupb" ||
                ListingType == "treealle" || ListingType == "treealls" ||
                ListingType == "treeallenew" || ListingType == "treeallsnew" ||
                ListingType == "upbprevision")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "");
                }
                DescribeAColumn(T, "codefin", "Codice");
                DescribeAColumn(T, "leveldescr", "Livello");
                DescribeAColumn(T, "title", "Denominazione");
                DescribeAColumn(T, "manager", "Responsabile");
                DescribeAColumn(T, "cupcode", "CUP");
                DescribeAColumn(T, "prevision", "Prev. Iniziale Princ.");
                DescribeAColumn(T, "currentprevision", "Prev. Attuale Princ.");
                DescribeAColumn(T, "availableprevision", "Prev. Disponibile Princ.");
                if (Conn != null)
                {
                    int finkind = CfgFn.GetNoNullInt32(Conn.GetSys("fin_kind"));
                    if (finkind == 3)
                    {
                        DescribeAColumn(T, "secondaryprev", "Prev. Iniziale Second.");
                        DescribeAColumn(T, "currentsecondaryprev", "Prev. Attuale Second.");
                        DescribeAColumn(T, "availablesecondaryprev", "Prev. Disponibile Second.");
                    }
                }
            }

            base.DescribeTree(tree, T, ListingType);

            int    esercizionew    = esercizio + 1;
            string filterC         = QHC.CmpEq("nlevel", 1);
            string filtersql       = QHS.CmpEq("nlevel", 1);
            string kind            = "ES";
            string filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));

            if (ListingType == "treee")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "E";
            }
            if (ListingType == "trees")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "S";
            }
            if (ListingType == "treees")
            {
                //filter="(nlevel='1')";
                kind = "ES";
            }
            if (ListingType == "tree")
            {
                //filter="(nlevel='1')";
                kind = "ES";
            }
            if (ListingType == "treeenew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind            = "E";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
            }
            if (ListingType == "treeeupbnew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind            = "E";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
            }

            if (ListingType == "treesnew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind            = "S";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
            }
            if (ListingType == "treesupbnew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind            = "S";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
            }
            if (ListingType == "treeeupb")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "E";
            }

            if (ListingType == "treesupb")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "S";
            }

            if (ListingType == "upbprevision")
            {
                filtersql = QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin"));
                filterC   = QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin"));
                kind      = "ES";
            }

            bool all = false;

            if (ListingType == "treealle")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "E";
                all  = true;
            }
            if (ListingType == "treealls")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizio), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizio), QHC.IsNull("paridfin")));
                kind = "S";
                all  = true;
            }

            if (ListingType == "treeallenew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitClear("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitClear("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind = "E";
                all  = true;
            }
            if (ListingType == "treeallsnew")
            {
                filtersql = QHS.AppAnd(
                    QHS.BitSet("flag", 0),
                    QHS.AppAnd(QHS.CmpEq("ayear", esercizionew), QHS.IsNull("paridfin")));
                filterC = QHC.AppAnd(
                    QHC.BitSet("flag", 0),
                    QHC.AppAnd(QHC.CmpEq("ayear", esercizionew), QHC.IsNull("paridfin")));
                kind = "S";
                all  = true;
            }
            int    maxlevel = 0;
            object o        = Conn.DO_READ_VALUE("finlevel", QHS.CmpEq("ayear", GetSys("esercizio")), "max(nlevel)");

            if ((o != null) && (o != DBNull.Value))
            {
                maxlevel = Convert.ToInt32(o);
            }
            TreeViewManager M = new TreeViewBilancio(Conn, T, tree, filterC, filtersql, kind, all, maxlevel,
                                                     CfgFn.GetNoNullInt32(GetSys("finusablelevel")));

            myGetData.SetStaticFilter("finlevel", filteresercizio);
        }
예제 #26
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }


            DateTime datainizio = (DateTime)R["start"];

            if (!controllaData(datainizio, out errmess))
            {
                errfield = "start";
                return(false);
            }

            object df = R["stop"];

            if (df != DBNull.Value)
            {
                DateTime datafine = (DateTime)df;
                if (!controllaData(datafine, out errmess))
                {
                    errfield = "stop";
                    return(false);
                }

                if ((datafine != QueryCreator.EmptyDate()) && (datafine < datainizio))
                {
                    errmess  = "'Data fine validità' non può precedere 'Data inizio validità'";
                    errfield = "stop";
                    return(false);
                }
            }

            int codicecreddeb = CfgFn.GetNoNullInt32(R["idreg"]);

            if (codicecreddeb <= 0)
            {
                errmess  = "Inserire il codice dell'anagrafica";
                errfield = "idreg";
                return(false);
            }

            if ((R["address"].ToString() == "") || (R["address"].ToString().Trim() == "."))
            {
                errmess  = "Attenzione! Inserire l'indirizzo.";
                errfield = "address";
                return(false);
            }

            object codeAddressKind =
                Conn.DO_READ_VALUE("address", QHS.CmpEq("idaddress", R["idaddresskind"]), "codeaddress");

            if (codeAddressKind != null)
            {
                if ((codeAddressKind.ToString() == "07_SW_DOM") && (R["idcity"] is DBNull))
                {
                    errmess  = "Il domicilio fiscale non può essere estero! Inserire un comune italiano.";
                    errfield = "idcity";
                    return(false);
                }
            }

            if (codeAddressKind != null)
            {
                if ((codeAddressKind.ToString() != "07_SW_ANP") && (R["recipientagency"] != DBNull.Value))
                {
                    errmess = "L'Ente di provenienza deve essere specificato solo per l'indirizzo di tipo " +
                              "Anagrafe delle Prestazioni";
                    errfield = "recipientagency";
                    return(false);
                }
            }

            //indirizzo estero o nazionale
            if (R["flagforeign"].ToString().ToUpper() == "S")
            {
                if (R["idnation"].ToString() == "")
                {
                    errmess  = "Attenzione! Inserire lo stato estero.";
                    errfield = "idnation";
                    return(false);
                }
            }
            else
            {
                if (R["idcity"].ToString() == "")
                {
                    errmess  = "Attenzione! Inserire il Comune.";
                    errfield = "idcity";
                    return(false);
                }

                if (Conn.RUN_SELECT_COUNT("geo_city_agency",
                                          QHS.AppAnd(QHS.CmpEq("idagency", 3), QHS.CmpEq("idcity", R["idcity"]), QHS.IsNull("stop")),
                                          false) > 0)
                {
                    object cap   = R["cap"];
                    string query = "select value from geo_city_agency where " +
                                   QHS.AppAnd(QHS.CmpEq("idagency", 3), QHS.CmpEq("idcity", R["idcity"]),
                                              QHS.IsNull("stop"));
                    DataTable t  = Conn.SQLRunner(query);
                    DataRow[] r1 = t.Select("value=" + QueryCreator.quotedstrvalue(cap, false));
                    if (r1.Length == 0)
                    {
                        //DialogResult dr = MessageBox.Show(LinkedForm, "Il C.A.P. non è coerente o non è più valido per il comune inserito. Salvare ugualmente?", "Avviso", MessageBoxButtons.YesNo);
                        //if (dr==DialogResult.No)
                        //{
                        object comune = Conn.readValue("geo_city", q.eq("idcity", R["idcity"]), "title") ??
                                        "(Comune non trovato)";
                        //R.GetParentRow("geo_cityregistryaddress")["title"];
                        if (t.Rows.Count == 1)
                        {
                            errmess = "Il codice postale del comune di '" + comune + "' è '" +
                                      t.Rows[0]["value"].ToString() + "'";
                        }
                        else
                        {
                            errmess = "Il comune di '" + comune + "' ha i seguenti codici postali:\n"
                                      + QueryCreator.ColumnValues(t, null, "value", false);
                        }

                        errfield = "cap";
                        return(false);
                        //}
                    }
                }
            }

            return(true);
        }
예제 #27
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }

//parasubcon§06000011
            DataRow Rparasubcontract = R.GetParentRow("parasubcontractparasubcontractyear");
            // 7862: il campo non viene copiato nell'AP
            //string filter_idrelated = "parasubcontract§" + Rparasubcontract["idcon"].ToString();
            //filter_idrelated = QHS.CmpEq("idrelated", filter_idrelated);

            //bool IsAdmin = (GetSys("manage_prestazioni") != null)
            //    ? GetSys("manage_prestazioni").ToString() == "S"
            //    : false;

            //DataTable Tserviceregistry = Conn.RUN_SELECT("serviceregistry","*",null,filter_idrelated,null,null,true);
            //if ((Tserviceregistry.Rows.Count>0)&&(R.RowState == DataRowState.Modified))
            //{
            //    if (
            //        R["idresidence",DataRowVersion.Current].ToString()!= R["idresidence",DataRowVersion.Original].ToString()
            //        )
            //    {
            //        if (IsAdmin)
            //        {
            //            errmess = "L'Anagrafe delle Prestazioni è stata già generata, adeguare anche i dati dell'Incarico.";
            //            MessageBox.Show(errmess, "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //        }
            //        else
            //        {
            //            errmess = "Modifica non consentita perché l'Anagrafe delle Prestazioni è stata già generata";
            //            return false;
            //        }
            //    }
            //}


            string q = "SELECT * FROM servicetax JOIN tax " +
                       "ON servicetax.taxcode = tax.taxcode " +
                       "WHERE " + QHS.AppAnd(QHS.CmpEq("tax.taxkind", 3), QHS.CmpEq("servicetax.idser", Rparasubcontract["idser"]));
            DataTable prestazione = Conn.SQLRunner(q, -1, out errmess);

            if ((prestazione.Rows.Count != 0) && (R["idemenscontractkind"] is DBNull))
            {
                errmess  = "Scegliere un Tipo Rapporto";
                errfield = "idemenscontractkind";
                return(false);
            }

            DataRow rigaEmensTipoRapporto = R.GetParentRow("emenscontractkindparasubcontractyear");

            if (rigaEmensTipoRapporto != null)
            {
                if (rigaEmensTipoRapporto["flagactivityrequested"].Equals("S") &&
                    (R["activitycode"] is DBNull))
                {
                    errmess  = "Per il 'Tipo Rapporto' scelto è necessario specificare l'Attività Previdenziale";
                    errfield = "activitycode";
                    return(false);
                }

                if (!rigaEmensTipoRapporto["flagactivityrequested"].Equals("S") &&
                    !(R["activitycode"] is DBNull))
                {
                    errmess  = "Per il 'Tipo Rapporto' scelto non va selezionata l'Attività Previdenziale";
                    errfield = "activitycode";
                    return(false);
                }
            }
            DataRow rContratto = R.GetParentRow("parasubcontractparasubcontractyear");
            DataRow rService   = rContratto.GetParentRow("serviceparasubcontract");

            string codeser = rService["servicecode770"].ToString().ToUpper();

            bool inps10 = (codeser == "05_COORDM") ||
                          (codeser == "05_ASSRICM") ||
                          (codeser == "05_TUTORM") ||
                          (codeser == "16_COORDM_DS") ||
                          (codeser == "16_COORDM_AS") ||
                          (codeser == "15_BRS_POSTM") || //Borse post-doc mutuati (con solo rit. Inps)
                          (codeser == "15_BRS_DOTTM"); //Borse dottorato di ricerca mutuati (solo Inps)

            bool inps15 = codeser == "05_COORDP";

            if (inps10 && (R["idotherinsurance"] == DBNull.Value))
            {
                errmess  = "Per i soggetti mutuati è necessario specificare l'altra forma assicurativa";
                errfield = "idotherinsurance";
                return(false);
            }
            if (inps15 && (!R["idotherinsurance"].Equals("002")))
            {
                errmess = "Per i titolari di pensione diretta è necessario specificare 'Titolari di pensione diretta' come altra forma assicurativa";
                return(false);
            }
            if (!inps15 && (R["idotherinsurance"].Equals("002")))
            {
                errmess  = "La prestazione scelta non è compatibile con l'altra forma assicurativa 'Titolari di pensione diretta'";
                errfield = "idser";
                return(false);
            }

            if (CfgFn.GetNoNullInt32(rService["idser"]) != 0)
            {
                object foreign     = Conn.DO_READ_VALUE("service", QHS.CmpEq("idser", rContratto["idser"]), "flagforeign");
                string flagforeign = "";
                if (foreign != null)
                {
                    flagforeign = foreign.ToString().ToUpper();
                }
                if ((flagforeign != "S") && (CfgFn.GetNoNullInt32(R["idresidence"]) <= 0))
                {
                    errmess  = "Inserire il comune di residenza";
                    errfield = "idresidence";
                    return(false);
                }
            }


            // Controllo su applicascaglioni - maggioreritenuta
            if (R["applybrackets"].ToString().ToUpper() == "N")
            {
                if (CfgFn.GetNoNullDecimal(R["highertax"]) <= 0)
                {
                    errmess  = "Impostare l'aliquota marginale";
                    errfield = "highertax";
                    return(false);
                }
            }

            // Controlli sulle Addizionali IRPEF
            if ((CfgFn.GetNoNullDecimal(R["regionaltax"]) > 0) ||
                (CfgFn.GetNoNullDecimal(R["countrytax"]) > 0) ||
                (CfgFn.GetNoNullDecimal(R["citytax"]) > 0)
                )
            {
                // Il numero di rate non può essere nullo o pari a zero
                if (CfgFn.GetNoNullInt32(R["ratequantity"]) <= 0)
                {
                    errmess  = "Inserire il numero di rate di pagamento delle addizionali";
                    errfield = "ratequantity";
                    return(false);
                }

                // Il mese di inizio non può essere nullo
                if (CfgFn.GetNoNullInt32(R["startmonth"]) <= 0)
                {
                    errmess  = "Inserire il mese da cui iniziare a pagare le rate delle addizionali";
                    errfield = "startmonth";
                    return(false);
                }

                // Il mese di inizio deve cadere nel range di esistenza del contratto
                DateTime dataInizio = (DateTime)rContratto["start"];
                DateTime dataFine   = (DateTime)rContratto["stop"];

                DateTime datamin = (dataInizio.Year == (int)R["ayear"]) ? dataInizio : new DateTime((int)R["ayear"], 1, 1);
                DateTime datamax = (dataFine.Year == (int)R["ayear"]) ? dataFine : new DateTime((int)R["ayear"], 12, 31);
                if ((CfgFn.GetNoNullInt32(R["startmonth"]) < datamin.Month) ||
                    (CfgFn.GetNoNullInt32(R["startmonth"]) > datamax.Month))

                {
                    errmess  = "Il mese da cui si intende cominciare a pagare le rate delle addizionali non è congruo con l'esistenza del contratto";
                    errfield = "startmonth";
                    return(false);
                }
                // Le rate devono essere pagate entro la fine del contratto e comunque entro l'anno solare
                if (CfgFn.GetNoNullInt32(R["startmonth"]) + CfgFn.GetNoNullInt32(R["ratequantity"]) - 1 > datamax.Month)
                {
                    errmess  = "Le rate devono essere pagate entro la fine del contratto e comunque entro l'anno fiscale";
                    errfield = "ratequantity";
                    return(false);
                }
            }

            // Controlli sull'acconto dell'addizionale comunale
            if (CfgFn.GetNoNullDecimal(R["citytax_account"]) > 0)
            {
                // Il numero di rate non può essere nullo o pari a zero
                if (CfgFn.GetNoNullInt32(R["ratequantity_account"]) <= 0)
                {
                    errmess  = "Inserire il numero di rate di pagamento dell'acconto dell'addizionale comunale";
                    errfield = "ratequantity_account";
                    return(false);
                }

                // Il mese di inizio non può essere nullo
                if (CfgFn.GetNoNullInt32(R["startmonth_account"]) <= 0)
                {
                    errmess  = "Inserire il mese da cui iniziare a pagare le rate dell'acconto dell'addizionale comunale";
                    errfield = "startmonth_account";
                    return(false);
                }

                // Il mese di inizio deve cadere nel range di esistenza del contratto
                DateTime dataInizio = (DateTime)rContratto["start"];
                DateTime dataFine   = (DateTime)rContratto["stop"];

                DateTime datamin = (dataInizio.Year == (int)R["ayear"]) ? dataInizio : new DateTime((int)R["ayear"], 1, 1);
                DateTime datamax = (dataFine.Year == (int)R["ayear"]) ? dataFine : new DateTime((int)R["ayear"], 12, 31);
                if ((CfgFn.GetNoNullInt32(R["startmonth_account"]) < datamin.Month) ||
                    (CfgFn.GetNoNullInt32(R["startmonth_account"]) > datamax.Month))
                {
                    errmess  = "Il mese da cui si intende cominciare a pagare le rate dell'acconto dell'addizionale comunale non è congruo con l'esistenza del contratto";
                    errfield = "startmonth_account";
                    return(false);
                }
                // Le rate devono essere pagate entro la fine del contratto e comunque entro l'anno solare
                if (CfgFn.GetNoNullInt32(R["startmonth_account"]) + CfgFn.GetNoNullInt32(R["ratequantity_account"]) - 1 > datamax.Month)
                {
                    errmess  = "Le rate devono essere pagate entro la fine del contratto e comunque entro l'anno fiscale";
                    errfield = "ratequantity_account";
                    return(false);
                }
            }
            return(true);
        }
예제 #28
0
        public override void DescribeTree(TreeView tree, DataTable T, string ListingType)
        {
            int maxlev = 0;

            //Aggiorno le intestazioni del DataGrid
            if (ListingType == "treeap" || ListingType == "tree" || ListingType == "treea" || ListingType == "treep" || ListingType == "treeanew" || ListingType == "treepnew")
            {
                base.DescribeColumns(T, ListingType);
                foreach (DataColumn C in T.Columns)
                {
                    DescribeAColumn(T, C.ColumnName, "", -1);
                }
                DescribeAColumn(T, "!livello", "Livello", "patrimonylevel.description", 1);
                DescribeAColumn(T, "codepatrimony", "Codice", 2);
                DescribeAColumn(T, "title", "Denominazione", 3);
            }

            base.DescribeTree(tree, T, ListingType);
            int    esercizio       = Convert.ToInt32(GetSys("esercizio"));
            int    esercizionew    = esercizio + 1;
            string filteresercizio = QHS.CmpEq("ayear", GetSys("esercizio"));
            string filterc         = QHC.CmpEq("nlevel", "1");
            string filtersql       = QHS.CmpEq("nlevel", "1");
            string kind            = "AP";
            bool   all             = false;

            if (ListingType == "treeap")
            {
                //filter="(nlevel='1')";
                kind = "AP";
            }
            if (ListingType == "tree")
            {
                //filter="(nlevel='1')";
                kind = "AP";
            }
            if (ListingType == "treea")
            {
                string livsupid = esercizio.ToString().Substring(2) + "A";
                //filter = "(paridpatrimony=" + QueryCreator.quotedstrvalue(livsupid, true) + ")";
                filterc   = QHC.CmpEq("paridpatrimony", livsupid);
                filtersql = QHS.CmpEq("paridpatrimony", livsupid);
                kind      = "A";
                all       = true;
            }
            if (ListingType == "treep")
            {
                string livsupid = esercizio.ToString().Substring(2) + "P";
                filterc   = QHC.CmpEq("paridpatrimony", livsupid);
                filtersql = QHS.CmpEq("paridpatrimony", livsupid);
                kind      = "P";
                all       = true;
            }
            if (ListingType == "treeanew")
            {
                string livsupid = esercizionew.ToString().Substring(2) + "A";
                filterc         = QHC.CmpEq("paridpatrimony", livsupid);
                filtersql       = QHS.CmpEq("paridpatrimony", livsupid);
                kind            = "A";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
                all             = true;
            }
            if (ListingType == "treepnew")
            {
                string livsupid = esercizionew.ToString().Substring(2) + "P";
                filterc         = QHC.CmpEq("paridpatrimony", livsupid);
                filtersql       = QHS.CmpEq("paridpatrimony", livsupid);
                kind            = "P";
                filteresercizio = QHS.CmpEq("ayear", esercizionew);
                all             = true;
            }
            object o = Conn.DO_READ_VALUE("patrimonylevel", filteresercizio, "max(nlevel)");

            if ((o != null) && (o != DBNull.Value))
            {
                maxlev = Convert.ToInt32(o);
            }

            if (maxlev > 0)
            {
                myGetData.SetStaticFilter("patrimony", QHS.AppAnd(filteresercizio, QHS.CmpLe("nlevel", maxlev)));
                //myGetData.SetStaticFilter("patrimonyview", QHS.AppAnd(filteresercizio, QHS.CmpLe("nlevel", maxlev)));
            }

            TreeViewPatrimoniale M = new TreeViewPatrimoniale(T, tree, filterc, filtersql, kind, all, maxlev);

            myGetData.SetStaticFilter("patrimonylevel", filteresercizio);
        }
예제 #29
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (R["completed"].ToString() == "S" && R.Table.Columns.Contains("datecompleted"))
            {
                if (R["datecompleted"] == DBNull.Value)
                {
                    errmess  = "E' necessario specificare la  data di acquisizione documentazione definitiva";
                    errfield = "datecompleted";
                    return(false);
                }
            }

            if ((R.RowState == DataRowState.Added || (
                     R.RowState == DataRowState.Modified && R["datecompleted", DataRowVersion.Original] == DBNull.Value)
                 ) &&
                R["datecompleted"] != DBNull.Value
                )
            {
                DateTime dateCompleted = (DateTime)R["datecompleted"];

                if (R["stop"] == DBNull.Value)
                {
                    errmess  = "Non è possibile considerare pagare una parcella senza data fine";
                    errfield = "stop";
                    return(false);
                }
                DateTime stop = (DateTime)R["stop"];
                if (dateCompleted < stop)
                {
                    errmess  = "La data di acquisizione documentazione definitiva non può precedere la data fine";
                    errfield = "datecompleted";
                    return(false);
                }

                if (dateCompleted.Year != Conn.GetEsercizio())
                {
                    errmess  = "La data di acquisizione documentazione definitiva deve essere quella dell'esercizio all'atto dell'inserimento";
                    errfield = "datecompleted";
                    return(false);
                }

                int ycon = CfgFn.GetNoNullInt32(R["ycon"]);
                if (dateCompleted.Year < ycon)
                {
                    errmess  = "La data di acquisizione documentazione definitiva non può precedere l'anno parcella";
                    errfield = "datecompleted";
                    return(false);
                }
            }

            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }
            if ((R["idser"] is DBNull) || (CfgFn.GetNoNullInt32(R["idser"]) == 0))
            {
                errmess  = "il campo prestazione è obbligatorio";
                errfield = "idser";
                return(false);
            }

            string    filterRitEnpals = QHS.AppAnd(QHS.CmpEq("idser", R["idser"]), QHS.CmpEq("taxkind", 3), QHS.Like("taxref", "%enpals%"));
            DataTable TRitEnpals      = Conn.RUN_SELECT("servicetaxview", "*", null, filterRitEnpals, null, false);

            if (TRitEnpals.Rows.Count > 0)
            {
                errmess = "La denuncia UNIEMENS per il compenso assoggettato ad ENPALS \n\r " +
                          "non sarà prodotta con il flusso UNIEMENS di Easy ma \n\r " +
                          "dovrà essere eventualmente effettuata direttamente dal sito \n\r " +
                          "http://www.inps.it/ . Si raccomanda di informare tempestivamente \n\r " +
                          "l'ufficio competente alla trasmissione della denuncia UNIEMENS.";
                errfield = "idser";
                MessageBox.Show(errmess, "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            if (R["description"].ToString() == "")
            {
                errmess  = "Il campo descrizione è obbligatorio.";
                errfield = "description";
                return(false);
            }



//cascon§2006§2
            bool IsAdmin = (GetSys("manage_prestazioni") != null)
                ? GetSys("manage_prestazioni").ToString() == "S"
                : false;


            string filter_idrelated = "cascon§" + R["ycon"].ToString() + "§" + R["ncon"].ToString();

            filter_idrelated = QHS.CmpEq("idrelated", filter_idrelated);

            DataTable Tserviceregistry = Conn.RUN_SELECT("serviceregistry", "*", null, filter_idrelated, null, null, true);

            if ((Tserviceregistry.Rows.Count > 0) && (R.RowState == DataRowState.Modified))
            {
                bool   error   = false;
                string message = "";
                if (R["idreg", DataRowVersion.Current].ToString() != R["idreg", DataRowVersion.Original].ToString())
                {
                    message = "Percipiente \n\r ";
                    error   = true;
                }
                if (R["description", DataRowVersion.Current].ToString() != R["description", DataRowVersion.Original].ToString())
                {
                    message = message + "Descrizione \n\r ";
                    error   = true;
                }
                if (R["start", DataRowVersion.Current].ToString() != R["start", DataRowVersion.Original].ToString())
                {
                    message = message + "Data Inizio \n\r ";
                    error   = true;
                }
                if (R["stop", DataRowVersion.Current].ToString() != R["stop", DataRowVersion.Original].ToString())
                {
                    message = message + "Data Fine \n\r ";
                    error   = true;
                }
                if (CfgFn.RoundValuta(CfgFn.GetNoNullDecimal(R["feegross", DataRowVersion.Current])) != CfgFn.RoundValuta(CfgFn.GetNoNullDecimal(R["feegross", DataRowVersion.Original])))
                {
                    message = message + "Lordo al beneficiario \n\r ";
                    error   = true;
                }

                if (error)
                {
                    if (IsAdmin)
                    {
                        errmess = "L'Anagrafe delle Prestazioni è stata già generata, e risultano modificati i seguenti dati: \n\r"
                                  + message + "Adeguare anche i dati dell'Incarico.";
                        MessageBox.Show(errmess, "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        errmess = "Risultano modificati i seguenti dati: \n\r"
                                  + message + "La modifica non è consentita perché l'Anagrafe delle Prestazioni è stata già generata.\r\n" +
                                  "Contattare il servizio assistenza o un utente con ruolo 'manage_prestazioni' ";
                        return(false);
                    }
                }
            }
//

            DataRow[] righeImpContr = R.GetChildRows("casualcontractcasualcontractyear");
            if (R["!codiceritenutainps"] != DBNull.Value)
            {
                if (righeImpContr[0]["idemenscontractkind"] is DBNull)
                {
                    errmess  = "Per una prestazione soggetta ad INPS è obbligatorio specificare il 'Tipo Rapporto'";
                    errfield = "codicerapporto";
                    return(false);
                }
                string filtro = QHS.AppAnd(QHS.CmpEq("idemenscontractkind", righeImpContr[0]["idemenscontractkind"]),
                                           QHS.CmpEq("ayear", R["ycon"]));
                object flagAttivitaObbligatoria = Conn.DO_READ_VALUE("emenscontractkind", filtro,
                                                                     "flagactivityrequested");
                if (flagAttivitaObbligatoria != null &&
                    flagAttivitaObbligatoria.Equals("S") && (righeImpContr[0]["activitycode"] is DBNull))
                {
                    errmess  = "Per il 'Tipo Rapporto' scelto è necessario specificare l'Attività Previdenziale";
                    errfield = "activitycode";
                    return(false);
                }
                if (flagAttivitaObbligatoria != null &&
                    !flagAttivitaObbligatoria.Equals("S") && !(righeImpContr[0]["activitycode"] is DBNull))
                {
                    errmess  = "Per il 'Tipo Rapporto' scelto non va selezionata l'Attività Previdenziale";
                    errfield = "activitycode";
                    return(false);
                }
                string codiceritenutainps = R["!codiceritenutainps"].ToString();
                if ((codiceritenutainps == "07_INPS_M") && (righeImpContr[0]["idotherinsurance"] is DBNull))
                {
                    errmess = "Per i soggetti mutuati è necessario specificare l'altra forma assicurativa";
                    return(false);
                }
                if ((codiceritenutainps == "07_INPS_P") && (!righeImpContr[0]["idotherinsurance"].Equals("002")))
                {
                    errmess = "Per i titolari di pensione diretta è necessario specificare 'Titolari di pensione diretta' come altra forma assicurativa";
                    return(false);
                }
                if ((codiceritenutainps == "07_INPS_P") && (!righeImpContr[0]["idotherinsurance"].Equals("002")))
                {
                    errmess  = "La prestazione scelta non è compatibile con l'altra forma assicurativa 'Titolari di pensione diretta'";
                    errfield = "idser";
                    return(false);
                }
            }
            if (CfgFn.GetNoNullDecimal(R["feegross"]) <= 0)
            {
                errmess  = "L'importo lordo del contratto deve essere maggiore di zero";
                errfield = "feegross";
                return(false);
            }

            DateTime dataInizio = (DateTime)R["start"];
            DateTime dataFine   = (DateTime)R["stop"];

            if (dataInizio > dataFine)
            {
                errmess  = "La data di fine deve essere identica o successiva a quella di inizio";
                errfield = "stop";
                return(false);
            }

            //Se il percipiente ha un indirizzo AP, nel form del compenso si deve scegliere o S o N
            String    codeaddress   = "07_SW_ANP";
            DateTime  DataInizio    = (DateTime)R["start"];
            object    idaddresskind = Conn.DO_READ_VALUE("address", QHS.CmpEq("codeaddress", codeaddress), "idaddress");
            DataTable Address       = DataAccess.RUN_SELECT(Conn, "registryaddress", "*", null,
                                                            QHS.AppAnd(QHS.CmpEq("idaddresskind", idaddresskind), QHS.CmpEq("idreg", R["idreg"]),
                                                                       QHS.CmpLe("start", DataInizio), QHS.NullOrGe("stop", DataInizio)), false);

            if (Address.Rows.Count > 0)
            {
                if ((R["authneeded"].ToString() != "S") && (R["authneeded"].ToString() != "N"))
                {
                    errfield = "authneeded";
                    errmess  = "Il percipiente ha un indirizzo Anagrafe delle Prestazioni, pertanto va indicato se necessita o meno dell'autorizzazione.";
                    return(false);
                }
            }

            if (R["authneeded"].ToString() == "S" && R["authdoc"].ToString() == "")
            {
                errmess  = "Il campo 'Documento' è obbligatorio";
                errfield = "authdoc";
                return(false);
            }

            if (R["authneeded"].ToString() == "S" && R["authdocdate"] == DBNull.Value)
            {
                errmess  = "Il campo 'data' è obbligatorio";
                errfield = "authdocdate";
                return(false);
            }

            if (R["authneeded"].ToString() == "N" && R["noauthreason"].ToString() == "")
            {
                errmess  = "Il campo 'Motivo' è obbligatorio";
                errfield = "authdoc";
                return(false);
            }

            if ((R.RowState == DataRowState.Added) && (!RowChange.IsAutoIncrement(R.Table.Columns["ncon"])))
            {
                int NPRESENT = Conn.RUN_SELECT_COUNT("casualcontract", "(ycon=" + QueryCreator.quotedstrvalue(R["ycon"], true) + ")AND" +
                                                     "(ncon=" + QueryCreator.quotedstrvalue(R["ncon"], true) + ")", true);
                if (NPRESENT > 0)
                {
                    errmess  = "Esiste già un contratto con lo stesso numero.";
                    errfield = "ncon";
                    return(false);
                }
            }
            //Se il DS contiene la tabella registry, controlla che l'idreg abbia il CF,se SI chiama il metodo.
            if (R.Table.DataSet.Tables.Contains("registry") && (R.Table.DataSet.Tables["registry"].Rows.Count > 0))
            {
                DataRow Registry = R.Table.DataSet.Tables["registry"].Rows[0];
                if (Registry["cf"] != DBNull.Value)
                {
                    string errori;
                    if (!CalcolaCodiceFiscale.CodiceFiscaleValido(this.Conn, Registry, out errori))
                    {
                        errmess = "Il Codice Fiscale non è valido!\n" + errori;
                        return(false);
                    }
                }
            }
            else
            {
                //Se il DS non contiene la tabella registry,controlla che l'idreg abbia il CF se SI legge la riga dal DB
                // e chiama il metodo.
                object CF = Conn.DO_READ_VALUE("registry", QHS.CmpEq("idreg", R["idreg"]), "cf");
                if (CF != DBNull.Value)
                {
                    DataTable TRegistry = Conn.RUN_SELECT("registry", "*", null, QHS.CmpEq("idreg", R["idreg"]), null, null, true);
                    if (TRegistry.Rows.Count > 0)
                    {
                        DataRow Registry = TRegistry.Rows[0];
                        string  errori;
                        if (!CalcolaCodiceFiscale.CodiceFiscaleValido(this.Conn, Registry, out errori))
                        {
                            errmess = "Il Codice Fiscale non è valido!\n" + errori;
                            return(false);
                        }
                    }
                }
            }
            if (!CfgFn.IsValidString(R["cigcode"].ToString()))
            {
                errmess  = "Il CIG contiene caratteri non validi.I caratteri ammessi sono solo numeri e lettere.";
                errfield = "cigcode";
                return(false);
            }
            return(true);
        }
예제 #30
0
        public override bool IsValid(DataRow R, out string errmess, out string errfield)
        {
            if (!base.IsValid(R, out errmess, out errfield))
            {
                return(false);
            }
            //profservice§2006§34

            if (CfgFn.GetNoNullInt32(R["idser"]) <= 0)
            {
                errmess  = "Bisogna specificare la prestazione";
                errfield = "idser";
                return(false);
            }

            string    filterRitEnpals = QHS.AppAnd(QHS.CmpEq("idser", R["idser"]), QHS.CmpEq("taxkind", 3), QHS.Like("taxref", "%enpals%"));
            DataTable TRitEnpals      = Conn.RUN_SELECT("servicetaxview", "*", null, filterRitEnpals, null, false);

            if (TRitEnpals.Rows.Count > 0)
            {
                errmess = "La denuncia UNIEMENS per il compenso assoggettato ad ENPALS \n\r " +
                          "non sarà prodotta con il flusso UNIEMENS di Easy ma \n\r " +
                          "dovrà essere eventualmente effettuata direttamente dal sito \n\r " +
                          "http://www.inps.it/ . Si raccomanda di informare tempestivamente \n\r " +
                          "l'ufficio competente alla trasmissione della denuncia UNIEMENS.";
                errfield = "idser";
                MessageBox.Show(errmess, "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            bool IsAdmin = (GetSys("manage_prestazioni") != null)
                            ? GetSys("manage_prestazioni").ToString() == "S"
                            : false;

            string filter_idrelated = QHC.CmpEq("idrelated", "profservice§" + R["ycon"] + "§" + R["ncon"]);
            //filter_idrelated = "(idrelated="+QueryCreator.quotedstrvalue(filter_idrelated,true)+")";

            DataTable Tserviceregistry = Conn.RUN_SELECT("serviceregistry", "*", null, filter_idrelated, null, null, true);

            if ((Tserviceregistry.Rows.Count > 0) && (R.RowState == DataRowState.Modified))
            {
                bool   error   = false;
                string message = "";
                if (R["idreg", DataRowVersion.Current].ToString() != R["idreg", DataRowVersion.Original].ToString())
                {
                    message = "Percipiente \n\r ";
                    error   = true;
                }
                if (R["description", DataRowVersion.Current].ToString() != R["description", DataRowVersion.Original].ToString())
                {
                    message = message + "Descrizione \n\r ";
                    error   = true;
                }
                if (R["start", DataRowVersion.Current].ToString() != R["start", DataRowVersion.Original].ToString())
                {
                    message = message + "Data Inizio \n\r ";
                    error   = true;
                }
                if (R["stop", DataRowVersion.Current].ToString() != R["stop", DataRowVersion.Original].ToString())
                {
                    message = message + "Data Fine \n\r ";
                    error   = true;
                }
                if (CfgFn.RoundValuta(CfgFn.GetNoNullDecimal(R["totalcost", DataRowVersion.Current])) != CfgFn.RoundValuta(CfgFn.GetNoNullDecimal(R["totalcost", DataRowVersion.Original])))
                {
                    message = message + "Lordo al beneficiario \n\r ";
                    error   = true;
                }

                if (error)
                {
                    if (IsAdmin)
                    {
                        errmess = "L'Anagrafe delle Prestazioni è stata già generata, e risultano modificati i seguenti dati: \n\r"
                                  + message + "Adeguare anche i dati dell'Incarico.";
                        MessageBox.Show(errmess, "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        errmess = "Risultano modificati i seguenti dati: \n\r"
                                  + message + "La modifica non è consentita perché l'Anagrafe delle Prestazioni è stata già generata.\r\n" +
                                  "Contattare il servizio assistenza o un utente con ruolo 'manage_prestazioni' ";
                        return(false);
                    }
                }
            }

            //

            if (CfgFn.GetNoNullInt32(R["idreg"]) == 0)
            {
                errmess  = "Inserire il percipiente";
                errfield = "idreg";
                return(false);
            }
            if (R["description"].ToString() == "")
            {
                errmess  = "Il campo descrizione è obbligatorio.";
                errfield = "description";
                return(false);
            }
            if (R["doc"].ToString() == "")
            {
                errmess  = "Il campo documento è obbligatorio e dovrebbe contenere il rif. alla fattura.";
                errfield = "doc";
            }

            if (R["docdate"].ToString() == "")
            {
                errmess  = "Il campo data documento è obbligatorio e dovrebbe contenere la data della fattura.";
                errfield = "docdate";
            }
            //A questo controllo è stato tolto l' uguale,perchè ci sono dei casi in cui i professionisti fatturano solo spese non imponibili
            //anticipate per conto del committente quindi è possibile che l'importo della prestazione sia uguale a zero. Task 3750
            if (CfgFn.GetNoNullDecimal(R["feegross"]) < 0)
            {
                errmess  = "L'importo lordo del contratto deve essere maggiore di zero";
                errfield = "feegross";
                return(false);
            }

            DateTime dataInizio = (DateTime)R["start"];
            DateTime dataFine   = (DateTime)R["stop"];

            if (dataInizio > dataFine)
            {
                errmess  = "La data di fine deve essere identica o successiva a quella di inizio";
                errfield = "stop";
                return(false);
            }

            //Se il percipiente ha un indirizzo AP, nel form del compenso si deve scegliere o S o N
            String    codeaddress   = "07_SW_ANP";
            DateTime  DataInizio    = (DateTime)R["start"];
            object    idaddresskind = Conn.DO_READ_VALUE("address", QHS.CmpEq("codeaddress", codeaddress), "idaddress");
            DataTable Address       = DataAccess.RUN_SELECT(Conn, "registryaddress", "*", null,
                                                            QHS.AppAnd(QHS.CmpEq("idaddresskind", idaddresskind), QHS.CmpEq("idreg", R["idreg"]),
                                                                       QHS.CmpLe("start", DataInizio), QHS.NullOrGe("stop", DataInizio)), false);

            if (Address.Rows.Count > 0)
            {
                if ((R["authneeded"].ToString() != "S") && (R["authneeded"].ToString() != "N"))
                {
                    errfield = "authneeded";
                    errmess  = "Il percipiente ha un indirizzo Anagrafe delle Prestazioni, pertanto va indicato se necessita o meno dell'autorizzazione.";
                    return(false);
                }
            }
            if (R["authneeded"].ToString() == "S" && R["authdoc"].ToString() == "")
            {
                errmess  = "Il campo 'Documento' è obbligatorio";
                errfield = "authdoc";
                return(false);
            }

            if (R["authneeded"].ToString() == "S" && R["authdocdate"] == DBNull.Value)
            {
                errmess  = "Il campo 'data' è obbligatorio";
                errfield = "authdocdate";
                return(false);
            }

            if (R["authneeded"].ToString() == "N" && R["noauthreason"].ToString() == "")
            {
                errmess  = "Il campo 'Motivo' è obbligatorio";
                errfield = "authdoc";
                return(false);
            }


            if ((R.RowState == DataRowState.Added) && (!RowChange.IsAutoIncrement(R.Table.Columns["ncon"])))
            {
                string filterProfService = QHS.AppAnd(QHS.CmpEq("ycon", R["ycon"]),
                                                      QHS.CmpEq("ncon", R["ncon"]));
                int NPRESENT = Conn.RUN_SELECT_COUNT("profservice", filterProfService, true);
                if (NPRESENT > 0)
                {
                    errmess  = "Esiste già un contratto con lo stesso numero.";
                    errfield = "ncon";
                    return(false);
                }
            }
            //Se il DS contiene la tabella registry, controlla che l'idreg abbia il CF,se SI chiama il metodo.
            if (R.Table.DataSet.Tables.Contains("registry") && (R.Table.DataSet.Tables["registry"].Rows.Count > 0))
            {
                DataRow Registry = R.Table.DataSet.Tables["registry"].Rows[0];
                if (Registry["cf"] != DBNull.Value)
                {
                    string errori;
                    if (!CalcolaCodiceFiscale.CodiceFiscaleValido(this.Conn, Registry, out errori))
                    {
                        errmess = "Il Codice Fiscale non è valido!\n" + errori;
                        return(false);
                    }
                }
            }
            else
            {
                //Se il DS non contiene la tabella registry,controlla che l'idreg abbia il CF se SI legge la riga dal DB
                // e chiama il metodo.
                object CF = Conn.DO_READ_VALUE("registry", QHS.CmpEq("idreg", R["idreg"]), "cf");
                if (CF != DBNull.Value)
                {
                    DataTable TRegistry = Conn.RUN_SELECT("registry", "*", null, QHS.CmpEq("idreg", R["idreg"]), null, null, true);
                    if (TRegistry.Rows.Count > 0)
                    {
                        DataRow Registry = TRegistry.Rows[0];
                        string  errori;
                        if (!CalcolaCodiceFiscale.CodiceFiscaleValido(this.Conn, Registry, out errori))
                        {
                            errmess = "Il Codice Fiscale non è valido!\n" + errori;
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }