protected void getAddintionalProdSrvList()
        {
            ArrayList prodSpecList = (ArrayList)Session[SessionFactory.UPDATE_PROD_SELECTED_PROD_SPEC_MAP];

            if (prodSpecList == null)
            {
                prodSpecList = new ArrayList();
            }

            BackEndObjects.ShopChildProdsSpecs rfqSpec = new ShopChildProdsSpecs();
            //rfqSpec.set(Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT].ToString());
            rfqSpec.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            rfqSpec.setFeatId("ft_dummy");
            rfqSpec.setFromSpecId("");
            rfqSpec.setToSpecId("");
            rfqSpec.setSpecText(TextBox_Spec.Text);
            rfqSpec.setProdName(Session[SessionFactory.ALL_PRODUCT_SELECTED_PRODUCT_NAME].ToString());
            //rfqSpec.setCreatedDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            //if (User.Identity.Name != null)
            //rfqSpec.setCreatedUsr(User.Identity.Name);
            if (FileUpload_Extra_Spec.HasFile)
            {
                rfqSpec.setFileStream(FileUpload_Extra_Spec);
            }


            prodSpecList.Add(rfqSpec);

            Session[SessionFactory.UPDATE_PROD_SELECTED_PROD_SPEC_MAP] = prodSpecList;
        }
