Example #1
0
    public override void AfterLink(bool firsttime, bool formToLink)
    {
        Meta.CanInsert     = false;
        Meta.CanCancel     = false;
        Meta.CanSave       = false;
        Meta.SearchEnabled = false;

        //Parameters = reportVista1.reportparameter.Select(null, "number asc");
        //BuildForm(Parameters);
        //if(ParamsForm.Controls.Count==0)
        ParamsForm.Controls.Add(MainPlaceHolder);

        if (ComboToPreset != null)
        {
            for (int i = 0; i < ComboToPreset.Count; i++)
            {
                hwDropDownList CB = (hwDropDownList)ComboToPreset[i];
                if (CB.Items.Count > 1)
                {
                    CB.SelectedIndex = 1;
                }
            }
            ComboToPreset = null;
        }

        Page.Title = ExportTitle;
        DS.AcceptChanges();
        ExportVista.AcceptChanges();
    }
Example #2
0
    private void InserisciCombo(DataRow Param, bool IsAlias, TableCell TCell)
    {
        string tablename = Param["datasource"].ToString();
        string paramname = Param["paramname"].ToString();

        if (IsAlias)
        {
            tablename += AliasCount;
        }
        hwDropDownList CB = new hwDropDownList();

        TCell.Controls.Add(CB);
        //CB.Style.Add()
        //CB.Location = new Point(HPosition, VPosition + LabelHeight);
        CB.Width = ControlWidth;
        CB.Style.Add("width", "302px");

        //CB.DropDownStyle = ComboBoxStyle.DropDownList;
        CB.ID             = paramname;
        CB.Tag            = myPrymaryTable.TableName + "." + paramname;
        CB.DataSource     = DS.Tables[tablename];
        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);
        }
    }
Example #3
0
    public override void AfterFill()
    {
        if (ComboToPreset != null)
        {
            for (int i = 0; i < ComboToPreset.Count; i++)
            {
                hwDropDownList CB = (hwDropDownList)ComboToPreset[i];
                if (CB.Items.Count > 1)
                {
                    CB.SelectedIndex = 1;
                }
            }
            ComboToPreset = null;
        }

        Page.Title = ExportDescription;
        DS.AcceptChanges();
    }
Example #4
0
    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("&nbsp;");
            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);
    }