public string GetItemDetail(DataRow DR) { string outputstr = ""; string code = DR["intcode"].ToString(); string description = DR["description"].ToString(); bool skip = false; //if (code == "AA01327") // skip = true; //if (code == "AA00257") // skip = true; int idlist = CfgFn.GetNoNullInt32(DR["idlist"]); int idstore = CfgFn.GetNoNullInt32(DR["idstore"]); int idstock = 0; decimal price = 0; if (booking_on_invoice()) { idstock = CfgFn.GetNoNullInt32(DR["idstock"]); price = CfgFn.GetNoNullDecimal(DR["price"]); //era avgprice } decimal disponibili = 0; decimal number = 0; int availability = 0; string listclass = DR["listclasstitle"].ToString(); string requiresauth = ""; //string semaphore = "<img src=\"Immagini/tl_none.png\" alt=\"Disponibile\">"; string semaphore = ""; if (DR["authorizationrequired"] != null) { if (DR["authorizationrequired"].ToString().ToUpper() == "S") { requiresauth = "Richiede Autorizzazione"; } } int field_to_match = idstock; if (!booking_on_invoice()) { field_to_match = idlist; number = CfgFn.GetNoNullDecimal(DR["number"]); decimal booked = CfgFn.GetNoNullDecimal(DR["booked"]); decimal ordered = CfgFn.GetNoNullDecimal(DR["ordered"]); disponibili = number - booked; if (disponibili < 0) { disponibili = 0; } if (disponibili > 0) { semaphore = "<img src=\"Immagini/tl_green.png\" alt=\"Disponibile\">"; } else if (disponibili == 0 && ordered > 0) { semaphore = "<img src=\"Immagini/tl_yellow.png\" alt=\"In ordinazione\">"; } else if (disponibili == 0 && ordered == 0) { semaphore = "<img src=\"Immagini/tl_red.png\" alt=\"Non disponibile\">"; } else if (disponibili <= 0) { semaphore = "<img src=\"Immagini/tl_red.png\" alt=\"Non disponibile\">"; } } else { availability = CfgFn.GetNoNullInt32(DR["available"]); } string itemimage = ""; if (HasImage(idlist)) { itemimage = "<img src=\"GetItemImage.aspx?idlist=" + idlist + "\" style=\"width: 100px;\"/>"; } else { itemimage = "<img src=\"Immagini/imagenotavailable.png\" style=\"width: 100px;\"/>"; } outputstr += "<table class=\"normalwrap\" width=\"100%\"><tr><td style=\"width: 98%;\">"; //valign=\"top\" outputstr += "<p style=\"font-size: 13px; text-align:left;\"><b>Codice Articolo:</b> " + HttpUtility.HtmlEncode(code) + "</p>"; outputstr += "<p style=\"font-size: 13px; text-align:left;\"><b>Class. Merceologica:</b> " + HttpUtility.HtmlEncode(listclass) + "</p>"; if (booking_on_invoice()) { outputstr += "<p style=\"font-size: 13px; text-align:left;\"><b>Prezzo unitario:</b> " + HelpForm.StringValue(price, "x.y.n") + "</p>"; outputstr += "<p style=\"font-size: 13px; text-align:left;\"><b>Disponibili in magazzino:</b> " + HelpForm.StringValue(availability, "x.y.n") + "</p>"; } else { outputstr += "<p style=\"font-size: 13px; text-align:left;\"><b>Giacenza in magazzino:</b> " + HelpForm.StringValue(number, "x.y.n") + "</p>"; outputstr += "<p style=\"font-size: 13px; text-align:left;\"><b>Disponibili in magazzino:</b> " + HelpForm.StringValue(disponibili, "x.y.n") + "</p>"; } //if (skip) { // outputstr += "</td>"; // outputstr += "</tr></table><br/>"; // return outputstr; //} QueryCreator.MarkEvent("code:" + code + " listclass:" + listclass + " description: " + HttpUtility.HtmlEncode(description)); outputstr += "<p style=\"width: 98%; text-align:justify ;font-size: 13px;\"><strong>Descrizione:</strong><br/><i>" + HttpUtility.HtmlEncode(description) + "</i></p>"; outputstr += "<p style=\"width: 98%; font-size: 11px; color: red; text-align: right;\">" + requiresauth + "</p>"; outputstr += "</td>"; outputstr += "<td style=\"width: 300px;\"><center>" + itemimage + "</center></td>"; //valign=\"center\" outputstr += "<td style=\"width: 80px;\"><center>" + semaphore + "</center></td>"; // valign=\"center\" outputstr += "</tr><tr><td colspan=\"3\">"; outputstr += "<div style=\"position: relative; bottom:0px;background-color:#cccccc; width:100%;text-align: right;font-size:12px;\">"; outputstr += "Quantità:<input onfocus=\"document.getElementById(this.id).className='focused';\" onblur=\"document.getElementById(this.id).className='';\" id=\"quant" + field_to_match + "\" style=\"text-align:right;\" type=\"text\" size=\"5\" value=\"1\"> "; outputstr += "<input type=\"button\" onclick=\"javascript:inc('quant" + field_to_match + "');\" value=\"+\"/>"; outputstr += "<input type=\"button\" onclick=\"javascript:dec('quant" + field_to_match + "');\" value=\"-\"/>"; outputstr += "<input type=\"button\" onclick=\"javascript:addtocart('" + idlist + "','" + idstore + "','" + HelpForm.StringValue(price, "x.y.n") + "','" + field_to_match + "');\" value=\"Aggiungi al Carrello\"/>"; outputstr += "</div></td>"; outputstr += "</tr></table><br/>"; return(outputstr); }
void CreaPaginaParametri() { DataAccess Conn = GetVars.GetUserConn(this); DataTable Params; GetParamfromDB(); //Leggo i parametri del report dal DB e imposta var. di sessione Params = (DataTable)Session["ParamData"]; if (Params == null) { return; } DataTable UserPar = (DataTable)Session["UserPar"]; if (UserPar == null) { return; } DataRow Par = UserPar.Rows[0]; TxtBoxArr = new WebControl[15]; //Disegno la tabella dei parametri Table1.Width = 800; Table1.BorderStyle = BorderStyle.Solid; //Table1.BackColor = Color.LightSteelBlue; int CountParam = 0; foreach (DataRow MyRowParam in Params.Rows) { if (MyRowParam["selectioncode"].ToString() == "costant.hidden") { continue; } CountParam++; //Incrementa il contatore di parametri che mi server per generare gli ID dei controlli //Aggiunge una riga alla tabella TableRow tRow = new TableRow(); Table1.Rows.Add(tRow); //Aggiunge una cella TableCell tCell1 = new TableCell(); tRow.Cells.Add(tCell1); tCell1.Width = 200; tCell1.Font.Bold = true; //tCell1.BackColor = Color.LightSteelBlue; tCell1.Font.Size = FontUnit.Small; tCell1.Text = MyRowParam["description"].ToString(); //Descrizione del parametro //Nome parametro string ParamName = MyRowParam["paramname"].ToString(); string FlagCombo = MyRowParam["iscombobox"].ToString(); bool FlagNoSelection = MyRowParam["noselectionforall"].ToString().ToUpper() == "S"; if (IsParamLocked(MyRowParam)) { TableCell tCell2 = new TableCell(); tRow.Cells.Add(tCell2); //Crea una TextBox TextBox myTextBox = new TextBox(); //Memorizza la TextBox nell'array di TextBox //TxtBoxArr[countTxt] = myTextBox; myTextBox.Width = 220; tCell2.Controls.Add(myTextBox); MyRowParam["__WebControlID"] = myTextBox.UniqueID; MyRowParam.AcceptChanges(); ///////////////////////////////////////////////////////////////////////////////// ///Attenzione: Inserire in questa sezione i controlli per il blocco dei parametri //Controllo per Responsabile if (MyRowParam["datasource"].ToString().ToLower() == "manager") { myTextBox.ReadOnly = true; myTextBox.BackColor = System.Drawing.Color.LightGray; myTextBox.Text = Session["Responsabile"].ToString(); if (MyRowParam["valuemember"].ToString() == "idman") { Par[ParamName] = Session["codiceresponsabile"]; } else { Par[ParamName] = Session["Responsabile"]; } continue; } if (MyRowParam["datasource"].ToString().ToLower() == "registryreference") { myTextBox.ReadOnly = true; myTextBox.BackColor = System.Drawing.Color.LightGray; myTextBox.Text = Session["Fornitore"].ToString(); myTextBox.Width = 300; if (MyRowParam["valuemember"].ToString() == "idreg") { Par[ParamName] = Session["codicefornitore"]; } else { Par[ParamName] = Session["Fornitore"]; } continue; } } if (FlagCombo.ToUpper() == "S") { //////////////////Aggiunge una DropDownList TableCell tCell2 = new TableCell(); tRow.Cells.Add(tCell2); //Crea una dropDownList DropDownList myDropList = new DropDownList(); tCell2.Controls.Add(myDropList); DataTable myDtCombo; MyRowParam["__WebControlID"] = myDropList.UniqueID; MyRowParam.AcceptChanges(); //Esegue la select per leggere i valori da visualizzare nella dropDownList myDtCombo = GetDataTableXcombo(MyRowParam); foreach (DataRow drCombo in myDtCombo.Rows) { string myValue = drCombo[MyRowParam["displaymember"].ToString()].ToString(); if (myValue.Trim() == "") { continue; } myDropList.Items.Add(myValue); } if (FlagNoSelection) { myDropList.Items.Add("%"); myDropList.SelectedValue = "%"; } if ((ParamName.ToLower().IndexOf("livello") >= 0 || ParamName.ToLower().IndexOf("level") >= 0) && (MyRowParam["hintkind"].ToString().ToUpper() == "NOHINT") ) { if (myDropList.Items.Count > 0) { myDropList.SelectedIndex = 1; } } if (MyRowParam["hintkind"].ToString().ToUpper() != "NOHINT") { try { object def = DefaultForParameter(MyRowParam); DataRow[] Val = myDtCombo.Select(MyRowParam["valuemember"].ToString() + "=" + QueryCreator.quotedstrvalue(def, false)); if ((Val != null) && (Val.Length > 0)) { myDropList.SelectedValue = Val[0][MyRowParam["displaymember"].ToString()].ToString(); } //int NNN = 0; //foreach (DataRow drCombo2 in myDtCombo.Rows) { // string myValue = drCombo2[0].ToString(); // if (myValue.Trim() == "") // continue; // if (myValue == def.ToString()) { // myDropList.SelectedIndex = NNN; // break; // } // NNN++; //} } catch (Exception E) { QueryCreator.MarkEvent(QueryCreator.GetErrorString(E)); }; } else { myDropList.SelectedIndex = myDropList.Items.Count - 1; } } else { //////////////////Aggiunge una TextBox TableCell tCell2 = new TableCell(); tRow.Cells.Add(tCell2); //Crea una TextBox TextBox myTextBox = new TextBox(); //Memorizza la TextBox nell'array di TextBox //TxtBoxArr[countTxt] = myTextBox; myTextBox.Width = 220; tCell2.Controls.Add(myTextBox); MyRowParam["__WebControlID"] = myTextBox.UniqueID; MyRowParam.AcceptChanges(); string tag = "x.y" + MyRowParam["tag"].ToString(); //Inserisce il valore di default del parametro myTextBox.Text = HelpForm.StringValue( DefaultForParameter(MyRowParam), tag); // myTextBox.ID = "IdParam" + CountParam; //Assegna un nome ID alla TextBox; /////////////////////////////////////////////////////////////////////////////////// //////////////////Aggiunge la cella di Help TableCell tCell3 = new TableCell(); tCell3.Width = 400; tCell3.Font.Size = FontUnit.XSmall; //tCell3.BackColor = Color.LightSteelBlue; tRow.Cells.Add(tCell3); tCell3.Text = MyRowParam["help"].ToString(); } } }