示例#1
0
        protected void GridView1_Inner_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView grdInner = ((GridView)sender);

            grdInner.PageIndex = e.NewPageIndex;

            GridViewRow gvRowParent = ((GridView)sender).Parent.Parent as GridViewRow;

            DataTable dtSpec = new DataTable();

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

            ArrayList rfqSpecList = (ArrayList)Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_RFQ_SPEC];
            int       rowCount    = 0;

            for (int j = 0; j < rfqSpecList.Count; j++)
            {
                BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecList[j];

                if (rfqSpecObj.getPrdCatId().Equals(((Label)gvRowParent.Cells[0].FindControl("Label_Hidden")).Text))
                {
                    dtSpec.Rows.Add();
                    String featName = BackEndObjects.Features.getFeaturebyIdwoSpecDB(rfqSpecObj.getFeatId()).getFeatureName();
                    dtSpec.Rows[rowCount]["Hidden"]   = rfqSpecObj.getFeatId();
                    dtSpec.Rows[rowCount]["FeatName"] = (featName != null ? featName.Trim() : "");
                    dtSpec.Rows[rowCount]["SpecText"] = rfqSpecObj.getSpecText();
                    if (!rfqSpecObj.getFromSpecId().Equals(""))
                    {
                        dtSpec.Rows[rowCount]["FromSpec"] = BackEndObjects.Specifications.getSpecificationDetailbyIdDB(rfqSpecObj.getFromSpecId()).getSpecName();
                    }
                    if (!rfqSpecObj.getToSpecId().Equals(""))
                    {
                        dtSpec.Rows[rowCount]["ToSpec"] = BackEndObjects.Specifications.getSpecificationDetailbyIdDB(rfqSpecObj.getToSpecId()).getSpecName();
                    }

                    rowCount++;
                }
            }
            grdInner.DataSource = dtSpec;
            grdInner.DataBind();
            grdInner.Visible = true;
            //Session[SessionFactory.ALL_PURCHASE_ALL_REQUIREMENT_SHOW_SPEC_INNER_GRID_DATA] = dtSpec;
        }
