/// <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"; } }