protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["opt"] == null) { Response.Redirect("login.aspx"); } if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=palette&opt=" + Request.QueryString["opt"].ToString()); } settings = (UtilityMaietta.genSettings)Session["settings"]; u = (UtilityMaietta.Utente)Session["Utente"]; top = new LavClass.TipoOperatore(int.Parse(Request.QueryString["opt"].ToString()), settings.lavTipoOperatoreFile); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); fillAllStati(wc); fillPriorita(settings); fillPrinters(settings); wc.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Request.QueryString["merchantId"] == null || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=amzfindcode"); } Year = (int)Session["year"]; u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; LavClass.MafraInit folder = LavClass.MAFRA_INIT(Server.MapPath("")); if (folder.mafraPath == "") { folder.mafraPath = Server.MapPath("\\"); } settings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); settings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); amzSettings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); /*string folder = LavClass.MAFRA_FOLDER(Server.MapPath("")); * if (folder == "") * folder = Server.MapPath("\\"); * settings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * settings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); * amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); * amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\");*/ Session["settings"] = settings; Session["amzSettings"] = amzSettings; Session["Utente"] = u; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); COUNTRY = Year + " - " + aMerchant.nazione + " " + aMerchant.ImageUrlHtml(25, 40, "inherit"); imgTopLogo.ImageUrl = amzSettings.WebLogo; labReturn.Text = "<a href='amzPanoramica.aspx?token=" + Request.QueryString["token"].ToString() + MakeQueryParams() + "' target='_self'>" + labReturn.Text + "</a>"; if (!Page.IsPostBack && Request.QueryString["findCode"] != null) { rdbFindByCodiceMa.Checked = true; rdbFindBySku.Checked = false; txFindCode.Text = Request.QueryString["findCode"].ToString(); btnFindCode_Click(sender, e); } }
//private int workYear; protected void Page_Load(object sender, EventArgs e) { if (Session["amzSettings"] == null || Session["settings"] == null || Request.QueryString["merchantId"] == null || Request.QueryString["tiporisposta"] == null || Request.QueryString["from"] == null || Request.QueryString["to"] == null || Request.QueryString["ordid"] == null || Request.QueryString["dest"] == null || Request.QueryString["nomeB"] == null) //Request.QueryString["subject"] == null || { Response.Write("Sessione scaduta"); return; } amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; settings = (UtilityMaietta.genSettings)Session["settings"]; UtilityMaietta.Utente u = (UtilityMaietta.Utente)Session["Utente"]; //workYear = DateTime.Today.Year; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); int risposta = int.Parse(Request.QueryString["tiporisposta"].ToString()); string toMail = Request.QueryString["to"].ToString(); //string subject = Request.QueryString["subject"].ToString(); string fromMail = Request.QueryString["from"].ToString(); string ordid = Request.QueryString["ordid"].ToString(); string dest = HttpUtility.UrlDecode(Request.QueryString["dest"].ToString()); string nomeB = HttpUtility.UrlDecode(Request.QueryString["nomeB"].ToString()); string attach = ""; AmazonOrder.Comunicazione com = new AmazonOrder.Comunicazione(risposta, amzSettings, aMerchant); string subject = com.Subject(ordid); if (Request.QueryString["attach"] != null && com.selectedAttach && File.Exists(Request.QueryString["attach"].ToString())) { attach = Request.QueryString["attach"].ToString(); } if (com.hasCommonAttach) { attach = (attach == "") ? String.Join(",", com.commonAttaches) : attach + "," + String.Join(",", com.commonAttaches); } //string attach = (Request.QueryString["attach"] != null && com.selectedAttach && File.Exists(Request.QueryString["attach"].ToString())) ? Request.QueryString["attach"].ToString() : ""; //toMail = "*****@*****.**"; bool send = UtilityMaietta.sendmail(attach, fromMail, toMail, subject, com.GetHtml(ordid, dest, nomeB), false, "", "", settings.clientSmtp, settings.smtpPort, settings.smtpUser, settings.smtpPass, false, null); if (send) { Response.Write("Messaggio inviato."); } Response.Write("<script>window.close();</script>"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["token"] == null || Request.QueryString["token"] == null || Request.QueryString["merchantId"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null) { string fil = (Request.QueryString["localz"] != null) ? "&localz=" + Request.QueryString["localz"].ToString() : ""; Session.Abandon(); Response.Redirect("login.aspx?path=lavMaps" + fil); return; } //workYear = DateTime.Today.Year; Year = (int)Session["year"]; u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); imgTopLogo.ImageUrl = amzSettings.WebLogo; hylGoLav.NavigateUrl = "lavorazioni.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString(); hylGoLav.Target = "_self"; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); this.CODE = " - Prodotti"; string[] codmaie = null; if (!Page.IsPostBack) { if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { dropTypeOper.Visible = true; dropTypeOper.DataSource = null; dropTypeOper.DataBind(); dropTypeOper.DataSource = u.Operatori(); dropTypeOper.DataTextField = "tipo"; dropTypeOper.DataValueField = "id"; dropTypeOper.DataBind(); dropTypeOper.SelectedIndex = 0; op = new LavClass.Operatore(u.Operatori()[0]); } Session["operatore"] = op; if (Request.QueryString["localz"] != null) { OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); cnn.Open(); trBar.Visible = trSearch.Visible = false; codmaie = Request.QueryString["localz"].ToString().Split(','); List <ClassProdotto.Prodotto>[] matrix = ClassProdotto.Prodotto.GetProductsListsForCodes(cnn, codmaie, settings); SetTable(matrix, cnn); cnn.Close(); } else { //(Request.QueryString["search"] != null && bool.Parse(Request.QueryString["search"].ToString())) trBar.Visible = trSearch.Visible = true; } } else { if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } } Account = op.ToString(); TipoAccount = op.tipo.nome; }
protected void Page_Load(object sender, EventArgs e) { if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null || Request.QueryString["merchantId"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=lavModStato"); } u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; Year = (int)Session["year"]; this.amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); this.aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); if (!Page.IsPostBack) { int opid; if (u.OpCount() == 1) { op = u.Operatori()[0]; } else { if (Session["opListN"] != null && int.TryParse(Session["opListN"].ToString(), out opid)) { op = u.Operatori()[opid]; } else { op = u.Operatori()[0]; } } OleDbConnection bc = new OleDbConnection(settings.MainOleDbConnection); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); bc.Open(); fillDropStatoDisplay(dropSourceStato, wc); fillDropStatoAuth(dropTargetStato, bc); bc.Close(); wc.Close(); } else { if (u.OpCount() == 1) { op = u.Operatori()[0]; } else { op = u.Operatori()[int.Parse(Session["opListN"].ToString())]; } txDatetime.Text = Request.Form[txDatetime.UniqueID]; } Account = op.ToString(); TipoAccount = op.tipo.nome; Session["operatore"] = op; labGoHome.Text = "<a href='lavorazioni.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "' target='_self'>" + labGoHome.Text + "</a>"; }
protected void Page_Load(object sender, EventArgs e) { Page.Form.DefaultButton = this.FindControl("btnFindShips").UniqueID; if (Page.IsPostBack && Request.Form["btnLogOut"] != null) { btnLogOut_Click(sender, e); } if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Request.QueryString["merchantId"] == null || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=amzBarCode" + ((Request.QueryString["shipid"] != null)? "&shipid=" + Request.QueryString["shipid"].ToString() : "")); } u = (UtilityMaietta.Utente)Session["Utente"]; op = (LavClass.Operatore)Session["operatore"]; settings = (UtilityMaietta.genSettings)Session["settings"]; //workYear = DateTime.Today.Year; Year = (int)Session["year"]; LavClass.MafraInit folder = LavClass.MAFRA_INIT(Server.MapPath("")); if (folder.mafraPath == "") { folder.mafraPath = Server.MapPath("\\"); } settings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); settings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); amzSettings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); /*string folder = LavClass.MAFRA_FOLDER(Server.MapPath("")); * if (folder == "") * folder = Server.MapPath("\\"); * settings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * settings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); * amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); * amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\");*/ Session["settings"] = settings; Session["amzSettings"] = amzSettings; Session["Utente"] = u; Session["operatore"] = op; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); Account = op.ToString(); TipoAccount = op.tipo.nome; if (op.tipo.id == settings.lavDefMagazzID) { OPERAZIONE = "Genera BarCode"; dropLabels.Visible = labLabs.Visible = printcode = true; } else { OPERAZIONE = "Gestione Spedizione"; dropLabels.Visible = labLabs.Visible = printcode = false; } if (!Page.IsPostBack && printcode) { fillLabels(amzSettings); } if (!Page.IsPostBack && Request.QueryString["shipid"] != null) { txShipCode.Text = Request.QueryString["shipid"].ToString(); btnFindShips_Click(sender, e); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["token"] == null || Request.QueryString["token"] == null || Request.QueryString["merchantId"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=amzconverttrack"); return; } else if (Page.IsPostBack && Request.Form["btnLogOut"] != null) { return; } //workYear = DateTime.Today.Year; Year = (int)Session["year"]; u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); imgTopLogo.ImageUrl = amzSettings.WebLogo; hylGoLav.NavigateUrl = "amzpanoramica.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString(); hylGoLav.Target = "_self"; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); if (!Page.IsPostBack) { if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { dropTypeOper.Visible = true; dropTypeOper.DataSource = null; dropTypeOper.DataBind(); dropTypeOper.DataSource = u.Operatori(); dropTypeOper.DataTextField = "tipo"; dropTypeOper.DataValueField = "id"; dropTypeOper.DataBind(); dropTypeOper.SelectedIndex = 0; op = new LavClass.Operatore(u.Operatori()[0]); } Session["operatore"] = op; fillVettori(settings, amzSettings); } else { if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } } Account = op.ToString(); TipoAccount = op.tipo.nome; }
protected void btnMakePdf_Click(object sender, EventArgs e) { string errore = ""; UtilityMaietta.Utente u = (UtilityMaietta.Utente)Session["Utente"]; //string amzOrd = Request.Form["txNumOrd"].ToString(); string amzOrd = Request.QueryString["amzOrd"].ToString(); bool regalo = (Request.Form["chkRegalo"] != null && Request.Form["chkRegalo"].ToString() == "on"); bool mov = (Request.Form["chkMovimenta"] != null && Request.Form["chkMovimenta"].ToString() == "on") ? true : false; bool comm = (Request.Form["chkSendRisp"] != null && Request.Form["chkSendRisp"].ToString() == "on") ? true : false; DateTime invoiceDate = calInvoiceData.SelectedDate; UtilityMaietta.infoProdotto ip; int count = 0; string pos; string codprod; int codforn, qt; double costo; OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); cnn.Open(); // CHECK DISPONIBILITA if (mov) { foreach (GridViewRow gvr in gridProducts.Rows) { pos = (count + 2).ToString().PadLeft(2, '0'); codprod = gvr.Cells[colCodProd].Text; codforn = int.Parse(gvr.Cells[colCodForn].Text); costo = double.Parse(Request.Form["gridProducts$ctl" + pos + "$txCosto_" + count.ToString().Replace(",", ".")].ToString()); qt = int.Parse(Request.Form["gridProducts$ctl" + pos + "$txQt_" + count.ToString()].ToString()); ip = new UtilityMaietta.infoProdotto(codprod, codforn, cnn, settings); if (ip.getDispDate(cnn, DateTime.Now, false) < qt || ip.getDispDate(cnn, invoiceDate, true) - (qt) < 0) { wc.Close(); cnn.Close(); btnMakePdf.Enabled = false; Response.Write("Quantità indicata non disponibile!"); return; } count++; } } // RECUPERA ORDINE AmazonOrder.Order order; if (Session[amzOrd] == null) { order = AmazonOrder.Order.ReadOrderByNumOrd(amzOrd, amzSettings, aMerchant, out errore); } else { order = (AmazonOrder.Order)Session[amzOrd]; } if (order == null || errore != "") { Response.Write("Impossibile contattare amazon, riprova più tardi!<br />Errore: " + errore); return; } if (order.Items == null || order.Items.Count == 0) { order.RequestItems(amzSettings, aMerchant); } if (order.Items == null || order.Items.Count == 0) { Response.Write("Impossibile contattare amazon, riprova più tardi!<br />Errore: " + errore); return; } int vettS = int.Parse(dropVettori.SelectedValue.ToString()); int invoiceNum; /// IMPORTO DEFINITIVAMENTE L'ORDINE CON I VALORI della precedente schermata. if (Request.QueryString["amzInv"] != null && int.Parse(Request.QueryString["amzInv"].ToString()) > 0) { // ORDINE GIA' COMPLETAMENTE IMPORTATO E CON RICEVUTA, SOLO NUOVE MOVIMENTAZIONI invoiceNum = int.Parse(Request.QueryString["amzInv"].ToString()); } else if (order.IsFullyImported() || order.IsImported()) { // ORDINE COMPLETAMENTE IMPORTATO, CREO NUMERO RICEVUTA e MOVIMENTAZIONI invoiceNum = order.UpdateFullStatus(wc, cnn, amzSettings, aMerchant, invoiceDate, vettS, false); } else { // ORDINE DA IMPORTARE, CREO NUMERO RICEVUTA E MOVIMENTAZIONI invoiceNum = order.SaveFullStatus(wc, cnn, amzSettings, aMerchant, invoiceDate, vettS, false); } string siglaV = dropVettori.SelectedItem.Text; // EMETTI FATTURA AmzIFace.AmazonInvoice.makeInvoicePdf(amzSettings, aMerchant, order, invoiceNum, regalo, invoiceDate, siglaV, chkOpenLav.Checked); string inv = aMerchant.invoicePrefix(amzSettings) + invoiceNum.ToString().PadLeft(2, '0'); // MOVIMENTA SINGOLO CODICE count = 0; List <AmzIFace.CodiciDist> lip = new List <AmzIFace.CodiciDist>(); List <AmzIFace.ProductMaga> pm = new List <AmzIFace.ProductMaga>(); AmzIFace.ProductMaga prod; AmzIFace.CodiciDist cd; int cdpos; foreach (GridViewRow gvr in gridProducts.Rows) { pos = (count + 2).ToString().PadLeft(2, '0'); codprod = gvr.Cells[colCodProd].Text; codforn = int.Parse(gvr.Cells[colCodForn].Text); costo = double.Parse(Request.Form["gridProducts$ctl" + pos + "$txCosto_" + count.ToString()].ToString().Replace(",", ".")); qt = int.Parse(Request.Form["gridProducts$ctl" + pos + "$txQt_" + count.ToString()].ToString()); ip = new UtilityMaietta.infoProdotto(codprod, codforn, cnn, settings); if (mov) { ip.AmzMovimenta(cnn, inv, order.orderid, invoiceDate, costo, qt, order.dataUltimaMod, amzSettings, u); prod = new AmzIFace.ProductMaga(); prod.codicemaietta = ip.codmaietta; //prod.price = costo / 1.22; prod.price = costo / settings.IVA_MOLT; prod.qt = qt; pm.Add(prod); } cd = new AmzIFace.CodiciDist(ip, qt, costo); if (!lip.Contains(cd)) { lip.Add(cd); } else { cdpos = lip.IndexOf(cd); lip[cdpos].AddQuantity(qt, costo); } count++; } cnn.Close(); Session["freeProds"] = lip; if (mov) { UtilityMaietta.writeMagaOrder(pm, amzSettings.AmazonMagaCode, settings, 'F'); } if (comm && Request.Form["dropRisposte"] != null && Request.Form["dropRisposte"].ToString() != "0") { int risposta = int.Parse(Request.Form["dropRisposte"].ToString()); if (risposta != 0) { string fixedFile = AmazonOrder.Order.GetInvoiceFile(amzSettings, aMerchant, invoiceNum); AmazonOrder.Comunicazione com = new AmazonOrder.Comunicazione(risposta, amzSettings, aMerchant); string subject = com.Subject(order.orderid); string attach = (com.selectedAttach && File.Exists(fixedFile)) ? fixedFile : ""; bool send = UtilityMaietta.sendmail(attach, amzSettings.amzDefMail, order.buyer.emailCompratore, subject, com.GetHtml(order.orderid, order.destinatario.ToHtmlFormattedString(), order.buyer.nomeCompratore), false, "", "", settings.clientSmtp, settings.smtpPort, settings.smtpUser, settings.smtpPass, false, null); } } if (chkOpenLav.Checked) { /// APRI LAVORAZIONE Response.Redirect("lavAmzOpen.aspx?token=" + Request.QueryString["token"].ToString() + "&amzOrd=" + order.orderid + "&invnumb=" + inv + "&freeProds=" + lip.Count.ToString() + MakeQueryParams()); } else { /// TORNA IN HOME Response.Redirect("amzPanoramica.aspx?token=" + Session["token"].ToString() + MakeQueryParams()); } }
//189 protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] == null) { Session.Abandon(); Response.Redirect("login.aspx"); } int idlav = int.Parse(Request.QueryString["id"].ToString()); this.LAVID = idlav.ToString().PadLeft(5, '0'); if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null || Request.QueryString["merchantId"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=lavDettaglio&id=" + idlav); } u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; op = (LavClass.Operatore)Session["operatore"]; OleDbConnection cnn = new OleDbConnection(settings.MainOleDbConnection); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); OleDbConnection gc = new OleDbConnection(settings.OleDbConnString); wc.Open(); gc.Open(); cnn.Open(); this.scheda = new LavClass.SchedaLavoro(idlav, settings, wc, gc); this.storLav = LavClass.StatoLavoro.GetLastStato(scheda.id, settings, wc); if (!Page.IsPostBack) { labRiv.Text = scheda.rivenditore.codice + " - " + scheda.rivenditore.azienda + " - <a href='mailto:" + scheda.rivenditore.email + "?subject=" + scheda.nomeLavoro + "&body=Lavorazione " + scheda.id.ToString().PadLeft(4, '0') + " - " + storLav.stato.descrizione + "'>" + scheda.rivenditore.email + "</a>"; labCliente.Text = scheda.utente.id + " - " + scheda.utente.nome; if (scheda.utente.id != 1 && scheda.utente.email != "") { labCliente.Text += " - <a href='mailto:" + scheda.utente.email + "?subject=" + scheda.nomeLavoro + "&body=Lavorazione " + scheda.id.ToString().PadLeft(4, '0') + " - " + storLav.stato.descrizione + "'>" + scheda.utente.email + "</a>"; } labNomeLav.Text = scheda.nomeLavoro; tabName.BorderWidth = 2; tabName.BorderStyle = BorderStyle.Solid; tabName.BorderColor = System.Drawing.Color.LightGray; labInserimento.Text = "Inserita il: <b>" + scheda.datains.ToString() + "</b>"; labConsegna.Text = "Consegna: <b>" + scheda.consegna.ToShortDateString() + "</b>"; labPropriet.Text = scheda.user.ToString(); if (scheda.approvato && scheda.approvatore.id != 0) { labApprov.Text = scheda.approvatore.ToString(); } labInfo.Text = "<br />La lavorazione " + LAVID + " verrà inserita come ordine per il cliente " + scheda.rivenditore.codice + " con i prodotti e le quantità elencati e prezzi da vestito.<br />" + "Sarà anche aggiornata la merce impegnata e da ricevere.<br /><br />"; labPostB.Text = "L'operazione potrebbe richiedere qualche minuto.<br /><br />"; fillProds(scheda.id, cnn); } gc.Close(); wc.Close(); if (scheda.prodotti == null || scheda.prodotti.Count < 1 || op.tipo.id != settings.lavDefCommID) { btnMakeOrder.Visible = false; } else if (CheckOrdineAperto(cnn)) { btnMakeOrder.Visible = false; labInfo.Text = "<br /><font color='red'>Esiste già un ordine per il cliente " + scheda.rivenditore.codice + " con riferimento d'ordine Lav_" + LAVID + ".<br />Impossibile crearne uno ulteriore.</font>"; labPostB.Visible = false; } else { btnMakeOrder.Visible = true; } cnn.Close(); Account = op.ToString(); TipoAccount = op.tipo.nome; }
protected void Page_Load(object sender, EventArgs e) { if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null || Session["operatore"] == null || Request.QueryString["to"] == null || Request.QueryString["subject"] == null || Request.QueryString["from"] == null || Request.QueryString["path"] == null || Request.QueryString["lavid"] == null || Request.QueryString["merchantId"] == null) { Session.Abandon(); if (Request.QueryString["lavid"] != null) { Response.Redirect("login.aspx?path=lavDettaglio&id=" + Request.QueryString["lavid"].ToString()); } else { Response.Redirect("login.aspx"); } } //workYear = DateTime.Today.Year; Year = (int)Session["year"]; u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; op = (LavClass.Operatore)Session["operatore"]; amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); int idlav = int.Parse(Request.QueryString["lavid"].ToString()); this.LAVID = idlav.ToString().PadLeft(5, '0'); if (Request.QueryString["onlinelogo"] != null && bool.Parse(Request.QueryString["onlinelogo"].ToString())) { onlinelogo = true; } AmzIFace.AmazonMerchant chMerch; if (!Page.IsPostBack) { chMerch = (Request.QueryString["chMerchId"] != null && int.Parse(Request.QueryString["chMerchId"].ToString()) > -1) ? new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["chMerchId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings) : aMerchant; //new AmzIFace.AmazonMerchant(int.Parse(dropChMerch.SelectedValue.ToString()), amzSettings.marketPlacesFile, amzSettings) : aMerchant; fillDropLang(chMerch, settings); txMessage.Text = ((onlinelogo) ? chMerch.merchantPreview["lavAmz"].ToString() : "") + chMerch.merchantPreview["lavBozzaMsg"].Replace("LAVID", LAVID); txSubject.Text = ((onlinelogo) ? chMerch.merchantPreview["lavAmzSubject"].ToString() + " " : "") + HttpUtility.UrlDecode(Request.QueryString["subject"].ToString()); imgChMerch.ImageUrl = chMerch.image; tabMail.Rows[0].Visible = false; FileInfo fi = new FileInfo(HttpUtility.UrlDecode(Request.QueryString["path"].ToString())); txFrom.Text = Request.QueryString["from"].ToString(); txTo.Text = Request.QueryString["to"].ToString(); //txSubject.Text = HttpUtility.UrlDecode(Request.QueryString["subject"].ToString()); labAttach.Text = fi.Name; SetImage(fi.FullName); LavClass.StatoLavoro send = new LavClass.StatoLavoro(settings.lavDefStatoSend, settings); chkSetSendBozza.Text = "Aggiungi lo stato: " + send.descrizione; chkSetSendBozza.Checked = true; labBack.Text = "<a href='lavDettaglio.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "&id=" + idlav + "' target='_self'>torna alla scheda</a>"; imgTopLogo.ImageUrl = amzSettings.WebLogo; } else if (Page.IsPostBack && Request.Form["btnSend"] == null) { chMerch = new AmzIFace.AmazonMerchant(int.Parse(dropChMerch.SelectedValue.ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); imgChMerch.ImageUrl = chMerch.image; txMessage.Text = ((onlinelogo) ? chMerch.merchantPreview["lavAmz"].ToString() : "") + chMerch.merchantPreview["lavBozzaMsg"].Replace("LAVID", LAVID); txSubject.Text = ((onlinelogo) ? chMerch.merchantPreview["lavAmzSubject"].ToString() + " " : "") + HttpUtility.UrlDecode(Request.QueryString["subject"].ToString()); } Account = op.ToString(); TipoAccount = op.tipo.nome; COUNTRY = Year + " - " + aMerchant.nazione + " " + aMerchant.ImageUrlHtml(25, 40, "inherit"); //dropChMerch.Visible = imgChMerch.Visible = onlinelogo; }
protected void Page_Load(object sender, EventArgs e) { if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Request.QueryString["merchantId"] == null || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["operatore"] == null || Session["Utente"] == null || Session["settings"] == null || Request.QueryString["amzOrd"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=amzPanoramica"); } u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; op = (LavClass.Operatore)Session["operatore"]; Year = (int)Session["year"]; LavClass.MafraInit folder = LavClass.MAFRA_INIT(Server.MapPath("")); if (folder.mafraPath == "") { folder.mafraPath = Server.MapPath("\\"); } settings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); settings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); amzSettings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); /*string folder = LavClass.MAFRA_FOLDER(Server.MapPath("")); * if (folder == "") * folder = Server.MapPath("\\"); * settings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * settings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); * amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); * amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\");*/ Session["settings"] = settings; Session["amzSettings"] = amzSettings; aMerchant = new AmzIFace.AmazonMerchant(1, amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); freeProds = Request.QueryString["freeProds"] != null && int.Parse(Request.QueryString["freeProds"].ToString()) > 0; OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); cnn.Open(); string errore = ""; AmazonOrder.Order o; if (!CheckNomeLavoro(wc, Request.QueryString["amzOrd"].ToString(), amzSettings.AmazonMagaCode)) // ENTRA SE LAVORAZIONE NON ESISTENTE { if (Session[Request.QueryString["amzOrd"].ToString()] != null) { o = (AmazonOrder.Order)Session[Request.QueryString["amzOrd"].ToString()]; } else { o = AmazonOrder.Order.ReadOrderByNumOrd(Request.QueryString["amzOrd"].ToString(), amzSettings, aMerchant, out errore); } if (o == null || errore != "") { Response.Write("Impossibile contattare amazon, riprova più tardi!<br />Errore: " + errore); cnn.Close(); wc.Close(); return; } string invnumb = (Request.QueryString["invnumb"] != null && Request.QueryString["invnumb"].ToString() != "") ? "Ricevuta nr.:@ " + Request.QueryString["invnumb"].ToString() + " @": ""; if (o.Items == null) { o.RequestItemsAndSKU(amzSettings, aMerchant, settings, cnn, wc); } AmazonOrder.Order.lavInfo info = OpenLavorazioneFromAmz(o, wc, cnn, amzSettings, settings, invnumb); InsertPrimoStorico(info.lavID, wc, op, settings); LavClass.SchedaLavoro.MakeFolder(settings, info.rivID, info.lavID, info.userID); } wc.Close(); cnn.Close(); Response.Redirect("amzPanoramica.aspx?token=" + Request.QueryString["token"].ToString() + "&amzOrd=" + Request.QueryString["amzOrd"].ToString() + MakeQueryParams()); }
protected void Page_Load(object sender, EventArgs e) { if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Request.QueryString["merchantId"] == null || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null || (Request.QueryString["amzOrd"] == null && Request.QueryString["amzSku"] == null && Request.QueryString["amzSingleSku"] == null)) { Session.Abandon(); Response.Redirect("login.aspx?path=amzPanoramica"); } u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; //workYear = DateTime.Today.Year; Year = (int)Session["year"]; LavClass.MafraInit folder = LavClass.MAFRA_INIT(Server.MapPath("")); if (folder.mafraPath == "") { folder.mafraPath = Server.MapPath("\\"); } settings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); settings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); amzSettings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); /*string folder = LavClass.MAFRA_FOLDER(Server.MapPath("")); * settings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * settings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); * amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); * amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\");*/ Session["settings"] = settings; Session["amzSettings"] = amzSettings; Session["Utente"] = u; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); COUNTRY_TITLE = aMerchant.nazione; COUNTRY = Year + " - " + aMerchant.nazione + " " + aMerchant.ImageUrlHtml(25, 40, "inherit"); if (Page.IsPostBack) { } else if (Request.QueryString["amzOrd"] != null) // VENGO DA PANORAMICA VADO IN INVOICE { OPERAZIONE = " Inserimento da ordine"; string amzOrd = Request.QueryString["amzOrd"].ToString(); labOrderID.Text = "Ordine n#: " + amzOrd; string errore = ""; if (Session[amzOrd] != null) { order = (AmazonOrder.Order)Session[Request.QueryString["amzOrd"].ToString()]; } else { order = AmazonOrder.Order.ReadOrderByNumOrd(amzOrd, amzSettings, aMerchant, out errore); } Session[Request.QueryString["amzOrd"].ToString()] = order; if (order == null || errore != "") { Response.Write("Impossibile contattare amazon, riprova più tardi!<br />Errore: " + errore); return; } OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); cnn.Open(); if (order.Items == null) { System.Threading.Thread.Sleep(1500); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); order.RequestItemsAndSKU(amzSettings, aMerchant, settings, cnn, wc); wc.Close(); } FillTableCodes(order, cnn); cnn.Close(); labRedCode.Text = ""; } else if (Request.QueryString["amzSingleSku"] != null) { OPERAZIONE = " Inserimento singolo"; string amzSingleSku = Request.QueryString["amzSingleSku"].ToString(); labOrderID.Text = ""; OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); cnn.Open(); FillTableSingleSku(amzSingleSku, cnn); cnn.Close(); if (amzSingleSku.Contains(" ")) { btnSaveCodes.Enabled = false; } } else if (Request.QueryString["amzSku"] != null) /// MODIFICO SKU ESISTENTE { OPERAZIONE = " Modifica"; string amzSku = Request.QueryString["amzSku"].ToString(); labOrderID.Text = ""; OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); cnn.Open(); wc.Open(); ArrayList items = AmazonOrder.SKUItem.SkuItems(amzSku, wc, cnn, settings, amzSettings); FillTableSKU(items, cnn); cnn.Close(); wc.Close(); labRedCode.Text = "I codici con sfondo rosso sono già movimentati.<br />Non è possibile quindi modificare l'associazione."; } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack && Request.Form["btnLogOut"] != null) { btnLogOut_Click(sender, e); } if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null || Session["operatore"] == null || Request.QueryString["merchantId"] == null) { Session.Abandon(); Response.Write("Sessione scaduta"); return; } u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); cnn.Open(); int rivid = 0, clid = 0; //, lavid = 0; string rivName, clName = null; if (Request.QueryString["rivid"] == null) { wc.Close(); cnn.Close(); return; } else { rivid = int.Parse(Request.QueryString["rivid"].ToString()); rivName = (new UtilityMaietta.clienteFattura(rivid, cnn, settings)).azienda; LAVID = rivName; } if (Request.QueryString["clid"] != null) { clid = int.Parse(Request.QueryString["clid"].ToString()); clName = "(" + clid + ") - " + (new LavClass.UtenteLavoro(clid, rivid, wc, cnn, settings)).nome; LAVID += "<br / >" + clName; } string path = settings.lavFolderAllegati + CreatePath(0, rivid, clid); DirectoryInfo rootInfo = new DirectoryInfo(path); if (clid != 0) { this.PopulateTreeView(rootInfo, null, 0, clName, wc, cnn); } else { this.PopulateTreeView(rootInfo, null, rivid, rivName, wc, cnn); } wc.Close(); cnn.Close(); trvDirectories.CollapseAll(); if (trvDirectories.Nodes.Count > 0) { trvDirectories.Nodes[0].Expand(); } op = (LavClass.Operatore)Session["operatore"]; Account = op.ToString(); TipoAccount = op.tipo.nome; Session["operatore"] = op; }
protected void LoginButton_Click(object sender, EventArgs e) { int id = 0; if (txUserName.Text == "") { return; } bool auth = false; auth = (id = ValidateApplicationUser(txUserName.Text.ToString(), sCrypt(txPassword.Text), settings.userFile)) != 0; bool amazon = (Request.Form["chkAmazon"] != null && Request.Form["chkAmazon"].ToString() == "on"); if (auth) { UtilityMaietta.Utente u = new UtilityMaietta.Utente(settings.userFile, id, Request.ServerVariables["REMOTE_ADDR"].ToString(), Request.ServerVariables["REMOTE_HOST"].ToString(), 0, settings); Session["Utente"] = u; Session["entry"] = true; /*if (u.OpCount() > 1) * { * Session["operatore"] = u.Operatori(); * } * else * Session["operatore"] = u.Operatori()[0];*/ Session["operatore"] = u.Operatori()[0]; string redir, token; token = RandomString(12); Session["token"] = token; Session["year"] = int.Parse(dropYear.SelectedValue); if (Request.QueryString["path"] != null) { redir = Request.QueryString["path"].ToString() + ".aspx"; } else if (amazon) { redir = "amzPanoramica.aspx"; } else { redir = "lavorazioni.aspx"; } redir += "?token=" + token; redir += "&merchantId=" + amid.ToString(); if (Request.QueryString["findCode"] != null) { redir += "&findCode=" + Request.QueryString["findCode"].ToString(); } if (Request.QueryString["shipid"] != null) { redir += "&shipid=" + Request.QueryString["shipid"].ToString(); } if (Request.QueryString["id"] != null) { redir += "&id=" + Request.QueryString["id"].ToString(); } if (Request.QueryString["amzOrd"] != null) { redir += "&amzOrd=" + Request.QueryString["amzOrd"].ToString(); } if (Request.QueryString["localz"] != null) { redir += "&localz=" + Request.QueryString["localz"].ToString(); } if (Request.QueryString["search"] != null) { redir += "&search=" + Request.QueryString["search"].ToString(); } if (Request.Form["chkRememberMe"] != null && Request.Form["chkRememberMe"].ToString() == "on") // SAVE COOKIE NAME { Response.Cookies["authcookie"]["username"] = sCrypt(txUserName.Text); Response.Cookies["authcookie"]["password"] = sCrypt(txPassword.Text); Response.Cookies["authcookie"].Expires = DateTime.Now.AddMonths(2); } Response.Redirect(redir); } else { Session.Abandon(); Response.Redirect("Login.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Request.QueryString["merchantId"] == null || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null || Request.QueryString["amzOrd"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=amzPanoramica"); } Year = (int)Session["year"]; u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; LavClass.MafraInit folder = LavClass.MAFRA_INIT(Server.MapPath("")); if (folder.mafraPath == "") { folder.mafraPath = Server.MapPath("\\"); } settings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); settings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); amzSettings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); /*string folder = LavClass.MAFRA_FOLDER(Server.MapPath("")); * if (folder == "") * folder = Server.MapPath("\\"); * settings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * settings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); * amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); * amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\");*/ Session["settings"] = settings; Session["amzSettings"] = amzSettings; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); AmzInvoicePrefix = aMerchant.invoicePrefix(amzSettings); COUNTRY = Year + " - " + aMerchant.nazione + " " + aMerchant.ImageUrlHtml(25, 40, "inherit"); imgTopLogo.ImageUrl = amzSettings.WebLogo; AmazonOrder.Order o; txNumOrd.Text = Request.QueryString["amzOrd"].ToString(); string errore = ""; if (!Page.IsPostBack) { if (Session[Request.QueryString["amzOrd"].ToString()] != null) { o = (AmazonOrder.Order)Session[Request.QueryString["amzOrd"].ToString()]; } else { o = AmazonOrder.Order.ReadOrderByNumOrd(txNumOrd.Text, amzSettings, aMerchant, out errore); } if (o == null || errore != "") { Response.Write("Impossibile contattare amazon, riprova più tardi!<br />Errore: " + errore); btnMakePdf.Enabled = false; return; } else { btnMakePdf.Enabled = true; } Session[Request.QueryString["amzOrd"].ToString()] = o; fillRisposte(amzSettings, aMerchant); dropRisposte.SelectedValue = ((Request.QueryString["tiporisposta"] != null) ? int.Parse(Request.QueryString["tiporisposta"].ToString()) : amzSettings.amzDefaultRispID).ToString(); OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); cnn.Open(); fillVettori(cnn); cnn.Close(); calDataInvoice.SelectedDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); if (Request.QueryString["amzInv"] != null && int.Parse(Request.QueryString["amzInv"].ToString()) > 0) { txInvoiceNum.Text = Request.QueryString["amzInv"].ToString(); } if (Request.QueryString["noMov"] != null && bool.Parse(Request.QueryString["noMov"].ToString())) { chkMovimenta.Checked = false; chkMovimenta.Enabled = false; } else if (!amzSettings.amzPrimeLocalScarico && o.canaleOrdine.Index == AmazonOrder.FulfillmentChannel.LOGISTICA_AMAZON) { chkMovimenta.Checked = false; chkMovimenta.Enabled = false; } chkMakeEcmScheda.Checked = chkMovimenta.Checked; chkMakeEcmScheda.Enabled = chkMovimenta.Enabled; } else { o = (AmazonOrder.Order)Session[Request.QueryString["amzOrd"].ToString()]; } if (o != null) { calDataInvoice.SelectedDate = calDataInvoice.VisibleDate = o.InvoiceDate; } if (chkMovimenta.Enabled) { chkMovimenta.Checked = true; } if (Request.QueryString["vector"] != null && bool.Parse(Request.QueryString["vector"].ToString())) { chkMakeEcmScheda.Checked = chkMovimenta.Checked = chkRegalo.Checked = chkSendRisp.Checked = false; chkMakeEcmScheda.Enabled = chkMovimenta.Enabled = chkRegalo.Enabled = chkSendRisp.Enabled = false; txInvoiceNum.Enabled = txNumOrd.Enabled = false; calDataInvoice.Enabled = dropRisposte.Enabled = false; dropVettori.Enabled = true; dropVettori.SelectedIndex = dropVettori.Items.IndexOf(dropVettori.Items.FindByText(o.GetSiglaVettoreStatus())); btnMakePdf.Text = "Aggiorna Vettore"; } labDataScelta.Text = calDataInvoice.SelectedDate.ToShortDateString(); chkMovimenta.Checked = false; // inserito momentaneamente per cambio anno }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack && Request.Form["btnLogOut"] != null) { ///POSTBACK PER LOGOUT btnLogOut_Click(sender, e); } if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Request.QueryString["merchantId"] == null || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=amzShipDownload"); } u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; labGoLav.Text = "<a href='lavorazioni.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"] + "' target='_self'>Lavorazioni</a>"; imbNextPag.Visible = false; //workYear = DateTime.Today.Year; Year = (int)Session["year"]; if (!Page.IsPostBack && CheckQueryParams()) { Session["shipmentColumns"] = Session["shipOrderlist"] = Session["gvCsv"] = null; /// PAGINA PRIMO LOAD CON RITORNO DA ALTRA PAGINA, PARAMETRI INIZIALI SU QUERYSTRING LavClass.MafraInit folder = LavClass.MAFRA_INIT(Server.MapPath("")); if (folder.mafraPath == "") { folder.mafraPath = Server.MapPath("\\"); } settings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); settings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); amzSettings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); /*string folder = LavClass.MAFRA_FOLDER(Server.MapPath("")); * if (folder == "") * folder = Server.MapPath("\\"); * settings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * settings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); * amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); * amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\");*/ Session["amzSettings"] = amzSettings; Session["settings"] = settings; DateTime stDate = DateTime.Parse(Request.QueryString["sd"].ToString()); DateTime endDate = DateTime.Parse(Request.QueryString["ed"].ToString()); calFrom.SelectedDate = new DateTime(stDate.Year, stDate.Month, stDate.Day); calTo.SelectedDate = new DateTime(endDate.Year, endDate.Month, endDate.Day); rdbTuttiLav.Checked = true; fillDropStati(); dropStato.SelectedIndex = int.Parse(Request.QueryString["status"].ToString()); fillDropOrdina(); dropOrdina.SelectedIndex = int.Parse(Request.QueryString["order"].ToString()); dropResults.SelectedIndex = int.Parse(Request.QueryString["results"].ToString()); //dataModifica = bool.Parse(Request.QueryString["concluso"].ToString()); dataModifica = int.Parse(Request.QueryString["concluso"].ToString()) == ((int)AmazonOrder.Order.SEARCH_DATA.Data_Concluso); fillVettori(settings, amzSettings); OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); cnn.Open(); fillVettoriFiltro(cnn, amzSettings); cnn.Close(); imbNextPag.Visible = false; if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { dropTypeOper.Visible = true; dropTypeOper.DataSource = null; dropTypeOper.DataBind(); dropTypeOper.DataSource = u.Operatori(); dropTypeOper.DataTextField = "tipo"; dropTypeOper.DataValueField = "id"; dropTypeOper.DataBind(); dropTypeOper.SelectedIndex = 0; if (Session["opListN"] != null) { dropTypeOper.SelectedIndex = (int)Session["opListN"]; op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } else { dropTypeOper.SelectedIndex = 0; op = new LavClass.Operatore(u.Operatori()[0]); } } soloLav = (rdbConLav.Checked); soloAuto = (rdbSoloPartenza.Checked); fillListaFiltro(amzSettings); btnShowSped_Click(sender, e); } else if (!Page.IsPostBack) { /// PAGINA PRIMO LOAD Session["shipmentColumns"] = Session["shipOrderlist"] = Session["gvCsv"] = null; LavClass.MafraInit folder = LavClass.MAFRA_INIT(Server.MapPath("")); if (folder.mafraPath == "") { folder.mafraPath = Server.MapPath("\\"); } settings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); settings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); amzSettings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); /*string folder = LavClass.MAFRA_FOLDER(Server.MapPath("")); * if (folder == "") * folder = Server.MapPath("\\"); * settings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * settings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); * amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); * amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\");*/ Session["amzSettings"] = amzSettings; Session["settings"] = settings; calTo.SelectedDate = (DateTime.Today.Year == Year) ? DateTime.Today : (new DateTime(Year, 12, 31)); calFrom.SelectedDate = (calTo.SelectedDate.AddDays(-15).Year == Year) ? calTo.SelectedDate.AddDays(-15) : (new DateTime(calTo.SelectedDate.Year, 1, 1)); calFrom.VisibleDate = calFrom.SelectedDate; calTo.VisibleDate = calTo.SelectedDate; fillDropStati(); fillDropOrdina(); fillVettori(settings, amzSettings); OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); cnn.Open(); fillVettoriFiltro(cnn, amzSettings); cnn.Close(); imbNextPag.Visible = false; if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { dropTypeOper.Visible = true; dropTypeOper.DataSource = null; dropTypeOper.DataBind(); dropTypeOper.DataSource = u.Operatori(); dropTypeOper.DataTextField = "tipo"; dropTypeOper.DataValueField = "id"; dropTypeOper.DataBind(); if (Session["opListN"] != null) { dropTypeOper.SelectedIndex = (int)Session["opListN"]; op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } else { dropTypeOper.SelectedIndex = 0; op = new LavClass.Operatore(u.Operatori()[0]); } } Session["operatore"] = op; soloLav = (rdbConLav.Checked); soloAuto = (rdbSoloPartenza.Checked); dataModifica = (rdbDataMod.Checked); fillListaFiltro(amzSettings); } else if (Page.IsPostBack && Request.QueryString["amzToken"] != null) { /// POSTBACK DA AMAZON TOKEN PAGINA SUCCESSIVA if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } amzToken = (Request.QueryString["amzToken"].ToString()); this.amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; this.settings = (UtilityMaietta.genSettings)Session["settings"]; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); DateTime stDate = new DateTime(calFrom.SelectedDate.Year, calFrom.SelectedDate.Month, calFrom.SelectedDate.Day, 0, 0, 0); DateTime endDate = new DateTime(calTo.SelectedDate.Year, calTo.SelectedDate.Month, calTo.SelectedDate.Day, 23, 59, 59); if (endDate > DateTime.Now) { endDate = DateTime.Now.AddMinutes(-10); } int res = int.Parse(dropResults.SelectedValue.ToString()); int stIn = dropStato.SelectedIndex; dataModifica = (Request.Form["rdgData"] != null && Request.Form["rdgData"].ToString() == "rdbDataMod"); bool isPrime = (Request.Form["chkPrime"] != null && Request.Form["chkPrime"].ToString() == "on"); useFilters = true; amzQueryToken(stDate, endDate, res, amzToken, stIn, dataModifica, isPrime, op.tipo, settings); if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } soloLav = (Request.Form["rdgLav"] != null && Request.Form["rdgLav"].ToString() == "rdbConLav"); soloAuto = (Request.Form["rdgLav"] != null && Request.Form["rdgLav"].ToString() == "rdbSoloPartenza"); if (Page.IsPostBack && Session["shipmentColumns"] != null && Session["gvCsv"] != null) { fillCsvGridColumns((ArrayList)Session["shipmentColumns"]); fillCsvGrid(); } } else if (Page.IsPostBack && Request.Form["btnAddOrderList"] != null) { this.amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; this.settings = (UtilityMaietta.genSettings)Session["settings"]; if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } fillGridColumns((ArrayList)Session["shipmentColumns"]); gvShips.DataSource = Session["shipOrderlist"] as ArrayList; gvShips.DataBind(); dataModifica = (Request.Form["rdgData"] != null && Request.Form["rdgData"].ToString() == "rdbDataMod"); soloLav = (Request.Form["rdgLav"] != null && Request.Form["rdgLav"].ToString() == "rdbConLav"); soloAuto = (Request.Form["rdgLav"] != null && Request.Form["rdgLav"].ToString() == "rdbSoloPartenza"); } else if (Page.IsPostBack && (Request.Form["btnFindSingleOrder"] != null || Request.Form["btnFindInvoice"] != null || Request.Form["btnFindOrderFile"] != null)) { this.useFilters = false; this.singleOrder = true; this.amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; this.settings = (UtilityMaietta.genSettings)Session["settings"]; if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } dataModifica = (Request.Form["rdgData"] != null && Request.Form["rdgData"].ToString() == "rdbDataMod"); soloLav = (Request.Form["rdgLav"] != null && Request.Form["rdgLav"].ToString() == "rdbConLav"); soloAuto = (Request.Form["rdgLav"] != null && Request.Form["rdgLav"].ToString() == "rdbSoloPartenza"); } else { this.amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; this.settings = (UtilityMaietta.genSettings)Session["settings"]; if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } dataModifica = (Request.Form["rdgData"] != null && Request.Form["rdgData"].ToString() == "rdbDataMod"); soloLav = (Request.Form["rdgLav"] != null && Request.Form["rdgLav"].ToString() == "rdbConLav"); soloAuto = (Request.Form["rdgLav"] != null && Request.Form["rdgLav"].ToString() == "rdbSoloPartenza"); if (Page.IsPostBack && Page.Request.Params["__EVENTTARGET"] != null && (Page.Request.Params["__EVENTTARGET"].ToString() == "dropTypeOper" || Page.Request.Params["__EVENTTARGET"].ToString() == "calFrom" || Page.Request.Params["__EVENTTARGET"].ToString() == "calTo")) { gvShips.DataSource = null; gvShips.DataBind(); chkSetInTime.Visible = chkSetShipped.Visible = btnMakeFile.Visible = btnAddOrderList.Visible = false; } if (Page.IsPostBack && Session["shipmentColumns"] != null && Session["gvCsv"] != null) { fillCsvGridColumns((ArrayList)Session["shipmentColumns"]); fillCsvGrid(); } } aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); invPrefix = aMerchant.invoicePrefix(amzSettings); COUNTRY = Year + " - " + aMerchant.nazione + " " + aMerchant.ImageUrlHtml(25, 40, "inherit"); Account = op.ToString(); TipoAccount = op.tipo.nome; labGoPanoramica.Text = "<a href='amzPanoramica.aspx?token=" + Request.QueryString["token"].ToString() + MakeQueryParams() + "&merchantId=" + aMerchant.id + "' target='_self'>Panoramica</a>"; Session["opListN"] = dropTypeOper.SelectedIndex; }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack && Request.Form["btnLogOut"] != null) { btnLogOut_Click(sender, e); } if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Request.QueryString["merchantId"] == null || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=amzMultilabelPrint" + ((Request.QueryString["amzOrd"] != null) ? "&amzOrd=" + Request.QueryString["amzOrd"].ToString():"")); } Year = (int)Session["year"]; u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; LavClass.MafraInit folder = LavClass.MAFRA_INIT(Server.MapPath("")); if (folder.mafraPath == "") { folder.mafraPath = Server.MapPath("\\"); } settings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); settings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@folder.mafraInOut1[0], @folder.mafraInOut1[1]); amzSettings.ReplacePath(@folder.mafraInOut2[0], @folder.mafraInOut2[1]); /*string folder = LavClass.MAFRA_FOLDER(Server.MapPath("")); * if (folder == "") * folder = Server.MapPath("\\"); * settings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * settings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); * amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); * amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); * amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\");*/ Session["settings"] = settings; Session["amzSettings"] = amzSettings; labGoLav.Text = "<a href='amzPanoramica.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "' target='_self'>Home</a>"; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); COUNTRY = Year + " - " + aMerchant.nazione + " " + aMerchant.ImageUrlHtml(25, 40, "inherit"); imgTopLogo.ImageUrl = amzSettings.WebLogo; if (!Page.IsPostBack) { fillLabels(amzSettings); if (Request.QueryString["labCode"] != null) { dropLabels.SelectedValue = Request.QueryString["labCode"].ToString(); labGoLav.Text = "<a href='amzPanoramica.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "&labCode=" + Request.QueryString["labCode"].ToString() + "' target='_self'>Home</a>"; } else { dropLabels.SelectedIndex = 0; } } paperLab = new AmzIFace.AmazonInvoice.PaperLabel(0, 0, amzSettings.amzPaperLabelsFile, dropLabels.SelectedValue.ToString()); string errore = ""; if (!Page.IsPostBack && Request.QueryString["amzBCSku"] != null && Request.QueryString["labQt"] != null && Request.QueryString["descBC"] != null && Request.QueryString["status"] != null && Request.QueryString["labCode"] != null) { // STAMPA BARCODE int numLabels = int.Parse(Request.QueryString["labQt"].ToString()); string sku = Request.QueryString["amzBCSku"].ToString(); string descBC = HttpUtility.HtmlDecode(HttpUtility.UrlDecode(Request.QueryString["descBC"].ToString())); string status = Request.QueryString["status"].ToString(); if (numLabels >= paperLab.rows * paperLab.cols) // occupano intera pagina o più { Response.Redirect("download.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "&amzBCSku=" + Request.QueryString["amzBCSku"].ToString() + "&labQt=" + numLabels.ToString() + "&descBC=" + HttpUtility.UrlEncode(descBC) + "&status=" + status + "&labCode=" + Request.QueryString["labCode"].ToString()); } else // SI PUO' SCEGLIERE POSIZIONE SUL FOGLIO { numAddr = numLabels.ToString(); if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { dropTypeOper.Visible = true; dropTypeOper.DataSource = null; dropTypeOper.DataBind(); dropTypeOper.DataSource = u.Operatori(); dropTypeOper.DataTextField = "tipo"; dropTypeOper.DataValueField = "id"; dropTypeOper.DataBind(); dropTypeOper.SelectedIndex = 0; op = new LavClass.Operatore(u.Operatori()[0]); } Session["operatore"] = op; labOrderID.Text = ""; labAddress.Text = ""; makeBarCode(sku); MakeTable(paperLab.cols, paperLab.rows, true); btnPrint.OnClientClick = "return (checkNum());"; labDest.Text = "Codice a barre: "; } } else if (!Page.IsPostBack && Request.QueryString["amzAddr"] != null && bool.Parse(Request.QueryString["amzAddr"].ToString())) { // STAMPA ETICHETTE MULTIPLE if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { dropTypeOper.Visible = true; dropTypeOper.DataSource = null; dropTypeOper.DataBind(); dropTypeOper.DataSource = u.Operatori(); dropTypeOper.DataTextField = "tipo"; dropTypeOper.DataValueField = "id"; dropTypeOper.DataBind(); dropTypeOper.SelectedIndex = 0; op = new LavClass.Operatore(u.Operatori()[0]); } Session["operatore"] = op; labOrderID.Text = ""; labAddress.Text = ""; if (((ArrayList)Session["addresses"]).Count > (paperLab.cols * paperLab.rows)) { tabAddr.Visible = tabPaperSize.Visible = tabPaper.Visible = false; } else { MakeAddress((ArrayList)Session["addresses"]); MakeTable(paperLab.cols, paperLab.rows, true); btnPrint.OnClientClick = "return (checkNum());"; labDest.Text = "Destinatario: "; } numAddr = ((ArrayList)Session["addresses"]).Count.ToString(); labInfoBollino.Visible = txDownloadList.Visible = labDownloadList.Visible = hylDownloadList.Visible = true; labInfoBollino.Text = "Ultime " + VARNUM + " cifre variano"; } else if (!Page.IsPostBack && Request.QueryString["amzOrd"] != null) { if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { dropTypeOper.Visible = true; dropTypeOper.DataSource = null; dropTypeOper.DataBind(); dropTypeOper.DataSource = u.Operatori(); dropTypeOper.DataTextField = "tipo"; dropTypeOper.DataValueField = "id"; dropTypeOper.DataBind(); dropTypeOper.SelectedIndex = 0; op = new LavClass.Operatore(u.Operatori()[0]); } Session["operatore"] = op; labOrderID.Text = "Ordine #: " + Request.QueryString["amzOrd"].ToString(); AmazonOrder.Order order; if (Session[Request.QueryString["amzOrd"].ToString()] != null) { order = (AmazonOrder.Order)Session[Request.QueryString["amzOrd"].ToString()]; } else { order = AmazonOrder.Order.ReadOrderByNumOrd(Request.QueryString["amzOrd"].ToString(), amzSettings, aMerchant, out errore); } if (order == null || errore != "") { Response.Write("Impossibile contattare Amazon, riprovare più tardi!<br />Errore: " + errore); chkSetInTime.Enabled = chkSetShipped.Enabled = btnPrint.Enabled = false; return; } labAddress.Text = order.destinatario.ToStringLabelHtml(); Session["destinatario"] = order.destinatario; MakeTable(paperLab.cols, paperLab.rows, false); numAddr = "1"; labDest.Text = "Destinatario: "; } else if (Page.IsPostBack && Request.Form["btnPrint"] != null) { if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } hypHome.NavigateUrl = "amzPanoramica.aspx?token=" + Session["token"].ToString() + MakeQueryParams(); hypHome.Visible = true; chkSetInTime.Enabled = chkSetShipped.Enabled = btnPrint.Enabled = false; } else if (Page.IsPostBack) { if ((Request.QueryString["amzBCSku"] != null && Request.QueryString["labQt"] != null && Request.QueryString["descBC"] != null && Request.QueryString["status"] != null)) { // STAMPA CODICI BARRE multipleSel = true; makeBarCode(Request.QueryString["amzBCSku"].ToString()); numAddr = Request.QueryString["labQt"].ToString(); } else if (Request.QueryString["amzAddr"] != null && bool.Parse(Request.QueryString["amzAddr"].ToString())) {// STAMPA ETICHETTE MULTIPLE multipleSel = true; //MakeAddress((ArrayList)Session["addresses"], (ArrayList)Session["orderList"]); MakeAddress((ArrayList)Session["addresses"]); numAddr = ((ArrayList)Session["addresses"]).Count.ToString(); } else {// STAMPA ETICHETTA SINGOLA multipleSel = false; AmazonOrder.Order order; if (Session[Request.QueryString["amzOrd"].ToString()] != null) { order = (AmazonOrder.Order)Session[Request.QueryString["amzOrd"].ToString()]; } else { order = AmazonOrder.Order.ReadOrderByNumOrd(Request.QueryString["amzOrd"].ToString(), amzSettings, aMerchant, out errore); } if (order == null || errore != "") { Response.Write("Impossibile contattare Amazon, riprovare più tardi!<br />Errore: " + errore); chkSetInTime.Enabled = chkSetShipped.Enabled = btnPrint.Enabled = false; return; } numAddr = "1"; labAddress.Text = order.destinatario.ToStringLabelHtml(); } if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } hypHome.NavigateUrl = "amzPanoramica.aspx?token=" + Session["token"].ToString() + MakeQueryParams(); hypHome.Visible = true; } else { Response.Redirect("amzPanoramica.aspx?token=" + Request.QueryString["token"]); } hypHome.NavigateUrl = "amzPanoramica.aspx?token=" + Session["token"].ToString() + MakeQueryParams(); Account = op.ToString(); TipoAccount = op.tipo.nome; /*SetInfo(amzSettings.amzLabelW, amzSettings.amzLabelH, amzSettings.amzLabelTopM, amzSettings.amzLabelLeftM, amzSettings.amzLabelColonna, amzSettings.amzLabelRiga, * amzSettings.amzLabelInfraRiga, amzSettings.amzLabelInfraColonna);*/ SetInfo(paperLab); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack && Request.Form["btnLogOut"] != null) { btnLogOut_Click(sender, e); } if (Session["entry"] == null || !bool.Parse(Session["entry"].ToString()) || Session["token"] == null || Request.QueryString["token"] == null || Session["token"].ToString() != Request.QueryString["token"].ToString() || Session["Utente"] == null || Session["settings"] == null || Request.QueryString["merchantId"] == null) { Session.Abandon(); Response.Redirect("login.aspx?path=lavorazioni"); } hypRefresh.NavigateUrl = HttpContext.Current.Request.Url.PathAndQuery; hylAmazon.NavigateUrl = "amzPanoramica.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString(); labVersion.Text = "Versione " + (new FileInfo(Server.MapPath("lavorazioni.aspx"))).LastWriteTime.ToString(); hylMaps.NavigateUrl = "lavMaps.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "&search=true"; approvate = chkSoloApprovate.Checked; incomplete = chkSoloInevase.Checked; soloCommer = chkSoloCommerciale.Checked; sospesi = chkMostraSospesi.Checked; u = (UtilityMaietta.Utente)Session["Utente"]; settings = (UtilityMaietta.genSettings)Session["settings"]; HttpCookie aCookie; Session["settings"] = settings; Session["entry"] = "true"; Session["token"] = Request.QueryString["token"].ToString(); Session["Utente"] = u; //workYear = DateTime.Today.Year; Year = (int)Session["year"]; amzSettings = new AmzIFace.AmazonSettings(settings.lavAmazonSettingsFile, Year); amzSettings.ReplacePath(@"G:\", @"\\10.0.0.80\c$\"); amzSettings.ReplacePath(@"F:\", @"\\10.0.0.2\c$\"); aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); COUNTRY = Year + " - " + aMerchant.nazione + " " + aMerchant.ImageUrlHtml(25, 40, "inherit"); if (!Page.IsPostBack) { if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { dropTypeOper.Visible = true; dropTypeOper.DataSource = null; dropTypeOper.DataBind(); dropTypeOper.DataSource = u.Operatori(); dropTypeOper.DataTextField = "tipo"; dropTypeOper.DataValueField = "id"; dropTypeOper.DataBind(); if (Session["opListN"] != null) { dropTypeOper.SelectedIndex = (int)Session["opListN"]; op = new LavClass.Operatore(u.Operatori()[(int)Session["opListN"]]); } else { dropTypeOper.SelectedIndex = 0; op = new LavClass.Operatore(u.Operatori()[0]); } } fillOperatori(settings); fillPriorita(settings); fillObiettivi(settings); fillTipoStampa(settings); fillMacchine(settings); fillStatiLavoro(settings); chkSoloApprovate.Checked = (op.tipo.id != settings.lavDefSuperVID); chkSoloMieiStati.Checked = true; if (Request.Cookies["operatore"] != null) { aCookie = Request.Cookies["operatore"]; DropOperatoreV.SelectedValue = aCookie.Value.ToString(); } else if (DropOperatoreV.Items.Contains((new ListItem(op.ToString(), op.id.ToString())))) { DropOperatoreV.SelectedValue = op.id.ToString(); } if (op.tipo.id == settings.lavDefCommID) { soloCommer = chkSoloCommerciale.Checked = true; } InfoTab.Rows[0].Visible = false; } else { if (u.OpCount() == 1) { op = new LavClass.Operatore(u.Operatori()[0]); } else { op = new LavClass.Operatore(u.Operatori()[dropTypeOper.SelectedIndex]); } if (Request.Params.Get("__EVENTTARGET") == "dropTypeOper") { if (op.tipo.id == settings.lavDefCommID) { soloCommer = chkSoloCommerciale.Checked = true; } else { soloCommer = chkSoloCommerciale.Checked = false; } } if (Request.Form["btnGoToLav"] != null) { int idlav; if (int.TryParse(Request.Form["txGoToLav"].ToString(), out idlav)) { Response.Redirect("lavDettaglio.aspx?id=" + idlav + "&token=" + Session["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString()); } } else if (Request.Form["btnGoToOrder"] != null) { OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); int id = LavClass.SchedaLavoro.GetLavorazioneID(txGoToOrder.Text, amzSettings.AmazonMagaCode, wc); wc.Close(); if (id != 0) { Response.Redirect("lavDettaglio.aspx?id=" + id.ToString() + "&token=" + Session["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString()); } else { Response.Write("<script lang='text/javascript'>alert('Nessuna lavorazione per " + txGoToOrder.Text + "!');</script>"); txGoToOrder.Text = ""; } } else if (Request.Form["btnGoToMCS"] != null) { OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); int id = LavClass.SchedaLavoro.TryGetMCS(txGoToMCS.Text, wc, settings); wc.Close(); if (id != 0) { Response.Redirect("lavDettaglio.aspx?id=" + id.ToString() + "&token=" + Session["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString()); } else { Response.Write("<script lang='text/javascript'>alert('Nessuna lavorazione per MCS " + txGoToMCS.Text + "!');</script>"); txGoToMCS.Text = ""; } } } soloMieiStati = chkSoloMieiStati.Checked; Session["opListN"] = dropTypeOper.SelectedIndex; if (op.tipo.id == settings.lavDefSuperVID) { trApprovate.Visible = chkSoloApprovate.Visible = true; } else { trApprovate.Visible = chkSoloApprovate.Visible = false; } if (op.tipo.id == settings.lavDefCommID) { chkSoloCommerciale.Visible = true; } else { chkSoloCommerciale.Visible = false; } Account = op.ToString(); TipoAccount = op.tipo.nome; if (op.tipo.id == settings.lavDefSuperVID) { trStati.Visible = chkSoloMieiStati.Visible = false; } else { trStati.Visible = chkSoloMieiStati.Visible = true; } if (op.tipo.id == settings.lavDefOperatoreID) { chkMostraSospesi.Visible = false; } else { chkMostraSospesi.Visible = true; } try { cookieX = XDocument.Load(settings.lavCookieFile); } catch (Exception ex) { } fillGrid(settings, op); writeCookieXML(settings, op); if (cookieX != null) { clearCookieXML(cookieX, settings, LavClass.CookieLav.rootDesc, op.id); } labLinkPalette.Text = "Palette / Legenda"; labLinkPalette.Text = "<a href='palette.aspx?token=" + Session["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "&opt=" + op.tipo.id + "' target='_blank'>" + labLinkPalette.Text + "</a>"; labGoLav.Text = "<a href='lavModStato.aspx?token=" + Session["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "' target='_self'>" + labGoLav.Text + "</a>"; if (Request.QueryString["error"] != null) { Response.Write("<font color='red'><b>Errore: " + LavClass.LISTA_ERRORI[int.Parse(Request.QueryString["error"].ToString())] + "</b></font>"); } }
//private int Year; protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["bprefix"] != null && Request.QueryString["start"] != null && Request.QueryString["vettID"] != null && Session["addresses"] != null && Session["orderList"] != null) { amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; settings = (UtilityMaietta.genSettings)Session["settings"]; string csv = ""; string bprefix = Request.QueryString["bprefix"].ToString(); int start = int.Parse(Request.QueryString["start"].ToString()); int vettID = int.Parse(Request.QueryString["vettID"].ToString()); string code; int c = 0; List <string> lines = new List <string>(); for (c = 0; c < ((ArrayList)Session["addresses"]).Count; c++) { code = bprefix + (start + c).ToString().PadLeft(2, '0'); //csv = ((AmazonOrder.Order)((ArrayList)Session["orderIDS"])[c]).orderid + "\t" + DateTime.Today.ToString("ddMMyy") + "\t" + code.ToUpper(); csv = (((ArrayList)Session["orderIDS"])[c]).ToString() + "\t" + DateTime.Today.ToString("ddMMyy") + "\t" + code.ToUpper(); lines.Add(csv); } Shipment.ShipRead sr = new Shipment.ShipRead(vettID, amzSettings.amzShipReadColumns); string[] array = Shipment.ShipRead.AmazonLoadTable(lines, sr, '\t'); csv = ""; foreach (string s in array) { csv = (csv == "") ? s : csv + '\n' + s; } Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=" + bprefix + start + "_" + c + ".txt"); Response.Charset = ""; Response.ContentType = "application/text"; Response.Output.Write(csv); Response.Flush(); Response.End(); } else if (Request.QueryString["shipment"] != null && Session["shipmentTable"] != null) { string vettName = Request.QueryString["shipment"].ToString(); System.Data.DataTable csvTable = (System.Data.DataTable)Session["shipmentTable"]; string csv = ""; int i; foreach (DataRow dr in csvTable.Rows) { for (i = 0; i < csvTable.Columns.Count - 1; i++) { csv += dr[i].ToString() + ";"; } csv += dr[i].ToString() + Environment.NewLine; } Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=" + vettName + "_" + csvTable.Rows.Count.ToString() + ".csv"); Response.Charset = ""; Response.ContentType = "application/text"; Response.Output.Write(csv); Response.Flush(); Response.End(); } else if (Request.QueryString["csvPackage"] != null && Session[Request.QueryString["csvPackage"].ToString()] != null) { amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; string shipid = Request.QueryString["csvPackage"].ToString(); FileUpload fup = ((FileUpload)Session["fupPackage"]); string sourceFile = fup.FileName; ((FileUpload)Session["fupPackage"]).SaveAs(Path.Combine(Server.MapPath("temp"), "model_" + sourceFile)); string localFile = Path.Combine(Server.MapPath("temp"), "model_" + sourceFile); List <string> lines = File.ReadLines(localFile).ToList(); int colSt = SHIP_MODEL_COL_START; int rowSt = SHIP_MODEL_ROW_START; string[] linea; string fnsku; boxSets.shipsInfo ship = (boxSets.shipsInfo)Session["ship_" + shipid]; boxSets.Box box; List <int> boxlistIndexes; List <string[]> finalRows = new List <string[]>(); DateTime? scad; int hPos; // PER OGNI SKU CERCO I BOX for (int i = rowSt; i < lines.Count; i++) { linea = lines[i].Split('\t'); fnsku = linea[SHIP_MODEL_FNSKU_COL]; boxlistIndexes = ship.BoxContainsNames(fnsku); // PER OGNI BOX IN CUI SKU è PRESENTE SCRIVO QUANTITA foreach (int index in boxlistIndexes) { //box = ship.GetBox(bid); box = ship.GetBox(index); scad = box.GetScadenza(fnsku); hPos = (index * 2) + colSt; //hPos = (box.id * 2) + colSt; linea[hPos] = box.GetItemsQtBySku(fnsku).ToString(); //if (hPos + 1 < linea.Length && linea[hPos + 1].Trim() == "") if (scad.HasValue && hPos + 1 < linea.Length && linea[hPos + 1].Trim() == "") { //linea[hPos + 1] = DateTime.Today.AddYears(1).ToShortDateString(); linea[hPos + 1] = scad.Value.ToShortDateString(); } } // CONSERVO LA LINEA CON LE QUANTITA finalRows.Add(linea); } List <string> finalFile = new List <string>(); // RICOSTRUISCO IL FILE: INTESTAZIONE for (int i = 0; i < rowSt; i++) { finalFile.Add(lines[i]); } string res; // RICOSTRUISCO IL FILE: PRODOTTI foreach (string [] skuRow in finalRows) { res = String.Join('\t'.ToString(), skuRow); finalFile.Add(res); } string file = String.Join('\n'.ToString(), finalFile); Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=" + sourceFile); Response.Charset = ""; Response.ContentType = "application/text"; Response.Output.Write(file); Response.Flush(); Response.End(); } else if (Request.QueryString["csvFull"] != null && Session[Request.QueryString["csvFull"].ToString()] != null) { string shipid = Request.QueryString["csvFull"].ToString(); //string[] cods, qts; string csv = "codicemaietta;qt;descrizione;sku"; foreach (AmzIFace.AmzonInboundShipments.ShipItem si in (List <AmzIFace.AmzonInboundShipments.ShipItem>)Session[shipid]) { csv += Environment.NewLine + " ;" + si.quantita + ";" + si.title + ";" + si.FNSKU; } Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=" + shipid + "_full.csv"); Response.Charset = ""; Response.ContentType = "application/text"; Response.Output.Write(csv); Response.Flush(); Response.End(); } else if (Request.QueryString["csv"] != null && Session[Request.QueryString["csv"].ToString()] != null) { string shipid = Request.QueryString["csv"].ToString(); string csv = ""; string[] cods, qts; csv += "codicemaietta;qt"; foreach (AmzIFace.AmzonInboundShipments.ShipItem si in (List <AmzIFace.AmzonInboundShipments.ShipItem>)Session[shipid]) { if (si.codmaie == "" || si.qtSca == "") { csv += Environment.NewLine + si.codmaie + ";" + si.quantita; continue; } cods = si.codmaie.Split(';'); qts = si.qtSca.Split(';'); for (int i = 0; i < cods.Length; i++) { csv += Environment.NewLine + cods[i].Trim() + ";" + (si.quantita * int.Parse(qts[i].Trim())).ToString(); } } Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=" + shipid + ".csv"); Response.Charset = ""; Response.ContentType = "application/text"; Response.Output.Write(csv); Response.Flush(); Response.End(); } else if (Request.QueryString["path"] != null) { string filePath = Request.QueryString["path"].ToString(); Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "image/jpg"; Response.AddHeader("content-disposition", "attachment;filename=" + Path.GetFileName(HttpUtility.HtmlDecode(HttpUtility.UrlDecode(filePath))).Replace(" ", "_")); Response.TransmitFile(HttpUtility.HtmlDecode(HttpUtility.UrlDecode(filePath))); Response.End(); } else if (Request.QueryString["zip"] != null && Request.QueryString["id"] != null && Request.QueryString["tipo"] != null) { string dir = Request.QueryString["zip"].ToString(); string idLav = Request.QueryString["id"].ToString(); string tipo = Request.QueryString["tipo"].ToString(); string outZip = tipo + "_" + idLav + ".zip"; StreamCompressDirectory(dir, outZip); } else if (Request.QueryString["rtfId"] != null) { int idLav = int.Parse(Request.QueryString["rtfId"].ToString()); StreamConvertHtml(idLav); } else if (Request.QueryString["pdf"] != null && Request.QueryString["amzOrd"] != null && Session[Request.QueryString["amzOrd"].ToString()] != null && Request.QueryString["merchantId"] != null) { amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; string orderID = Request.QueryString["amzOrd"].ToString(); AmazonOrder.Order order = (AmazonOrder.Order)Session[orderID]; int invoiceNum = order.InvoiceNum; DateTime invoiceDate = order.InvoiceDate; string siglaV = order.GetSiglaVettoreStatus(); aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); AmzIFace.AmazonInvoice.makeInvoicePdf(amzSettings, aMerchant, order, invoiceNum, true, invoiceDate, siglaV, false); //string fixedFileRegalo = Path.Combine(amzSettings.invoicePdfFolder(aMerchant), aMerchant.invoicePrefix(amzSettings) + invoiceNum.ToString().PadLeft(2, '0') + "_regalo.pdf"); string fixedFileRegalo = order.GetGiftFile(amzSettings, aMerchant); //if (File.Exists(fixedFileRegalo)) if (order.ExistsGiftFile(amzSettings, aMerchant)) { Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "inline;filename=" + Path.GetFileName(HttpUtility.HtmlDecode(HttpUtility.UrlDecode(fixedFileRegalo))).Replace(" ", "_")); Response.TransmitFile(HttpUtility.HtmlDecode(HttpUtility.UrlDecode(fixedFileRegalo))); } else { Response.Write("File " + fixedFileRegalo + " non trovato!"); } Response.End(); } else if (Request.QueryString["pdf"] != null) { string filePath = Request.QueryString["pdf"].ToString(); if (File.Exists(filePath)) { Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "inline;filename=" + Path.GetFileName(HttpUtility.HtmlDecode(HttpUtility.UrlDecode(filePath))).Replace(" ", "_")); Response.TransmitFile(HttpUtility.HtmlDecode(HttpUtility.UrlDecode(filePath))); } else { Response.Write("File " + filePath + " non trovato!"); } Response.End(); } else if (Request.QueryString["amzOrd"] != null && Request.QueryString["amzInv"] != null && Request.QueryString["merchantId"] != null) { int invN = 0; //if (Session["amzSettings"] == null || !int.TryParse(Request.QueryString["amzInv"].ToString(), out invN) || invN < 1) if (Session["amzSettings"] == null || !int.TryParse(Request.QueryString["amzInv"].ToString(), out invN))// || invN < 1) { Response.Write("Sessione scaduta"); return; } //string invoiceNum = Request.QueryString["amzInv"].ToString(); string amzOrd = Request.QueryString["amzOrd"].ToString(); int risposta = (Request.QueryString["tiporisposta"] != null) ? int.Parse(Request.QueryString["tiporisposta"].ToString()) : 0; amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; settings = (UtilityMaietta.genSettings)Session["settings"]; UtilityMaietta.Utente u = (UtilityMaietta.Utente)Session["Utente"]; //Year = DateTime.Today.Year; aMerchant = new AmzIFace.AmazonMerchant(int.Parse(Request.QueryString["merchantId"].ToString()), amzSettings.Year, amzSettings.marketPlacesFile, amzSettings); COUNTRY = amzSettings.Year + " - " + aMerchant.nazione + " " + aMerchant.ImageUrlHtml(25, 40, "inherit"); string errore = ""; AmazonOrder.Order order; if (Session[Request.QueryString["amzOrd"].ToString()] != null) { order = (AmazonOrder.Order)Session[Request.QueryString["amzOrd"].ToString()]; } else { order = AmazonOrder.Order.ReadOrderByNumOrd(amzOrd, amzSettings, aMerchant, out errore); } if (order == null || errore != "") { Response.Write("Impossibile contattare amazon, riprova più tardi!<br />Errore: " + errore); return; } DateTime invoiceDate; if (Request.QueryString["invDate"] != null) { invoiceDate = DateTime.Parse(Request.QueryString["invDate"].ToString()); } else { invoiceDate = DateTime.Today; } OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); cnn.Open(); wc.Open(); if (order.Items == null) { order.RequestItemsAndSKU(amzSettings, aMerchant, settings, cnn, wc); } int vettS = 0; if (Request.QueryString["vettS"] != null) { int.TryParse(Request.QueryString["vettS"].ToString(), out vettS); } vettS = (vettS == 0) ? order.GetVettoreID(amzSettings) : vettS; int invoiceNum; /// IMPORTO DEFINITIVAMENTE L'ORDINE CON I VALORI della precedente schermata. /// /// if (int.Parse(Request.QueryString["amzInv"].ToString()) > 0) { // ORDINE GIA' COMPLETAMENTE IMPORTATO E CON RICEVUTA, SOLO NUOVE MOVIMENTAZIONI invoiceNum = int.Parse(Request.QueryString["amzInv"].ToString()); if (order.GetVettoreID(amzSettings) != vettS) // NUOVO VETTORE, AGGIORNO { order.UpdateVettore(cnn, wc, vettS); } } else if (order.IsFullyImported() || order.IsImported()) { // ORDINE COMPLETAMENTE IMPORTATO, CREO NUMERO RICEVUTA e MOVIMENTAZIONI invoiceNum = order.UpdateFullStatus(wc, cnn, amzSettings, aMerchant, invoiceDate, vettS, true); } else { // ORDINE DA IMPORTARE, CREO NUMERO RICEVUTA E MOVIMENTAZIONI invoiceNum = order.SaveFullStatus(wc, cnn, amzSettings, aMerchant, invoiceDate, vettS, true); } /// //string fixedFile = Path.Combine(amzSettings.invoicePdfFolder(aMerchant), aMerchant.invoicePrefix(amzSettings) + invoiceNum.ToString().PadLeft(2, '0') + ".pdf"); string fixedFile = AmazonOrder.Order.GetInvoiceFile(amzSettings, aMerchant, invoiceNum); //string fixedFileRegalo = Path.Combine(amzSettings.invoicePdfFolder(aMerchant), aMerchant.invoicePrefix(amzSettings) + invoiceNum.ToString().PadLeft(2, '0') + "_regalo.pdf"); string fixedFileRegalo = order.GetGiftFile(amzSettings, aMerchant); if (File.Exists(fixedFile)) { Response.Write("Impossibile sovrascrivere il file " + fixedFile + "<br />" + "Devi cancellarlo prima di poterlo sovrascrivere!"); return; } //else if (File.Exists(fixedFileRegalo)) else if (order.ExistsGiftFile(amzSettings, aMerchant)) { Response.Write("Impossibile sovrascrivere il file " + fixedFileRegalo + "<br />" + "Devi cancellarlo prima di poterlo sovrascrivere!"); return; } if (Request.QueryString["movimenta"] != null && bool.Parse(Request.QueryString["movimenta"].ToString())) { string inv = aMerchant.invoicePrefix(amzSettings) + invoiceNum.ToString().PadLeft(2, '0'); if (!order.HasDispItems(cnn, invoiceDate)) { cnn.Close(); wc.Close(); Response.Write("Disponibilità negative per uno o più Item dell'ordine. Impossibile eseguire lo scarico.<br />" + "Puoi solo creare il pdf."); return; } List <AmzIFace.ProductMaga> pm = order.MakeMovimentaAllItems(cnn, amzSettings, u, inv, invoiceDate, order.dataUltimaMod, aMerchant, settings); UtilityMaietta.writeMagaOrder(pm, amzSettings.AmazonMagaCode, settings, 'F'); } if (Request.QueryString["schedaecm"] != null && bool.Parse(Request.QueryString["schedaecm"].ToString())) { OleDbConnection ecmScn = new OleDbConnection(settings.EcmOleDbConnString); ecmScn.Open(); EcmUtility.EcmScheda es = new EcmUtility.EcmScheda(order, true, EcmUtility.categoria); es.makeSchedaEcm(ecmScn); ecmScn.Close(); } string siglaV = (vettS == 0) ? order.GetSiglaVettore(cnn, amzSettings) : order.GetSiglaVettoreStatus(); //AmzIFace.AmazonInvoice.makeInvoicePdf(amzSettings, aMerchant, order, invN, false, invoiceDate, siglaV, false); AmzIFace.AmazonInvoice.makeInvoicePdf(amzSettings, aMerchant, order, invoiceNum, false, invoiceDate, siglaV, false); if (Request.QueryString["regalo"] != null && bool.Parse(Request.QueryString["regalo"].ToString())) { fixedFile = fixedFileRegalo; //AmzIFace.AmazonInvoice.makeInvoicePdf(amzSettings, aMerchant, order, invN, true, invoiceDate, siglaV, false); AmzIFace.AmazonInvoice.makeInvoicePdf(amzSettings, aMerchant, order, invoiceNum, true, invoiceDate, siglaV, false); } cnn.Close(); wc.Close(); if (risposta != 0) { AmazonOrder.Comunicazione com = new AmazonOrder.Comunicazione(risposta, amzSettings, aMerchant); string subject = com.Subject(order.orderid); string attach = (com.selectedAttach && File.Exists(fixedFile)) ? fixedFile : ""; bool send = UtilityMaietta.sendmail(attach, amzSettings.amzDefMail, order.buyer.emailCompratore, subject, com.GetHtml(order.orderid, order.destinatario.ToHtmlFormattedString(), order.buyer.nomeCompratore), false, "", "", settings.clientSmtp, settings.smtpPort, settings.smtpUser, settings.smtpPass, false, null); } /*Response.Buffer = true; * Response.Charset = ""; * Response.Cache.SetCacheability(HttpCacheability.NoCache); * Response.ContentType = "application/pdf"; * Response.AddHeader("content-disposition", "attachment;filename=" + Path.GetFileName(fixedFile)); * Response.TransmitFile(fixedFile);*/ /* * */ /*if (Request.QueryString["amzToken"] != null) * { * string nexttoken = Request.QueryString["amzToken"].ToString(); * //imbNextPag.PostBackUrl = "amzPanoramica.aspx?token=" + Session["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "&amzToken=" + HttpUtility.UrlEncode(nexttoken); * * ClientScript.RegisterStartupScript(this.GetType(), "amzTokenPb", * "<script type='text/javascript' language='javascript'>" + * "window.open('download.aspx?pdf=" + HttpUtility.UrlEncode(fixedFile) + "&token=" + Session["token"].ToString() + "', '_blank');" + * "__doPostBack('imbNextPag','OnClick');</script>"); * } * else*/ //{ Response.Write(@"<script lang='text/javascript'>window.open('download.aspx?pdf=" + HttpUtility.UrlEncode(fixedFile) + "&token=" + Session["token"].ToString() + "', '_blank');" + "window.top.location.href = 'amzPanoramica.aspx?token=" + Session["token"].ToString() + MakeQueryParams() + "';</script>)"); //} /*if (Session["token"] != null) * Response.Redirect("amzPanoramica.aspx?token=" + Session["token"].ToString() + MakeQueryParams()); * else * Response.Redirect("login.aspx?path=amzPanoramica"); * Response.End();*/ } else if (Request.QueryString["amzBCSku"] != null && Request.QueryString["labQt"] != null && Request.QueryString["descBC"] != null && Request.QueryString["status"] != null && Request.QueryString["labCode"] != null) { amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; settings = (UtilityMaietta.genSettings)Session["settings"]; int numLabels = int.Parse(Request.QueryString["labQt"].ToString()); string sku = Request.QueryString["amzBCSku"].ToString(); string descBC = HttpUtility.HtmlDecode(HttpUtility.UrlDecode(Request.QueryString["descBC"].ToString())); string status = Request.QueryString["status"].ToString(); AmzIFace.AmazonInvoice.PaperLabel pl = new AmzIFace.AmazonInvoice.PaperLabel(0, 0, amzSettings.amzPaperLabelsFile, Request.QueryString["labCode"].ToString()); string file = "barcode_" + sku + "_" + numLabels.ToString() + ".pdf"; Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + file); AmzIFace.AmzonInboundShipments.MakeBarCodeFullPages(sku, descBC, status, numLabels, Response.OutputStream, amzSettings, amzSettings.amzBarCodeWpx, amzSettings.amzBarCodeHpx, amzSettings.amzBarCodeWmm, amzSettings.amzBarCodeHmm, pl); Response.End(); return; } else if (Request.QueryString["printAll"] != null && Request.QueryString["labCode"] != null && Session["printAll"] != null && Request.QueryString["status"] != null) { amzSettings = (AmzIFace.AmazonSettings)Session["amzSettings"]; settings = (UtilityMaietta.genSettings)Session["settings"]; string status = Request.QueryString["status"].ToString(); string shipid = Request.QueryString["printAll"].ToString(); AmzIFace.AmazonInvoice.PaperLabel pl = new AmzIFace.AmazonInvoice.PaperLabel(0, 0, amzSettings.amzPaperLabelsFile, Request.QueryString["labCode"].ToString()); List <AmzIFace.AmzonInboundShipments.FullLabel> printAll = (List <AmzIFace.AmzonInboundShipments.FullLabel>)Session["printAll"]; int forPage = pl.rows * pl.cols; int numpages = ((printAll.Count % forPage) == 0) ? printAll.Count / forPage : (printAll.Count / forPage) + 1; List <AmzIFace.AmzonInboundShipments.FullLabel[][]> document = new List <AmzIFace.AmzonInboundShipments.FullLabel[][]>(); AmzIFace.AmzonInboundShipments.FullLabel[][] page; int count = 0; for (int p = 0; p < numpages; p++) { if (count >= printAll.Count) { break; } page = new AmzIFace.AmzonInboundShipments.FullLabel[pl.rows][]; for (int r = 0; r < pl.rows; r++) { if (count >= printAll.Count) { break; } page[r] = new AmzIFace.AmzonInboundShipments.FullLabel[pl.cols]; for (int c = 0; c < pl.cols; c++) { if (count >= printAll.Count) { break; } page[r][c] = new AmzIFace.AmzonInboundShipments.FullLabel(); page[r][c].sku = printAll[count].sku; page[r][c].desc = printAll[count].desc; page[r][c].qt = printAll[count].qt; count++; } } document.Add(page); } /*int count = 0, pag = 0; * int c = 1, r = 1; * ArrayList labels = new ArrayList(); * * //////////// ERRORE AUMENTO R E C * while (count < printAll.Count) * { * labels.Add(new AmzIFace.AmazonInvoice.PaperLabel(c++, r++, amzSettings.amzPaperLabelsFile, Request.QueryString["labCode"].ToString())); * count++; * } * for (int r = 0; r < pl.rows; r++) * { * if (count >= printAll.Count) * break; * for (int c = 0; c < pl.cols; c++) * { * if (count >= printAll.Count) * break; * * labels.Add(new AmzIFace.AmazonInvoice.PaperLabel(c, r, amzSettings.amzPaperLabelsFile, Request.QueryString["labCode"].ToString())); * count++; * } * }*/ string file = "barcode_" + shipid + "_" + printAll.Count.ToString() + ".pdf"; Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + file); AmzIFace.AmzonInboundShipments.MakeMultiBarCodeGrid(document, Response.OutputStream, status, amzSettings, amzSettings.amzBarCodeWpx, amzSettings.amzBarCodeHpx, amzSettings.amzBarCodeWmm, amzSettings.amzBarCodeHmm, pl); Response.End(); return; } Response.Write("Sessione scaduta"); return; }