protected void btnSendEnquiry_Click(object sender, EventArgs e) { WorkFlow objWorkFlow = new WorkFlow(); objWorkFlow.WFID = Convert.ToInt32(Request.QueryString["WFID"]); DataTable dt1 = objWorkFlow.GetWFById(); objWorkFlow.Parent_WFID = Convert.ToInt32(dt1.Rows[0]["Parent_WFID"]); objWorkFlow.WF_Status = "Enquiry For Techno Commercial Negotiation Completed"; objWorkFlow.Project = dt1.Rows[0]["Project"].ToString().Substring(0, 6); //int res = objWorkFlow.UpdateEnquiryRaised(); int res = objWorkFlow.UpdateTechnoCommercialNegotiationCompleted(); objWorkFlow.UpdateWF_StatusInBAANTable();// Dump Preorder Data TO BAAN table change 25/08/2018 sagar if (res > 0) { InsertPreHistory(Convert.ToInt32(Request.QueryString["WFID"]), "Enquiry For Techno Commercial Negotiation Completed"); } #region ERP Transaction Update for Control Tower //if (Request.QueryString["Status"] == "Enquiry Raised" || Request.QueryString["Status"] == "Technical offer Received") // { objWorkFlow.TransactionDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; objWorkFlow.IndexValue = (Request.QueryString["WFID"]).ToString(); int SerialNoCount = objWorkFlow.GetSerialNumber(); SerialNoCount++; objWorkFlow.SLNO_WFID = SerialNoCount; string[] Project = txtProject.Text.Split('-'); objWorkFlow.Project = Project[0]; string[] Element = txtElement.Text.Split('-'); objWorkFlow.Element = Element[0]; objWorkFlow.UserId = Request.QueryString["u"]; int nRecordInserted = objWorkFlow.InsertPreOrderDatatoControlTower(); if (nRecordInserted > 0) { // for each PMDL doc insert a new record ( Sagar new change 11-July-2018) // 2 ways- comma seperated substring or select PMDLDoc for given WFID from WF1_PreOrderPMDL table //and loop through each PMDL doc. int DetailSerialNoCount = 0; DataTable dtPMDL = objWorkFlow.GetMultiPMDL(hdfParentWFID.Value); if (dtPMDL.Rows.Count > 0) { foreach (DataRow dr in dtPMDL.Rows) { DetailSerialNoCount = objWorkFlow.GetDetailSerialNumber(); DetailSerialNoCount++; objWorkFlow.DetailSerialCount = DetailSerialNoCount; objWorkFlow.PMDLdocDesc = dr["PMDLDocNo"].ToString(); DataTable dt = objWorkFlow.GetPartItemCount_Weight(); if (dt.Rows.Count > 0) { if (dt.Rows[0]["PartItemCount"].ToString() != "") { objWorkFlow.PartItemCount = (int)dt.Rows[0]["PartItemCount"]; } else { objWorkFlow.PartItemCount = 0; } if (dt.Rows[0]["PartItenWeight"].ToString() != "") { objWorkFlow.PartItemWeight = (double)dt.Rows[0]["PartItenWeight"]; } else { objWorkFlow.PartItemWeight = 0; } } else { objWorkFlow.PartItemCount = 0; objWorkFlow.PartItemWeight = 0; } objWorkFlow.InsertPreOrderDatatoControlTowerChildTable(); //if (Request.QueryString["Status"] == "Technical offer Received") //{ double nTechnoComNegotiationrawingCount = 0; double nTotalDrawingCount = 0; double nTotalChildRecordCount = 0; double nTechnoCommNegotiationWeight = 0; double nTotalWeight = 0; double nQualifiedforTechnoCommercial = 0; double nTechnoCommercialChildRecordCount = 0; string PMDLDocs = ""; string PMDLDocuments = ""; string PMDLDocNo = ""; double percentageTechnoCommercial_byCount; double percentageTechnoCommercial_byWeight; DataTable dataTable1 = objWorkFlow.GetTechnoCommercialItemReference(); objWorkFlow.ItemReference = (string)dataTable1.Rows[0]["t_iref"]; string Itemref_Typ = objWorkFlow.GetItemRefType(); if (dataTable1.Rows[0]["TechnoCommercialDate"].ToString() == "01-01-1970" || dataTable1.Rows[0]["TechnoCommercialDate"].ToString() == "01-01-1900") { string CurrentDate = DateTime.Now.ToString("yyyy-MM-dd"); // objWorkFlow.UpdateTechnoCommercialDate(CurrentDate); objWorkFlow.UpdateTechnoCommercialNegotiationDate(CurrentDate); } DataTable dtPMDLDoc = objWorkFlow.GetPMDLFromItemRef(); if (dtPMDLDoc.Rows.Count > 0) { for (int i = 0; i < dtPMDLDoc.Rows.Count; i++) { if (i == 0) { PMDLDocs = "'" + dtPMDLDoc.Rows[0]["t_docn"].ToString() + "'"; } else { PMDLDocs += ",'" + dtPMDLDoc.Rows[i]["t_docn"].ToString() + "'"; } } } DataTable dtPMDLDocForTechnoCommNegotiation = objWorkFlow.GetPMDLDocForTechnoCommNegotiation(); if (dtPMDLDocForTechnoCommNegotiation.Rows.Count > 0) { for (int i = 0; i < dtPMDLDocForTechnoCommNegotiation.Rows.Count; i++) { if (i == 0) { PMDLDocuments = "'" + dtPMDLDocForTechnoCommNegotiation.Rows[0]["t_docn"].ToString() + "'"; } else { PMDLDocuments += ",'" + dtPMDLDocForTechnoCommNegotiation.Rows[i]["t_docn"].ToString() + "'"; } } } int nWFID = objWorkFlow.WFID; objWorkFlow.WFID = objWorkFlow.Parent_WFID; DataTable dtStatus = objWorkFlow.GetWFById(); string sCurrentWFID_Status = dtStatus.Rows[0]["WF_Status"].ToString(); DataTable dtPMDLbyWFID = objWorkFlow.GetPMDLbyWFID(); objWorkFlow.WFID = nWFID; if (dtPMDLbyWFID.Rows.Count > 0) { for (int i = 0; i < dtPMDLbyWFID.Rows.Count; i++) { if (i == 0) { PMDLDocNo = "'" + dtPMDLbyWFID.Rows[0]["PMDLDocNo"].ToString() + "'"; } else { PMDLDocNo += ",'" + dtPMDLbyWFID.Rows[i]["PMDLDocNo"].ToString() + "'"; } } } nTechnoCommNegotiationWeight = objWorkFlow.GetTotalWeight(PMDLDocNo); nTotalWeight = objWorkFlow.GetTotalWeight(); nTechnoComNegotiationrawingCount += objWorkFlow.GetTechnoComNegotiationrawingCount(PMDLDocNo); nTotalDrawingCount = objWorkFlow.GeTotalDrawingCount(); // nQualifiedforTechnoCommercial += objWorkFlow.GetQualifiedforTechnoCommercialCount(); if (sCurrentWFID_Status == "All Offer Received") { nTotalChildRecordCount = objWorkFlow.GetTotalChildRecordCount_AllOfferReceived(PMDLDocNo); } else { nTotalChildRecordCount = objWorkFlow.GetTotalChildRecordCount(PMDLDocNo); } //3 nTechnoCommercialChildRecordCount += objWorkFlow.GetTechnoCommercialChildRecordCount(PMDLDocs); //4 //objWorkFlow.UpdateTechnoCommercialCount(nTechnoCommercialChildRecordCount); double Technicalvettingpercentage = objWorkFlow.GetTechnicalvettingpercentage(); if (nTotalChildRecordCount != 0 && nTotalDrawingCount != 0) { percentageTechnoCommercial_byCount = Math.Round((nTechnoCommercialChildRecordCount / nTotalChildRecordCount) * (nTechnoComNegotiationrawingCount / nTotalDrawingCount) * 100, 2); } else { percentageTechnoCommercial_byCount = 0; } //percentageTechnoCommercial_byWeight if (nTotalWeight != 0 && nTotalDrawingCount != 0) { // percentageTechnoCommercial_byWeight = Math.Round((nTechnoCommNegotiationWeight / nTotalWeight) * (nTechnoComNegotiationrawingCount / nTotalDrawingCount)*100, 2); percentageTechnoCommercial_byWeight = Math.Round((nTechnoCommNegotiationWeight / nTotalWeight) * (nTechnoCommercialChildRecordCount / nTotalChildRecordCount) * 100, 2); } else { percentageTechnoCommercial_byWeight = 0; } objWorkFlow.InsertIntoItemReferencewiseProgressTable(percentageTechnoCommercial_byWeight, percentageTechnoCommercial_byCount); //DataTable dtPercentage = objWorkFlow.GetTechnoComNegotiationPercentagebyCount_Weight(); DataTable dtPercentage = new DataTable(); if (sCurrentWFID_Status == "All Offer Received") { dtPercentage = objWorkFlow.GetPercentagebyCount_Weight_AllOfferReceievd(); } else { dtPercentage = objWorkFlow.GetPercentagebyCount_Weight(); } double percentage_byCount = 0; double percentage_byWeight = 0; if (dtPercentage.Rows.Count > 0) { foreach (DataRow dr2 in dtPercentage.Rows) { objWorkFlow.Project = dr2["Project"].ToString(); objWorkFlow.ItemReference = dr2["ItemReference"].ToString(); //double percentage_byCount = Convert.ToDouble(dr2["CountPercentage"]); //double percentage_byWeight = Convert.ToDouble(dr2["WeightPercentage"]); percentage_byCount += Convert.ToDouble(dr2["CountPercentage"]); percentage_byWeight += Convert.ToDouble(dr2["WeightPercentage"]); } } if (percentage_byCount < 100.00 && percentage_byWeight < 100.00) { if ((percentage_byCount >= percentage_byWeight)) { //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } else { if (Itemref_Typ == "4") // when item reference typ=="Self Engineered" { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byWeight); } else { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } } } else { if (percentage_byCount >= 100) { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); } else { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } } // } //} //if (percentageTechnoCommercial_byCount>= 100.00 || percentageTechnoCommercial_byWeight>=100.00) //{ // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); //} //else if ((percentageTechnoCommercial_byCount >= percentageTechnoCommercial_byWeight)) //{ // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentageTechnoCommercial_byCount); //} //else //{ // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentageTechnoCommercial_byWeight); //} // objWorkFlow.UpdateTechnoCommercialpercentage(percentageTechnoCommercial_byCount); DateTime MinTechnoCommecrialDate = objWorkFlow.GetMinTechnoCommecrialDate(); if (MinTechnoCommecrialDate != default(DateTime)) { string OfferReceieveDate = MinTechnoCommecrialDate.ToString("yyyy-MM-dd hh:mm:ss"); // objWorkFlow.UpdateTechnoCommercialDate(OfferReceieveDate); } } } else { Response.Redirect("RaisedEnquiry.aspx?u=" + Request.QueryString["u"] + "&WFPID=" + hdfParentWFID.Value); } #endregion //if (Request.QueryString["Status"] == "Enquiry Raised") //{ // Response.Redirect("EnquiryInProcess.aspx?u=" + Request.QueryString["u"]); //} //if (Request.QueryString["Status"] == "Technical offer Received" || Request.QueryString["Status"] == "Commercial offer Received") //{ // Response.Redirect("RaisedEnquiry.aspx?u=" + Request.QueryString["u"] + "&WFPID=" + Request.QueryString["WFPID"]); //} //if (Request.QueryString["Status"] == "Isgec Comment Submitted") //{ // Response.Redirect("ReleaseComments.aspx?u=" + Request.QueryString["u"]); //} // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('" + Request.QueryString["Status"] + "');", true); } Response.Redirect("RaisedEnquiry.aspx?u=" + Request.QueryString["u"] + "&WFPID=" + hdfParentWFID.Value); }
//protected void OnRowCommand(object sender, GridViewCommandEventArgs e) //{ // //Get the Command Name. // string commandName = e.CommandName; // //Get the Row Index. // int rowIndex = Convert.ToInt32(e.CommandArgument); // //Get the Row reference in which Button was clicked. // GridViewRow row = gvData.Rows[rowIndex]; //} protected void btnClosed_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; objWorkFlow = new WorkFlow(); objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); objWorkFlow.UserId = Request.QueryString["u"]; objWorkFlow.WF_Status = "Commercial offer Finalized"; string PMDLDocNo = ""; int res = objWorkFlow.UpdateWF_Status(); objWorkFlow.UpdateWF_StatusInBAANTable(); // Dump Preorder Data TO BAAN table change 25/08/2018 sagar if (res > 0) { InsertPreHistory(Convert.ToInt32(btn.CommandArgument), "Commercial offer Finalized"); GetData(); // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Commercial offer Finalized');", true); GridViewRow row = (btn.NamingContainer as GridViewRow); //Get the Row Index. int rowIndex = row.RowIndex; Label lProject = row.FindControl("Project") as Label; Label lElement = row.FindControl("Element") as Label; Label lPMDLDoc = row.FindControl("PMDLDocNo") as Label; string Project = ""; string Element = ""; string PMDLDoc = ""; double percentageTechOfferReceivedDrawing_byWeight = 0; double percentageTechOfferReceivedDrawing_byCount = 0; if (lProject != null) { Project = lProject.Text; } else { Project = ""; } if (lElement != null) { Element = lElement.Text; } else { Element = ""; } if (lPMDLDoc != null) { PMDLDoc = lPMDLDoc.Text; } else { PMDLDoc = ""; } // Convert.ToString(gvData.DataKeys[rowIndex].Values[2] // string Project = (gvData.Rows[rowIndex].Cells[2].Text).ToString(); //string Element = (gvData.Rows[rowIndex].Cells[3].Text).ToString(); //string PMDLDoc =(gvData.Rows[rowIndex].Cells[5].Text).ToString(); #region ERP Transaction Update for Control Tower // Change - 26 June 2018 -- ERP Transaction Update for Control Tower // Insert data into ttpisg229200 objWorkFlow.TransactionDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; objWorkFlow.IndexValue = objWorkFlow.WFID.ToString(); //(Request.QueryString["WFID"]).ToString(); int SerialNoCount = objWorkFlow.GetSerialNumber(); SerialNoCount++; objWorkFlow.SLNO_WFID = SerialNoCount; string[] sProject = Project.Split('-'); objWorkFlow.Project = sProject[0]; string[] sElement = Element.Split('-'); objWorkFlow.Element = sElement[0]; objWorkFlow.UserId = Request.QueryString["u"]; int nRecordInserted = objWorkFlow.InsertPreOrderDatatoControlTower(); if (nRecordInserted > 0) { objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); DataTable dt2 = objWorkFlow.GetWFById(); //objWorkFlow.Parent_WFID = Convert.ToInt32(dt2.Rows[0]["Parent_WFID"]); DataTable dtPMDL1 = objWorkFlow.GetMultiPMDL(objWorkFlow.WFID.ToString()); if (dtPMDL1.Rows.Count > 0) { foreach (DataRow dr2 in dtPMDL1.Rows) { long DetailSerialNoCount = objWorkFlow.GetDetailSerialNumber(); DetailSerialNoCount++; objWorkFlow.DetailSerialCount = DetailSerialNoCount; objWorkFlow.PMDLdocDesc = dr2["PMDLDocNo"].ToString(); //PMDLDoc.ToString(); DataTable dt = objWorkFlow.GetPartItemCount_Weight(); if (dt.Rows.Count > 0) { if (dt.Rows[0]["PartItemCount"].ToString() != "") { objWorkFlow.PartItemCount = (int)dt.Rows[0]["PartItemCount"]; } else { objWorkFlow.PartItemCount = 0; } if (dt.Rows[0]["PartItenWeight"].ToString() != "") { objWorkFlow.PartItemWeight = (double)dt.Rows[0]["PartItenWeight"]; } else { objWorkFlow.PartItemWeight = 0; } } else { objWorkFlow.PartItemCount = 0; objWorkFlow.PartItemWeight = 0; } objWorkFlow.InsertPreOrderDatatoControlTowerChildTable(); } } DataTable dtPMDL = objWorkFlow.GetMultiPMDL(Convert.ToInt32(btn.CommandArgument).ToString()); if (dtPMDL.Rows.Count > 0) { foreach (DataRow dr in dtPMDL.Rows) { objWorkFlow.PMDLdocDesc = dr["PMDLDocNo"].ToString(); DataTable dataTable = objWorkFlow.GetRaisedEnquiryDate(); objWorkFlow.ItemReference = (string)dataTable.Rows[0]["t_iref"]; // objWorkFlow.UpdateTechCommercialNegotiaitionpercentage();// Change in the logic date-14-09-2018 sagar objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); DataTable dtPMDLbyWFID = objWorkFlow.GetPMDLbyWFID(); if (dtPMDLbyWFID.Rows.Count > 0) { for (int i = 0; i < dtPMDLbyWFID.Rows.Count; i++) { if (i == 0) { PMDLDocNo = "'" + dtPMDLbyWFID.Rows[0]["PMDLDocNo"].ToString() + "'"; } else { PMDLDocNo += ",'" + dtPMDLbyWFID.Rows[i]["PMDLDocNo"].ToString() + "'"; } } } double nTechnoComNegotiationrawingCount = objWorkFlow.GetTechnoComNegotiationrawingCount(PMDLDocNo); // double nTotalDrawingCount = objWorkFlow.GeTotalDrawingCount(); double nTotalDrawingCount = objWorkFlow.TechnoComNegotiation_ChildRecordCount(PMDLDocNo); double nTechnoComNegotiationDrawing_Weight = objWorkFlow.GetTechnoComNegotiationWeight(PMDLDocNo); double nTotalTechnoComNegotiation_Weight = objWorkFlow.GetTotalWeight(); if (nTotalDrawingCount != 0) { percentageTechOfferReceivedDrawing_byCount = Math.Round((nTechnoComNegotiationrawingCount / nTotalDrawingCount) * 100, 4); } if (nTotalTechnoComNegotiation_Weight != 0) { percentageTechOfferReceivedDrawing_byWeight = Math.Round((nTechnoComNegotiationDrawing_Weight / nTotalTechnoComNegotiation_Weight) * 100, 4); } objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; objWorkFlow.WF_Status = "Commercial offer Finalized"; objWorkFlow.Parent_WFID = objWorkFlow.WFID; objWorkFlow.InsertIntoItemReferencewiseProgressTable(percentageTechOfferReceivedDrawing_byWeight, percentageTechOfferReceivedDrawing_byCount); //DataTable dtPercentage = objWorkFlow.GetTechnoComNegotiationPercentagebyCount_Weight(); DataTable dtPercentage1 = objWorkFlow.GetPercentagebyCount_Weight(); objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; objWorkFlow.WF_Status = "Commercial offer Finalized"; objWorkFlow.Parent_WFID = objWorkFlow.WFID; objWorkFlow.InsertIntoItemReferencewiseProgressTable(percentageTechOfferReceivedDrawing_byWeight, percentageTechOfferReceivedDrawing_byCount); //DataTable dtPercentage = objWorkFlow.GetTechnoComNegotiationPercentagebyCount_Weight(); DataTable dtPercentage2 = objWorkFlow.GetPercentagebyCount_Weight(); double percentage_byCount_ComFinalized = 0; double percentage_byWeight_ComFinalized = 0; double percentage_byCount_OfferReceieved = 0; double percentage_byWeight_OfferReceieved = 0; string Itemref_Typ = objWorkFlow.GetItemRefType(); if (dtPercentage1.Rows.Count > 0) { foreach (DataRow dr1 in dtPercentage1.Rows) { objWorkFlow.Project = dr1["Project"].ToString(); objWorkFlow.ItemReference = dr1["ItemReference"].ToString(); //double percentage_byCount = Convert.ToDouble(dr1["CountPercentage"]); //double percentage_byWeight = Convert.ToDouble(dr1["WeightPercentage"]); percentage_byCount_ComFinalized += Convert.ToDouble(dr1["CountPercentage"]); percentage_byWeight_ComFinalized += Convert.ToDouble(dr1["WeightPercentage"]); } } if (dtPercentage2.Rows.Count > 0) { foreach (DataRow dr2 in dtPercentage2.Rows) { objWorkFlow.Project = dr2["Project"].ToString(); objWorkFlow.ItemReference = dr2["ItemReference"].ToString(); //double percentage_byCount = Convert.ToDouble(dr1["CountPercentage"]); //double percentage_byWeight = Convert.ToDouble(dr1["WeightPercentage"]); percentage_byCount_OfferReceieved += Convert.ToDouble(dr2["CountPercentage"]); percentage_byWeight_OfferReceieved += Convert.ToDouble(dr2["WeightPercentage"]); } } // since it is now being globally updated now commenting out local update. if (percentage_byCount_OfferReceieved < 100.00 && percentage_byWeight_ComFinalized < 100.00) { if ((percentage_byCount_OfferReceieved >= percentage_byWeight_OfferReceieved)) { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_OfferReceieved); } else { if (Itemref_Typ == "4")// when item reference typ=="Self Engineered" { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byWeight_OfferReceieved); } else { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_OfferReceieved); } } } else { if (percentage_byCount_OfferReceieved >= 100) { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); } else { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_OfferReceieved); } } if (percentage_byCount_ComFinalized < 100.00 && percentage_byWeight_ComFinalized < 100.00) { if ((percentage_byCount_ComFinalized >= percentage_byWeight_ComFinalized)) { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_ComFinalized); } else { if (Itemref_Typ == "4")// when item reference typ=="Self Engineered" { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byWeight_ComFinalized); } else { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_ComFinalized); } } } else { if (percentage_byCount_ComFinalized >= 100) { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); } else { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_ComFinalized); } } // } //objWorkFlow.UpdateTechnicalClearancepercentage(); // } } } else { } #endregion } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Some technical issue');", true); } } }
protected void btnSendEnquiry_Click(object sender, EventArgs e) { string RandomNo = string.Empty; WorkFlow objWorkFlow = new WorkFlow(); if (hdfRandomNo.Value == "") { RandomNo = GetRandomAlphanumericString(8); } if (txtSupplierEmail.Text != "") { string MailTo = string.Empty; if (ddlSupplier.SelectedValue != "Select") { objWorkFlow.SupplierCode = ddlSupplier.SelectedValue; } else { objWorkFlow.SupplierCode = ""; } objWorkFlow.SupplierName = txtSupplier.Text; objWorkFlow.WFID = Convert.ToInt32(Request.QueryString["WFID"]); objWorkFlow.Parent_WFID = Convert.ToInt32(Request.QueryString["WFPID"]); objWorkFlow.WF_Status = Request.QueryString["Status"]; objWorkFlow.UserId = Request.QueryString["u"]; objWorkFlow.Supplier = txtSupplierEmail.Text.Trim(); objWorkFlow.EmailSubject = txtEmailSub.Text.Trim(); objWorkFlow.RandomNo = RandomNo != "" ? RandomNo : hdfRandomNo.Value; int res = objWorkFlow.UpdateEnquiryRaised(); // objWorkFlow.UpdateWF_StatusInBAANTable(); // Dump Preorder Data TO BAAN table change 25/08/2018 sagar if (res > 0) { string IndexValue = InsertPreHistory(Convert.ToInt32(Request.QueryString["WFID"]), Request.QueryString["Status"]); // UploadAttachments(IndexValue); if (Request.QueryString["Status"] == "Enquiry Raised") { MailTo = txtSupplierEmail.Text.Trim(); SendMail(MailTo, RandomNo, objWorkFlow.EmailSubject); string url = "http://192.9.200.146/webtools2/CreateExternalUser.aspx?LoginID=" + RandomNo + "&Password="******"&UserName="******"&EMailID=" + txtSupplierEmail.Text.Trim(); HttpWebRequest rq = (HttpWebRequest)WebRequest.Create(new Uri(url)); rq.Method = "GET"; rq.ContentType = "application/json"; WebResponse rs = rq.GetResponse(); System.IO.Stream st = rs.GetResponseStream(); System.IO.StreamReader sr = new System.IO.StreamReader(st); String strResponse = sr.ReadToEnd(); sr.Close(); } GetData(); // Change - 26 June 2018 -- ERP Transaction Update for Control Tower // Insert data into ttpisg229200 #region ERP Transaction Update for Control Tower if (Request.QueryString["Status"] == "Enquiry Raised" || Request.QueryString["Status"] == "Technical offer Received") { objWorkFlow.TransactionDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (Request.QueryString["Status"] == "Technical offer Received") { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; } else { objWorkFlow.BusinessObjectHandle = "CT_RFQRAISED"; } objWorkFlow.IndexValue = (Request.QueryString["WFID"]).ToString(); int SerialNoCount = objWorkFlow.GetSerialNumber(); SerialNoCount++; objWorkFlow.SLNO_WFID = SerialNoCount; string[] Project = txtProject.Text.Split('-'); objWorkFlow.Project = Project[0]; string[] Element = txtElement.Text.Split('-'); objWorkFlow.Element = Element[0]; objWorkFlow.UserId = Request.QueryString["u"]; int nRecordInserted = objWorkFlow.InsertPreOrderDatatoControlTower(); if (nRecordInserted > 0) { // for each PMDL doc insert a new record ( Sagar new change 11-July-2018) // 2 ways- comma seperated substring or select PMDLDoc for given WFID from WF1_PreOrderPMDL table //and loop through each PMDL doc. int DetailSerialNoCount = 0; DataTable dtPMDL = objWorkFlow.GetMultiPMDL(hdfParentWFID.Value); if (dtPMDL.Rows.Count > 0) { foreach (DataRow dr in dtPMDL.Rows) { DetailSerialNoCount = objWorkFlow.GetDetailSerialNumber(); DetailSerialNoCount++; objWorkFlow.DetailSerialCount = DetailSerialNoCount; objWorkFlow.PMDLdocDesc = dr["PMDLDocNo"].ToString(); DataTable dt = objWorkFlow.GetPartItemCount_Weight(); if (dt.Rows.Count > 0) { if (dt.Rows[0]["PartItemCount"].ToString() != "") { objWorkFlow.PartItemCount = (int)dt.Rows[0]["PartItemCount"]; } else { objWorkFlow.PartItemCount = 0; } if (dt.Rows[0]["PartItenWeight"].ToString() != "") { objWorkFlow.PartItemWeight = (double)dt.Rows[0]["PartItenWeight"]; } else { objWorkFlow.PartItemWeight = 0; } } else { objWorkFlow.PartItemCount = 0; objWorkFlow.PartItemWeight = 0; } objWorkFlow.InsertPreOrderDatatoControlTowerChildTable(); } } } } if (Request.QueryString["Status"] == "Enquiry Raised") { Response.Redirect("EnquiryInProcess.aspx?u=" + Request.QueryString["u"]); } // old one if (Request.QueryString["Status"] == "Technical offer Received" || Request.QueryString["Status"] == "Commercial offer Received" || Request.QueryString["Status"] == "Enquiry For Techno Commercial Negotiation Completed") { Response.Redirect("RaisedEnquiry.aspx?u=" + Request.QueryString["u"] + "&WFPID=" + Request.QueryString["WFPID"]); } //if (Request.QueryString["Status"] == "Technical offer Received") //{ // Response.Redirect("TechnoCommercialNegotiaition.aspx?u=" + Request.QueryString["u"] + "&WFID=" + Request.QueryString["WFID"]); //} if (Request.QueryString["Status"] == "Commercial offer Received") { Response.Redirect("RaisedEnquiry.aspx?u=" + Request.QueryString["u"] + "&WFPID=" + Request.QueryString["WFPID"]); } if (Request.QueryString["Status"] == "Isgec Comment Submitted") { Response.Redirect("ReleaseComments.aspx?u=" + Request.QueryString["u"]); } // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('" + Request.QueryString["Status"] + "');", true); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Please Fill All information');", true); } } // //send mail }
//protected void OnRowCommand(object sender, GridViewCommandEventArgs e) //{ // //Get the Command Name. // string commandName = e.CommandName; // //Get the Row Index. // int rowIndex = Convert.ToInt32(e.CommandArgument); // //Get the Row reference in which Button was clicked. // GridViewRow row = gvData.Rows[rowIndex]; //} protected void btnClosed_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; objWorkFlow = new WorkFlow(); objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); objWorkFlow.UserId = Request.QueryString["u"]; objWorkFlow.WF_Status = "Commercial offer Finalized"; string PMDLDocNo = ""; int res = objWorkFlow.UpdateWF_Status(); // objWorkFlow.UpdateWF_StatusInBAANTable(); // Dump Preorder Data TO BAAN table change 25/08/2018 sagar if (res > 0) { InsertPreHistory(Convert.ToInt32(btn.CommandArgument), "Commercial offer Finalized"); GetData(); // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Commercial offer Finalized');", true); GridViewRow row = (btn.NamingContainer as GridViewRow); //Get the Row Index. int rowIndex = row.RowIndex; Label lProject = row.FindControl("Project") as Label; Label lElement = row.FindControl("Element") as Label; Label lPMDLDoc = row.FindControl("PMDLDocNo") as Label; string Project = ""; string Element = ""; string PMDLDoc = ""; double percentageTechOfferReceivedDrawing_byWeight = 0; double percentageTechOfferReceivedDrawing_byCount = 0; if (lProject != null) { Project = lProject.Text; } else { Project = ""; } if (lElement != null) { Element = lElement.Text; } else { Element = ""; } if (lPMDLDoc != null) { PMDLDoc = lPMDLDoc.Text; } else { PMDLDoc = ""; } // Convert.ToString(gvData.DataKeys[rowIndex].Values[2] // string Project = (gvData.Rows[rowIndex].Cells[2].Text).ToString(); //string Element = (gvData.Rows[rowIndex].Cells[3].Text).ToString(); //string PMDLDoc =(gvData.Rows[rowIndex].Cells[5].Text).ToString(); #region ERP Transaction Update for Control Tower // Change - 26 June 2018 -- ERP Transaction Update for Control Tower // Insert data into ttpisg229200 objWorkFlow.TransactionDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; objWorkFlow.IndexValue = objWorkFlow.WFID.ToString(); //(Request.QueryString["WFID"]).ToString(); int SerialNoCount = objWorkFlow.GetSerialNumber(); SerialNoCount++; objWorkFlow.SLNO_WFID = SerialNoCount; string[] sProject = Project.Split('-'); objWorkFlow.Project = sProject[0]; string[] sElement = Element.Split('-'); objWorkFlow.Element = sElement[0]; objWorkFlow.UserId = Request.QueryString["u"]; int nRecordInserted = objWorkFlow.InsertPreOrderDatatoControlTower(); if (nRecordInserted > 0) { objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); DataTable dt2 = objWorkFlow.GetWFById(); //objWorkFlow.Parent_WFID = Convert.ToInt32(dt2.Rows[0]["Parent_WFID"]); DataTable dtPMDL = objWorkFlow.GetMultiPMDL(objWorkFlow.WFID.ToString()); if (dtPMDL.Rows.Count > 0) { foreach (DataRow dr1 in dtPMDL.Rows) { long DetailSerialNoCount = objWorkFlow.GetDetailSerialNumber(); DetailSerialNoCount++; objWorkFlow.DetailSerialCount = DetailSerialNoCount; objWorkFlow.PMDLdocDesc = dr1["PMDLDocNo"].ToString(); //PMDLDoc.ToString(); DataTable dt = objWorkFlow.GetPartItemCount_Weight(); if (dt.Rows.Count > 0) { if (dt.Rows[0]["PartItemCount"].ToString() != "") { objWorkFlow.PartItemCount = (int)dt.Rows[0]["PartItemCount"]; } else { objWorkFlow.PartItemCount = 0; } if (dt.Rows[0]["PartItenWeight"].ToString() != "") { objWorkFlow.PartItemWeight = (double)dt.Rows[0]["PartItenWeight"]; } else { objWorkFlow.PartItemWeight = 0; } } else { objWorkFlow.PartItemCount = 0; objWorkFlow.PartItemWeight = 0; } objWorkFlow.InsertPreOrderDatatoControlTowerChildTable(); } } } } }