示例#2
0
        protected void generateLead()
        {
            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_Next0.Enabled         = true;
                Button_Submit_Next.Enabled          = true;
                Button_Submit_Extra_Prd_Srv.Enabled = true;
            }
            else
            {
                BackEndObjects.RFQDetails rfqObj = new BackEndObjects.RFQDetails();
                BackEndObjects.Id         idGen  = new BackEndObjects.Id();
                String rfqId = "";
                if (Session[SessionFactory.CREATE_LEAD_RFQ_ID] == null)
                {
                    rfqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_RFQ_STRING);
                    Session[SessionFactory.CREATE_LEAD_RFQ_ID] = rfqId; //store the newly created RFQ id in the session
                }
                if (!TextBox_Spec.Text.Equals(""))
                {
                    getAddintionalProdSrvList();
                    TextBox_Spec.Text = "";
                }

                ArrayList rfqSpecObjList = (ArrayList)Session[SessionFactory.CREATE_LEAD_SELECTED_RFQ_SPEC_MAP];

                //Set the RFQ id for all the  spec objects
                if (rfqSpecObjList != null)
                {
                    for (int i = 0; i < rfqSpecObjList.Count; i++)
                    {
                        ((BackEndObjects.RFQProductServiceDetails)rfqSpecObjList[i]).setRFQId(rfqId);
                    }
                }

                rfqObj.setRFQProdServList(rfqSpecObjList);
                rfqObj.setRFQId(rfqId);
                rfqObj.setCreatedUsr(User.Identity.Name);
                rfqObj.setActiveStat(BackEndObjects.RFQDetails.RFQ_ACTIVE_STAT_ACTIVE);
                rfqObj.setDueDate(TextBox_Within_Date.Text);
                //For Manually Created Lead entity id and CreateEntityId is different for the same rfq/lead object
                rfqObj.setEntityId(DropDownList_Contacts.SelectedValue);
                rfqObj.setCreatedEntity(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

                //     FileUpload1=(FileUpload1 == null ? (FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE] : FileUpload1);
                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:""))));

                rfqObj.setLocalityId(localId);
                rfqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                rfqObj.setTermsandConds(TextBox_TnC.Text);
                rfqObj.setRFQName(TextBox_Reqr_Name.Text);
                rfqObj.setCreateMode(RFQDetails.CREATION_MODE_MANUAL);
                rfqObj.setCurrency(DropDownList_Curr.SelectedValue);

                BackEndObjects.RFQProdServQnty rfqPrdQnty = new BackEndObjects.RFQProdServQnty();
                rfqPrdQnty.setRFQId(rfqObj.getRFQId());
                rfqPrdQnty.setFromPrice(TextBox_Price_Range_From.Text);
                rfqPrdQnty.setToPrice(TextBox_Price_Range_To.Text);
                rfqPrdQnty.setFromQnty(float.Parse(TextBox_Prod_Qnty_From.Text));
                rfqPrdQnty.setToQnty(float.Parse(TextBoxrod_Qnty_To.Text));
                rfqPrdQnty.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue);
                rfqPrdQnty.setProdCatId(Session[SessionFactory.CREATE_LEAD_SELECTED_PRODUCT_CAT].ToString());
                //ArrayList rfqPrdQntyList = new ArrayList();
                //rfqPrdQntyList.Add(rfqPrdQnty);

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

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

                prodSrvQntyList.Add(rfqPrdQnty);

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

                rfqObj.setRFQProdServQntyList(prodSrvQntyList);

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

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

                BackEndObjects.RFQResponse leadRespObj = new RFQResponse();
                leadRespObj.setRespEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                leadRespObj.setRFQId(Session[SessionFactory.CREATE_LEAD_RFQ_ID].ToString());
                leadRespObj.setRespDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                leadRespObj.setNextFollowupDate(TextBox_Fwp_Date.Text);
                leadRespObj.setAssignedTo(DropDownList_Users.SelectedValue);
                //Load the document for the lead response
                if (FileUpload1 != null && FileUpload1.HasFile)
                {
                    leadRespObj.setFileStream(FileUpload1);
                    leadRespObj.setNDADocPathInFileStore(leadRespObj.getRespEntityId());
                }
                else if ((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE] != null && ((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE]).HasFile)
                {
                    leadRespObj.setFileStream((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE]);
                    leadRespObj.setNDADocPathInFileStore(leadRespObj.getRespEntityId());
                }

                ArrayList leadRespQuoteList = (ArrayList)Session[SessionFactory.CREATE_LEAD_RESP_QUOTE_LIST];
                if (leadRespQuoteList == null)
                {
                    leadRespQuoteList = new ArrayList();
                }

                BackEndObjects.RFQResponseQuotes respQuoteObj = new RFQResponseQuotes();
                respQuoteObj.setPrdCatId(Session[SessionFactory.CREATE_LEAD_SELECTED_PRODUCT_CAT].ToString());
                respQuoteObj.setQuote((TextBox_Quote_Amnt.Text.Equals("") ? "0" : TextBox_Quote_Amnt.Text));
                respQuoteObj.setResponseEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                respQuoteObj.setResponseUsrId(User.Identity.Name);
                //respQuoteObj.setUnitName(Session[SessionFactory.CREATE_LEAD_QUOTE_UNIT].ToString());
                respQuoteObj.setUnitName(Label_Per_Unit.Text);
                respQuoteObj.setProductName((!TextBox_Prod_Name.Text.Equals("") ? TextBox_Prod_Name.Text.Trim() : DropDownList_Prod_List.SelectedItem.Text));

                leadRespQuoteList.Add(respQuoteObj);
                //Ensure that all objects in the arraylist has an associated rfqid
                for (int i = 0; i < leadRespQuoteList.Count; i++)
                {
                    BackEndObjects.RFQResponseQuotes temp = (RFQResponseQuotes)leadRespQuoteList[i];
                    if (temp.getRFQId() == null || temp.getRFQId().Equals(""))
                    {
                        temp.setRFQId(rfqObj.getRFQId());
                    }
                }

                leadRespObj.setResponseQuoteList(leadRespQuoteList);

                ActionLibrary.SalesActions._createLeads cL = new ActionLibrary.SalesActions._createLeads();

                LeadRecord leadObj = new LeadRecord();
                leadObj.setRFQProdServList(rfqObj.getRFQProdServList());
                leadObj.setRFQId(rfqObj.getRFQId());
                leadObj.setActiveStat(rfqObj.getActiveStat());
                leadObj.setApprovalStat(rfqObj.getApprovalStat());
                leadObj.setCreatedEntity(rfqObj.getCreatedEntity());
                leadObj.setCreatedUsr(rfqObj.getCreatedUsr());
                leadObj.setCreateMode(rfqObj.getCreateMode());
                leadObj.setDueDate(rfqObj.getDueDate());
                leadObj.setEntityId(rfqObj.getEntityId());
                leadObj.setFileStream(rfqObj.getFileStream());
                leadObj.setLocalityId(rfqObj.getLocalityId());
                leadObj.setNDADocPath(rfqObj.getNDADocPath());
                leadObj.setReqId(rfqObj.getReqId());
                leadObj.setRFQName(rfqObj.getRFQName());
                leadObj.setRFQProdServQntyList(rfqObj.getRFQProdServQntyList());
                leadObj.setSubmitDate(rfqObj.getSubmitDate());
                leadObj.setTermsandConds(rfqObj.getTermsandConds());
                leadObj.setCurrency(rfqObj.getCurrency());

                leadObj.setLeadResp(leadRespObj);


                try
                {
                    cL.createNewLead(leadObj, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), User.Identity.Name);
                    Label_Status.Text      = "Lead created successfully";
                    Label_Status.ForeColor = System.Drawing.Color.Green;
                    Label_Status.Visible   = true;

                    DataTable dt = (DataTable)Session[SessionFactory.ALL_SALE_ALL_LEAD_GRID_DATA];
                    Dictionary <String, Currency> allCurrList = (Dictionary <String, Currency>)Session[SessionFactory.CURRENCY_LIST];
                    //DateUtility dU = new DateUtility();

                    dt.Rows.Add();
                    int count = dt.Rows.Count - 1;


                    dt.Rows[count]["RFQNo"]   = leadObj.getRFQId();
                    dt.Rows[count]["RFQName"] = leadObj.getRFQName();

                    String alertRequired = "true";
                    for (int j = 0; j < leadRespQuoteList.Count; j++)
                    {
                        RFQResponseQuotes QuoteObj = (RFQResponseQuotes)leadRespQuoteList[j];
                        if (!QuoteObj.getQuote().Equals("0"))
                        {
                            alertRequired = "false"; break;
                        }
                    }

                    DateUtility dU = new DateUtility();

                    dt.Rows[count]["Lead_Alert_Required"] = alertRequired;
                    dt.Rows[count]["CustName"]            = DropDownList_Contacts.SelectedItem.Text;
                    dt.Rows[count]["CustId"] = leadObj.getEntityId();
                    dt.Rows[count]["curr"]   = allCurrList.ContainsKey(leadObj.getCurrency()) ?
                                               allCurrList[leadObj.getCurrency()].getCurrencyName() : "";
                    dt.Rows[count]["Submit Date"]       = leadObj.getSubmitDate();
                    dt.Rows[count]["Submit Date Ticks"] = Convert.ToDateTime(leadObj.getSubmitDate()).Ticks;
                    dt.Rows[count]["Due Date"]          = dU.getConvertedDateWoTime(leadObj.getDueDate());
                    dt.Rows[count]["Due Date Ticks"]    = !dt.Rows[count]["Due Date"].Equals("") ? Convert.ToDateTime(leadObj.getDueDate()).Ticks : 0;
                    dt.Rows[count]["Next Date"]         = dU.getConvertedDateWoTime(TextBox_Fwp_Date.Text.Trim());
                    dt.Rows[count]["Next Date Ticks"]   = (!dt.Rows[count]["Next Date"].Equals("") ? Convert.ToDateTime(TextBox_Fwp_Date.Text).Ticks : 0);
                    dt.Rows[count]["Assgn To"]          = (!DropDownList_Users.SelectedValue.Equals("") ? DropDownList_Users.SelectedValue : "");
                    dt.Rows[count]["ActiveStat"]        = leadObj.getActiveStat();
                    dt.Rows[count]["Mode"] = leadObj.getCreateMode();

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



                    ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshLeadGrid", "RefreshParent();", true);
                }
                catch (Exception ex)
                {
                    Label_Status.Text      = "Lead creation failed";
                    Label_Status.ForeColor = System.Drawing.Color.Red;
                    Label_Status.Visible   = true;
                }
                finally
                {
                    Session.Remove(SessionFactory.CREATE_LEAD_SELECTED_RFQ_SPEC_MAP);
                    Session.Remove(SessionFactory.CREATE_LEAD_RFQ_ID);
                    Session.Remove(SessionFactory.CREATE_LEAD_PROD_SRV_QNTY_LIST);
                    Session.Remove(SessionFactory.CREATE_LEAD_NDA_FILE);
                    Session.Remove(SessionFactory.CREATE_LEAD_RESP_QUOTE_LIST);
                    Session.Remove(SessionFactory.CREATE_LEAD_QUOTE_UNIT);
                }
            }
        }
        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);
        }
        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);
        }
