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 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; }
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 fillFirstGrid() { String entId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); String prodName = Session[SessionFactory.ALL_PRODUCT_SELECTED_PRODUCT_NAME].ToString(); Dictionary <String, ShopChildProdsSpecs> prodSpecDict = BackEndObjects.ShopChildProdsSpecs. getShopChildProdsSpecObjbyEntIdandProdNameDB(entId, prodName); Dictionary <String, String> existingFeatList = new Dictionary <string, string>(); DataTable dt = new DataTable(); dt.Columns.Add("FeatId"); dt.Columns.Add("FeatName"); dt.Columns.Add("SpecText"); dt.Columns.Add("FromSpec"); dt.Columns.Add("ToSpec"); dt.Columns.Add("imgName"); int counter = 0; foreach (KeyValuePair <String, ShopChildProdsSpecs> kvp in prodSpecDict) { ShopChildProdsSpecs specObj = (ShopChildProdsSpecs)kvp.Value; dt.Rows.Add(); existingFeatList.Add(specObj.getFeatId(), specObj.getFeatId()); dt.Rows[counter]["FeatId"] = specObj.getFeatId(); dt.Rows[counter]["FeatName"] = Features.getFeaturebyIdwoSpecDB(specObj.getFeatId()).getFeatureName(); dt.Rows[counter]["SpecText"] = specObj.getSpecText(); if (!specObj.getFromSpecId().Equals("")) { dt.Rows[counter]["FromSpec"] = Specifications.getSpecificationDetailbyIdDB(specObj.getFromSpecId()).getSpecName(); } if (!specObj.getToSpecId().Equals("")) { dt.Rows[counter]["ToSpec"] = Specifications.getSpecificationDetailbyIdDB(specObj.getToSpecId()).getSpecName(); } String[] imgPath = specObj.getImgPath().Split(new String[] { "\\" }, StringSplitOptions.RemoveEmptyEntries); dt.Rows[counter]["imgName"] = (imgPath != null && imgPath.Length > 0 ? imgPath[imgPath.Length - 1] : "N\\A"); counter++; } GridView1.DataSource = dt; GridView1.DataBind(); GridView1.Visible = true; GridView1.Columns[2].Visible = false; Session[SessionFactory.PRODUCT_SPECIFICATION_EXISTING_FEAT_LIST] = existingFeatList; Session[SessionFactory.ALL_PROD_SPECIFICATION_DATAGRID] = dt; }
protected void Button_Add_To_Prod_Click(object sender, EventArgs e) { if (!TextBox_Spec.Text.Equals("")) { getAddintionalProdSrvList(); TextBox_Spec.Text = ""; } ArrayList prodSpecList = (ArrayList)Session[SessionFactory.UPDATE_PROD_SELECTED_PROD_SPEC_MAP]; /*Dictionary<String, String> existingProdList = (Dictionary<String,String>) * Session[SessionFactory.PRODUCT_SPECIFICATION_EXISTING_FEAT_LIST]; * existingProdList=(existingProdList==null?new Dictionary<String,String>():existingProdList);*/ Dictionary <String, String> rSpecUniqnessValidation = new Dictionary <string, string>(); String mainEntId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); if (prodSpecList != null) { for (int i = 0; i < prodSpecList.Count; i++) { ShopChildProdsSpecs prodSpecObj = (ShopChildProdsSpecs)prodSpecList[i]; //existingProdList.Add(prodSpecObj.getFeatId(),prodSpecObj.getFeatId()); if (rSpecUniqnessValidation.ContainsKey(prodSpecObj.getEntityId() + ":" + prodSpecObj.getProdName() + ":" + prodSpecObj.getFeatId())) { prodSpecList.RemoveAt(i); } else { rSpecUniqnessValidation.Add(prodSpecObj.getEntityId() + ":" + prodSpecObj.getProdName() + ":" + prodSpecObj.getFeatId(), prodSpecObj.getEntityId()); if (prodSpecObj != null && prodSpecObj.getFileStream() != null && prodSpecObj.getFileStream().HasFile) { prodSpecObj.setImgPathInFileStore(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); } } } } try { if (prodSpecList != null) { BackEndObjects.ShopChildProdsSpecs.insertShopChildProdsSpecsListDB(prodSpecList); } Label_Status.Text = "Product/Service Details Updated Successfully"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Green; fillFirstGrid(); } catch (Exception ex) { Label_Status.Text = "Product/Service Details Addition Failed"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Red; } finally { Session.Remove(SessionFactory.UPDATE_PROD_SELECTED_PROD_SPEC_MAP); } }
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(); }
protected Dictionary <String, String> getContentTypeandPath() { ActionLibrary.ImageContextFactory icObj = (ActionLibrary.ImageContextFactory)Session[SessionFactory.DISP_IMAGE_CONTEXT_FACTORY_OBJ]; DataTable dt = new DataTable(); dt.Columns.Add("img"); String serverPath = ""; String contentType = ""; Dictionary <String, String> pathAndContent = new Dictionary <string, string>(); switch (icObj.getParentContextName()) { case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_NOTES: if (icObj.getDestinationContextName().Equals (ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_DOC_FOR_PARENT_NOTE)) { serverPath = BackEndObjects.Communications.getCommunicationbyIdDB(icObj.getParentContextValue()).getDocPath(); contentType = getMimeType(serverPath); } break; case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_REQUIREMENT: int counter = 0; if (icObj.getDestinationContextName().Equals (ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_FEAT_FOR_PARENT_REQUIREMENT)) { String prodCatId = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_PRODCAT_ID], featId = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_FEAT_ID]; ArrayList reqSpecList = BackEndObjects.Requirement_Spec.getRequirementSpecsforReqbyIdDB(icObj.getParentContextValue()); for (int i = 0; i < reqSpecList.Count; i++) { BackEndObjects.Requirement_Spec reqrObj = (Requirement_Spec)reqSpecList[i]; if (reqrObj.getProdCatId().Equals(prodCatId) && reqrObj.getFeatId().Equals(featId)) { serverPath = reqrObj.getImgPath(); //dt.Rows.Add(); //dt.Rows[counter]["img"] = serverPath; contentType = getMimeType(serverPath); counter++; } } } break; case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_RFQ: if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_FEAT_FOR_PARENT_RFQ)) { String prodCatId = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_PRODCAT_ID], featId = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_FEAT_ID]; ArrayList rfqSpecList = BackEndObjects.RFQProductServiceDetails.getAllProductServiceDetailsbyRFQIdDB(icObj.getParentContextValue()); counter = 0; for (int i = 0; i < rfqSpecList.Count; i++) { BackEndObjects.RFQProductServiceDetails rfqObj = (RFQProductServiceDetails)rfqSpecList[i]; if (rfqObj.getPrdCatId().Equals(prodCatId) && rfqObj.getFeatId().Equals(featId)) { serverPath = rfqObj.getImgPath(); //dt.Rows.Add(); //dt.Rows[counter]["img"] = serverPath; contentType = getMimeType(serverPath); counter++; } } } if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_NDA_FOR_PARENT_RFQ)) { serverPath = BackEndObjects.RFQDetails.getRFQDetailsbyIdDB(icObj.getParentContextValue()).getNDADocPath(); //dt.Rows.Add(); //dt.Rows[0]["img"] = serverPath; contentType = getMimeType(serverPath); } break; case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_RFQ_RESPONSE: if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_NDA_FOR_PARENT_RFQ_RESPONSE)) { serverPath = BackEndObjects.RFQResponse. getRFQResponseforRFQIdandResponseEntityIdDB (icObj.getParentContextValue(), (icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_RFQ_RESPONSE_RESPONSE_ENTITY_ID]).ToString()).getNdaPath(); contentType = getMimeType(serverPath); //dt.Rows.Add(); //dt.Rows[0]["img"] = serverPath; } break; case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_PRODUCT: if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_FEAT_FOR_PARENT_PRODUCT)) { String prodName = icObj.getParentContextValue(); String entId = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_PROD_ENT_ID]; String featId = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_PROD_FEAT_ID]; ShopChildProdsSpecs specObj = (ShopChildProdsSpecs)ShopChildProdsSpecs. getShopChildProdsSpecObjbyEntIdandProdNameDB(entId, prodName)[featId]; serverPath = specObj.getImgPath(); contentType = getMimeType(serverPath); } break; case ActionLibrary.ImageContextFactory.PARENET_CONTEXT_DEFECT: if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_DOC_FOR_PARENT_DEFECT)) { String defectId = icObj.getParentContextValue(); BackEndObjects.DefectDetails defObj = BackEndObjects.DefectDetails.getDefectDetailsbyidDB(defectId); serverPath = defObj.getDocPath(); contentType = getMimeType(serverPath); } break; } pathAndContent.Add(SERVER_PATH, serverPath); pathAndContent.Add(CONTENT_TYPE, contentType); return(pathAndContent); }
protected void createNewProduct() { Dictionary <String, String> allExistingProdDict = (Dictionary <String, String>)Session[SessionFactory.ALL_PRODUCT_CREATE_PRODUCT_EXISTING_NAMES]; if (allExistingProdDict.ContainsKey(TextBox_Prod_Name.Text.Trim())) { Label_Status.Text = "Product Name Already Exists"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Red; } else if (Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT] == null || Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT].ToString().Equals("")) { Label_Status.Text = "Must select one product category"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Red; } else { if (!TextBox_Spec.Text.Equals("")) { getAddintionalProdSrvList(); TextBox_Spec.Text = ""; } ArrayList prodSpecList = (ArrayList)Session[SessionFactory.CREATE_PRODUCT_CHILD_PROD_SPEC_MAP]; Dictionary <String, String> rSpecUniqnessValidation = new Dictionary <string, string>(); String mainEntId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); if (prodSpecList != null) { for (int i = 0; i < prodSpecList.Count; i++) { ShopChildProdsSpecs prodSpecObj = (ShopChildProdsSpecs)prodSpecList[i]; prodSpecObj.setProdName(TextBox_Prod_Name.Text); if (rSpecUniqnessValidation.ContainsKey(prodSpecObj.getEntityId() + ":" + prodSpecObj.getProdName() + ":" + prodSpecObj.getFeatId())) { prodSpecList.RemoveAt(i); } else { rSpecUniqnessValidation.Add(prodSpecObj.getEntityId() + ":" + prodSpecObj.getProdName() + ":" + prodSpecObj.getFeatId(), prodSpecObj.getEntityId()); if (prodSpecObj != null && prodSpecObj.getFileStream() != null && prodSpecObj.getFileStream().HasFile) { prodSpecObj.setImgPathInFileStore(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); } } } } ShopChildProdsInventory childProdObj = new ShopChildProdsInventory(); childProdObj.setCreatedBy(User.Identity.Name); childProdObj.setDateCreated(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); childProdObj.setEntityId(mainEntId); childProdObj.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue); childProdObj.setProdCatId(Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT].ToString()); childProdObj.setProdName(TextBox_Prod_Name.Text); childProdObj.setQnty((!TextBox_Stock.Text.Equals("")?float.Parse(TextBox_Stock.Text):0)); childProdObj.setUnitListPrice(TextBox_List_Price.Text); childProdObj.setUnitSrcPrice(TextBox_Src_Price.Text); childProdObj.setCurrency(DropDownList_Curr.SelectedValue); try { BackEndObjects.ShopChildProdsInventory.insertShopChildProdsInventoryDB(childProdObj); if (prodSpecList != null) { BackEndObjects.ShopChildProdsSpecs.insertShopChildProdsSpecsListDB(prodSpecList); } //Refresh the session variable with the newly added product name allExistingProdDict.Add(childProdObj.getProdName(), childProdObj.getProdName()); Session[SessionFactory.ALL_PRODUCT_CREATE_PRODUCT_EXISTING_NAMES] = allExistingProdDict; Dictionary <String, ProductCategory> existingProdDict = MainBusinessEntity. getProductDetailsforMainEntitybyIdDB(mainEntId); Label_Status.Text = "Product/Service Details Created Successfully"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Green; DropDownList_Level1.SelectedIndex = -1; DropDownList_Level2.SelectedIndex = -1; DropDownList_Level3.SelectedIndex = -1; if (!existingProdDict.ContainsKey(DropDownList_Level1.SelectedValue)) { ArrayList newMainProdCat = new ArrayList(); newMainProdCat.Add(DropDownList_Level1.SelectedValue); MainBusinessEntity.insertProductDetailsforEntityDB(mainEntId, newMainProdCat); Label_Status.Text += "...New Product category added to your product list"; } DataTable dt = (DataTable)Session[SessionFactory.ALL_PRODUCT_PROD_DATA_GRID]; dt.Rows.Add(); int count = dt.Rows.Count - 1; dt.Rows[count]["ProdCatId"] = childProdObj.getProdCatId(); dt.Rows[count]["ProdName"] = childProdObj.getProdName(); dt.Rows[count]["Stock"] = childProdObj.getQnty(); dt.Rows[count]["msrmnt"] = childProdObj.getMsrmntUnit(); dt.Rows[count]["srcPrice"] = childProdObj.getUnitSrcPrice(); dt.Rows[count]["listPrice"] = childProdObj.getUnitListPrice(); dt.Rows[count]["curr"] = DropDownList_Curr.SelectedItem.Text; Session[SessionFactory.ALL_PRODUCT_PROD_DATA_GRID] = dt; ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshProdGrid", "RefreshParent();", true); } catch (Exception ex) { Label_Status.Text = "Product/Service Details Creation Failed"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Red; } finally { Session.Remove(SessionFactory.CREATE_PRODUCT_CHILD_PROD_SPEC_MAP); Session.Remove(SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT); } } }