public void FillShowcases() { DataTable TStore = Conn.RUN_SELECT("store", "*", null, QHS.AppAnd(QHS.NullOrEq("active", "S"), Conn.Security.SelectCondition("store", true)), null, false); //DataTable DT = DataAccess.RUN_SELECT(Conn, "showcase", "*", "title asc", null, false); string Query = " SELECT showcase.idshowcase as idshowcase, showcase.idstore as idstore, showcase.title as title FROM showcase JOIN store "; Query += " on (showcase.idstore = store.idstore) WHERE store.active='S'"; DataTable DT = Conn.SQLRunner(Query); if (DT == null || DT.Rows.Count == 0) { return; } //Cancella le vetrine non associate a magazzini autorizzati foreach (DataRow r in DT.Select()) { string search = QHS.CmpEq("idstore", r["idstore"]); if (TStore.Select(search).Length > 0) { continue; } r.Delete(); } DT.AcceptChanges(); foreach (DataRow DR in DT.Rows) { string Label = DR["title"].ToString(); string id = DR["idshowcase"].ToString(); string idstore = DR["idstore"].ToString(); hwButton HB = new hwButton(); HB.ID = "btnShowcase_" + id + "_" + idstore; HB.CssClass = "showcasebutton"; /* * HB.Style.Add("border", "0px"); * HB.Style.Add("background-color", "white"); * HB.Style.Add("cursor", "hand"); * HB.Style.Add(); */ HB.Tag = "showcase." + id + "." + idstore; HB.Text = Label; showcases.Controls.Add(HB); HtmlGenericControl br = new HtmlGenericControl("br"); showcases.Controls.Add(br); } }
private bool AddCustomControl(string tag, string tablename, string paramname, int HPosition, int VPosition, DataRow param, bool IsAlias, TableCell TCell) { if (tag == "") { return(false); } int dotpos = tag.IndexOf("."); string tipo = tag.Substring(0, dotpos); string[] token = tag.Substring(dotpos + 1).Split('|'); switch (tipo.ToLower()) { case "check": hwCheckBox ctrl = new hwCheckBox(); ctrl.Tag = tablename + "." + paramname + ":" + token[0] + ":" + token[1]; ctrl.Text = token[2]; ctrl.Width = ControlWidth - 20; TCell.Controls.Add(ctrl); TCell.Style.Add("text-align", "left"); TCell.Style.Add("vertical-align", "top"); //ctrl.Style.Add("left", HPosition.ToString()); //ctrl.Style.Add("top", VPosition + 8); //ctrl.Location = new Point(HPosition, VPosition + 8); if (OnePrintObbligatorio && paramname == "oneprint") { ctrl.Enabled = false; } break; case "radio": hwPanel grp = InserisciGroupBox(param, TCell); LiteralControl br; int i; Unit Altezza = new Unit(0); for (i = 0; i < token.Length / 2; i++) { hwRadioButton rb = new hwRadioButton(); rb.Tag = tablename + "." + paramname + ":" + token[2 * i]; rb.Text = token[2 * i + 1]; //rb.Width = ControlWidth - 20; rb.Height = LabelHeight; //TCell.Controls.Add(rb); grp.Controls.Add(rb); br = new LiteralControl("<br/>"); grp.Controls.Add(br); TCell.Controls.Add(grp); // come li piazziamo //rb.Location = new Point(12, Altezza); // Serve incrementarlo?? Altezza = new Unit(Altezza.Value + rb.Height.Value); } grp.Height = new Unit(Altezza.Value + grp.Height.Value); //Altezza + 10; //this.VPosition += (grp.Height - HelpHeight - 4); break; case "custom": string selectioncode = token[0]; //ReportVista.customselectionDataTable T = reportVista1.customselection; //DataRow selRow = T.FindByselectioncode(selectioncode); DataTable T = ExportVista.customselection; string filter = QHC.CmpEq("selectioncode", selectioncode); DataRow[] selRow = T.Select(filter); if (selRow == null || selRow.Length == 0) { return(false); } string parenttable = selRow[0]["tablename"].ToString(); string editlisttype = selRow[0]["editlisttype"].ToString(); string selectiontype = selRow[0]["selectiontype"].ToString(); string fieldname = selRow[0]["fieldname"].ToString(); filter = myDA.Compile(selRow[0]["filter"].ToString(), true); string filterapp = filter; AddCustomTableToDS(selRow[0], paramname, IsAlias); if (IsAlias) { parenttable += AliasCount; } GestioneClass GestAttributi = GestioneClass.GetGestioneClassForField(selectioncode, myDA, parenttable); if (GestAttributi != null) { selectiontype = "C"; if (GestAttributi.AllowSelection() == false) { myPrymaryTable.Columns[paramname].DefaultValue = GestAttributi.DefaultValue(); myPrymaryTable.Columns[paramname].AllowDBNull = GestAttributi.AllowNull(); return(false); } } if (filter != "") { filterapp = "." + filterapp; } // C(hoose) o M(anage)? bool IsAutoManage = (selectiontype.ToUpper() == "M"); bool IsAutoChoose = (selectiontype.ToUpper() == "C"); bool IsComboManage = (selectiontype.ToUpper() == "U"); // Si riporta la patch relativa al task 2525 if (false) //(paramname == "idupb" && Session["codiceresponsabile"] != null) { // Invece di inserire il groupbox, se sono un responsabile // Inserisco la classica dropdown e la filtro. hwDropDownList CB = new hwDropDownList(); CB.Style.Add("width", "302px"); string tablename2 = param["datasource"].ToString(); string paramname2 = param["paramname"].ToString(); if (IsAlias) { tablename2 += AliasCount; } //CB.Location = new Point(btn.Location.X + btn.Width + 1, 14); //CB.Width = ControlWidth - btn.Width - 20; CB.ID = paramname; //CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.Tag = myPrymaryTable.TableName + "." + paramname2; string cmbfilter; cmbfilter = QHC.AppAnd(QHC.DoPar(QHC.AppOr(QHC.IsNull("idman"), QHC.CmpEq("idman", Session["codiceresponsabile"]))), QHC.CmpEq("active", "S")); GetData.SetStaticFilter(DS.Tables[tablename2], cmbfilter); hwLabel LB = InserisciLabel(param, TCell); CB.DataSource = DS.Tables[tablename2]; CB.DataValueField = "idupb"; CB.DataTextField = "title"; CB.AutoPostBack = true; TCell.Controls.Add(CB); return(false); } //Inserisco un groupbox hwPanel gb = InserisciGroupBox(param, selRow[0]["selectionname"].ToString(), TCell); //gb.Style.Add("background-color", "#bababa;"); //gb.Style.Add("border", "1px solid grey"); //gb.Style.Add("width", "95%"); //aggiungo un button hwButton btn = new hwButton(); btn.ID = "btn" + paramname; btn.Text = "Seleziona"; //btn.Location = new Point(12, 14); btn.Style.Add("width", "85px"); //btn.Height = TextHeight - 9; gb.Controls.Add(btn); LiteralControl nbsp = new LiteralControl(" "); gb.Controls.Add(nbsp); hwTextBox TBP = null; if (IsAutoChoose || IsAutoManage) { //e un textbox TBP = new hwTextBox(); TBP.ID = paramname; //TBP.Location = new Point(btn.Location.X + btn.Width + 1, 14); //TBP.Width = ControlWidth - btn.Width - 20; //TBP.Height = TextHeight; TBP.Tag = parenttable + "." + fieldname + "?x"; TBP.Style.Add("width", "179px"); gb.Controls.Add(TBP); } if (IsComboManage) { btn.Tag = "manage." + parenttable + "." + editlisttype + filterapp; hwDropDownList CBP = new hwDropDownList(); string tablename2 = param["datasource"].ToString(); string paramname2 = param["paramname"].ToString(); if (IsAlias) { tablename2 += AliasCount; } hwDropDownList CB = new hwDropDownList(); CB.Style.Add("width", "179px"); //CB.Location = new Point(btn.Location.X + btn.Width + 1, 14); //CB.Width = ControlWidth - btn.Width - 20; CB.ID = paramname; //CB.DropDownStyle = ComboBoxStyle.DropDownList; CB.Tag = myPrymaryTable.TableName + "." + paramname2; CB.DataSource = DS.Tables[tablename2]; CB.DataValueField = param["valuemember"].ToString(); CB.DataTextField = param["displaymember"].ToString(); CB.AutoPostBack = true; if ((paramname.IndexOf("level") >= 0) && (param["hintkind"].ToString().ToUpper() == "NOHINT")) { ComboToPreset.Add(CB); } gb.Controls.Add(CB); TCell.Controls.Add(gb); } if (GestAttributi != null) { TBP.Style.Add("text-align", "left"); TBP.Style.Add("width", "179px"); btn.Tag = GestAttributi.BtnTag(); gb.Tag = "AutoChoose." + TBP.ID + "." + editlisttype + "." + GestAttributi.GetFilterAutoChoose(); } else { if (IsAutoManage) { TBP.Style.Add("text-align", "right"); //TBP.TextAlign = HorizontalAlignment.Right; btn.Tag = "manage." + parenttable + "." + editlisttype + filterapp; gb.Tag = "AutoManage." + parenttable + "." + editlisttype + filterapp; } if (IsAutoChoose) { TBP.Style.Add("text-align", "left"); TBP.Style.Add("width", "179px"); //TBP.TextAlign = HorizontalAlignment.Left; btn.Tag = "choose." + parenttable + "." + editlisttype + filterapp; gb.Tag = "AutoChoose." + TBP.ID + "." + editlisttype + filterapp; } } break; case "costant": //controlli il cui valore è costante (es. il filtro bilancio deve essere 'E') bool visible = !(token[0].ToLower() == "hidden"); hwLabel lb = InserisciLabel(param, TCell); lb.Visible = visible; hwTextBox tb = InserisciTextBox(param, TCell); if (!visible) { tb.Style.Add("display", "none"); } tb.ReadOnly = true; if (!visible) { return(false); } break; } return(true); }