示例#5
0
        /// <summary>
        /// if create potential is true then it will create the potential as well
        /// </summary>
        /// <param name="contextId"></param>
        /// <param name="newrfqId"></param>
        /// <returns></returns>
        protected void createLead(String contextId, String newrfqId, bool createPotn)
        {
            BackEndObjects.RFQDetails  rfqObjForLead = BackEndObjects.RFQDetails.getRFQDetailsbyIdDB(contextId);
            BackEndObjects.RFQResponse rfqRespObj    = BackEndObjects.RFQResponse.
                                                       getRFQResponseforRFQIdandResponseEntityIdDB(rfqObjForLead.getRFQId(),
                                                                                                   Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            BackEndObjects.RFQShortlisted potObj = new RFQShortlisted();
            if (createPotn)
            {
                potObj = RFQShortlisted.
                         getRFQShortlistedbyRespEntandRFQId(rfqRespObj.getRespEntityId(), rfqRespObj.getRFQId());
            }

            Dictionary <String, RFQResponseQuotes> leadRespDict = BackEndObjects.RFQResponseQuotes.getAllResponseQuotesforRFQandResponseEntityDB(rfqObjForLead.getRFQId(),
                                                                                                                                                 Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            ArrayList rfqSpecListForLead = BackEndObjects.RFQProductServiceDetails.getAllProductServiceDetailsbyRFQIdDB(rfqObjForLead.getRFQId());
            ArrayList rfqQntyListForLead = BackEndObjects.RFQProdServQnty.getRFQProductServiceQuantityforRFIdDB(rfqObjForLead.getRFQId());

            rfqObjForLead.setRFQName(TextBox_Name.Text);
            rfqObjForLead.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            rfqObjForLead.setRFQId(newrfqId);
            rfqObjForLead.setReqId("");//Remove tagged requirements
            rfqObjForLead.setNDADocPath("");

            for (int i = 0; i < rfqSpecListForLead.Count; i++)
            {
                BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecListForLead[i];
                rfqSpecObj.setRFQId(rfqObjForLead.getRFQId());
                rfqSpecObj.setImgPath("");
            }
            rfqObjForLead.setRFQProdServList(rfqSpecListForLead);
            for (int i = 0; i < rfqQntyListForLead.Count; i++)
            {
                BackEndObjects.RFQProdServQnty rfqQntyObj = (BackEndObjects.RFQProdServQnty)rfqQntyListForLead[i];
                rfqQntyObj.setRFQId(rfqObjForLead.getRFQId());
            }
            rfqObjForLead.setRFQProdServQntyList(rfqQntyListForLead);

            rfqRespObj.setRespDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            rfqRespObj.setNdaPath("");
            rfqRespObj.setRFQId(rfqObjForLead.getRFQId());

            ArrayList rfqRespQuoteList = new ArrayList();

            foreach (KeyValuePair <String, RFQResponseQuotes> kvp in leadRespDict)
            {
                BackEndObjects.RFQResponseQuotes respQuoteObj = kvp.Value;
                respQuoteObj.setRFQId(rfqObjForLead.getRFQId());
                rfqRespQuoteList.Add(respQuoteObj);
            }
            rfqRespObj.setResponseQuoteList(rfqRespQuoteList);

            if (createPotn)
            {
                potObj.setRFQId(rfqObjForLead.getRFQId());
                potObj.setPotentialId(new Id().getNewId(BackEndObjects.Id.ID_TYPE_POTENTIAL_ID_STRING));
                potObj.setCreatedDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                potObj.setConfMatPath("");
            }

            try
            {
                ActionLibrary.SalesActions._createLeads cL = new ActionLibrary.SalesActions._createLeads();

                LeadRecord leadObj = new LeadRecord();
                leadObj.setRFQProdServList(rfqObjForLead.getRFQProdServList());
                leadObj.setRFQId(rfqObjForLead.getRFQId());
                leadObj.setActiveStat(rfqObjForLead.getActiveStat());
                leadObj.setApprovalStat(rfqObjForLead.getApprovalStat());
                leadObj.setCreatedEntity(rfqObjForLead.getCreatedEntity());
                leadObj.setCreatedUsr(rfqObjForLead.getCreatedUsr());
                leadObj.setCreateMode(rfqObjForLead.getCreateMode());
                leadObj.setDueDate(rfqObjForLead.getDueDate());
                leadObj.setEntityId(rfqObjForLead.getEntityId());

                leadObj.setLocalityId(rfqObjForLead.getLocalityId());

                leadObj.setReqId(rfqObjForLead.getReqId());
                leadObj.setRFQName(rfqObjForLead.getRFQName());
                leadObj.setRFQProdServQntyList(rfqObjForLead.getRFQProdServQntyList());
                leadObj.setSubmitDate(rfqObjForLead.getSubmitDate());
                leadObj.setTermsandConds(rfqObjForLead.getTermsandConds());
                leadObj.setCurrency(rfqObjForLead.getCurrency());

                leadObj.setLeadResp(rfqRespObj);

                cL.createNewLead(leadObj, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), User.Identity.Name);
                if (createPotn)
                {
                    RFQShortlisted.insertRFQShorListedEntryDB(potObj);
                }

                Label_Clone_Stat.Visible   = true;
                Label_Clone_Stat.ForeColor = System.Drawing.Color.Green;
                Label_Clone_Stat.Text      = "Cloning Successful. But no existing image or document will be copied.";
            }
            catch (Exception ex)
            {
                Label_Clone_Stat.Visible   = true;
                Label_Clone_Stat.ForeColor = System.Drawing.Color.Red;
                Label_Clone_Stat.Text      = "Cloning Failed";
            }
        }
示例#6
0
        protected void Button_Clone_Click(object sender, EventArgs e)
        {
            String contextName = Request.QueryString.GetValues("context")[0];
            String contextId   = Request.QueryString.GetValues("contextId1")[0];

            switch (contextName)
            {
            case "requirement":
                BackEndObjects.Requirement reqObj = BackEndObjects.Requirement.getRequirementbyIdDB(contextId);
                reqObj.setReqName(TextBox_Name.Text);
                reqObj.setReqId(new Id().getNewId(BackEndObjects.Id.ID_TYPE_REQR_STRING));
                reqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                ArrayList reqSpecLists = reqObj.getReqSpecs();
                for (int i = 0; i < reqSpecLists.Count; i++)
                {
                    BackEndObjects.Requirement_Spec reqSpecObj = (BackEndObjects.Requirement_Spec)reqSpecLists[i];
                    reqSpecObj.setReqId(reqObj.getReqId());
                    reqSpecObj.setImgPath("");
                }
                reqObj.setReqSpecs(reqSpecLists);

                ArrayList reqQntyList = reqObj.getReqProdSrvQnty();
                for (int i = 0; i < reqQntyList.Count; i++)
                {
                    BackEndObjects.RequirementProdServQnty reqQntyObj = (BackEndObjects.RequirementProdServQnty)reqQntyList[i];
                    reqQntyObj.setRequirementId(reqObj.getReqId());
                }
                reqObj.setReqProdSrvQnty(reqQntyList);

                try
                {
                    BackEndObjects.Requirement.insertRequirementDB(reqObj);
                    Label_Clone_Stat.Visible   = true;
                    Label_Clone_Stat.ForeColor = System.Drawing.Color.Green;
                    Label_Clone_Stat.Text      = "Cloning Successful. But no existing image or document will be copied.";
                }
                catch (Exception ex)
                {
                    Label_Clone_Stat.Visible   = true;
                    Label_Clone_Stat.ForeColor = System.Drawing.Color.Red;
                    Label_Clone_Stat.Text      = "Cloning Failed";
                }
                break;

            case "rfq":
                BackEndObjects.RFQDetails rfqObj = BackEndObjects.RFQDetails.getRFQDetailsbyIdDB(contextId);

                ArrayList rfqSpecList = BackEndObjects.RFQProductServiceDetails.getAllProductServiceDetailsbyRFQIdDB(rfqObj.getRFQId());
                ArrayList rfqQntyList = BackEndObjects.RFQProdServQnty.getRFQProductServiceQuantityforRFIdDB(rfqObj.getRFQId());

                rfqObj.setRFQName(TextBox_Name.Text);
                rfqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                rfqObj.setRFQId(new Id().getNewId(Id.ID_TYPE_RFQ_STRING));
                rfqObj.setReqId("");                                                    //Remove tagged requirements
                rfqObj.setNDADocPath("");
                rfqObj.setActiveStat(BackEndObjects.RFQDetails.RFQ_ACTIVE_STAT_ACTIVE); //Overwrite the active status to active

                for (int i = 0; i < rfqSpecList.Count; i++)
                {
                    BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecList[i];
                    rfqSpecObj.setRFQId(rfqObj.getRFQId());
                    rfqSpecObj.setImgPath("");
                }
                rfqObj.setRFQProdServList(rfqSpecList);
                for (int i = 0; i < rfqQntyList.Count; i++)
                {
                    BackEndObjects.RFQProdServQnty rfqQntyObj = (BackEndObjects.RFQProdServQnty)rfqQntyList[i];
                    rfqQntyObj.setRFQId(rfqObj.getRFQId());
                }
                rfqObj.setRFQProdServQntyList(rfqQntyList);

                //Get the approval status
                int rfqLevel = BackEndObjects.MainBusinessEntity.
                               getMainBusinessEntitybyIdwithLessDetailsDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()).getRfqApprovalLevel();
                if (rfqLevel > 0)
                {
                    String reportingToUser = BackEndObjects.userDetails.
                                             getUserDetailsbyIdDB(User.Identity.Name, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()).getReportsTo();
                    rfqObj.setApprovalStat(reportingToUser);
                }
                else
                {
                    rfqObj.setApprovalStat(RFQDetails.RFQ_APPROVAL_STAT_APPROVED);
                }


                try
                {
                    BackEndObjects.RFQDetails.insertRFQDetailsDB(rfqObj);
                    Label_Clone_Stat.Visible   = true;
                    Label_Clone_Stat.ForeColor = System.Drawing.Color.Green;
                    Label_Clone_Stat.Text      = "Cloning Successful. But no existing image or document will be copied.Also approvals will be required as rule set in Administration->WorkFlow->RFQ Rules";
                }
                catch (Exception ex)
                {
                    Label_Clone_Stat.Visible   = true;
                    Label_Clone_Stat.ForeColor = System.Drawing.Color.Red;
                    Label_Clone_Stat.Text      = "Cloning Failed";
                }
                break;

            case "lead": createLead(contextId, new Id().getNewId(BackEndObjects.Id.ID_TYPE_RFQ_STRING), false);
                break;

            case "Potn":
                createLead(contextId, new Id().getNewId(BackEndObjects.Id.ID_TYPE_RFQ_STRING), true);

                break;
            }
        }
示例#7
0
        protected void loadProductGrid(String poId)
        {
            ArrayList rfqSpecList = new ArrayList();
            String    context     = Request.QueryString.GetValues("context")[0];

            if (context.Equals("client"))
            {
                rfqSpecList = (ArrayList)Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_RFQ_SPEC];
            }
            else if (context.Equals("vendor"))
            {
                rfqSpecList = (ArrayList)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_POTN_SPEC];
            }
            else if (context.Equals("clientInvoiceGrid") || context.Equals("vendInvoiceGrid"))
            {//If this is sent from the Invoice grid in Purchase screen
                rfqSpecList = BackEndObjects.RFQProductServiceDetails.getAllProductServiceDetailsbyRFQIdDB(Request.QueryString.GetValues("rfId")[0]);
            }

            ArrayList poQuoteList = PurchaseOrderQuote.getPurcahseOrderQuoteListbyPOIdDB(poId);

            DataTable dt = new DataTable();

            dt.Columns.Add("Hidden_Cat_Id");
            dt.Columns.Add("Serial");
            dt.Columns.Add("Qnty");
            dt.Columns.Add("Prod_Name");
            dt.Columns.Add("Cat_Name");
            dt.Columns.Add("Unit_Price");
            dt.Columns.Add("Cat_Total");

            float totalAmnt = 0;

            for (int i = 0; i < poQuoteList.Count; i++)
            {
                BackEndObjects.PurchaseOrderQuote poQntyObj = (PurchaseOrderQuote)poQuoteList[i];
                //Preference to toQuantity
                float  qnty  = poQntyObj.getUnits();
                String catId = poQntyObj.getProd_srv_category();

                dt.Rows.Add();
                dt.Rows[i]["Hidden_Cat_Id"] = catId;
                dt.Rows[i]["Serial"]        = i + 1;
                dt.Rows[i]["Qnty"]          = qnty.ToString();
                dt.Rows[i]["Prod_Name"]     = poQntyObj.getProduct_name();
                dt.Rows[i]["Cat_Name"]      = BackEndObjects.ProductCategory.getProductCategorybyIdwoFeaturesDB(catId).getProductCategoryName();
                dt.Rows[i]["Unit_Price"]    = poQntyObj.getQuote();
                dt.Rows[i]["Cat_Total"]     = qnty * poQntyObj.getQuote();

                totalAmnt += poQntyObj.getQuote() * qnty;
            }


            GridView1.Visible    = true;
            GridView1.DataSource = dt;
            GridView1.DataBind();
            GridView1.Columns[0].Visible = false;

            foreach (GridViewRow gVR in GridView1.Rows)
            {
                // if (!context.Equals("client"))
                //{
                ((TextBox)gVR.Cells[2].FindControl("TextBox_Qnty")).Enabled       = false;
                ((TextBox)gVR.Cells[2].FindControl("TextBox_Unit_Price")).Enabled = false;
                //}
                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 < rfqSpecList.Count; j++)
                {
                    BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecList[j];

                    if (rfqSpecObj.getPrdCatId().Equals(((Label)gVR.Cells[1].FindControl("Label_Hidden")).Text))
                    {
                        dtSpec.Rows.Add();
                        String featName = BackEndObjects.Features.getFeaturebyIdwoSpecDB(rfqSpecObj.getFeatId()).getFeatureName();
                        dtSpec.Rows[rowCount]["Hidden"]   = rfqSpecObj.getFeatId();
                        dtSpec.Rows[rowCount]["FeatName"] = (featName != null ? featName.Trim() : "");
                        dtSpec.Rows[rowCount]["SpecText"] = rfqSpecObj.getSpecText();
                        if (!rfqSpecObj.getFromSpecId().Equals(""))
                        {
                            dtSpec.Rows[rowCount]["FromSpec"] = BackEndObjects.Specifications.getSpecificationDetailbyIdDB(rfqSpecObj.getFromSpecId()).getSpecName();
                        }
                        if (!rfqSpecObj.getToSpecId().Equals(""))
                        {
                            dtSpec.Rows[rowCount]["ToSpec"] = BackEndObjects.Specifications.getSpecificationDetailbyIdDB(rfqSpecObj.getToSpecId()).getSpecName();
                        }

                        rowCount++;
                    }
                }
                ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).DataSource = dtSpec;
                ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).DataBind();
                ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).Visible            = true;
                ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).Columns[0].Visible = false;
            }

            Label_Sub_Total_Amount_Value.Visible = true;
            Label_Sub_Total_Amount_Value.Text    = totalAmnt.ToString();
            if (TextBox_Taxable_Amount.Text.Equals("") || float.Parse(TextBox_Taxable_Amount.Text) == 0)
            {
                TextBox_Taxable_Amount.Text = totalAmnt.ToString();
            }
            Label_Total_Amount_Value.Visible = true;
            Label_Total_Amount_Value.Text    = updateTotalINVAmount();
        }
