protected void fillDefectGrid(Dictionary <String, DefectDetails> defectDictPassed)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("DefectId");
            dt.Columns.Add("RFQId");
            dt.Columns.Add("InvNo");
            dt.Columns.Add("descr");
            dt.Columns.Add("Submit Date");
            dt.Columns.Add("Close Date");
            dt.Columns.Add("Amount");
            dt.Columns.Add("Defect_Stat");
            dt.Columns.Add("Defect_Stat_Reason");
            dt.Columns.Add("Assigned_To");
            dt.Columns.Add("Severity");
            dt.Columns.Add("Defect_Resol_Stat");

            Dictionary <String, DefectDetails> defectDict = new Dictionary <string, DefectDetails>();

            if (defectDictPassed == null)
            {
                defectDict = BackEndObjects.DefectDetails.getAllDefectDetailsforInvoiceIdDB(Request.QueryString.GetValues("contextId1")[0]);
            }
            else
            {
                defectDict = defectDictPassed;
            }

            int         counter = 0;
            DateUtility dU      = new DateUtility();

            foreach (KeyValuePair <String, DefectDetails> kvp in defectDict)
            {
                BackEndObjects.DefectDetails defObj = kvp.Value;

                dt.Rows.Add();

                dt.Rows[counter]["DefectId"]           = defObj.getDefectId();
                dt.Rows[counter]["RFQId"]              = defObj.getRFQId();
                dt.Rows[counter]["InvNo"]              = defObj.getInvoiceId();
                dt.Rows[counter]["descr"]              = defObj.getDescription();
                dt.Rows[counter]["Submit Date"]        = dU.getConvertedDate(defObj.getDateCreated());
                dt.Rows[counter]["Close Date"]         = dU.getConvertedDate(defObj.getCloseDate() != null && !defObj.getCloseDate().Equals("") ? defObj.getCloseDate() : "");
                dt.Rows[counter]["Amount"]             = defObj.getTotalAmount();
                dt.Rows[counter]["Defect_Stat"]        = defObj.getDefectStat();
                dt.Rows[counter]["Defect_Stat_Reason"] = defObj.getStatReason();
                dt.Rows[counter]["Assigned_To"]        = defObj.getAssignedToUser();
                dt.Rows[counter]["Severity"]           = defObj.getSeverity();
                dt.Rows[counter]["Defect_Resol_Stat"]  = defObj.getResolStat();

                counter++;
            }

            if (defectDict.Count > 0)
            {
                GridView_Defects.Visible    = true;
                GridView_Defects.DataSource = dt;
                GridView_Defects.DataBind();
            }
            else
            {
                Label_Empty_Grid.Visible = true;
            }
            //Dont show assigned to for outgoing defects
            String context = Request.QueryString.GetValues("contextId2")[0];

            if (context != null && !context.Equals("vendor"))
            {
                GridView_Defects.Columns[9].Visible = false;
            }
        }
Example #2
0
        protected void fillIncomingDefectGrid(Dictionary <String, DefectDetails> defectDictPassed)
        {
            String[] contactEntId = Request.QueryString.GetValues("contactId");

            DataTable dt = new DataTable();

            dt.Columns.Add("DefectId");
            dt.Columns.Add("RFQId");
            dt.Columns.Add("InvNo");
            dt.Columns.Add("descr");
            dt.Columns.Add("Submit Date");
            dt.Columns.Add("Amount");
            dt.Columns.Add("Defect_Stat");
            dt.Columns.Add("Defect_Stat_Reason");
            dt.Columns.Add("Assigned_To");
            dt.Columns.Add("Severity");
            dt.Columns.Add("Defect_Resol_Stat");

            Dictionary <String, DefectDetails> defectDict = new Dictionary <string, DefectDetails>();

            if (defectDictPassed == null)
            {
                defectDict = BackEndObjects.DefectDetails.getAllDefectDetailsforSupplierIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            }
            else
            {
                defectDict = defectDictPassed;
            }

            int counter = 0;

            DateUtility dU = new DateUtility();

            foreach (KeyValuePair <String, DefectDetails> kvp in defectDict)
            {
                BackEndObjects.DefectDetails defObj = kvp.Value;

                String custId = defObj.getCustomerId();

                if (custId != null && custId.Equals(contactEntId[0]))
                {
                    dt.Rows.Add();

                    dt.Rows[counter]["DefectId"]           = defObj.getDefectId();
                    dt.Rows[counter]["RFQId"]              = defObj.getRFQId();
                    dt.Rows[counter]["InvNo"]              = defObj.getInvoiceId();
                    dt.Rows[counter]["descr"]              = defObj.getDescription();
                    dt.Rows[counter]["Submit Date"]        = dU.getConvertedDate(defObj.getDateCreated());
                    dt.Rows[counter]["Amount"]             = defObj.getTotalAmount();
                    dt.Rows[counter]["Defect_Stat"]        = defObj.getDefectStat();
                    dt.Rows[counter]["Defect_Stat_Reason"] = defObj.getStatReason();
                    dt.Rows[counter]["Assigned_To"]        = defObj.getAssignedToUser();
                    dt.Rows[counter]["Severity"]           = defObj.getSeverity();
                    dt.Rows[counter]["Defect_Resol_Stat"]  = defObj.getResolStat();


                    counter++;
                }
            }

            GridView_Incoming_Defects.Visible    = true;
            GridView_Incoming_Defects.DataSource = dt;
            GridView_Incoming_Defects.DataBind();

            Session[SessionFactory.ALL_CONTACT_ALL_DEFECT_INCOMING_DEF_GRID]       = dt;
            Session[SessionFactory.ALL_CONTACT_ALL_DEFECT_INCOMING_DEF_DICTIONARY] = defectDict;
        }