Esempio n. 2
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ArrayList rfqProdSrvList = (ArrayList)Session[SessionFactory.CREATE_PRODUCT_CHILD_PROD_SPEC_MAP];

            if (rfqProdSrvList == null)
            {
                rfqProdSrvList = new ArrayList();
            }

            BackEndObjects.ShopChildProdsSpecs prodSpec = new ShopChildProdsSpecs();

            prodSpec.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            prodSpec.setFeatId(((Label)GridView1.SelectedRow.Cells[1].FindControl("Label_Hidden")).Text);
            prodSpec.setFromSpecId(((DropDownList)GridView1.SelectedRow.Cells[2].FindControl("DropDownList_Gridview1_From")).SelectedValue);
            prodSpec.setToSpecId(((DropDownList)GridView1.SelectedRow.Cells[3].FindControl("DropDownList_Gridview1_To")).SelectedValue);
            //rfqSpec.setSpecText(TextBox_Spec.Text);
            //prodSpec.setSpecText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            if (((FileUpload)GridView1.SelectedRow.Cells[4].FindControl("FileUpload_Spec")).HasFile)
            {
                prodSpec.setFileStream((FileUpload)GridView1.SelectedRow.Cells[4].FindControl("FileUpload_Spec"));
            }


            rfqProdSrvList.Add(prodSpec);

            GridView1.SelectedRow.Cells[0].Enabled = false;
            GridView1.SelectedRow.Cells[3].Enabled = false;
            GridView1.SelectedRow.Cells[4].Enabled = false;
            GridView1.SelectedRow.Cells[5].Enabled = false;
            GridView1.SelectedRow.Cells[0].FindControl("Image_Selected").Visible = true;
            Label_Selected_List.Text += "," + GridView1.SelectedRow.DataItemIndex;

            Session[SessionFactory.CREATE_PRODUCT_CHILD_PROD_SPEC_MAP] = rfqProdSrvList;
        }
        protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Dictionary <String, String> existingFeatList = (Dictionary <String, String>)Session[SessionFactory.PRODUCT_SPECIFICATION_EXISTING_FEAT_LIST];

            if (existingFeatList != null && existingFeatList.ContainsKey(((Label)GridView2.SelectedRow.Cells[1].FindControl("Label_Hidden")).Text))
            {
                Label_Feat_Exists.Visible   = true;
                Label_Feat_Exists.Text      = "Feature already added to this product. You can delete from the above list and re-enter";
                Label_Feat_Exists.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                Label_Feat_Exists.Visible  = false;
                Button_Add_To_Prod.Enabled = true;

                ArrayList PRODSpecList = (ArrayList)Session[SessionFactory.UPDATE_PROD_SELECTED_PROD_SPEC_MAP];
                String    fileName     = null;
                String    prodName     = Session[SessionFactory.ALL_PRODUCT_SELECTED_PRODUCT_NAME].ToString();

                if (PRODSpecList == null)
                {
                    PRODSpecList = new ArrayList();
                }

                BackEndObjects.ShopChildProdsSpecs PRODSpec = new ShopChildProdsSpecs();
                PRODSpec.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                PRODSpec.setFeatId(((Label)GridView2.SelectedRow.Cells[1].FindControl("Label_Hidden")).Text);
                PRODSpec.setFromSpecId(((DropDownList)GridView2.SelectedRow.Cells[2].FindControl("DropDownList_GridView1_From")).SelectedValue);
                PRODSpec.setToSpecId(((DropDownList)GridView2.SelectedRow.Cells[3].FindControl("DropDownList_GridView1_To")).SelectedValue);
                PRODSpec.setProdName(prodName);

                if (((FileUpload)GridView2.SelectedRow.Cells[3].FindControl("FileUpload_Spec")).HasFile)
                {
                    PRODSpec.setFileStream((FileUpload)GridView2.SelectedRow.Cells[3].FindControl("FileUpload_Spec"));
                    fileName = ((FileUpload)GridView2.SelectedRow.Cells[3].FindControl("FileUpload_Spec")).FileName;
                    ((Label)GridView2.SelectedRow.Cells[0].FindControl("Label_File_Name")).Text         = fileName;
                    ((Label)GridView2.SelectedRow.Cells[0].FindControl("Label_File_Name")).Visible      = true;
                    ((FileUpload)GridView2.SelectedRow.Cells[0].FindControl("FileUpload_Spec")).Visible = false;
                }

                PRODSpecList.Add(PRODSpec);


                GridView2.SelectedRow.Cells[0].Enabled = false;
                GridView2.SelectedRow.Cells[3].Enabled = false;
                GridView2.SelectedRow.Cells[4].Enabled = false;
                GridView2.SelectedRow.Cells[5].Enabled = false;


                GridView2.SelectedRow.Cells[0].FindControl("Image_Selected").Visible = true;
                Label_Selected_List.Text += "," + GridView2.SelectedRow.DataItemIndex;
                Session[SessionFactory.UPDATE_PROD_SELECTED_PROD_SPEC_MAP] = PRODSpecList;
            }
        }
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            DataTable dt       = (DataTable)Session[SessionFactory.ALL_PROD_SPECIFICATION_DATAGRID];
            String    prodName = Session[SessionFactory.ALL_PRODUCT_SELECTED_PRODUCT_NAME].ToString();

            String fromSpecText = ((DropDownList)GridView1.Rows[e.RowIndex].Cells[0].FindControl("DropDownList_From_Spec_Edit")).SelectedItem != null ?
                                  ((DropDownList)GridView1.Rows[e.RowIndex].Cells[0].FindControl("DropDownList_From_Spec_Edit")).SelectedItem.Text : "";
            String fromSpecId = ((DropDownList)GridView1.Rows[e.RowIndex].Cells[0].FindControl("DropDownList_From_Spec_Edit")).SelectedValue != null ?
                                ((DropDownList)GridView1.Rows[e.RowIndex].Cells[0].FindControl("DropDownList_From_Spec_Edit")).SelectedValue:"";
            String ToSpecText = ((DropDownList)GridView1.Rows[e.RowIndex].Cells[0].FindControl("DropDownList_To_Spec_Edit")).SelectedItem != null ?
                                ((DropDownList)GridView1.Rows[e.RowIndex].Cells[0].FindControl("DropDownList_To_Spec_Edit")).SelectedItem.Text:"";
            String ToSpecId = ((DropDownList)GridView1.Rows[e.RowIndex].Cells[0].FindControl("DropDownList_To_Spec_Edit")).SelectedValue != null ?
                              ((DropDownList)GridView1.Rows[e.RowIndex].Cells[0].FindControl("DropDownList_To_Spec_Edit")).SelectedValue:"";

            String specText = ((TextBox)GridView1.Rows[e.RowIndex].Cells[0].FindControl("TextBox_SpecText_Edit")).Text;

            int index = GridView1.Rows[e.RowIndex].DataItemIndex;

            dt.Rows[index]["SpecText"] = specText;
            dt.Rows[index]["FromSpec"] = fromSpecText;
            dt.Rows[index]["ToSpec"]   = ToSpecText;

            String updatedImgPath = "";

            Dictionary <String, String> whereCls   = new Dictionary <string, string>();
            Dictionary <String, String> targetVals = new Dictionary <string, string>();

            whereCls.Add(BackEndObjects.ShopChildProdsSpecs.SHOP_CHILD_PROD_SPEC_COL_PROD_NAME, prodName);
            whereCls.Add(BackEndObjects.ShopChildProdsSpecs.SHOP_CHILD_PROD_SPEC_COL_ENTITY_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            whereCls.Add(BackEndObjects.ShopChildProdsSpecs.SHOP_CHILD_PROD_SPEC_COL_FEAT_ID, ((Label)GridView1.Rows[e.RowIndex].Cells[0].FindControl("Label_Hidden_Feat")).Text);

            if (!((FileUpload)GridView1.Rows[e.RowIndex].Cells[0].FindControl("FileUpload_Image")).HasFile)
            {
                targetVals.Add(BackEndObjects.ShopChildProdsSpecs.SHOP_CHILD_PROD_SPEC_COL_FROM_SPEC_ID, fromSpecId);
                targetVals.Add(BackEndObjects.ShopChildProdsSpecs.SHOP_CHILD_PROD_SPEC_COL_TO_SPEC_ID, ToSpecId);
                targetVals.Add(BackEndObjects.ShopChildProdsSpecs.SHOP_CHILD_PROD_SPEC_COL_SPEC_TEXT, specText);

                BackEndObjects.ShopChildProdsSpecs.updateShopChildProdsSpecsDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE);
            }
            else
            {
                //Remove the entry and re-create
                BackEndObjects.ShopChildProdsSpecs.updateShopChildProdsSpecsDB(targetVals, whereCls, DBConn.Connections.OPERATION_DELETE);

                BackEndObjects.ShopChildProdsSpecs specObj = new ShopChildProdsSpecs();
                specObj.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                specObj.setFeatId(((Label)GridView1.Rows[e.RowIndex].Cells[0].FindControl("Label_Hidden_Feat")).Text);
                specObj.setFileStream(((FileUpload)GridView1.Rows[e.RowIndex].Cells[0].FindControl("FileUpload_Image")));
                specObj.setFromSpecId(fromSpecId);
                specObj.setSpecText(specText);
                specObj.setToSpecId(ToSpecId);
                specObj.setProdName(prodName);
                specObj.setImgPathInFileStore(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

                BackEndObjects.ShopChildProdsSpecs.insertShopChildProdsSpecsDB(specObj);
                String[] imgPath = specObj.getImgPath().Split(new String[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
                dt.Rows[index]["imgName"] = (imgPath != null && imgPath.Length > 0 ? imgPath[imgPath.Length - 1] : "N\\A");
                updatedImgPath            = specObj.getImgPath();
            }
            Session[SessionFactory.ALL_PROD_SPECIFICATION_DATAGRID] = dt;
            GridView1.EditIndex  = -1;
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }