예제 #1
0
        protected void grdFruttiSerie_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                long idFruttoSerie = Convert.ToInt64(e.CommandArgument);

                if (e.CommandName == "Modifica")
                {
                    FruttoSerie fruttoSerie = FruttiSerieDAO.GetAll().Where(w => w.IdFruttoSerie == idFruttoSerie).FirstOrDefault();
                    hfIdFruttoSerie.Value         = idFruttoSerie.ToString();
                    ddlScegliFrutto.SelectedValue = fruttoSerie.IdFrutto.ToString();
                    ddlScegliSerie.SelectedValue  = fruttoSerie.IdSerie.ToString();
                    List <Mamg0> listino = new List <Mamg0>()
                    {
                        Mamg0DAO.GetSingle(fruttoSerie.CodiceListinoUnivoco)
                    };
                    ddlScegliListino.Items.Clear();
                    DropDownListManager.FillDdlMamg0WithIdListino(listino, ref ddlScegliListino);
                    btnInserisciFruttoSerie.Visible = false;
                    btnModificaFruttoSerie.Visible  = !btnInserisciFruttoSerie.Visible;
                }
                else if (e.CommandName == "Elimina")
                {
                    FruttiSerieDAO.Delete(idFruttoSerie);
                    BindGrid();
                }
            }
            catch (Exception ex)
            {
                (Master as layout).SetAlert("alert-danger", $"Errore durante il grdFruttiSerie_RowCommand in GestisciSerie ===> {ex.Message}");
            }
        }
예제 #2
0
        protected void btn_ImportaListino_Click(object sender, EventArgs e)
        {
            DBTransaction tr = new DBTransaction();

            tr.Begin();
            try
            {
                //// Elimino il listino
                //Mamg0DAO.EliminaListino(tr);

                //// Reinserisco tutto il listino Mamg0, recuperando i dati da un file excel nominato Mamg0.xlsx
                //Mamg0DAO.GetDataFromExcelAndInsertBulkCopy(filePath, tr);

                // Nuovo metodo, con txt
                // Elimino il listino
                List <Mamg0> items = ReadDataFromTextFile();
                Mamg0DAO.DeleteListino(tr);
                Mamg0DAO.InsertListino(items, tr);

                tr.Commit();
                lblImportMsg.Text      = "Importazione del listino avvenuta con successo";
                lblImportMsg.ForeColor = Color.Blue;
            }
            catch (Exception ex)
            {
                tr.Rollback();
                lblImportMsg.Text      = "Errore durante l'importazione del listino. <br />" + ex;
                lblImportMsg.ForeColor = Color.Red;
            }

            // Aggiorno la tabella di visualizzazione risultati
            BindGrid();
        }
예제 #3
0
        /* HELPERS */
        protected void BindGrid()
        {
            List <Mamg0> listaDDT = new List <Mamg0>();

            listaDDT = Mamg0DAO.GetListino("", "", "", "", "", "", true);
            grdListino.DataSource = listaDDT;
            grdListino.DataBind();
        }
예제 #4
0
        protected void BindGridWithSearch()
        {
            List <Mamg0> listaDDT = new List <Mamg0>();

            listaDDT = Mamg0DAO.GetListino(txtCodArt1.Text, txtCodArt2.Text, txtCodArt3.Text, txtDescriCodArt1.Text, txtDescriCodArt2.Text, txtDescriCodArt3.Text, false);
            grdListino.DataSource = listaDDT;
            grdListino.DataBind();
        }