示例#8
0
        protected void fillGrid()
        {
            ArrayList rfqProdList = (ArrayList)Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_PROD_QNTY];
            ArrayList rfqSpecList = (ArrayList)Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_RFQ_SPEC];


            float totalAmountFrom = 0, totalAmountTo = 0;

            String rfqId = Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString();

            DataTable dt = new DataTable();

            dt.Columns.Add("Hidden");
            dt.Columns.Add("CategoryName");
            dt.Columns.Add("featureDataTable");
            dt.Columns.Add("FromQnty");
            dt.Columns.Add("ToQnty");
            dt.Columns.Add("FromPrice");
            dt.Columns.Add("ToPrice");
            dt.Columns.Add("msrmntUnit");
            //dt.Columns.Add("HiddenCatId");
            dt.Columns.Add("Quote");
            // dt.Columns.Add("QuoteUnit");
            dt.Columns.Add("Total");
            //dt.Columns.Add("Audit");

            Dictionary <String, RFQResponseQuotes> rfqRespQuoteDict = BackEndObjects.RFQResponseQuotes.
                                                                      getAllResponseQuotesforRFQandResponseEntityDB(rfqId, Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SHOW_QUOTE_SELECTED_RESP_ENTITY_ID].ToString());

            String contactEntId = "";

            for (int i = 0; i < rfqProdList.Count; i++)
            {
                BackEndObjects.RFQProdServQnty rfqProdObj = (BackEndObjects.RFQProdServQnty)rfqProdList[i];

                dt.Rows.Add();
                dt.Rows[i]["Hidden"]       = rfqProdObj.getProdCatId();
                dt.Rows[i]["CategoryName"] = BackEndObjects.ProductCategory.
                                             getProductCategorybyIdwoFeaturesDB(rfqProdObj.getProdCatId()).getProductCategoryName();
                //dt.Rows[i]["featureDataTable"] = dtSpec;
                dt.Rows[i]["FromQnty"]   = rfqProdObj.getFromQnty();
                dt.Rows[i]["ToQnty"]     = rfqProdObj.getToQnty();
                dt.Rows[i]["FromPrice"]  = rfqProdObj.getFromPrice();
                dt.Rows[i]["ToPrice"]    = rfqProdObj.getToPrice();
                dt.Rows[i]["msrmntUnit"] = rfqProdObj.getMsrmntUnit();

                RFQResponseQuotes rfqRespObj = new RFQResponseQuotes();


                try
                {
                    rfqRespObj   = rfqRespQuoteDict[rfqProdObj.getProdCatId()];
                    contactEntId = rfqRespObj.getResponseEntityId();
                    String respQuote = rfqRespObj.getQuote().Equals("") ? "0" : rfqRespObj.getQuote();;
                    dt.Rows[i]["Quote"] = respQuote;
                    //dt.Rows[i]["QuoteUnit"] = rfqRespObj.getUnitName();
                    totalAmountFrom     = totalAmountFrom + (rfqProdObj.getFromQnty() * float.Parse(respQuote));
                    totalAmountTo       = totalAmountTo + (rfqProdObj.getToQnty() * float.Parse(respQuote));
                    dt.Rows[i]["Total"] = (rfqProdObj.getFromQnty() * float.Parse(respQuote)) + " to " + (rfqProdObj.getToQnty() * float.Parse(respQuote));
                }
                catch (KeyNotFoundException e)
                {
                    //If no response given to this RFQ by this entity so far
                    dt.Rows[i]["Quote"] = "0";
                    dt.Rows[i]["Total"] = "0";
                }
            }

            Label_RFQ_Name.Text = rfqId;
            //Label_Vendor.Text =
            Dictionary <String, Object> contactDict = ActionLibrary.customerDetails.getContactDetails(contactEntId,
                                                                                                      Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            if (contactDict.ContainsKey(ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_CONTACT_DETAILS))
            {
                Label_Vendor.Text = ((BackEndObjects.Contacts)contactDict[ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_CONTACT_DETAILS]).getContactName();
            }
            else
            {
                Label_Vendor.Text = ((BackEndObjects.MainBusinessEntity)contactDict[ActionLibrary.customerDetails.RETURN_OBJECT_TYPE_MAIN_BUSINESS_ENTITY]).getEntityName();
            }


            GridView1.DataSource = dt;
            GridView1.DataBind();
            GridView1.Columns[0].Visible = false;

            foreach (GridViewRow gVR in GridView1.Rows)
            {
                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 < rfqSpecList.Count; j++)
                {
                    BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecList[j];

                    if (rfqSpecObj.getPrdCatId().Equals(((Label)gVR.Cells[1].FindControl("Label_Hidden")).Text))
                    {
                        dtSpec.Rows.Add();
                        String featName = BackEndObjects.Features.getFeaturebyIdwoSpecDB(rfqSpecObj.getFeatId()).getFeatureName();
                        dtSpec.Rows[rowCount]["Hidden"]   = rfqSpecObj.getFeatId();
                        dtSpec.Rows[rowCount]["FeatName"] = (featName != null ? featName.Trim() : "");
                        dtSpec.Rows[rowCount]["SpecText"] = rfqSpecObj.getSpecText();
                        if (!rfqSpecObj.getFromSpecId().Equals(""))
                        {
                            dtSpec.Rows[rowCount]["FromSpec"] = BackEndObjects.Specifications.
                                                                getSpecificationDetailbyIdDB(rfqSpecObj.getFromSpecId()).getSpecName();
                        }
                        if (!rfqSpecObj.getToSpecId().Equals(""))
                        {
                            dtSpec.Rows[rowCount]["ToSpec"] = BackEndObjects.Specifications.
                                                              getSpecificationDetailbyIdDB(rfqSpecObj.getToSpecId()).getSpecName();
                        }

                        rowCount++;
                    }
                }
                ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).DataSource = dtSpec;
                ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).DataBind();
                ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).Visible            = true;
                ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).Columns[1].Visible = false;
            }

            GridView1.Visible = true;
            Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_RESP_QUOTE_GRID_DATA] = dt;

            Label_Total.Text = totalAmountFrom + " to " + totalAmountTo;
        }
        protected void createRfq()
        {
            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.RFQDetails rfqObj = new BackEndObjects.RFQDetails();
                BackEndObjects.Id         idGen  = new BackEndObjects.Id();
                String rfqId = "";
                if (Session[SessionFactory.CREATE_RFQ_RFQ_ID] == null)
                {
                    rfqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_RFQ_STRING);
                    Session[SessionFactory.CREATE_RFQ_RFQ_ID] = rfqId; //store the newly created RFQ id in the session
                }
                if (!TextBox_Spec.Text.Equals(""))
                {
                    getAddintionalProdSrvList();
                    TextBox_Spec.Text = "";
                }

                ArrayList rfqSpecObjList = (ArrayList)Session[SessionFactory.CREATE_RFQ_SELECTED_RFQ_SPEC_MAP];

                //Set the RFQ id for all the  spec objects
                if (rfqSpecObjList != null)
                {
                    for (int i = 0; i < rfqSpecObjList.Count; i++)
                    {
                        ((BackEndObjects.RFQProductServiceDetails)rfqSpecObjList[i]).setRFQId(rfqId);
                    }
                }

                rfqObj.setRFQProdServList(rfqSpecObjList);
                rfqObj.setRFQId(rfqId);
                rfqObj.setCreatedUsr(User.Identity.Name);
                rfqObj.setActiveStat(BackEndObjects.RFQDetails.RFQ_ACTIVE_STAT_ACTIVE);
                rfqObj.setDueDate(TextBox_Within_Date.Text);
                rfqObj.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                rfqObj.setCreatedEntity(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                rfqObj.setCurrency(DropDownList_Curr.SelectedValue);
                //     FileUpload1=(FileUpload1 == null ? (FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE] : FileUpload1);
                if (FileUpload1 != null && FileUpload1.HasFile)
                {
                    rfqObj.setFileStream(FileUpload1);
                    rfqObj.setNDADocPathInFileStore(rfqObj.getEntityId());
                }
                else if ((FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE] != null && ((FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE]).HasFile)
                {
                    rfqObj.setFileStream((FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE]);
                    rfqObj.setNDADocPathInFileStore(rfqObj.getEntityId());
                }

                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 : ""))));

                rfqObj.setLocalityId(localId);
                rfqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                rfqObj.setTermsandConds(TextBox_TnC.Text);
                rfqObj.setRFQName(TextBox_Reqr_Name.Text);
                rfqObj.setCreateMode(RFQDetails.CREATION_MODE_AUTO);

                //Set the approval Status
                int rfqLevel = BackEndObjects.MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()).getRfqApprovalLevel();
                BackEndObjects.Workflow_Action actionObj = null;
                if (rfqLevel > 0)
                {
                    String reportingToUser = BackEndObjects.userDetails.
                                             getUserDetailsbyIdDB(User.Identity.Name, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()).getReportsTo();
                    rfqObj.setApprovalStat(reportingToUser);

                    actionObj = new Workflow_Action();
                    actionObj.setEntId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                    actionObj.setUserId(User.Identity.Name);
                    actionObj.setActionTaken(BackEndObjects.Workflow_Action.WORKFLOW_ACTION_ACTION_TAKEN_SUBMITTED);
                    actionObj.setActionDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    actionObj.setContextId(rfqObj.getRFQId());
                    actionObj.setContextName(BackEndObjects.Workflow_Action.WORKFLOW_ACTION_CONTEXT_NAME_RFQ);
                    actionObj.setComment("");
                }
                else
                {
                    rfqObj.setApprovalStat(RFQDetails.RFQ_APPROVAL_STAT_APPROVED);
                }
                rfqObj.setApprovalLevel("0".ToString());

                BackEndObjects.RFQProdServQnty rfqPrdQnty = new BackEndObjects.RFQProdServQnty();
                rfqPrdQnty.setRFQId(rfqObj.getRFQId());
                if (!TextBox_Price_Range_From.Text.Equals(""))
                {
                    rfqPrdQnty.setFromPrice(TextBox_Price_Range_From.Text);
                }
                if (!TextBox_Price_Range_To.Text.Equals(""))
                {
                    rfqPrdQnty.setToPrice(TextBox_Price_Range_To.Text);
                }
                if (!TextBox_Prod_Qnty_From.Text.Equals(""))
                {
                    rfqPrdQnty.setFromQnty(float.Parse(TextBox_Prod_Qnty_From.Text));
                }
                if (!TextBoxrod_Qnty_To.Text.Equals(""))
                {
                    rfqPrdQnty.setToQnty(float.Parse(TextBoxrod_Qnty_To.Text));
                }
                rfqPrdQnty.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue);
                rfqPrdQnty.setProdCatId(Session[SessionFactory.CREATE_RFQ_SELECTED_PRODUCT_CAT].ToString());
                //ArrayList rfqPrdQntyList = new ArrayList();
                //rfqPrdQntyList.Add(rfqPrdQnty);

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

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

                prodSrvQntyList.Add(rfqPrdQnty);

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

                rfqObj.setRFQProdServQntyList(prodSrvQntyList);

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

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

                ActionLibrary.PurchaseActions._createRFQ cR = new ActionLibrary.PurchaseActions._createRFQ();
                try
                {
                    cR.createNewRFQ(rfqObj);
                    if (actionObj != null)
                    {
                        BackEndObjects.Workflow_Action.insertWorkflowActionObject(actionObj);
                    }

                    Label_Status.Text      = "RFQ created successfully....You MUST broadcast an RFQ for vendors to see!" + (rfqLevel == 0 ? " RFQ will be auto approved as there is no approval rule set in Administration->WorkflowMgmt->RFQ" : "");
                    Label_Status.ForeColor = System.Drawing.Color.Green;
                    Label_Status.Visible   = true;

                    //Refresh the parent grid
                    DataTable dt = (DataTable)Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_GRID_DATA];
                    Dictionary <String, Currency> allCurrList = (Dictionary <String, Currency>)Session[SessionFactory.CURRENCY_LIST];

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

                    String docName = "";
                    if (rfqObj.getNDADocPath() != null)
                    {
                        String[] docPathList = rfqObj.getNDADocPath().
                                               Split(new String[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
                        if (docPathList.Length > 0)
                        {
                            docName = docPathList[docPathList.Length - 1];
                        }
                    }

                    DateUtility dU = new DateUtility();

                    dt.Rows[i]["RFQNo"]       = rfqObj.getRFQId();
                    dt.Rows[i]["RFQName"]     = rfqObj.getRFQName();
                    dt.Rows[i]["Submit Date"] = rfqObj.getSubmitDate();
                    dt.Rows[i]["curr"]        = allCurrList.ContainsKey(rfqObj.getCurrency()) ?
                                                allCurrList[rfqObj.getCurrency()].getCurrencyName() : "";
                    dt.Rows[i]["Submit Date Ticks"] = Convert.ToDateTime(rfqObj.getSubmitDate()).Ticks;
                    dt.Rows[i]["Due Date"]          = dU.getConvertedDateWoTime(rfqObj.getDueDate());
                    dt.Rows[i]["Due Date Ticks"]    = !dt.Rows[i]["Due Date"].Equals("")?Convert.ToDateTime(dt.Rows[i]["Due Date"]).Ticks:0;
                    dt.Rows[i]["ApprovalStat"]      = rfqObj.getApprovalStat();
                    dt.Rows[i]["Po_No"]             = "N/A";
                    dt.Rows[i]["Hidden_Doc_Name"]   = (docName == null || docName.Equals("") ? "" : docName);
                    dt.Rows[i]["ActiveStatus"]      = rfqObj.getActiveStat();
                    dt.Rows[i]["Inv_No"]            = "N/A";

                    dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC";
                    Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_GRID_DATA] = dt.DefaultView.ToTable();
                    ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshRefqGrid", "RefreshParent();", true);
                }

                catch (Exception ex)
                {
                    Label_Status.Text      = "RFQ creation failed";
                    Label_Status.ForeColor = System.Drawing.Color.Red;
                    Label_Status.Visible   = true;
                }
                finally
                {
                    Session.Remove(SessionFactory.CREATE_RFQ_SELECTED_RFQ_SPEC_MAP);
                    Session.Remove(SessionFactory.CREATE_RFQ_RFQ_ID);
                    Session.Remove(SessionFactory.CREATE_RFQ_PROD_SRV_QNTY_LIST);
                    Session.Remove(SessionFactory.CREATE_RFQ_NDA_FILE);
                }
            }
        }
