Esempio n. 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;
        }
Esempio n. 2
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();
        }
Esempio n. 3
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;
        }
Esempio n. 4
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;
        }