Пример #1
0
        protected void fillGrid()
        {
            String    selectedProdCat = Session[SessionFactory.ALL_PURCHASE_ALL_REQUIREMENT_SHOW_FEAT_SELECTED_PRODCAT].ToString();
            ArrayList reqrSpecList    = (ArrayList)Session[SessionFactory.ALL_PURCHASE_ALL_REQUIREMENT_REQR_SPEC];

            DataTable dtSpec = new DataTable();

            dtSpec.Columns.Add("Hidden");
            dtSpec.Columns.Add("FeatName");
            dtSpec.Columns.Add("SpecText");
            dtSpec.Columns.Add("FromSpec");
            dtSpec.Columns.Add("ToSpec");

            int rowCount = 0;

            for (int j = 0; j < reqrSpecList.Count; j++)
            {
                BackEndObjects.Requirement_Spec reqrSpecObj = (BackEndObjects.Requirement_Spec)reqrSpecList[j];

                if (reqrSpecObj.getProdCatId().Equals(selectedProdCat))
                {
                    dtSpec.Rows.Add();
                    String featName = BackEndObjects.Features.getFeaturebyIdwoSpecDB(reqrSpecObj.getFeatId()).getFeatureName();
                    dtSpec.Rows[rowCount]["Hidden"]   = reqrSpecObj.getFeatId();
                    dtSpec.Rows[rowCount]["FeatName"] = (featName != null ? featName.Trim() : "");
                    dtSpec.Rows[rowCount]["SpecText"] = reqrSpecObj.getSpecText();
                    if (!reqrSpecObj.getFromSpecId().Equals(""))
                    {
                        dtSpec.Rows[rowCount]["FromSpec"] = BackEndObjects.Specifications.getSpecificationDetailbyIdDB(reqrSpecObj.getFromSpecId()).getSpecName();
                    }
                    if (!reqrSpecObj.getToSpecId().Equals(""))
                    {
                        dtSpec.Rows[rowCount]["ToSpec"] = BackEndObjects.Specifications.getSpecificationDetailbyIdDB(reqrSpecObj.getToSpecId()).getSpecName();
                    }

                    rowCount++;
                }
            }
            GridView_Spec.DataSource = dtSpec;
            GridView_Spec.DataBind();
            GridView_Spec.Columns[1].Visible = false;
        }
