コード例 #1
0
        bool SaveData()
        {
            Easy_PostData MyPostData = new Easy_PostData();

            MyPostData.InitClass(DS, Meta.Conn);

            return(MyPostData.DO_POST());
        }
コード例 #2
0
        bool AggiungiUtenteAGruppoOrganigramma(string idcustomuser, string login)
        {
            //Aggiunge la riga in customuser ove necessario
            DataTable tCustomUser = Conn.RUN_SELECT("customuser", "*", null, QHS.CmpEq("idcustomuser", idcustomuser), null, false);

            if (tCustomUser.Rows.Count == 0)
            {
                Conn.SQLRunner("insert into customuser(idcustomuser,lt,lu,ct,cu,username) values " +
                               "(" + QHS.List(idcustomuser, DateTime.Now, "flowchartmassive",
                                              DateTime.Now, "flowchartmassive", login) + ")", true);
            }
            else
            {
                Conn.SQLRunner("update customuser set username="******" WHERE " + QHS.CmpEq("idcustomuser", idcustomuser), true);
            }

            CheckEsistenzaGruppoOrganigramma();

            DataTable tCustomGroup = DataAccess.CreateTableByName(Meta.Conn, "customgroup", "*");
            DataTable tSecurityVar = DataAccess.CreateTableByName(Meta.Conn, "securityvar", "*");

            DataTable tCustomUserGroup = DataAccess.CreateTableByName(Meta.Conn, "customusergroup", "*");
            DataTable tUserEnvironment = DataAccess.CreateTableByName(Meta.Conn, "userenvironment", "*");

            DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tCustomGroup, null,
                                             QHS.CmpEq("idcustomgroup", "ORGANIGRAMMA"), null, true);
            fillUserInGroup(idcustomuser, tCustomGroup, tCustomUserGroup);

            // Fill della tabella securityvar
            DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tSecurityVar, null, null, null, true);
            fillUserEnvironment(idcustomuser, tSecurityVar, tUserEnvironment);

            DataSet dsPost = new DataSet();

            dsPost.Tables.Add(tCustomUserGroup);
            dsPost.Tables.Add(tUserEnvironment);

            Easy_PostData pd = new Easy_PostData();

            pd.InitClass(dsPost, Meta.Conn);
            if (!pd.DO_POST())
            {
                MessageBox.Show(this, "Errore nel salvataggio dei dati in AggiungiUtenteAGruppoOrganigramma", "Errore");
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #3
0
        private void btnApplica_Click(object sender, EventArgs e)
        {
            if (Meta.IsEmpty)
            {
                return;
            }
            if (Meta.InsertMode)
            {
                return;
            }
            if (DS.customuser.Rows.Count == 0)
            {
                return;
            }
            QueryHelper QHS  = Meta.Conn.GetQueryHelper();
            DataRow     Curr = DS.customuser.Rows[0];

            DataTable tCustomGroup = DataAccess.CreateTableByName(Meta.Conn, "customgroup", "*");
            DataTable tSecurityVar = DataAccess.CreateTableByName(Meta.Conn, "securityvar", "*");

            DataTable tCustomUserGroup = DataAccess.CreateTableByName(Meta.Conn, "customusergroup", "*");
            DataTable tUserEnvironment = DataAccess.CreateTableByName(Meta.Conn, "userenvironment", "*");

            DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tCustomGroup, null,
                                             QHS.CmpEq("idcustomgroup", "ORGANIGRAMMA"), null, true);
            fillUserInGroup(Curr["idcustomuser"], tCustomGroup, tCustomUserGroup);

            // Fill della tabella securityvar
            DataAccess.RUN_SELECT_INTO_TABLE(Meta.Conn, tSecurityVar, null, null, null, true);
            fillUserEnvironment(Curr["idcustomuser"], tSecurityVar, tUserEnvironment);

            DataSet dsPost = new DataSet();

            dsPost.Tables.Add(tCustomUserGroup);
            dsPost.Tables.Add(tUserEnvironment);

            Easy_PostData pd = new Easy_PostData();

            pd.InitClass(dsPost, Meta.Conn);
            if (!pd.DO_POST())
            {
                MessageBox.Show(this, "Errore nel salvataggio dei dati", "Errore");
            }
            else
            {
                MessageBox.Show(this, "Procedura di Applicazione dell'utente effettuata", "Ok");
            }
        }
