Esempio n. 1
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        int id = Convert.ToInt32(Session["ticketid"]);
        int id1;
        id1 = Convert.ToInt32(Session["clientid"]);

        Hashtable dataforvalue = new Hashtable();
        bll compview = new bll();
        if (id != 0)
        {
            dataforvalue = compview.selcomp(id);

            commaDelimited = dataforvalue["fullstring"].ToString();

            string[] year = commaDelimited.Split(new char[] { ',' });
            foreach (string month in year)
            {
                d[k] = month;
                k++;
            }

            int a = id1;
            bll noof = new bll();
            int w, z, tn, cn, tc = 0, cc = 0;
            Hashtable datano = new Hashtable();
            datano = noof.noofrows(a);
            w = Convert.ToInt32(datano["noofrows"]);
            tn = Convert.ToInt32(datano["nooftxt"]);
            cn = Convert.ToInt32(datano["noofcb"]);
            dynamicTextBoxes = new TextBox[tn];
            dynamiccombobox = new AjaxControlToolkit.ComboBox[cn];
            Table tbl = new Table();
            for (z = 0; z < w; z++)
            {
                bll cuscontrol = new bll();
                Hashtable data = new Hashtable();
                data = cuscontrol.ccomp(a, z);

                TableRow tr = new TableRow();
                TableCell td0 = new TableCell();
                tr.CssClass = "table_tr";
                TableCell td1 = new TableCell();
                int field = Convert.ToInt32(data["id"]);

                if (data["control"].ToString() == "Combobox")
                {
                    Response.Write(System.Environment.NewLine);
                    lbl = new System.Web.UI.WebControls.Label();
                    lbl.ID = (2 * z).ToString();

                    lbl.Text = data["label"].ToString();
                    lbl.CssClass = "ajxtxt";

                    td0.Controls.Add(lbl);
                    cb = new AjaxControlToolkit.ComboBox();
                    cb.ID = (2 * z + 1).ToString();
                    cb.Enabled = false;
                    cb.CssClass = "ajxtxt";
                    cb.ForeColor = Color.Black;
                    dynamiccombobox[cc] = cb;
                    cc++;
                    td1.Controls.Add(cb);

                    if (data["value"].ToString() == "get")
                    {
                        string q = data["dbname"].ToString();
                        bll reff = new bll();

                        Type t = reff.GetType();

                        Type[] paramTypes = new Type[1];
                        paramTypes[0] = Type.GetType("System.Int32");

                        MethodInfo CosineInfo = t.GetMethod(q, paramTypes);

                        Object[] parameters = new Object[1];
                        parameters[0] = a;
                        Object returnVal = CosineInfo.Invoke(reff, parameters);

                        string commaDelimited1 = returnVal.ToString();
                        string[] year1 = commaDelimited1.Split(new char[] { ',' });
                        foreach (string month1 in year1)
                        {
                            cb.Items.Add(month1);
                        }
                        cb.SelectedItem.Text = d[2 * z + 1];

                    }
                    else
                    {
                        string returnVal = data["value"].ToString();

                        string commaDelimited2 = returnVal.ToString();
                        string[] year2 = commaDelimited2.Split(new char[] { ',' });
                        foreach (string month2 in year2)
                        {
                            cb.Items.Add(month2);

                        }
                        cb.SelectedItem.Text = d[2 * z + 1];
                    }
                    tr.Cells.Add(td0);
                    tr.Cells.Add(td1);
                    tbl.Rows.Add(tr);
                }

                else
                {
                    int y = 10;
                    lbl = new System.Web.UI.WebControls.Label();
                    lbl.ID = (2 * z).ToString();
                    lbl.Text = data["label"].ToString();

                    lbl.CssClass = "ajxtxt";

                    td0.Controls.Add(lbl);
                    TextBox txt = new TextBox();
                    txt.ID = (2 * z + 1).ToString();
                    // txt.Text = data["value"].ToString();
                    txt.Enabled = false;
                    txt.CssClass = "ajxtxt";
                    txt.Text = d[2 * z + 1];
                    td1.Controls.Add(txt);
                    dynamicTextBoxes[tc] = txt;
                    tc++;
                }
                tr.Cells.Add(td0);
                tr.Cells.Add(td1);
                tbl.Rows.Add(tr);
            }
            PlaceHolder1.Controls.Add(tbl);

        }
    }
Esempio n. 2
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        int i = 0,j=0;
          string[] cmbb= new string[10];
        foreach (AjaxControlToolkit.ComboBox tb in dynamiccombobox)
        {

           cmbb [i] = tb.SelectedItem.Text ;
           i++;
        }
          string[] tbb = new string[10];
        foreach (TextBox tb in dynamicTextBoxes)
        {

        tbb[j] = tb.Text;
        j++;
        }

        Hashtable data = new Hashtable();
        data.Add("client_id", cbclientnme.SelectedValue);
        data.Add("cc_id", cbclientcont.SelectedValue);
        data.Add("doc", txtdoc.Text);
        data.Add("probtype", cbprobtype.SelectedValue);
        data.Add("probsubtype", cbprobtype0.SelectedValue);
        data.Add("priority", ddlpriority.SelectedValue);
        data.Add("taskdesc", txtxtaskdesc.Text);
        data.Add("others", txtothers.Text);
        data.Add("emp_reg",Session["empid"]);
        data.Add("eta", txteta.Text);
        int a = Convert.ToInt32(Session["combosel"]);
        bll noof = new bll();
        int w, z,tn,cn,tc=0,cc=0;
        Hashtable datano = new Hashtable();
        datano = noof.noofrows(a);
        w = Convert.ToInt32(datano ["noofrows"]);
        tn = Convert.ToInt32(datano["nooftxt"]);
        cn = Convert.ToInt32(datano["noofcb"]);
        dynamicTextBoxes = new TextBox[tn];
        dynamiccombobox = new AjaxControlToolkit.ComboBox[cn];
        Table tbl = new Table();
        for (z = 0; z < w; z++)
        {

            bll cuscontrol = new bll();
            Hashtable data1 = new Hashtable();
            data1 = cuscontrol.ccomp(a, z);
            if (data1["control"].ToString() == "Textbox")
            {
                string value = data1["id"].ToString();
                value += ",";

               value+=tbb[tc];

               data.Add(z,  value);
               tc++;
            }
            else if (data1["control"].ToString() == "Combobox")
            {
                string value = data1["id"].ToString();
                value += ",";

                  value += cmbb [cc];
                data.Add(z, value);
                cc++;
            }
        }
        for (int h = w; h < 20; h++)
        {
            data.Add(h, "");
        }
        int id;
        bll inscomp = new bll();
        id=inscomp.inscomplaindet(data);
        lblretticketid.Text = "Complain Details Inserted & Ticket ID is " + id.ToString();
    }