Ejemplo n.º 1
0
        protected void Button_Submit_Click(object sender, EventArgs e)
        {
            if (FileUpload1 != null && FileUpload1.HasFile)
            {
                BackEndObjects.DefectDetails defObj = BackEndObjects.DefectDetails.getDefectDetailsbyidDB(Request.QueryString.GetValues("contextId1")[0]);
                defObj.setFileStream(FileUpload1);
                try
                {
                    BackEndObjects.DefectDetails.updateorInsertDefectDocDB(defObj);
                    Label_Upload_Stat.Visible   = true;
                    Label_Upload_Stat.Text      = "Document Uploaded Successfully";
                    Label_Upload_Stat.ForeColor = System.Drawing.Color.Green;

                    String docName = "";
                    if (defObj.getDocPath() != null)
                    {
                        String[] docPathList = defObj.getDocPath().
                                               Split(new String[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
                        if (docPathList.Length > 0)
                        {
                            docName = docPathList[docPathList.Length - 1];
                        }
                    }

                    LinkButton_Existing_Doc.Text = docName;

                    String context       = Request.QueryString.GetValues("contextId")[0];
                    String dataItemIndex = Request.QueryString.GetValues("dataItemIndex")[0];



                    if (context.Equals("incoming"))
                    {
                        DataTable dt = (DataTable)Session[SessionFactory.ALL_DEFECT_ALL_INCOMING_DEFECT_GRID];
                        dt.Rows[Int32.Parse(dataItemIndex)]["docNameHidden"] = docName;
                        dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC";
                        Session[SessionFactory.ALL_DEFECT_ALL_INCOMING_DEFECT_GRID] = dt.DefaultView.ToTable();

                        ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshDefectGridIncm", "RefreshParentIncm();", true);
                    }
                    else
                    {
                        DataTable dt = (DataTable)Session[SessionFactory.ALL_DEFECT_ALL_OUTGOING_DEFECT_GRID];
                        dt.Rows[Int32.Parse(dataItemIndex)]["docNameHidden"] = docName;
                        dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC";
                        Session[SessionFactory.ALL_DEFECT_ALL_OUTGOING_DEFECT_GRID] = dt.DefaultView.ToTable();

                        ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshDefectGridIncm", "RefreshParentIncm();", true);
                    }
                }
                catch (Exception ex)
                {
                    Label_Upload_Stat.Visible   = true;
                    Label_Upload_Stat.Text      = "Document Upload Failed";
                    Label_Upload_Stat.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
        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;
            }
        }
Ejemplo n.º 3
0
        protected void fillOutgoingDefectGrid(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.getAllDefectDetailsforCustomerIdDB(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 suplId = defObj.getSupplierId();

                if (suplId != null && suplId.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_Outgoing_Defects.Visible    = true;
            GridView_Outgoing_Defects.DataSource = dt;
            GridView_Outgoing_Defects.DataBind();

            Session[SessionFactory.ALL_CONTACT_ALL_DEFECT_OUTGOING_DEF_GRID]       = dt;
            Session[SessionFactory.ALL_CONTACT_ALL_DEFECT_OUTGOING_DEF_DICTIONARY] = defectDictPassed;
        }
Ejemplo n.º 4
0
        protected Dictionary <String, String> getContentTypeandPath()
        {
            ActionLibrary.ImageContextFactory icObj = (ActionLibrary.ImageContextFactory)Session[SessionFactory.DISP_IMAGE_CONTEXT_FACTORY_OBJ];
            DataTable dt = new DataTable();

            dt.Columns.Add("img");
            String serverPath  = "";
            String contentType = "";
            Dictionary <String, String> pathAndContent = new Dictionary <string, string>();

            switch (icObj.getParentContextName())
            {
            case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_NOTES:
                if (icObj.getDestinationContextName().Equals
                        (ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_DOC_FOR_PARENT_NOTE))
                {
                    serverPath  = BackEndObjects.Communications.getCommunicationbyIdDB(icObj.getParentContextValue()).getDocPath();
                    contentType = getMimeType(serverPath);
                }

                break;

            case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_REQUIREMENT:
                int counter = 0;
                if (icObj.getDestinationContextName().Equals
                        (ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_FEAT_FOR_PARENT_REQUIREMENT))
                {
                    String prodCatId = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_PRODCAT_ID],
                           featId    = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_FEAT_ID];

                    ArrayList reqSpecList = BackEndObjects.Requirement_Spec.getRequirementSpecsforReqbyIdDB(icObj.getParentContextValue());


                    for (int i = 0; i < reqSpecList.Count; i++)
                    {
                        BackEndObjects.Requirement_Spec reqrObj = (Requirement_Spec)reqSpecList[i];
                        if (reqrObj.getProdCatId().Equals(prodCatId) && reqrObj.getFeatId().Equals(featId))
                        {
                            serverPath = reqrObj.getImgPath();
                            //dt.Rows.Add();
                            //dt.Rows[counter]["img"] = serverPath;
                            contentType = getMimeType(serverPath);
                            counter++;
                        }
                    }
                }
                break;

            case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_RFQ:

                if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_FEAT_FOR_PARENT_RFQ))
                {
                    String prodCatId = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_PRODCAT_ID],
                           featId    = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_FEAT_ID];

                    ArrayList rfqSpecList = BackEndObjects.RFQProductServiceDetails.getAllProductServiceDetailsbyRFQIdDB(icObj.getParentContextValue());

                    counter = 0;
                    for (int i = 0; i < rfqSpecList.Count; i++)
                    {
                        BackEndObjects.RFQProductServiceDetails rfqObj = (RFQProductServiceDetails)rfqSpecList[i];
                        if (rfqObj.getPrdCatId().Equals(prodCatId) && rfqObj.getFeatId().Equals(featId))
                        {
                            serverPath = rfqObj.getImgPath();
                            //dt.Rows.Add();
                            //dt.Rows[counter]["img"] = serverPath;
                            contentType = getMimeType(serverPath);
                            counter++;
                        }
                    }
                }
                if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_NDA_FOR_PARENT_RFQ))
                {
                    serverPath = BackEndObjects.RFQDetails.getRFQDetailsbyIdDB(icObj.getParentContextValue()).getNDADocPath();
                    //dt.Rows.Add();
                    //dt.Rows[0]["img"] = serverPath;
                    contentType = getMimeType(serverPath);
                }
                break;

            case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_RFQ_RESPONSE:

                if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_NDA_FOR_PARENT_RFQ_RESPONSE))
                {
                    serverPath = BackEndObjects.RFQResponse.
                                 getRFQResponseforRFQIdandResponseEntityIdDB
                                     (icObj.getParentContextValue(),
                                     (icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_RFQ_RESPONSE_RESPONSE_ENTITY_ID]).ToString()).getNdaPath();
                    contentType = getMimeType(serverPath);
                    //dt.Rows.Add();
                    //dt.Rows[0]["img"] = serverPath;
                }

                break;

            case ActionLibrary.ImageContextFactory.PARENT_CONTEXT_PRODUCT:

                if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_FEAT_FOR_PARENT_PRODUCT))
                {
                    String prodName = icObj.getParentContextValue();
                    String entId    = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_PROD_ENT_ID];
                    String featId   = icObj.getChildContextObjects()[ActionLibrary.ImageContextFactory.CHILD_CONTEXT_PROD_FEAT_ID];

                    ShopChildProdsSpecs specObj = (ShopChildProdsSpecs)ShopChildProdsSpecs.
                                                  getShopChildProdsSpecObjbyEntIdandProdNameDB(entId, prodName)[featId];

                    serverPath  = specObj.getImgPath();
                    contentType = getMimeType(serverPath);
                }
                break;

            case ActionLibrary.ImageContextFactory.PARENET_CONTEXT_DEFECT:

                if (icObj.getDestinationContextName().Equals(ActionLibrary.ImageContextFactory.DESTINATION_CONTEXT_DOC_FOR_PARENT_DEFECT))
                {
                    String defectId = icObj.getParentContextValue();
                    BackEndObjects.DefectDetails defObj = BackEndObjects.DefectDetails.getDefectDetailsbyidDB(defectId);
                    serverPath  = defObj.getDocPath();
                    contentType = getMimeType(serverPath);
                }
                break;
            }

            pathAndContent.Add(SERVER_PATH, serverPath);
            pathAndContent.Add(CONTENT_TYPE, contentType);

            return(pathAndContent);
        }