示例#10
0
        protected void loadProductGrid()
        {
            String context = Request.QueryString.GetValues("context")[0];

            String[]  rfqId       = Request.QueryString.GetValues("rfqId");
            String    respEntId   = "";
            ArrayList rfqSpecList = null;

            if (context.Equals("client"))
            {
                respEntId   = Request.QueryString.GetValues("respCompId")[0];
                rfqSpecList = (ArrayList)Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_RFQ_SPEC];
            }
            else
            {
                respEntId   = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString();
                rfqSpecList = (ArrayList)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_POTN_SPEC];
            }

            DataTable dt = new DataTable();

            dt.Columns.Add("Hidden_Cat_Id");
            dt.Columns.Add("Serial");
            dt.Columns.Add("Qnty");
            dt.Columns.Add("Prod_Name");
            dt.Columns.Add("Cat_Name");
            dt.Columns.Add("Unit_Price");
            dt.Columns.Add("Cat_Total");


            float totalAmnt = 0;

            ArrayList rfqQntyList = BackEndObjects.RFQProdServQnty.getRFQProductServiceQuantityforRFIdDB(rfqId[0]);
            Dictionary <String, RFQResponseQuotes> respQuoteDict = BackEndObjects.RFQResponseQuotes.getAllResponseQuotesforRFQandResponseEntityDB(rfqId[0], respEntId);

            int k = 0;

            for (int i = 0; i < rfqQntyList.Count; i++)
            {
                BackEndObjects.RFQProdServQnty rfqQntyObj = (RFQProdServQnty)rfqQntyList[i];
                //Preference to toQuantity
                float  qnty  = rfqQntyObj.getToQnty() > 0 ? rfqQntyObj.getToQnty() : rfqQntyObj.getFromQnty();
                String catId = rfqQntyObj.getProdCatId();

                RFQResponseQuotes respQuoteObj = respQuoteDict != null && respQuoteDict.ContainsKey(catId)?respQuoteDict[catId]:null;
                if (respQuoteObj != null)
                {
                    String quote    = respQuoteObj.getQuote();
                    String prodName = respQuoteObj.getProductName();

                    dt.Rows.Add();
                    dt.Rows[k]["Hidden_Cat_Id"] = catId;
                    dt.Rows[k]["Serial"]        = k + 1;
                    dt.Rows[k]["Qnty"]          = qnty.ToString();
                    dt.Rows[k]["Prod_Name"]     = prodName;
                    dt.Rows[k]["Cat_Name"]      = BackEndObjects.ProductCategory.getProductCategorybyIdwoFeaturesDB(catId).getProductCategoryName();
                    dt.Rows[k]["Unit_Price"]    = quote;
                    dt.Rows[k]["Cat_Total"]     = float.Parse(quote) * qnty;

                    totalAmnt += float.Parse(quote) * qnty;
                    k++;
                }
            }

            if (dt != null && dt.Rows.Count > 0)
            {
                GridView1.Visible    = true;
                GridView1.DataSource = dt;
                GridView1.DataBind();
                GridView1.Columns[0].Visible = false;

                foreach (GridViewRow gVR in GridView1.Rows)
                {
                    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 < rfqSpecList.Count; j++)
                    {
                        BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecList[j];

                        if (rfqSpecObj.getPrdCatId().Equals(((Label)gVR.Cells[1].FindControl("Label_Hidden")).Text))
                        {
                            dtSpec.Rows.Add();
                            String featName = BackEndObjects.Features.getFeaturebyIdwoSpecDB(rfqSpecObj.getFeatId()).getFeatureName();
                            dtSpec.Rows[rowCount]["Hidden"]   = rfqSpecObj.getFeatId();
                            dtSpec.Rows[rowCount]["FeatName"] = (featName != null ? featName.Trim() : "");
                            dtSpec.Rows[rowCount]["SpecText"] = rfqSpecObj.getSpecText();
                            if (!rfqSpecObj.getFromSpecId().Equals(""))
                            {
                                dtSpec.Rows[rowCount]["FromSpec"] = BackEndObjects.Specifications.getSpecificationDetailbyIdDB(rfqSpecObj.getFromSpecId()).getSpecName();
                            }
                            if (!rfqSpecObj.getToSpecId().Equals(""))
                            {
                                dtSpec.Rows[rowCount]["ToSpec"] = BackEndObjects.Specifications.getSpecificationDetailbyIdDB(rfqSpecObj.getToSpecId()).getSpecName();
                            }

                            rowCount++;
                        }
                    }
                    ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).DataSource = dtSpec;
                    ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).DataBind();
                    ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).Visible            = true;
                    ((GridView)gVR.Cells[2].FindControl("GridView1_Inner")).Columns[0].Visible = false;
                }

                Label_Sub_Total_Amount_Value.Visible = true;
                Label_Sub_Total_Amount_Value.Text    = totalAmnt.ToString();
                Label_Total_Amount_Value.Visible     = true;
                Label_Total_Amount_Value.Text        = updateTotalPOAmount();
            }
            else
            {
                //Warning --- no prod specification found

                GridView1.Visible             = false;
                Label_GridView_Status.Visible = true;
                if (context.Equals("client"))
                {
                    Label_GridView_Status.Text = "* No product details added in the RFQ. Only product details added in RFQ will populate in Purchase Order";
                }
                else
                {
                    Label_GridView_Status.Text = "* No product details added in the Potential. Only product details added in Potential will populate in Sales Order";
                }

                Label_GridView_Status.ForeColor = System.Drawing.Color.Red;
            }

            Session[SessionFactory.ALL_PURCHASE_FINALIZE_DEAL_PO_PROD_GRID] = dt;
        }