public DataTable poPulateImage()
        {
            ActionLibrary.ImageContextFactory icObj = (ActionLibrary.ImageContextFactory)Session[SessionFactory.DISP_IMAGE_CONTEXT_FACTORY_OBJ];
            DataTable dt = new DataTable();

            dt.Columns.Add("img");
            String serverPath = "";

            switch (icObj.getParentContextName())
            {
            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;
                            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;
                            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;
                }
                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();

                    dt.Rows.Add();
                    dt.Rows[0]["img"] = serverPath;
                }

                break;
            }

            return(dt);
        }
예제 #2
0
        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);
        }