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("ShortListed"); int counter = 0; Dictionary <String, RFQResponse> respDict = RFQResponse.getAllRFQResponseforRFQIdDB(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); DateUtility dU = new DateUtility(); foreach (KeyValuePair <String, RFQResponse> kvp in respDict) { RFQResponse respObj = (RFQResponse)kvp.Value; dt.Rows.Add(); dt.Rows[counter]["RespCompId"] = respObj.getRespEntityId(); dt.Rows[counter]["VendName"] = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(respObj.getRespEntityId()).getEntityName(); dt.Rows[counter]["DateVal"] = dU.getConvertedDate(respObj.getRespDate()); BackEndObjects.RFQShortlisted shortObj = BackEndObjects.RFQShortlisted. getRFQShortlistedbyRespEntandRFQId(respObj.getRespEntityId(), Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); if (shortObj != null && shortObj.getRFQId() != null && !shortObj.getRFQId().Equals("")) { dt.Rows[counter]["ShortListed"] = "Y"; } else { dt.Rows[counter]["ShortListed"] = "N"; } counter++; } GridView_RFQ_Resp_Quotes.DataSource = dt; GridView_RFQ_Resp_Quotes.DataBind(); GridView_RFQ_Resp_Quotes.Columns[1].Visible = false; if (dt == null || dt.Rows.Count == 0) { Label_Empty_Quote.Visible = true; } else { Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_ALL_QUOTES_GRID] = dt; } }
protected void Button_ShortList_Click(object sender, EventArgs e) { BackEndObjects.RFQShortlisted potRec = new BackEndObjects.RFQShortlisted(); potRec.setRFQId(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); potRec.setRespEntityId(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SHOW_QUOTE_SELECTED_RESP_ENTITY_ID].ToString()); potRec.setPotStat(BackEndObjects.PotentialStatus.POTENTIAL_STAT_PRELIM); potRec.setPotentialId(new Id().getNewId(BackEndObjects.Id.ID_TYPE_POTENTIAL_ID_STRING)); //Now calculate the potential amount String[] splitDelim = { "to" }; String[] splitData = Label_Total.Text.Split(splitDelim, StringSplitOptions.RemoveEmptyEntries); float potAmnt = 0; if (splitData.Length > 1) { potAmnt = (float.Parse(splitData[0]) + float.Parse(splitData[1])) / 2; } else { potAmnt = float.Parse(splitData[0]); } potRec.setPotenAmnt(potAmnt); potRec.setPotActStat(BackEndObjects.RFQShortlisted.POTENTIAL_ACTIVE_STAT_ACTIVE); potRec.setFinlSupFlag("N"); potRec.setFinlCustFlag("N"); potRec.setCreateMode(BackEndObjects.RFQShortlisted.POTENTIAL_CREATION_MODE_AUTO); potRec.setCreatedDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); try { BackEndObjects.RFQShortlisted.insertRFQShorListedEntryDB(potRec); Label_ShortList_Stat.Text = "Entry shortlisted successfully"; Label_ShortList_Stat.ForeColor = System.Drawing.Color.Green; Label_ShortList_Stat.Visible = true; DataTable dt = (DataTable)Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_ALL_QUOTES_GRID]; int dataItemIndex = Int32.Parse(Request.QueryString.GetValues("dataItemIndex")[0]); dt.Rows[dataItemIndex]["ShortListed"] = "Y"; //dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC"; Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_GRID_DATA] = dt; ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshRefqGrid", "RefreshParent();", true); } catch (Exception ex) { Label_ShortList_Stat.Text = "Shortlisting process failed"; Label_ShortList_Stat.ForeColor = System.Drawing.Color.Red; Label_ShortList_Stat.Visible = true; } }
/// <summary> /// This method check if this respectiv entry was already shortlisted. /// Based on this result the shortlist button will be enabled/disabled /// </summary> /// <returns></returns> protected Boolean checkIfAlreadyShortListed() { BackEndObjects.RFQShortlisted shortObj = BackEndObjects.RFQShortlisted. getRFQShortlistedbyRespEntandRFQId(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SHOW_QUOTE_SELECTED_RESP_ENTITY_ID].ToString(), Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); Dictionary <String, bool> accessList = (Dictionary <String, bool>)Session[SessionFactory.ACCESSLIST_FOR_USER]; if (shortObj != null && shortObj.getRFQId() != null && !shortObj.getRFQId().Equals("")) { return(false); } else if (accessList[BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_EDIT_RFQ] || accessList[BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_OWNER_ACCESS]) { return(true); } else { return(false); } }