Пример #2
0
        protected void createReq()
        {
            if (DropDownList_Level1.SelectedValue.Equals("_"))
            {
                Label_Status.Text      = "Please select one product category";
                Label_Status.ForeColor = System.Drawing.Color.Red;
                Label_Status.Visible   = true;

                Button_Submit_Req.Enabled           = true;
                Button_Submit_Next.Enabled          = true;
                Button_Submit_Extra_Prd_Srv.Enabled = true;
            }
            else
            {
                BackEndObjects.Requirement reqObj = new BackEndObjects.Requirement();
                BackEndObjects.Id          idGen  = new BackEndObjects.Id();
                // String reqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_REQR_STRING);

                String reqId = "";
                if (Session[SessionFactory.CREATE_REQ_REQR_ID] == null)
                {
                    reqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_REQR_STRING);
                    Session[SessionFactory.CREATE_REQ_REQR_ID] = reqId; //store the newly created RFQ id in the session
                }
                if (!TextBox_Spec.Text.Equals(""))
                {
                    getAddintionalProdSrvList();
                    TextBox_Spec.Text = "";
                }

                ArrayList reqrSpecObjList = (ArrayList)Session[SessionFactory.CREATE_REQ_SELECTED_REQR_SPEC_MAP];

                //Set the requirement id for all the requirement spec objects
                //if(reqrSpecObjList!=null)
                //for(int i=0;i<reqrSpecObjList.Count;i++)
                //((BackEndObjects.Requirement_Spec)reqrSpecObjList[i]).setReqId(reqId);
                reqObj.setReqSpecs(reqrSpecObjList);
                //This setter method makes sure to add req id to all associated requirement spec objects if missing.
                reqObj.setReqId(reqId);
                reqObj.setCreatedUsr(User.Identity.Name);
                reqObj.setActiveStat(BackEndObjects.Requirement.REQ_ACTIVE_STAT_ACTIVE);
                reqObj.setDueDate(TextBox_Within_Date.Text);

                //Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()
                //reqObj.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                //Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()
                reqObj.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

                String localId = (!DropDownList_Locality.SelectedValue.Equals("_") && !DropDownList_Locality.SelectedValue.Equals("") ?
                                  DropDownList_Locality.SelectedValue : (!DropDownList_City.SelectedValue.Equals("_") && !DropDownList_City.SelectedValue.Equals("") ?
                                                                         DropDownList_City.SelectedValue : (!DropDownList_State.SelectedValue.Equals("_") && !DropDownList_State.SelectedValue.Equals("") ?
                                                                                                            DropDownList_State.SelectedValue : (!DropDownList_Country.SelectedValue.Equals("_") && !DropDownList_Country.SelectedValue.Equals("") ?
                                                                                                                                                DropDownList_Country.SelectedValue : ""))));

                reqObj.setLocalId(localId);
                reqObj.setReqName(TextBox_Reqr_Name.Text);

                reqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                reqObj.setReqName(TextBox_Reqr_Name.Text);
                reqObj.setCurrency(DropDownList_Curr.SelectedValue);

                Dictionary <String, String> reqSpecUniqnessValidation = new Dictionary <string, string>();

                if (reqrSpecObjList != null)
                {
                    for (int i = 0; i < reqrSpecObjList.Count; i++)
                    {
                        BackEndObjects.Requirement_Spec reqrSpecObj = (BackEndObjects.Requirement_Spec)reqrSpecObjList[i];
                        if (reqSpecUniqnessValidation.ContainsKey(reqrSpecObj.getProdCatId() + ":" + reqrSpecObj.getFeatId()))
                        {
                            reqrSpecObjList.RemoveAt(i);//Remove the current requirement spec object from the list - otherwise it will cause exception at DB layer while inserting
                        }
                        else
                        {
                            reqSpecUniqnessValidation.Add(reqrSpecObj.getProdCatId() + ":" + reqrSpecObj.getFeatId(), "");
                            if (reqrSpecObj.getFileStream() != null)
                            {
                                reqrSpecObj.setImgPathInFileStore(reqObj.getEntityId());
                            }
                        }
                    }
                }

                BackEndObjects.RequirementProdServQnty reqProdSrvObj = new BackEndObjects.RequirementProdServQnty();
                reqProdSrvObj.setRequirementId(reqObj.getReqId());
                reqProdSrvObj.setProdCatId(Session[SessionFactory.CREATE_REQR_SELECTED_PRODUCT_CAT].ToString());
                reqProdSrvObj.setFromPrice(TextBox_Price_Range_From.Text);
                reqProdSrvObj.setFromQnty(float.Parse(TextBox_Prod_Qnty_From.Text));
                reqProdSrvObj.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue);
                reqProdSrvObj.setToPrice(TextBox_Price_Range_To.Text);
                reqProdSrvObj.setToQnty(float.Parse(TextBoxrod_Qnty_To.Text));

                ArrayList prodSrvQntyList = (ArrayList)Session[SessionFactory.CREATE_REQ_PROD_SRV_QNTY_LIST];

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

                //Ensure that all objects in the arraylist has an associated rfqid
                for (int i = 0; i < prodSrvQntyList.Count; i++)
                {
                    BackEndObjects.RequirementProdServQnty temp = (RequirementProdServQnty)prodSrvQntyList[i];
                    if (temp.getRequirementId() == null || temp.getRequirementId().Equals(""))
                    {
                        temp.setRequirementId(reqObj.getReqId());
                    }
                }

                prodSrvQntyList.Add(reqProdSrvObj);
                reqObj.setReqProdSrvQnty(prodSrvQntyList);

                ActionLibrary.PurchaseActions._createRequirements cR = new ActionLibrary.PurchaseActions._createRequirements();
                try
                {
                    cR.createNewRequirement(reqObj);
                    Label_Status.Text      = "Requirement created successfully";
                    Label_Status.ForeColor = System.Drawing.Color.Green;
                    Label_Status.Visible   = true;
                    //Refresh the parent grid
                    DataTable dt = (DataTable)Session[SessionFactory.ALL_PURCHASE_ALL_REQUIREMENT_GRID_DATA];
                    Dictionary <String, Currency> allCurrList = (Dictionary <String, Currency>)Session[SessionFactory.CURRENCY_LIST];

                    dt.Rows.Add();
                    int         i  = dt.Rows.Count - 1;
                    DateUtility dU = new DateUtility();

                    dt.Rows[i]["Hidden"]           = reqObj.getReqId();
                    dt.Rows[i]["Requirement Name"] = reqObj.getReqName();
                    dt.Rows[i]["curr"]             = allCurrList.ContainsKey(reqObj.getCurrency()) ?
                                                     allCurrList[reqObj.getCurrency()].getCurrencyName() : "";
                    dt.Rows[i]["Submit Date"]       = reqObj.getSubmitDate();
                    dt.Rows[i]["Submit Date Ticks"] = Convert.ToDateTime(reqObj.getSubmitDate()).Ticks;
                    dt.Rows[i]["Due Date"]          = dU.getConvertedDateWoTime(reqObj.getDueDate());
                    dt.Rows[i]["Due Date Ticks"]    = reqObj.getDueDate() != null && !reqObj.getDueDate().Equals("")?
                                                      Convert.ToDateTime(dt.Rows[i]["Due Date"]).Ticks:0;
                    dt.Rows[i]["Created By"] = reqObj.getCratedUsr();
                    dt.Rows[i]["Active?"]    = reqObj.getActiveStat();

                    dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC";
                    Session[SessionFactory.ALL_PURCHASE_ALL_REQUIREMENT_GRID_DATA] = dt.DefaultView.ToTable();

                    ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshReqGrid", "RefreshParent();", true);
                }
                catch (Exception ex)
                {
                    Label_Status.Text      = "Requirement creation failed";
                    Label_Status.ForeColor = System.Drawing.Color.Red;
                    Label_Status.Visible   = true;
                }
                finally
                {
                    Session.Remove(SessionFactory.CREATE_REQ_SELECTED_REQR_SPEC_MAP);
                    Session.Remove(SessionFactory.CREATE_REQ_REQR_ID);
                    Session.Remove(SessionFactory.CREATE_RFQ_PROD_SRV_QNTY_LIST);
                }
            }
        }
        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);
        }
Пример #4
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);
        }