private void writeCookieXML(UtilityMaietta.genSettings s, LavClass.Operatore op) { /*if (DropOperatoreV.SelectedIndex == 0) * return;*/ if (op.id == 0) { return; } int lavorazioneID, operatoreID; string stato; operatoreID = op.id; foreach (GridViewRow gvr in LavGrid.Rows) { lavorazioneID = int.Parse(gvr.Cells[idCol].Text.Trim()); stato = LavClass.CookieLav.NormalizeCookie(gvr.Cells[statoCol].Text); //BOZZA DA FARE<br /><font size='1'>04/08/2016 11:01:12</font> //if (!LavClass.CookieLav.CookieExists(s.lavCookieFile, lavorazioneID, operatoreID)) // INSERISCE COOKIE if (!LavClass.CookieLav.CookieExists(cookieX, lavorazioneID, operatoreID)) { try { //XDocument doc = XDocument.Load(s.lavCookieFile); XDocument doc = cookieX; XElement root = new XElement(LavClass.CookieLav.rootDesc); root.Add(new XElement(LavClass.CookieLav.idlav, lavorazioneID)); root.Add(new XElement(LavClass.CookieLav.idoperatore, operatoreID)); root.Add(new XElement(LavClass.CookieLav.nomestato, stato)); doc.Element(LavClass.CookieLav.rootSection).Add(root); doc.Save(s.lavCookieFile); } catch (Exception ex) { } } else // AGGIORNA COOKIE { LavClass.CookieLav.updateCookie(lavorazioneID, operatoreID, stato, cookieX, s.lavCookieFile); } } }
protected void gvLav_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex == -1) { return; } e.Row.Cells[colStato].Text = "<b>" + e.Row.Cells[colStato].Text.Replace("#", "</b><br /><font size='1'>") + "</font>"; e.Row.Cells[colUser].Font.Size = 9; LavClass.Operatore userRow = LavClass.Operatore.GetFromFile(operFile, "operatore", "id", int.Parse(e.Row.Cells[colUser].Text.Split('#')[0]), tipoOpFile, "tipo", "id"); LavClass.Operatore operRow = LavClass.Operatore.GetFromFile(operFile, "operatore", "id", int.Parse(e.Row.Cells[colUser].Text.Split('#')[1]), tipoOpFile, "tipo", "id"); e.Row.Cells[colUser].Text = "<b>" + userRow.ToString() + "</b><br />(" + operRow.ToString() + ")"; e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(e.Row.Cells[colColore].Text); e.Row.Cells[colLink].Text = "<a href='lavdettaglio.aspx?token=" + Request.QueryString["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "&id=" + e.Row.Cells[colID].Text + "' target='_blank'>" + e.Row.Cells[colID].Text + "</a>"; }
private int SaveLavoro(OleDbConnection cnn, OleDbConnection wc, AmzIFace.AmazonSettings amzs, UtilityMaietta.genSettings s, string nomeLavoro, List <int> indexRow) { LavClass.UtenteLavoro ul = new LavClass.UtenteLavoro(1, amzs.AmazonMagaCode, wc, cnn, s); LavClass.Operatore opLav; LavClass.Macchina mc = new LavClass.Macchina(amzs.lavMacchinaDef, s.lavMacchinaFile, s); LavClass.TipoStampa ts = new LavClass.TipoStampa(amzs.lavTipoStampaDef, s.lavTipoStampaFile); LavClass.Obiettivo ob = new LavClass.Obiettivo(amzs.lavObiettivoDef, s.lavObiettiviFile); LavClass.Priorita pr = new LavClass.Priorita(amzs.lavPrioritaDefStd, s.lavPrioritaFile); LavClass.Operatore approvatore = new LavClass.Operatore(amzs.lavApprovatoreDef, s.lavOperatoreFile, s.lavTipoOperatoreFile); int lavid = 0; if (ul.HasOperatorePref()) { opLav = ul.OperatorePreferito(); } else { opLav = new LavClass.Operatore(amzs.lavOperatoreDef, s.lavOperatoreFile, s.lavTipoOperatoreFile); } string testo = "Lavorazione Amazon spedizione logistica @ " + nomeLavoro + " @ <br />"; string qt, sku, titolo; int q; foreach (int ir in indexRow) { qt = int.TryParse((((TextBox)gridCheckItems.Rows[ir].Cells[OPcolQtLav].Controls[1]).Text), out q)? ((TextBox)gridCheckItems.Rows[ir].Cells[OPcolQtLav].Controls[1]).Text : gridCheckItems.Rows[ir].Cells[OPcolSped].Text; sku = gridCheckItems.Rows[ir].Cells[colSku].Text.Substring(0, gridCheckItems.Rows[ir].Cells[colSku].Text.IndexOf("<br")); titolo = UtilityMaietta.RemoveSpecialCharacters(gridCheckItems.Rows[ir].Cells[colTitolo].Text.Replace("My Custom Style", "").Trim()); titolo = (titolo.Length > 50) ? titolo.Substring(0, 49) : titolo; testo += "<br />-- n." + qt + " - " + sku + " - " + titolo; } lavid = LavClass.SchedaLavoro.SaveLavoro(wc, amzs.AmazonMagaCode, ul.id, opLav.id, mc.id, ts.id, ob.id, DateTime.Now, op, null, null, true, approvatore.id, false, testo, "", DateTime.Today.AddDays(2), nomeLavoro, pr.id); return(lavid); }
private DataTable GetGrid(LavClass.Operatore op, int stato_id, OleDbConnection BigCon, UtilityMaietta.genSettings s, DateTime maxDate) { //if (incomplete) string fil = " AND works.dbo.lavorazione.evaso = 0"; if (op.tipo.id == s.lavDefCommID) { fil += " AND works.dbo.lavorazione.utente_id = " + op.id; } fil += " AND storico.stato_id = " + stato_id; string str = "SELECT works.dbo.lavorazione.id AS ID, Right('000' + CONVERT(NVARCHAR, works.dbo.lavorazione.id), 6) AS LinkID, " + " works.dbo.lavorazione.rivenditore_id AS [Riv.Cod.], giomai_db.dbo.ecmonsql.azienda AS [Rivenditore], " + " works.dbo.utente_lavoro.nome + ' (' + convert(VARCHAR, works.dbo.utente_lavoro.utente_id) + ')' AS [Cliente], " + " works.dbo.lavorazione.nomelavoro AS [Nome], convert(VARCHAR, works.dbo.lavorazione.utente_id) + '#' + convert(VARCHAR, works.dbo.lavorazione.operatore_id) AS [Proprietario], " + " storico.descrizione + '#' + convert (varchar, storico.data, 103) + ' ' + convert(varchar, storico.data, 24) AS [Ultimo Stato], storico.colore AS [USID] " + // , works.dbo.lavorazione.id AS [News], " + //" works.dbo.lavorazione.id AS [Link], works.dbo.lavorazione.note AS [Nota], storico.colore AS [USID], storico.ordine AS [ORDCOL], storico.stato_id AS [IDSTATO], '0' AS [NEWORD], '0' AS [SCAD], storico.operatori_display AS [OPDISP], works.dbo.utente_lavoro.utente_id AS clfID" + " from works.dbo.lavorazione " + " outer apply(select top 1 works.dbo.storico_lavoro.stato_id, works.dbo.stato_lavoro.ordine, works.dbo.stato_lavoro.descrizione, works.dbo.storico_lavoro.data, works.dbo.stato_lavoro.colore, works.dbo.stato_lavoro.operatori_display " + " from works.dbo.storico_lavoro, works.dbo.stato_lavoro where works.dbo.stato_lavoro.id = works.dbo.storico_lavoro.stato_id and works.dbo.storico_lavoro.lavorazione_id = works.dbo.lavorazione.id order by works.dbo.storico_lavoro.data desc) as storico " + " join giomai_db.dbo.ecmonsql on (works.dbo.lavorazione.rivenditore_id = giomai_db.dbo.ecmonsql.cliente_id) " + " join works.dbo.utente_lavoro on (works.dbo.lavorazione.rivenditore_id = works.dbo.utente_lavoro.rivenditore_id AND works.dbo.utente_lavoro.utente_id = works.dbo.lavorazione.clienteF_id ) " + " where works.dbo.lavorazione.datainserimento <= '" + maxDate.ToShortDateString() + " 23:59:59' and works.dbo.lavorazione.id > 0 " + fil + " order by works.dbo.lavorazione.id ASC"; //filOb + filTs + filMc + filPr + filApp + filEv + filOp + filComm + filRivend; OleDbDataAdapter adt = new OleDbDataAdapter(str, BigCon); DataTable dt = new DataTable(); adt.Fill(dt); operFile = XDocument.Load(settings.lavOperatoreFile); tipoOpFile = XDocument.Load(settings.lavTipoOperatoreFile); return(dt); }
//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 (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 (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>"; }
private AmazonOrder.Order.lavInfo OpenLavorazioneFromAmz(AmazonOrder.Order order, OleDbConnection wc, OleDbConnection cnn, AmzIFace.AmazonSettings amzs, UtilityMaietta.genSettings s, string invoice) { string mailcl = order.buyer.emailCompratore; LavClass.UtenteLavoro ul = new LavClass.UtenteLavoro(mailcl, amzs.AmazonMagaCode, wc, cnn, s); LavClass.Operatore opLav; LavClass.Macchina mc = new LavClass.Macchina(amzs.lavMacchinaDef, s.lavMacchinaFile, s); LavClass.TipoStampa ts = new LavClass.TipoStampa(amzs.lavTipoStampaDef, s.lavTipoStampaFile); LavClass.Obiettivo ob = new LavClass.Obiettivo(amzs.lavObiettivoDef, s.lavObiettiviFile); //LavClass.Priorita pr = new LavClass.Priorita(amzs.lavPrioritaDef, s.lavPrioritaFile); LavClass.Priorita pr = new LavClass.Priorita(((order.ShipmentServiceLevelCategory.ShipmentLevelIs(AmazonOrder.ShipmentLevel.ESPRESSA)) ? amzs.lavPrioritaDefExpr : amzs.lavPrioritaDefStd), s.lavPrioritaFile); LavClass.Operatore approvatore = new LavClass.Operatore(amzs.lavApprovatoreDef, s.lavOperatoreFile, s.lavTipoOperatoreFile); int lavid = 0; //double myprice; if (ul.id == 0) // NON HO MAIL UTENTE { // INSERISCI SAVE UTENTE UtilityMaietta.clienteFattura amazonRiv = new UtilityMaietta.clienteFattura(amzs.AmazonMagaCode, cnn, s); LavClass.UtenteLavoro.SaveUtente(amazonRiv, wc, order.buyer.nomeCompratore + " c/o " + order.destinatario.nome, order.buyer.emailCompratore, order.destinatario.ToString(), order.destinatario.ToStringFormatted()); ul = new LavClass.UtenteLavoro(order.buyer.emailCompratore, amzs.AmazonMagaCode, wc, cnn, s); } if (ul.HasOperatorePref()) { opLav = ul.OperatorePreferito(); } else { opLav = new LavClass.Operatore(amzs.lavOperatoreDef, s.lavOperatoreFile, s.lavTipoOperatoreFile); } //string postit = ((order.GetSiglaVettore(cnn, amzs)) == postaSigla) ? "Spedizione con " + postaSigla : ""; // INSERISCI SAVE LAVORAZIONE string testo = (invoice != "") ? "Lavorazione <b>" + order.canaleVendita.ToUpper() + "</b> automatica.<br /><br />" + invoice : "Lavorazione <b>" + order.canaleVendita.ToUpper() + "</b> automatica."; lavid = LavClass.SchedaLavoro.SaveLavoro(wc, amzs.AmazonMagaCode, ul.id, opLav.id, mc.id, ts.id, ob.id, DateTime.Now, op, null, null, true, approvatore.id, false, testo, "", order.dataSpedizione, order.orderid, pr.id); // ADD PRODOTTI ArrayList distinctMaietta; if (freeProds && Session["freeProds"] != null) /// VENGO DA RICEVUTA FREEINVOICE E CON SPUNTA CREA LAVORAZIONE { distinctMaietta = new ArrayList((List <AmzIFace.CodiciDist>)Session["freeProds"]); foreach (AmzIFace.CodiciDist codD in distinctMaietta) { LavClass.ProdottoLavoro.SaveProdotto(lavid, codD.maietta.idprodotto, codD.qt, "", codD.totPrice / codD.qt, false, wc); } } else if (order.Items != null) /// VENGO DA PANORAMICA { distinctMaietta = FillDistinctCodes(order.Items, aMerchant, s); //, DateTime.Today); foreach (AmzIFace.CodiciDist codD in distinctMaietta) { LavClass.ProdottoLavoro.SaveProdotto(lavid, codD.maietta.idprodotto, codD.qt, "", codD.totPrice / codD.qt, false, wc); } } AmazonOrder.Order.lavInfo li = new AmazonOrder.Order.lavInfo(); li.lavID = lavid; li.rivID = amzs.AmazonMagaCode; li.userID = ul.id; return(li); }
private void fillGrid(UtilityMaietta.genSettings s, LavClass.Operatore oper) { string filOp, filOb, filTs, filMc, filPr, filApp, filEv, filComm, filRivend; filRivend = filOp = filOb = filTs = filMc = filPr = filApp = filEv = filComm = ""; int opID = int.Parse(DropOperatoreV.SelectedValue.ToString()); LavClass.Operatore op = new LavClass.Operatore(opID, s.lavOperatoreFile, s.lavTipoOperatoreFile); if (opID != 0) { filOp = " AND works.dbo.lavorazione.operatore_id = " + opID; } int obID = int.Parse(DropObiettiviV.SelectedValue.ToString()); LavClass.Obiettivo ob = new LavClass.Obiettivo(obID, s.lavObiettiviFile); if (obID != 0) { filOb = " AND works.dbo.lavorazione.obiettivo_id = " + obID; } int tsID = int.Parse(DropTipoStampa.SelectedValue.ToString()); LavClass.TipoStampa ts = new LavClass.TipoStampa(tsID, s.lavTipoStampaFile); if (tsID != 0) { filTs = " AND works.dbo.lavorazione.tipostampa_id = " + tsID; } int mcID = int.Parse(DropMacchina.SelectedValue.ToString()); LavClass.Macchina mc = new LavClass.Macchina(mcID, s.lavMacchinaFile, s); if (mcID != 0) { filMc = " AND works.dbo.lavorazione.macchina_id = " + mcID; } int prID = int.Parse(DropPriorita.SelectedValue.ToString()); LavClass.Priorita pr = new LavClass.Priorita(prID, s.lavPrioritaFile); if (prID != 0) { filPr = " AND works.dbo.lavorazione.priorita_id = " + prID; } int statID = int.Parse(dropStato.SelectedValue.ToString()); if (approvate) { filApp = " AND works.dbo.lavorazione.approvato = 1"; } if (incomplete) { filEv = " AND works.dbo.lavorazione.evaso = 0"; } if (soloCommer) { filComm = " AND works.dbo.lavorazione.utente_id = " + oper.id; } if (DropRivenditori.SelectedValue != "" && int.Parse(DropRivenditori.SelectedValue.ToString()) != 0) { filRivend = " AND works.dbo.lavorazione.rivenditore_id = " + DropRivenditori.SelectedValue.ToString(); } OleDbConnection mcn = new OleDbConnection(s.MainOleDbConnection); mcn.Open(); /*string str = " SELECT '0' AS [Sel.], Right('000' + CONVERT(NVARCHAR, works.dbo.lavorazione.id), 6) AS ID, works.dbo.lavorazione.rivenditore_id AS [Riv.Cod.], " + * " giomai_db.dbo.ecmonsql.azienda AS [Rivenditore], works.dbo.utente_lavoro.nome + ' (' + convert(VARCHAR, works.dbo.utente_lavoro.utente_id) + ')' AS [Cliente], " + * " works.dbo.lavorazione.nomelavoro AS [Nome], works.dbo.lavorazione.obiettivo_id AS [Obiettivo], works.dbo.lavorazione.priorita_id AS [Priorita], " + * " convert(varchar, works.dbo.lavorazione.consegna, 103) AS [Consegna], works.dbo.lavorazione.datainserimento AS [Inserito], works.dbo.lavorazione.utente_id AS [Proprietario], " + * " works.dbo.lavorazione.id AS [Ultimo Stato], works.dbo.lavorazione.id AS [News], works.dbo.lavorazione.operatore_id AS [OP], works.dbo.lavorazione.id AS [Link], " + * " works.dbo.lavorazione.id AS [USID], '0' AS [ORDCOL], '0' AS [IDSTATO], '0' AS [NEWORD], '0' AS [SCAD] " + * " from works.dbo.lavorazione, giomai_db.dbo.ecmonsql, works.dbo.utente_lavoro " + * " where works.dbo.lavorazione.rivenditore_id = works.dbo.utente_lavoro.rivenditore_id AND works.dbo.utente_lavoro.utente_id = works.dbo.lavorazione.clienteF_id AND works.dbo.lavorazione.rivenditore_id = giomai_db.dbo.ecmonsql.cliente_id " + * filOb + filTs + filMc + filPr + filApp + filEv + filOp + filComm + filRivend;*/ string str = " SELECT '0' AS [Sel.], Right('000' + CONVERT(NVARCHAR, works.dbo.lavorazione.id), 6) AS ID, " + " works.dbo.lavorazione.rivenditore_id AS [Riv.Cod.], giomai_db.dbo.ecmonsql.azienda AS [Rivenditore], " + " works.dbo.utente_lavoro.nome + ' (' + convert(VARCHAR, works.dbo.utente_lavoro.utente_id) + ')' AS [Cliente], " + " works.dbo.lavorazione.nomelavoro AS [Nome], works.dbo.lavorazione.obiettivo_id AS [Obiettivo], works.dbo.lavorazione.priorita_id AS [Priorita], " + " convert(varchar, works.dbo.lavorazione.consegna, 103) AS [Consegna], works.dbo.lavorazione.datainserimento AS [Inserito], " + " works.dbo.lavorazione.utente_id AS [Proprietario], storico.descrizione + '#' + convert (varchar, storico.data, 103) + ' ' + convert(varchar, storico.data, 24) AS [Ultimo Stato], works.dbo.lavorazione.id AS [News], works.dbo.lavorazione.operatore_id AS [OP], " + " works.dbo.lavorazione.id AS [Link], works.dbo.lavorazione.note AS [Nota], isnull(works.dbo.amzordine.vettore_id, 0) AS [VettID], " + " storico.colore AS [USID], storico.ordine AS [ORDCOL], storico.stato_id AS [IDSTATO], '0' AS [NEWORD], '0' AS [SCAD], storico.operatori_display AS [OPDISP], works.dbo.utente_lavoro.utente_id AS clfID" + " from works.dbo.lavorazione " + " outer apply(select top 1 works.dbo.storico_lavoro.stato_id, works.dbo.stato_lavoro.ordine, works.dbo.stato_lavoro.descrizione, works.dbo.storico_lavoro.data, works.dbo.stato_lavoro.colore, works.dbo.stato_lavoro.operatori_display " + " from works.dbo.storico_lavoro, works.dbo.stato_lavoro where works.dbo.stato_lavoro.id = works.dbo.storico_lavoro.stato_id and works.dbo.storico_lavoro.lavorazione_id = works.dbo.lavorazione.id order by works.dbo.storico_lavoro.data desc) as storico " + " join giomai_db.dbo.ecmonsql on (works.dbo.lavorazione.rivenditore_id = giomai_db.dbo.ecmonsql.cliente_id) " + " join works.dbo.utente_lavoro on (works.dbo.lavorazione.rivenditore_id = works.dbo.utente_lavoro.rivenditore_id AND works.dbo.utente_lavoro.utente_id = works.dbo.lavorazione.clienteF_id ) " + " left join works.dbo.amzordine on (works.dbo.amzordine.numamzordine = works.dbo.lavorazione.nomelavoro) " + " where works.dbo.lavorazione.id > 0 " + filOb + filTs + filMc + filPr + filApp + filEv + filOp + filComm + filRivend; //" order by works.dbo.lavorazione.datainserimento desc "; OleDbDataAdapter adt = new OleDbDataAdapter(str, mcn); DataTable dt = new DataTable(); adt.Fill(dt); DataTable res = dt.Clone(); res.Columns[statoCol].DataType = typeof(string); res.Columns[ordCol].DataType = typeof(int); res.Columns[prCol].DataType = typeof(int); res.Columns[inserCol].DataType = typeof(DateTime); res.Columns[idStatoCol].DataType = typeof(int); res.Columns[newOrd].DataType = typeof(int); res.Columns[scadCol].DataType = typeof(int); res.Columns[clienteFID].DataType = typeof(int); res.Columns[clienteFID].DataType = typeof(int); foreach (DataRow row in dt.Rows) { res.ImportRow(row); } //LavClass.StoricoLavoro storL; //LavClass.StatoLavoro slDisplay; int dispID; string dispUsers; DateTime cons; OleDbConnection wc = new OleDbConnection(s.lavOleDbConnection); wc.Open(); foreach (DataRow dr in res.Rows) { /*storL = LavClass.StatoLavoro.GetLastStato(int.Parse(dr[statoCol].ToString()), this.settings, wc); * dr[statoCol] = storL.stato.descrizione + "#" + storL.data.ToString(); * dr[ordCol] = storL.stato.ordine; * dr[idStatoCol] = storL.stato.id;*/ // MODIFICA PRIORITA' cons = DateTime.Parse(dr[consCol].ToString()); if (oper.tipo.id == settings.lavDefOperatoreID && cons.Subtract(DateTime.Today).Days <= NPriorita) { dr[newOrd] = -1; } if (cons < DateTime.Today) { dr[scadCol] = -1; } /*slDisplay = new LavClass.StatoLavoro(int.Parse(dr[idStatoCol].ToString()), settings, wc); * if (!sospesi && slDisplay.id == s.lavDefStatoSospeso) * dr.Delete(); * else if (!soloMieiStati && (slDisplay.id == s.lavDefStoricoChiudi || slDisplay.id == s.lavDefStatoNotificaIns)) * dr.Delete(); * else if (soloMieiStati && !slDisplay.OperatoreDisplay(oper)) * dr.Delete(); * else if (!soloMieiStati && !slDisplay.OperatoreDisplay(oper)) * dr[linkCol] = 0;*/ dispID = int.Parse(dr[idStatoCol].ToString()); dispUsers = dr[opDispCol].ToString(); if (!sospesi && dispID == s.lavDefStatoSospeso) { dr.Delete(); } else if (!soloMieiStati && (dispID == s.lavDefStoricoChiudi || dispID == s.lavDefStatoNotificaIns)) { dr.Delete(); } else if (soloMieiStati && !LavClass.StatoLavoro.IsOperatoreInList(dispUsers, ',', oper)) { dr.Delete(); } else if (!soloMieiStati && !LavClass.StatoLavoro.IsOperatoreInList(dispUsers, ',', oper)) { dr[linkCol] = 0; } } wc.Close(); mcn.Close(); if (statID == 0) { res.DefaultView.Sort = (chkSortDate.Checked) ? "ORDCOL ASC, Inserito ASC, SCAD ASC, NEWORD ASC, Priorita DESC" : "ORDCOL ASC, SCAD ASC, NEWORD ASC, Priorita DESC, Inserito ASC"; //////////// res.Columns.RemoveAt(opDispCol); res.Columns.RemoveAt(scadCol); res.Columns.RemoveAt(newOrd); LavGrid.DataSource = res.DefaultView.ToTable(); } else if (statID != 0 && res.Select(" IDSTATO = " + statID.ToString()).Length > 0) { res = res.Select(" IDSTATO = " + statID.ToString()).CopyToDataTable(); res.DefaultView.Sort = (chkSortDate.Checked) ? "ORDCOL ASC, Inserito ASC, SCAD ASC, NEWORD ASC, Priorita DESC" : "ORDCOL ASC, SCAD ASC, NEWORD ASC, Priorita DESC, Inserito ASC"; //////////// res.Columns.RemoveAt(opDispCol); res.Columns.RemoveAt(scadCol); res.Columns.RemoveAt(newOrd); LavGrid.DataSource = res.DefaultView.ToTable(); } else if (statID == 0 && res.Select(" IDSTATO = " + statID.ToString()).Length == 0) { res = null; LavGrid.DataSource = res; } prFile = XDocument.Load(settings.lavPrioritaFile); obFile = XDocument.Load(settings.lavObiettiviFile); operFile = XDocument.Load(settings.lavOperatoreFile); tipoOpFile = XDocument.Load(settings.lavTipoOperatoreFile); LavGrid.DataBind(); labTotRighe.Text = "Lavorazioni mostrate: " + LavGrid.Rows.Count; fillDropRivenditori((DataTable)LavGrid.DataSource, DropRivenditori.SelectedValue); }
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 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 (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 (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 void InsertPrimoStorico(int idlav, OleDbConnection wc, LavClass.Operatore oper, UtilityMaietta.genSettings s) { LavClass.StatoLavoro stl = new LavClass.StatoLavoro(settings.lavDefStatoNotificaIns, settings, wc); LavClass.SchedaLavoro.InsertStoricoLavoro(idlav, stl.successivoid.Value, oper, DateTime.Now, s, wc); }
protected void LavGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.Cells.Count > idCol) { e.Row.Cells[clienteFID - 3].Visible = false; e.Row.Cells[operCol].Visible = false; e.Row.Cells[usidCol].Visible = false; e.Row.Cells[ordCol].Visible = false; e.Row.Cells[idStatoCol].Visible = false; //e.Row.Cells[opDispCol].Visible = false; } if (e.Row.RowIndex == -1) { return; } AmazonOrder.Order.lavInfo idlav = new AmazonOrder.Order.lavInfo(); idlav.lavID = int.Parse(e.Row.Cells[idCol].Text); idlav.rivID = int.Parse(e.Row.Cells[rivcodCol].Text); idlav.userID = int.Parse(e.Row.Cells[clienteFID - 3].Text); e.Row.Cells[obCol].Text = LavClass.Obiettivo.GetFromFile(obFile, "obiettivo", "id", int.Parse(e.Row.Cells[obCol].Text)).nome; e.Row.Cells[obCol].Font.Bold = true; LavClass.Priorita pr = LavClass.Priorita.GetFromFile(prFile, "npriorita", "id", int.Parse(e.Row.Cells[prCol].Text)); e.Row.Cells[prCol].Text = pr.nome; e.Row.Cells[prCol].Font.Bold = true; e.Row.Cells[prCol].BackColor = pr.colore; string allegati = ""; if (LavClass.SchedaLavoro.HasEmptyAttach(idlav.lavID, idlav.rivID, idlav.userID, settings)) { allegati = "<br /><font color='black' size='2px'><b>senza allegato</b></font>"; } else if (!LavClass.SchedaLavoro.HasAllegati(idlav.lavID, idlav.rivID, idlav.userID, settings)) { allegati = "<br /><font color='red' size='2px'><b>nessun allegato</b></font>"; } e.Row.Cells[statoCol].Text = "<b>" + e.Row.Cells[statoCol].Text.Replace("#", "</b><br /><font size='1'>") + "</font>" + allegati; e.Row.Cells[userCol].Font.Size = 9; LavClass.Operatore userRow = LavClass.Operatore.GetFromFile(operFile, "operatore", "id", int.Parse(e.Row.Cells[userCol].Text), tipoOpFile, "tipo", "id"); LavClass.Operatore operRow = LavClass.Operatore.GetFromFile(operFile, "operatore", "id", int.Parse(e.Row.Cells[operCol].Text), tipoOpFile, "tipo", "id"); e.Row.Cells[userCol].Text = "<b>" + userRow.ToString() + "</b><br />(" + operRow.ToString() + ")"; e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(e.Row.Cells[usidCol].Text); //if (checkCookie(int.Parse(e.Row.Cells[idCol].Text), op.id, settings.lavCookieFile).ToLower() != LavClass.CookieLav.NormalizeCookie(e.Row.Cells[statoCol].Text)) if (checkCookie(int.Parse(e.Row.Cells[idCol].Text), op.id, cookieX).ToLower() != LavClass.CookieLav.NormalizeCookie(e.Row.Cells[statoCol].Text)) { e.Row.Cells[blinkCol].Text = "<img src='pics/star-blink.gif' width='30px' height='30px' />"; } else { e.Row.Cells[blinkCol].Text = ""; } e.Row.Cells[isNoteCol].Text = (HttpUtility.HtmlDecode(e.Row.Cells[isNoteCol].Text).Trim() != "") ? "<img src='pics/postit.png' width='30px' height='30px' title='" + HttpUtility.HtmlDecode(e.Row.Cells[isNoteCol].Text).Trim() + "' />" : ""; string idvett; e.Row.Cells[isVettoreCol].Text = (idvett = HttpUtility.HtmlDecode(e.Row.Cells[isVettoreCol].Text).Trim()) != "0" && File.Exists(Server.MapPath("pics/vettori/" + idvett + ".png")) ? "<img src='pics/vettori/" + idvett + ".png' width='30px' height='30px' />" : ""; //title='" + HttpUtility.HtmlDecode(e.Row.Cells[isVettoreCol].Text).Trim() + "' />" : ""; e.Row.Cells[nomeLavCol].Font.Bold = true; e.Row.Cells[nomeLavCol].Font.Size = 12; Label lbId = new Label(); lbId.Text = int.Parse(e.Row.Cells[idCol].Text).ToString().PadLeft(5, '0'); lbId.ID = "lab_" + e.Row.Cells[idCol].Text; lbId.Width = 45; lbId.Font.Size = 12; lbId.Font.Bold = true; e.Row.Cells[idCol].Controls.Add(lbId); if (e.Row.Cells[linkCol].Text != "0") { e.Row.Cells[linkCol].Text = "<a href='lavDettaglio.aspx?id=" + e.Row.Cells[idCol].Text + "&token=" + Session["token"].ToString() + "&merchantId=" + Request.QueryString["merchantId"].ToString() + "' target='_self'><img src='pics/info.png' width='30px' height='30px' /></a>"; } else { e.Row.Cells[linkCol].Text = ""; } e.Row.Cells[inserCol].Text = "<b>" + e.Row.Cells[inserCol].Text.Replace(" ", "</b><br />"); e.Row.Cells[inserCol].Font.Size = 9; if (DateTime.Parse(e.Row.Cells[consCol].Text) < DateTime.Today) { e.Row.Cells[consCol].BackColor = System.Drawing.Color.Red; e.Row.Cells[consCol].Style.Add("text-decoration", "blink"); e.Row.Cells[consCol].Font.Bold = true; } Button b = new Button(); e.Row.Cells[rdbCol].Controls.Add(b); b.ID = "btn_" + e.Row.Cells[idCol].Text; b.Click += b_Click; b.Text = "*"; b.OnClientClick = "btnVisible(" + idlav.lavID + ");scrollBottom();"; AsyncPostBackTrigger trigger = new AsyncPostBackTrigger(); trigger.ControlID = b.UniqueID; trigger.EventName = "Click"; updPan1.Triggers.Add(trigger); }
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; }