protected void fillRespQuoteGrid() { DataTable dt = new DataTable(); dt.Columns.Add("RespCompId"); dt.Columns.Add("VendName"); dt.Columns.Add("quote"); dt.Columns.Add("NDA"); dt.Columns.Add("DateVal"); dt.Columns.Add("comm"); dt.Columns.Add("TotalAmnt"); dt.Columns.Add("DealReq"); ArrayList shortListedList = RFQShortlisted. getAllShortListedEntriesbyRFQId(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); DateUtility dU = new DateUtility(); for (int i = 0; i < shortListedList.Count; i++) { RFQShortlisted shortObj = (RFQShortlisted)shortListedList[i]; dt.Rows.Add(); dt.Rows[i]["RespCompId"] = shortObj.getRespEntityId(); dt.Rows[i]["VendName"] = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(shortObj.getRespEntityId()).getEntityName(); dt.Rows[i]["DateVal"] = dU.getConvertedDate(shortObj.getCreatedDate()); dt.Rows[i]["TotalAmnt"] = shortObj.getPotenAmnt(); dt.Rows[i]["DealReq"] = shortObj.getFinlSupFlag(); } GridView_RFQ_Resp_Quotes.DataSource = dt; GridView_RFQ_Resp_Quotes.DataBind(); GridView_RFQ_Resp_Quotes.Columns[1].Visible = false; //Find out the selected entity if any RFQShortlisted selectedPotObj = RFQShortlisted. getRFQShortlistedEntryforFinalizedVendor(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SHORLISTED_FINALIZED_POTEN] = selectedPotObj.getPotentialId(); foreach (GridViewRow gVR in GridView_RFQ_Resp_Quotes.Rows) { if (((Label)gVR.Cells[0].FindControl("Label_Hidden")).Text.Equals(selectedPotObj.getRespEntityId())) { ((System.Web.UI.WebControls.Image)gVR.Cells[0].FindControl("Image_Selected")).Visible = true; } } }
protected void Button_Finalz_Deal_Click(object sender, EventArgs e) { String respEntityId = Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SHOW_QUOTE_SELECTED_RESP_ENTITY_ID].ToString(); String rfqId = Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString(); RFQShortlisted rfqShortObj = RFQShortlisted.getRFQShortlistedbyRespEntandRFQId(respEntityId, rfqId); //Allow only if the supplier finalized the deal if (rfqShortObj.getFinlSupFlag().Equals("Y")) { Dictionary <String, String> whereCls = new Dictionary <string, string>(); whereCls.Add(BackEndObjects.RFQShortlisted.RFQ_SHORTLIST_COL_RFQ_ID, rfqId); whereCls.Add(BackEndObjects.RFQShortlisted.RFQ_SHORTLIST_COL_RESP_ENT_ID, respEntityId); Dictionary <String, String> targetVals = new Dictionary <string, string>(); targetVals.Add(BackEndObjects.RFQShortlisted.RFQ_SHORTLIST_COL_FINL_BY_CUST, "Y"); try { BackEndObjects.RFQShortlisted.updateRFQShortListedEntryDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE); Label_Finalize_Stat.Visible = true; Label_Finalize_Stat.ForeColor = System.Drawing.Color.Green; Label_Finalize_Stat.Text = "Deal Finalization Request Sent"; String forwardString = "/Pages/Popups/Purchase/FinalizeDeal.aspx"; forwardString += "?respCompId=" + respEntityId + "&rfqId=" + rfqId + "&context=" + "client"; Button_Finalz_Deal.Enabled = false; Response.Redirect(forwardString); //Server.Transfer(forwardString); } catch (Exception ex) { Label_Finalize_Stat.Visible = true; Label_Finalize_Stat.ForeColor = System.Drawing.Color.Red; Label_Finalize_Stat.Text = "Deal Finalization Request Failed"; } } else { Label_Finalize_Stat.Visible = true; Label_Finalize_Stat.ForeColor = System.Drawing.Color.Red; Label_Finalize_Stat.Text = "Vendor needs to finalize the deal with final quotes"; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { String rfId = Request.QueryString.GetValues("rfId")[0]; String context = Request.QueryString.GetValues("context")[0]; String poId = Request.QueryString.GetValues("poId")[0]; String otherEntId = ""; //This flag determines whether or no any tax component is changed in this screen Label_Inv_Tax_Comp_Changed.Text = "N"; String invId = Request.QueryString.GetValues("invId")[0]; BackEndObjects.Invoice invObj = new BackEndObjects.Invoice(); if (invId != null && !invId.Equals("")) { invObj = BackEndObjects.Invoice.getInvoicebyIdDB(invId); loadAlreadyCreatedInvData(invObj); } else { //If invoice data does not exist then forward to create invoice screen String forwardString = "/Pages/createInvoice.aspx"; forwardString += "?rfId=" + rfId; if (poId == null || poId.Equals("")) { forwardString += "&emptySO=" + "true"; } Response.Redirect(forwardString); //Server.Transfer(forwardString); //ScriptManager.RegisterStartupScript(this, typeof(string), "createInv", "window.open('" + forwardString + "',null,'resizeable=yes,scrollbars=yes,addressbar=no,toolbar=no,width=900,Height=900');", true); } // Button_Update_Inv.Visible = false; RFQShortlisted rfqDealObj = BackEndObjects.RFQShortlisted.getRFQShortlistedEntryforFinalizedVendor(rfId); if (context.Equals("client") || context.Equals("clientInvoiceGrid")) { otherEntId = rfqDealObj.getRespEntityId(); //If control is in client context, then the invoice is already created and the response entity details are available if (otherEntId == null || otherEntId.Equals("")) { otherEntId = invObj.getRespEntityId(); } } else { bool approvalContext = false; if (Request.QueryString.GetValues("approvalContext") != null) { approvalContext = Request.QueryString.GetValues("approvalContext")[0].Equals("Y") ? true : false; } if (approvalContext) { Button_Create_Inv.Enabled = false; Button_Update_Inv.Enabled = false; Label_INV_Creation_Stat.Visible = true; Label_INV_Creation_Stat.Text = "To edit anything for this invoice, please check the invoice from Sales->Invoice screen."; Label_INV_Creation_Stat.ForeColor = System.Drawing.Color.Red; } else { Dictionary <String, bool> accessList = (Dictionary <String, bool>)Session[SessionFactory.ACCESSLIST_FOR_USER]; if (!accessList[BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_EDIT_INVOICE_SALES] && !accessList[BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_OWNER_ACCESS]) { Label_INV_Creation_Stat.Visible = true; Label_INV_Creation_Stat.Text = "You don't have edit access to invoice record"; Label_INV_Creation_Stat.ForeColor = System.Drawing.Color.Red; Button_Create_Inv.Enabled = false; Button_Update_Inv.Enabled = false; } } otherEntId = RFQDetails.getRFQDetailsbyIdDB(rfId).getEntityId(); } loadClientAndVendorDetails(rfId, otherEntId); loadProductGrid(poId); populateLogo(otherEntId, context); loadInvTaxCompGrid(invId); loadTnC(invObj); updateTotalINVAmount(); if (context.Equals("client") || context.Equals("clientInvoiceGrid")) { disableControlsForClient(); } } }
/// <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"; } }
protected void createPotentialManul() { 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_Pot.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_POTENTIAL_RFQ_ID] == null) { rfqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_RFQ_STRING); Session[SessionFactory.CREATE_POTENTIAL_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_POTENTIAL_SELECTED_POTN_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(DropDownList_Contacts.SelectedValue); 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_POTENTIAL_NDA_FILE] != null && ((FileUpload)Session[SessionFactory.CREATE_POTENTIAL_NDA_FILE]).HasFile) * { * rfqObj.setFileStream((FileUpload)Session[SessionFactory.CREATE_POTENTIAL_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); //RFQ creation mode is manual while manually creating lead/potential rfqObj.setCreateMode(RFQDetails.CREATION_MODE_MANUAL); 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(TextBox_Prod_Qnty_To.Text)); rfqPrdQnty.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue); rfqPrdQnty.setProdCatId(Session[SessionFactory.CREATE_POTENTIAL_SELECTED_PRODUCT_CAT].ToString()); //ArrayList rfqPrdQntyList = new ArrayList(); //rfqPrdQntyList.Add(rfqPrdQnty); ArrayList prodSrvQntyList = (ArrayList)Session[SessionFactory.CREATE_POTENTIAL_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_POTENTIAL_RFQ_ID].ToString()); leadRespObj.setRespDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); leadRespObj.setAssignedTo(DropDownList_Users.SelectedValue); leadRespObj.setNextFollowupDate(TextBox_Fwp_Date.Text); //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_POTENTIAL_NDA_FILE] != null && ((FileUpload)Session[SessionFactory.CREATE_POTENTIAL_NDA_FILE]).HasFile) { leadRespObj.setFileStream((FileUpload)Session[SessionFactory.CREATE_POTENTIAL_NDA_FILE]); leadRespObj.setNDADocPathInFileStore(leadRespObj.getRespEntityId()); } ArrayList leadRespQuoteList = (ArrayList)Session[SessionFactory.CREATE_POTENTIAL_RESP_QUOTE_LIST]; if (leadRespQuoteList == null) { leadRespQuoteList = new ArrayList(); } BackEndObjects.RFQResponseQuotes respQuoteObj = new RFQResponseQuotes(); respQuoteObj.setPrdCatId(Session[SessionFactory.CREATE_POTENTIAL_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); BackEndObjects.RFQShortlisted potObj = new RFQShortlisted(); potObj.setRFQId(rfqObj.getRFQId()); potObj.setRespEntityId(rfqObj.getCreatedEntity()); potObj.setPotStat(DropDownList_Pot_Stage.SelectedValue); potObj.setPotentialId(new Id().getNewId(BackEndObjects.Id.ID_TYPE_POTENTIAL_ID_STRING)); potObj.setPotenAmnt(calculatePotAmnt(leadRespQuoteList, prodSrvQntyList)); potObj.setPotActStat(DropDownList_Pot_State.SelectedValue); potObj.setFinlSupFlag("N"); potObj.setFinlCustFlag("N"); potObj.setCreateMode(rfqObj.getCreateMode()); potObj.setCreatedDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //potObj.setConfMatPathInFileStore(potObj.getRespEntityId()); /* if (FileUpload2 != null && FileUpload2.HasFile) * { * potObj.setFileStream(FileUpload2); * potObj.setConfMatPathInFileStore(potObj.getRespEntityId()); * * }*/ /*else if ((FileUpload)Session[SessionFactory.CREATE_POTENTIAL_CONF_MAT] != null && * ((FileUpload)Session[SessionFactory.CREATE_POTENTIAL_CONF_MAT]).HasFile) * { * potObj.setFileStream((FileUpload)Session[SessionFactory.CREATE_POTENTIAL_CONF_MAT]); * potObj.setConfMatPathInFileStore(potObj.getRespEntityId()); * }*/ try { cL.createNewLead(leadObj, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), User.Identity.Name); BackEndObjects.RFQShortlisted.insertRFQShorListedEntryDB(potObj); Label_Status.Text = "Potential created successfully"; Label_Status.ForeColor = System.Drawing.Color.Green; Label_Status.Visible = true; DataTable dt = (DataTable)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_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(); dt.Rows[count]["curr"] = allCurrList.ContainsKey(leadObj.getCurrency()) ? allCurrList[leadObj.getCurrency()].getCurrencyName() : ""; 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]["PotId"] = potObj.getPotentialId(); dt.Rows[count]["Potn_Alert_Required"] = alertRequired; dt.Rows[count]["DateCreated"] = potObj.getCreatedDate(); dt.Rows[count]["DateCreatedTicks"] = Convert.ToDateTime(potObj.getCreatedDate()).Ticks; dt.Rows[count]["CustName"] = DropDownList_Contacts.SelectedItem.Text; dt.Rows[count]["CustId"] = leadObj.getEntityId(); dt.Rows[count]["PotAmnt"] = potObj.getPotenAmnt(); dt.Rows[count]["Due Date"] = dU.getConvertedDateWoTime(leadObj.getDueDate()); dt.Rows[count]["Due Date Ticks"] = !leadObj.getDueDate().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"] = (!TextBox_Fwp_Date.Text.Equals("") ? Convert.ToDateTime(TextBox_Fwp_Date.Text).Ticks : 0); dt.Rows[count]["Assgn To"] = (!DropDownList_Users.SelectedValue.Equals("") ? DropDownList_Users.SelectedValue : ""); dt.Rows[count]["PotStage"] = potObj.getPotStat(); dt.Rows[count]["ActiveStat"] = potObj.getPotActStat(); dt.Rows[count]["Mode"] = potObj.getCreateMode(); dt.Rows[count]["PO_Id"] = "N/A"; dt.DefaultView.Sort = "DateCreatedTicks" + " " + "DESC"; Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_GRID_DATA] = dt.DefaultView.ToTable(); ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshPotnGrid", "RefreshParent();", true); } catch (Exception ex) { Label_Status.Text = "Potential creation failed"; Label_Status.ForeColor = System.Drawing.Color.Red; Label_Status.Visible = true; } finally { Session.Remove(SessionFactory.CREATE_POTENTIAL_SELECTED_POTN_SPEC_MAP); Session.Remove(SessionFactory.CREATE_POTENTIAL_RFQ_ID); Session.Remove(SessionFactory.CREATE_POTENTIAL_PROD_SRV_QNTY_LIST); Session.Remove(SessionFactory.CREATE_POTENTIAL_NDA_FILE); Session.Remove(SessionFactory.CREATE_POTENTIAL_RESP_QUOTE_LIST); } } }