private void StreamConvertHtml(int idLav) { settings = (UtilityMaietta.genSettings)Session["settings"]; LavClass.SchedaLavoro sl = new LavClass.SchedaLavoro(idLav, settings); string descDecoded = HttpUtility.HtmlDecode(sl.descrizione); string prods = HttpUtility.HtmlDecode(Session["prodForm"].ToString()); string finalDesc = "<html><head></head>" + "<body>" + "<div id='wrapper' style='width: 800px; margin:0 auto; text-align: center; border-width: 2px; border-style: solid; border-color: lightgray;'>" + "<h2>Lavorazione - " + sl.id.ToString().PadLeft(5, '0') + "</h2>" + "<h3>Lavoro: " + sl.nomeLavoro + "</h3><br>" + "<table style='text-align: left; width: 100%;'><tr><td>" + "<b>" + "Rivenditore : " + sl.rivenditore.codice.ToString() + " - " + sl.rivenditore.azienda + "<br>" + "Cliente : " + sl.utente.id + " - " + sl.utente.nome + "</b><br><br>" + "<div style='text-align: left;'>" + descDecoded + "</div>" + prods + "</td></tr></table></div></body></html>"; Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=Lav_" + idLav + ".html"); Response.Charset = ""; Response.ContentType = "text/html"; Response.Output.Write(finalDesc); Response.Flush(); Response.End(); }
private bool skuInScheda(LavClass.SchedaLavoro sl, string sku) { foreach (LavClass.ProdottoLavoro pl in sl.prodotti) { if (pl.riferimento.ToUpper().StartsWith(sku.ToUpper())) { return(true); } } return(false); }
private void setLavorazioneStato(OleDbConnection wc, OleDbConnection gc, int targetStato, int lavID) { LavClass.SchedaLavoro scheda = new LavClass.SchedaLavoro(lavID, settings, wc, gc); LavClass.StoricoLavoro actualState = LavClass.StatoLavoro.GetLastStato(scheda.id, settings, wc); if (actualState.stato.id == settings.lavDefStatoNotificaIns) // IN APPROVAZIONE { scheda.Approva(wc, op.id); } LavClass.StatoLavoro nextState = new LavClass.StatoLavoro(targetStato, settings, wc); scheda.InsertStoricoLavoro(nextState, op, DateTime.Now, settings, wc); if (nextState.id == settings.lavDefStoricoChiudi) // QUI CHIUDO { scheda.Evadi(wc, settings); } else if (actualState.stato.id == settings.lavDefStoricoChiudi && nextState.id != settings.lavDefStoricoChiudi) // QUI RIAPRO { scheda.Ripristina(wc); } }
//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 btnFindShips_Click(object sender, EventArgs e) { string shipid = txShipCode.Text.Trim().ToUpper(); string fileXml = Path.Combine(amzSettings.amzXmlSpedFolder, shipid + ".xml"); List <AmzIFace.AmzonInboundShipments.ShipItem> listaShips = AmzIFace.AmzonInboundShipments.GetShipItemList(amzSettings, aMerchant, shipid); if (listaShips == null) { Response.Write("Errore: Spedizione non trovata!"); return; } listaShips = AmzIFace.AmazonProductInfo.GetProductListInfo(amzSettings, aMerchant, AmzIFace.AmazonProductInfo.SellerSKU, listaShips); gridShipItems.DataSource = null; gridShipItems.DataBind(); if (File.Exists(fileXml)) { xmlNote = XDocument.Load(fileXml); } else { xmlNote = null; } OleDbConnection cnn = new OleDbConnection(settings.OleDbConnString); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); wc.Open(); cnn.Open(); if (printcode) { printAll = new List <AmzIFace.AmzonInboundShipments.FullLabel>(); SetCodiceMaietta(ref listaShips, wc, cnn); gridShipItems.DataSource = listaShips; gridShipItems.DataBind(); panBtn.Visible = hylPrintAll.Visible = btnSaveNote.Visible = true; labGoToCsv.Visible = false; labNumProds.Text = "Prodotti: " + gridShipItems.Rows.Count; Session["printAll"] = printAll; hylPrintAll.NavigateUrl = "download.aspx?printAll=" + shipid + "&labCode=" + dropLabels.SelectedValue.ToString() + "&status=Nuovo"; } else { ArrayList risposte = AmazonOrder.Comunicazione.GetAllRisposte(amzSettings.amzComunicazioniFile, aMerchant); DataTable vettori = UtilityMaietta.Vettore.GetVettori(cnn); ListOptionalInfo(ref listaShips, risposte, vettori, wc, cnn); gridCheckItems.DataSource = listaShips; labGoToShipPackaging.Text = labGoToCsvFull.Text = labGoToCsv.Text = ""; if (listaShips.Count > 0) { OleDbConnection gcc = new OleDbConnection(settings.MainOleDbConnection); gcc.Open(); scheda = new LavClass.SchedaLavoro(findLavoro(wc, shipid, amzSettings.AmazonMagaCode), settings, wc, gcc); gcc.Close(); labGoToCsv.Text = "<a href='download.aspx?csv=" + shipid + "' target='_blank'>Scarica lista prodotti.</a>"; labGoToCsvFull.Text = "<a href='download.aspx?csvFull=" + shipid + "' target='_blank'>Scarica lista descrizioni.</a>"; Session[shipid] = listaShips; //int boxcount = shi boxSets.shipsInfo ship = new boxSets.shipsInfo(shipid, DateTime.Now, DateTime.Now, amzSettings); Session["ship_" + shipid] = ship; labGoToShipPackaging.Text = "Distinta spedizione (" + ship.boxCount.ToString() + " box):"; btnPackageUpload.OnClientClick = "return(checkFile());"; btnPackageUpload.Visible = fupPackageModel.Visible = true; } gridCheckItems.DataBind(); labGoToShipPackaging.Visible = labGoToCsvFull.Visible = labGoToCsv.Visible = btnMakeLav.Visible = btnMakeLav.Enabled = true; labNumProds.Text = "Prodotti: " + gridCheckItems.Rows.Count; if (scheda != null && scheda.id > 0) { LavClass.StoricoLavoro sl = LavClass.StatoLavoro.GetLastStato(scheda.id, settings, wc); if (sl.stato.colore.HasValue) { ((TableCell)labGoToLav.Parent).BackColor = sl.stato.colore.Value; } labGoToLav.Text = "<a href='lavDettaglio.aspx?id=" + scheda.id + "&token=" + Session["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "' target='_self'>Lav.: #" + scheda.id.ToString().PadLeft(5, '0') + "<br />" + sl.stato.descrizione + "</a>"; labGoToLav.Visible = labGoToLav.Font.Bold = true; } } wc.Close(); cnn.Close(); }
protected void btnSend_Click(object sender, EventArgs e) { FileInfo fi = new FileInfo(HttpUtility.UrlDecode(Request.QueryString["path"].ToString())); string logoInMail = amzSettings.amzEmailLogo; string intro; //http://www.amazon.it/gp/feedback/leave-customer-feedback.html/?pageSize=1&order=[order-id] AlternateView altView = null; if (onlinelogo) { intro = " <div id='wrapper' style='text-align: center; font-family: cambria;'>" + "<table align='center' style=' padding: 0px; width:600px; font-family: cambria;'>" + "<tr><td><hr /></td></tr>" + //"<tr><td style='text-align: left;'>" + txMessage.Text.Replace(Environment.NewLine, "<br />") + "</td></tr>" + "<tr><td style='text-align: left;'>" + txMessage.Text.Replace("#", "<br />") + "</td></tr>" + "</table></div>"; /*var webClient = new System.Net.WebClient(); * byte[] imageBytes = webClient.DownloadData(amzSettings.amzOnlineLogo); * MemoryStream ms = new MemoryStream(imageBytes); * PICLOGO = new LinkedResource(ms, System.Net.Mime.MediaTypeNames.Image.Jpeg); * PICLOGO.ContentId = logoInMail;*/ } else { intro = " <div id='wrapper' style='text-align: center; font-family: cambria;'>" + "<table align='center' style=' padding: 0px; width:600px; font-family: cambria;'>" + "<tr><td><hr /></td></tr>" + "<tr><td align='center'><img src='cid:" + logoInMail + "' /><br ><hr /><br /></td></tr>" + //"<tr><td style='text-align: left;'>" + txMessage.Text.Replace(Environment.NewLine, "<br />") + "</td></tr>" + "<tr><td style='text-align: left;'>" + txMessage.Text.Replace("#", "<br />") + "</td></tr>" + "</table></div>"; altView = AlternateView.CreateAlternateViewFromString(intro, null, System.Net.Mime.MediaTypeNames.Text.Html); LinkedResource PICLOGO; PICLOGO = new LinkedResource(Server.MapPath("pics/" + amzSettings.amzEmailLogo), System.Net.Mime.MediaTypeNames.Image.Jpeg); PICLOGO.ContentId = logoInMail; altView.LinkedResources.Add(PICLOGO); } string cc = ""; if (chkCopiaC.Checked) { cc = op.email; } bool send = UtilityMaietta.sendmail(fi.FullName, txFrom.Text, txTo.Text, txSubject.Text, intro, false, "", cc, settings.clientSmtp, settings.smtpPort, settings.smtpUser, settings.smtpPass, false, altView); if (send) { labStatus.Text = "Invio eseguito con successo."; btnSend.Enabled = false; } else { labStatus.Text = "Errore nell'invio della mail."; } tabMail.Rows[0].Visible = true; if (chkSetSendBozza.Checked) { OleDbConnection gc = new OleDbConnection(settings.OleDbConnString); OleDbConnection wc = new OleDbConnection(settings.lavOleDbConnection); gc.Open(); wc.Open(); LavClass.SchedaLavoro sc = new LavClass.SchedaLavoro(int.Parse(LAVID), settings, wc, gc); LavClass.StoricoLavoro actualState = LavClass.StatoLavoro.GetLastStato(sc.id, settings, wc); LavClass.StatoLavoro sl = new LavClass.StatoLavoro(settings.lavDefStatoSend, settings, wc); sc.InsertStoricoLavoro(sl, op, DateTime.Now, settings, wc); if (actualState.stato.id == settings.lavDefStoricoChiudi) { sc.Ripristina(wc); } LavClass.StoricoLavoro st = LavClass.StatoLavoro.GetLastStato(sc.id, settings, wc); sc.Notifica(sl, settings, LavClass.mailMessage); gc.Close(); wc.Close(); } }