コード例 #4
0
        /// <summary>
        /// Aggiunge un utente al gruppo organigramma e poi lo collega ad uno specifico nodo dell'organigramma stesso
        /// </summary>
        /// <param name="FlowChartUserToAdd"></param>
        /// <returns></returns>
        bool AggiungiUtenteAdOrganigramma(FlowChartUser FlowChartUserToAdd)
        {
            MetaData meta_flowchartuser = Meta.Dispatcher.Get("flowchartuser");

            string idcustomuser = FlowChartUserToAdd.idcustomuser;
            string login        = idcustomuser; // assunzione base

            bool res = AggiungiUtenteAGruppoOrganigramma(idcustomuser, login);

            if (!res)
            {
                return(false);
            }

            object idflowchart = Conn.DO_READ_VALUE("flowchart",
                                                    QHS.AppAnd(QHS.CmpEq("codeflowchart", FlowChartUserToAdd.flowchartcode),
                                                               QHS.CmpEq("ayear", Conn.GetSys("esercizio")))
                                                    , "idflowchart");

            if (idflowchart == null || idflowchart == DBNull.Value)
            {
                MessageBox.Show(this,
                                "Il codice " + FlowChartUserToAdd.flowchartcode + " non è presente nella tabella organigramma dell'anno " +
                                Conn.GetSys("esercizio").ToString() + ".",
                                "Errore");
                return(false);
            }

            string f = QHS.AppAnd(QHS.CmpEq("idcustomuser", idcustomuser), QHS.CmpEq("idflowchart", idflowchart),
                                  QHS.CmpEq("title", FlowChartUserToAdd.title));

            if (Conn.RUN_SELECT_COUNT("flowchartuser", f, false) > 0)
            {
                return(true);                                                      //già presente
            }
            DataTable TFlowchartUser = Conn.CreateTableByName("flowchartuser", "*");
            DataSet   D = new DataSet();

            D.Tables.Add(TFlowchartUser);

            MetaData.SetDefault(TFlowchartUser, "idflowchart", idflowchart);
            MetaData.SetDefault(TFlowchartUser, "idcustomuser", idcustomuser);

            meta_flowchartuser.SetDefaults(TFlowchartUser);
            DataRow fu = meta_flowchartuser.Get_New_Row(null, TFlowchartUser);

            fu["title"] = FlowChartUserToAdd.title;

            fu["idsor01"] = FlowChartUserToAdd.idsor01;
            fu["idsor02"] = FlowChartUserToAdd.idsor02;
            fu["idsor03"] = FlowChartUserToAdd.idsor03;
            fu["idsor04"] = FlowChartUserToAdd.idsor04;
            fu["idsor05"] = FlowChartUserToAdd.idsor05;

            fu["all_sorkind01"] = FlowChartUserToAdd.all_sorkind01;
            fu["all_sorkind02"] = FlowChartUserToAdd.all_sorkind02;
            fu["all_sorkind03"] = FlowChartUserToAdd.all_sorkind03;
            fu["all_sorkind04"] = FlowChartUserToAdd.all_sorkind04;
            fu["all_sorkind05"] = FlowChartUserToAdd.all_sorkind05;

            fu["sorkind01_withchilds"] = FlowChartUserToAdd.sorkind01_withchilds;
            fu["sorkind02_withchilds"] = FlowChartUserToAdd.sorkind02_withchilds;
            fu["sorkind03_withchilds"] = FlowChartUserToAdd.sorkind03_withchilds;
            fu["sorkind04_withchilds"] = FlowChartUserToAdd.sorkind04_withchilds;
            fu["sorkind05_withchilds"] = FlowChartUserToAdd.sorkind05_withchilds;

            fu["flagdefault"] = FlowChartUserToAdd.flagdefault;

            fu["start"] = FlowChartUserToAdd.start == DBNull.Value? new DateTime(1900, 1, 1): FlowChartUserToAdd.start;

            Easy_PostData pd = new Easy_PostData();

            pd.InitClass(D, Conn);
            if (!pd.DO_POST())
            {
                MessageBox.Show(this, "Errore nel salvataggio dei dati in AggiungiUtenteAdOrganigramma", "Errore");
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #5
0
        void ScaricaPrenotazione(DataAccess Conn, string idbooking)
        {
            vistaform_storeunload_magazzino DS = new vistaform_storeunload_magazzino();
            CQueryHelper QHC = new CQueryHelper();

            QueryHelper QHS = Conn.GetQueryHelper();

            //WebLog.Log(this, "Visualizza Login_Servizi");
            object Obooking_on_invoice = Conn.DO_READ_VALUE("config", QHS.CmpEq("ayear", Conn.GetSys("esercizio")), "booking_on_invoice");

            if (Obooking_on_invoice == null || Obooking_on_invoice == DBNull.Value || Obooking_on_invoice.ToString() == "")
            {
                Obooking_on_invoice = "N";
            }
            Obooking_on_invoice = Obooking_on_invoice.ToString().ToUpper();
            bool booking_on_invoice = (Obooking_on_invoice.ToString() == "S");



            DataTable BookingToUnload = Conn.RUN_SELECT("booktotalview", "*", null,
                                                        QHS.AppAnd(QHS.CmpGt("allocated", 0), QHS.CmpEq("idbooking", idbooking)), null, true);

            DataTable TStockView = Conn.CreateTableByName("stockview", "*");

            TStockView.PrimaryKey = new DataColumn[] { TStockView.Columns["idstock"] };

            Meta_EasyDispatcher Disp = new Meta_EasyDispatcher(Conn);

            MetaData MetaStoreUnload = Disp.Get("storeunload");

            MetaStoreUnload.SetDefaults(DS.storeunload);
            MetaData MetaStoreUnloadDetail = Disp.Get("storeunloaddetail");

            MetaStoreUnloadDetail.SetDefaults(DS.storeunloaddetail);


            DataRow[] Selected = BookingToUnload.Select();
            if (Selected.Length == 0)
            {
                //niente da scaricare
                lblMessaggio.Text = "Non c'è nulla da scaricare";
                txtCodice.Text    = "";
                return;
            }

            DataRow RStoreUnload = MetaStoreUnload.Get_New_Row(null, DS.storeunload);

            RStoreUnload["description"] = "Scarico prenotazione da magazzino";
            RStoreUnload["idstore"]     = Selected[0]["idstore"];
            RStoreUnload["adate"]       = DateTime.Now;

            Hashtable idlistToStock = new Hashtable();//l'elemento della hashtable è un list<int>

            //Prende una riga di prenotazione
            foreach (DataRow R in Selected)    // riga di prenotazione
            {
                string filterbooking       = QHS.CmpEq("idbooking", R["idbooking"]);
                string filterbookingdetail = QHS.AppAnd(filterbooking,
                                                        QHS.CmpEq("idlist", R["idlist"]));

                DataTable B     = Conn.RUN_SELECT("bookingdetail", "*", null, filterbookingdetail, null, false);
                DataTable Bmain = Conn.RUN_SELECT("booking", "*", null, filterbooking, null, false);

                DataRow BookingDetail = null;


                string filterstock = QHS.AppAnd(QHS.CmpEq("idstore", R["idstore"]),
                                                QHS.CmpEq("idlist", R["idlist"]),
                                                QHS.CmpGt("residual", 0));
                string filterstockds = QHC.AppAnd(QHC.CmpEq("idstore", R["idstore"]),
                                                  QHC.CmpEq("idlist", R["idlist"]),
                                                  QHC.CmpGt("residual", 0));


                //legge in TStockView i cespiti di stock disponibili ad essere scaricati

                if (booking_on_invoice)
                {
                    filterstock   = QHS.AppAnd(filterstock, QHS.CmpEq("idstock", R["idstock"]));
                    filterstockds = QHC.AppAnd(filterstockds, QHC.CmpEq("idstock", R["idstock"]));
                }

                if (TStockView.Select(filterstockds).Length == 0)
                {
                    Conn.RUN_SELECT_INTO_TABLE(TStockView, "expiry asc, idstock asc", filterstock, null, true);
                }

                ///SViewRows = cespiti disponibili (da stockview) allo scarico
                DataRow[] SViewRows = TStockView.Select(filterstockds);
                if (SViewRows.Length == 0)
                {
                    continue;
                }

                DataRow RS;
                decimal tounload = CfgFn.GetNoNullDecimal(R["allocated"]);

                int i = 0;
                //Cerca di scaricare prendendo le righe in SViewRows
                while (i < SViewRows.Length && tounload > 0)
                {
                    DataRow RStock     = SViewRows[i];
                    decimal unloadable = CfgFn.GetNoNullDecimal(RStock["residual"]);
                    if (unloadable > tounload)
                    {
                        unloadable = tounload;
                    }
                    //devo scaricare unloadable
                    string fbooking = filterbooking;


                    //devo scaricare unloadable
                    fbooking = QHC.AppAnd(fbooking, QHC.CmpEq("idstock", RStock["idstock"]));

                    //cerca una riga in storeunloaddetail di pari idstock e idbooking (idstock è sempre noto a questo punto)
                    if (DS.storeunloaddetail.Select(fbooking).Length > 0)
                    {
                        RS           = DS.storeunloaddetail.Select(fbooking)[0];
                        RS["number"] = CfgFn.GetNoNullDecimal(RS["number"]) + unloadable;
                    }
                    else
                    {
                        RS              = MetaStoreUnloadDetail.Get_New_Row(DS.storeunload.Rows[0], DS.storeunloaddetail);
                        RS["number"]    = unloadable;
                        RS["idbooking"] = R["idbooking"];
                        // Determino idstock
                        // io ho una serie di di idlist e idstore
                        // in base ai dettagli selezionati mi servono
                        // per accedere alla vista delle giacenze di stock e creo
                        // una tabella che deve essere filtrata per idlist
                        // idstore e giacenza > 0
                        RS["idstock"] = RStock["idstock"];//T.Rows[0]["idstock"];
                        if (B.Rows.Count > 0)
                        {
                            BookingDetail = B.Rows[0];
                            RS["idsor1"]  = BookingDetail["idsor1"];
                            RS["idsor2"]  = BookingDetail["idsor2"];
                            RS["idsor3"]  = BookingDetail["idsor3"];
                            RS["idman"]   = Bmain.Rows[0]["idman"];
                        }
                    }
                    tounload          -= unloadable;
                    RStock["residual"] = CfgFn.GetNoNullDecimal(RStock["residual"]) - unloadable;
                    i++;
                }
            }
            StoreUnloadSendMail SUSM = new StoreUnloadSendMail(Conn);

            SUSM.PrepareMailToSend(DS);

            Easy_PostData EP = new Easy_PostData();

            EP.InitClass(DS, Conn);
            ProcedureMessageCollection PC = EP.DO_POST_SERVICE();

            if (PC.Count > 0)
            {
                string err = "";
                foreach (EasyProcedureMessage PM in PC)
                {
                    err += PM.AuditID + "/" + PM.TableName + "/" + PM.Operation + "/" + PM.EnforcementNumber + "(" + PM.LongMess + ") ";
                }
                string data = "";
                foreach (DataRow r in DS.storeunloaddetail.Rows)
                {
                    data += "[idstock=" + r["idstock"].ToString() + ",number=" + r["number"].ToString() + ",idbooking=" + r["idbooking"].ToString() +
                            ",idman=" + r["idman"].ToString() + "] ";
                }
                lblMessaggio.Text = "Errore in fase di salvataggio dati: " + err + " Data: " + data;
                GetVars.ClearUserConn(this);
            }
            else
            {
                EP.DO_POST_SERVICE();
                DataRow Curr = DS.storeunload.Rows[0];
                StampaReport(Conn, CfgFn.GetNoNullInt32(Curr["idstoreunload"]));
                SUSM.SendMail();
                lblMessaggio.Text = "Scarico effettuato.";
                txtCodice.Text    = "";
            }
        }