예제 #5
0
        private List <DDTMef> ReadDataFromTextFile(int idFornitore)
        {
            List <DDTMef> ddts = new List <DDTMef>();

            try
            {
                string[] lines = File.ReadAllLines(filePathTxt);
                foreach (string line in lines)
                {
                    DDTMef  ddt     = new DDTMef();
                    int     qta     = line.Substring(174, 8).Trim() == "" ? 0 : Convert.ToInt32(line.Substring(174, 8).Trim());
                    decimal importo = line.Substring(185, 12).Trim() == "" ? 0 : Convert.ToDecimal($"{Convert.ToInt32(line.Substring(185, 12).Trim())},{Convert.ToInt32(line.Substring(197, 3).Trim())}");
                    string  sigf    = line.Substring(41, 3).Trim();
                    string  codf    = line.Substring(44, 16).Trim();

                    DateTime data  = GetDateFromString(line.Substring(4, 8).Trim()).Value;
                    DateTime data2 = GetDateFromString(line.Substring(200, 8).Trim()) ?? data;
                    DateTime data3 = GetDateFromString(line.Substring(219, 8).Trim()) ?? data;

                    ddt.Anno                 = line.Substring(0, 4).Trim() == "" ? 0 : Convert.ToInt32(line.Substring(0, 4).Trim());
                    ddt.Data                 = line.Substring(4, 8).Trim() == "" ? new DateTime() : data;
                    ddt.N_DDT                = line.Substring(12, 6).Trim() == "" ? 0 : Convert.ToInt32(line.Substring(12, 6).Trim());
                    ddt.FTVRF0               = line.Substring(18, 15).Trim();
                    ddt.FTDT30               = line.Substring(33, 41).Trim();
                    ddt.CodArt               = line.Substring(41, 19).Trim();
                    ddt.FTAIN                = line.Substring(60, 17).Trim();
                    ddt.DescriCodArt         = line.Substring(77, 40).Trim();
                    ddt.DescrizioneArticolo2 = line.Substring(117, 40).Trim();
                    ddt.Iva = line.Substring(157, 2).Trim() == "" ? 0 : Convert.ToInt32(line.Substring(157, 2).Trim());
                    //ddt.PrezzoListino = line.Substring(159, 12).Trim() == "" ? 0 : Convert.ToDecimal($"{Convert.ToInt32(line.Substring(159, 12).Trim())},{Convert.ToInt32(line.Substring(170, 3).Trim())}");
                    ddt.PrezzoListino  = Convert.ToDecimal(Mamg0DAO.GetPrezzoDiListino(sigf, codf));
                    ddt.Qta            = qta;
                    ddt.Importo        = importo;
                    ddt.Data2          = line.Substring(200, 8).Trim() == "" ? new DateTime() : data2;
                    ddt.Valuta         = line.Substring(208, 3).Trim();
                    ddt.FTFOM          = line.Substring(211, 1).Trim();
                    ddt.FTCMA          = line.Substring(212, 2).Trim();
                    ddt.FTCDO          = line.Substring(214, 2).Trim();
                    ddt.FLFLAG         = line.Substring(216, 1).Trim();
                    ddt.FLFLQU         = line.Substring(217, 2).Trim();
                    ddt.Data3          = line.Substring(219, 8).Trim() == "" ? new DateTime() : data3;
                    ddt.FTORAG         = line.Substring(227, 6).Trim();
                    ddt.FTMLT0         = line.Substring(233, 5).Trim() == "" ? "" : $"{Convert.ToInt32(line.Substring(233, 5).Trim())},{Convert.ToInt32(line.Substring(238, 2).Trim())}";
                    ddt.Importo2       = line.Substring(240, 12).Trim() == "" ? 0 : Convert.ToDecimal($"{Convert.ToInt32(line.Substring(240, 12).Trim())},{Convert.ToInt32(line.Substring(252, 3).Trim())}");
                    ddt.FTIMRA         = line.Substring(255, 12).Trim() == "" ? "" : $"{Convert.ToInt32(line.Substring(255, 12).Trim())},{Convert.ToInt32(line.Substring(267, 3).Trim())}";
                    ddt.AnnoN_ddt      = (line.Substring(0, 4).Trim() == "" || line.Substring(12, 6).Trim() == "") ? 0 : Convert.ToInt32($"{Convert.ToInt32(line.Substring(0, 4).Trim())}{Convert.ToInt32(line.Substring(12, 6).Trim())}");
                    ddt.IdFornitore    = idFornitore;
                    ddt.Acquirente     = txtAcquirente.Text;
                    ddt.PrezzoUnitario = importo / (qta == 0 ? 1 : qta);
                    ddts.Add(ddt);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Errore durante il popolamento della lista dei DDT Mef da ddt.txt", ex);
            }
            return(ddts);
        }
예제 #6
0
 private void FillListino()
 {
     try
     {
         ddlScegliListino.Items.Clear();
         DropDownListManager.FillDdlMamg0WithIdListino(Mamg0DAO.GetListino(txtFiltroCodice1.Text, txtFiltroCodice2.Text, txtFiltroCodice3.Text, txtFiltroDescr1.Text, txtFiltroDescr2.Text, txtFiltroDescr3.Text), ref ddlScegliListino);
     }
     catch (Exception ex)
     {
         (Master as layout).SetAlert("alert-danger", $"Errore durante il FillDdls in GestisciSerie ===> {ex.Message}");
     }
 }
        protected void FillDdlScegliListino()
        {
            List <Mamg0> listMamg0 = Mamg0DAO.GetListino(txtFiltroCodFSS.Text, txtFiltroAA_Des.Text);

            ddlScegliListino.Items.Clear();
            ddlScegliListino.Items.Add(new ListItem("", "-1"));

            foreach (Mamg0 mmg in listMamg0)
            {
                string show = mmg.CodArt + " | " + mmg.Desc + " | " + mmg.PrezzoNetto + " | " + mmg.PrezzoListino + " | " + mmg.Sconto1 + " | " + mmg.Sconto2 + " | " + mmg.Sconto3;
                ddlScegliListino.Items.Add(new ListItem(show, mmg.CodArt.ToString()));
            }
        }
예제 #8
0
        protected void btnEliminaListino_Click(object sender, EventArgs e)
        {
            DBTransaction tr = new DBTransaction();

            tr.Begin();
            try
            {
                Mamg0DAO.DeleteListino(tr);
                tr.Commit();
            }
            catch (Exception ex)
            {
                tr.Rollback();
                throw new Exception("Errore durante l'eliminazione del listino MEF", ex);
            }
            Response.Redirect("~/Listino.aspx");
        }