コード例 #1
0
        protected void Button_Add_Spec_Click(object sender, EventArgs e)
        {
            BackEndObjects.Id IdGen  = new BackEndObjects.Id();
            String            specId = IdGen.getNewId(BackEndObjects.Id.ID_TYPE_SPEC_SRING);
            ArrayList         dimn   = new ArrayList();

            dimn.Add(TextBox11.Text);
            dimn.Add(TextBox12.Text);
            dimn.Add(TextBox13.Text);

            BackEndObjects.Specifications spec = new BackEndObjects.Specifications();
            spec.setSpecName(TextBox10.Text);
            spec.setDimensions(dimn);
            spec.setSpecId(specId);

            ArrayList specList = new ArrayList();

            specList.Add(spec);
            try
            {
                BackEndObjects.Features.insertSpecforFeatureDB(DropDownList2.SelectedValue, specList);
                Label2.Visible   = true;
                Label2.Text      = "Data Inserted Successfully";
                Label2.ForeColor = System.Drawing.Color.Green;
            }
            catch (Exception ex)
            {
                Label2.Visible   = true;
                Label2.Text      = "Data Insertion Failed";
                Label2.ForeColor = System.Drawing.Color.Green;
            }
        }
コード例 #2
0
        protected void fillGrid()
        {
            String selectedProdCatId = Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT] != null?
                                       Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT].ToString():"";

            if (selectedProdCatId != null && !selectedProdCatId.Equals(""))
            {
                Dictionary <String, Features> featDict = BackEndObjects.ProductCategory.getFeatureforCategoryDB(selectedProdCatId);

                if (featDict.Count > 0)
                {
                    GridView1.Visible               = true;
                    Label_Extra_Spec.Visible        = true;
                    TextBox_Spec.Visible            = true;
                    Label_Extra_Spec_upload.Visible = true;
                    FileUpload2.Visible             = true;

                    DataTable dt = new DataTable();
                    dt.Columns.Add("Hidden_Feat_Id");
                    dt.Columns.Add("Feature");
                    dt.Columns.Add("From");
                    dt.Columns.Add("To");

                    int i = 0;
                    foreach (KeyValuePair <String, Features> kvp in featDict)
                    {
                        dt.Rows.Add();
                        Features ft = kvp.Value;
                        dt.Rows[i]["Hidden_Feat_Id"] = ft.getFeatureId();
                        dt.Rows[i]["Feature"]        = ft.getFeatureName();

                        i++;
                    }

                    GridView1.DataSource = dt;
                    GridView1.DataBind();

                    GridView1.HeaderRow.Cells[1].Visible = false;
                    foreach (GridViewRow gVR in GridView1.Rows)
                    {
                        gVR.Cells[1].Visible = false;

                        Features  ft       = featDict[((Label)gVR.Cells[1].FindControl("Label_Hidden")).Text];
                        ArrayList specList = ft.getSpecifications();

                        for (int j = 0; j < specList.Count; j++)
                        {
                            BackEndObjects.Specifications specObj = (BackEndObjects.Specifications)specList[j];
                            ListItem ltSpec = new ListItem();
                            ltSpec.Text  = specObj.getSpecName();
                            ltSpec.Value = specObj.getSpecId();
                            ((DropDownList)gVR.Cells[2].FindControl("DropDownList_Gridview1_From")).Items.Add(ltSpec);
                            ((DropDownList)gVR.Cells[3].FindControl("DropDownList_Gridview1_To")).Items.Add(ltSpec);
                        }
                    }
                }
            }
        }