protected void gvUserType_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { if (ViewState["SORTBYCOLOUMN"] != null) { HtmlImage img = (HtmlImage)e.Row.FindControl(ViewState["SORTBYCOLOUMN"].ToString()); if (img != null) { if (ViewState["SORTDIRECTION"] == null || ViewState["SORTDIRECTION"].ToString() == "0") { img.Src = "~/purchase/Image/arrowUp.png"; } else { img.Src = "~/purchase/Image/arrowDown.png"; } img.Visible = true; } } MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.backgroundColor='#FEECEC';"; e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';this.style.color='black';this.style.backgroundColor=''"; } }
protected void gvInvoice_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { Label lblUSD_Amount = (Label)e.Row.FindControl("lblUSD_Amount"); double qty = Convert.ToDouble(lblUSD_Amount.Text); Label lblDispute = (Label)e.Row.FindControl("lblDispute_Flag"); intotal = intotal + qty; if (DataBinder.Eval(e.Row.DataItem, "Dispute_Flag").ToString() == "YES") { e.Row.Cells[13].BackColor = System.Drawing.Color.Red; lblDispute.ForeColor = System.Drawing.Color.White; } } if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[9].Text = "Total: "; e.Row.Cells[10].Text = intotal.ToString();; } }
protected void gvPurchase_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { TotPOUSDValue += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "PO_USD_Value")); TotInvUSDAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Invoice_USD_Amount")); TotPaidUSDAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Paid_USD_Amount")); TotOutPOCurAmt += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "OutStanding_USD_Amount")); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblTotPOUSDValue = (Label)e.Row.FindControl("lblTotPOUSDValue"); Label lblTotInvUSDAmt = (Label)e.Row.FindControl("lblTotInvUSDAmt"); Label lblTotPaidUSDAmt = (Label)e.Row.FindControl("lblTotPaidUSDAmt"); Label lblTotOutPOCurAmt = (Label)e.Row.FindControl("lblTotOutPOCurAmt"); Label lblTotOutPOCurAmt1 = (Label)e.Row.FindControl("lblTotOutPOCurAmt1"); Label lblTotPOUSDValue1 = (Label)e.Row.FindControl("lblTotPOUSDValue1"); Label lblTotInvUSDAmt1 = (Label)e.Row.FindControl("lblTotInvUSDAmt1"); Label lblTotPaidUSDAmt1 = (Label)e.Row.FindControl("lblTotPaidUSDAmt1"); lblTotPOUSDValue.Text = TotPOUSDValue.ToString(); lblTotInvUSDAmt.Text = TotInvUSDAmt.ToString(); lblTotPaidUSDAmt.Text = TotPaidUSDAmt.ToString(); lblTotOutPOCurAmt.Text = TotOutPOCurAmt.ToString(); lblTotOutPOCurAmt1.Text = TotOutPOCurAmt.ToString(); lblTotPOUSDValue1.Text = TotPOUSDValue.ToString(); lblTotInvUSDAmt1.Text = TotInvUSDAmt.ToString(); lblTotPaidUSDAmt1.Text = TotOutPOCurAmt.ToString(); } }
protected void gvLimit_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } }
protected void rgdQuatationInfo_ItemCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objItemColumn); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } }
protected void gvWelfareDetails_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objItemColumn); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } }
protected void gvOrtg_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(mergeheadgvOrtg); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } }
//protected void gvEvaluation_RowCommand(object sender, GridViewCommandEventArgs e) //{ // if (e.CommandName == "Select") // { // string[] arg = e.CommandArgument.ToString().Split(','); // Session["EvalID"] = UDFLib.ConvertToInteger(arg[1]); // Session["Supp_ID"] = UDFLib.ConvertToInteger(arg[0]); // string EvalID = UDFLib.ConvertStringToNull(arg[1]); // string Supp_ID = UDFLib.ConvertStringToNull(arg[0]); // string Type = "1"; // ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('../ASL/ASL_General_Data.aspx?Supp_ID=" + Supp_ID + "&Type=" + Type + "&EvalID=" + EvalID + "', '_blank');", true); // } //} //protected void gvChangeRequest_RowCommand(object sender, GridViewCommandEventArgs e) //{ // if (e.CommandName == "Select") // { // string[] arg = e.CommandArgument.ToString().Split(','); // Session["Supplier_Code"] = UDFLib.ConvertToInteger(arg[0]); // string Supplier_Code = UDFLib.ConvertStringToNull(arg[0]); // string Type = "0"; // ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('../ASL/ASL_General_Data.aspx?Supp_ID=" + Supplier_Code + "&Type=" + Type + "', '_blank');", true); // } //} protected void gvSupplier_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objContractList); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "HeaderStyle-css-2"; } }
protected void gvVictuallingRate_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objVicRate); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "HeaderStyle-css"; } }
protected void gvApprovalHistory_RowCreated(object sender, GridViewRowEventArgs e) //call the method for custom rendering the columns headers on row created event { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objApprovalHist); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "HeaderStyle-css"; } }
protected void gvOnlineInvoice_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } //if (e.Row.RowType == DataControlRowType.DataRow) //{ // if (gvOnlineInvoice.Rows.Count > 0) gvOnlineInvoice.Rows[0].RowState = DataControlRowState.Selected; //} }
protected void gvInspecrionSchedule_RowCreated(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objMegeHead); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "HeaderStyle-css-2"; } } catch { } }
protected void gvNotification_RowCreated(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objContractList); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "PMSGridItemStyle-css"; } } catch { } }
protected void rgdReqAllStage_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.CssClass = "PMSGridItemStyle-css"; Label lbldocument_code = (Label)e.Row.FindControl("lblInfo"); Label lblRFQSend = ((Label)e.Row.FindControl("lblRFQSend")); Label lblQuotReceived = ((Label)e.Row.FindControl("lblQuotReceived")); lblRFQSend.Attributes.Add("onmouseover", "Get_ToopTipsForQtnSent('" + lbldocument_code.Text.ToString() + "',event,this)"); lblQuotReceived.Attributes.Add("onmouseover", "Get_ToopTipsForQtnRecve('" + lbldocument_code.Text.ToString() + "',event,this)"); string Received = BindToolTipsSuppNameOnQtnRecvd("", ((Label)e.Row.FindControl("lblInfo")).ToolTip.Split(new char[] { ',' })[0], ((Label)e.Row.FindControl("lblInfo")).ToolTip.Split(new char[] { ',' })[1]); string Sent = BindToolTipsSuppNameOnQtnSent("", ((Label)e.Row.FindControl("lblInfo")).ToolTip.Split(new char[] { ',' })[0], ((Label)e.Row.FindControl("lblInfo")).ToolTip.Split(new char[] { ',' })[1]); //string[] st = Sent.Split(')'); //string[] rcvd = Received.Split(')'); lblQuotReceived.Text = Received; //(rcvd.Length - 1) >= 0 ? (rcvd.Length - 1).ToString() : "0"; lblRFQSend.Text = Sent; //(st.Length - 1) >= 0 ? (st.Length - 1).ToString() : "0"; if (Convert.ToInt32(lblQuotReceived.Text) > 0) { lblQuotReceived.Style.Add("text-decoration", "underline"); } if (Convert.ToInt32(lblRFQSend.Text) > 0) { lblRFQSend.Style.Add("text-decoration", "underline"); } //lblRFQSend.Attributes.Add("onclick", "Get_ToopTipsForQtnSent('" + lbldocument_code.Text.Split(new char[] { ',' })[0] + "',event,this)"); //lblQuotReceived.Attributes.Add("onclick", "Get_ToopTipsForQtnRecve('" + lbldocument_code.Text.Split(new char[] { ',' })[0] + "',event,this)"); //string Received = BindToolTipsSuppNameOnQtnRecvd("", ((Label)e.Row.FindControl("lblInfo")).ToolTip.Split(new char[] { ',' })[0], ((Label)e.Row.FindControl("lblInfo")).ToolTip.Split(new char[] { ',' })[1]); //string Sent = BindToolTipsSuppNameOnQtnSent("", ((Label)e.Row.FindControl("lblInfo")).ToolTip.Split(new char[] { ',' })[0], ((Label)e.Row.FindControl("lblInfo")).ToolTip.Split(new char[] { ',' })[1]); //Label lblsent = ((Label)e.Row.FindControl("lblRFQSend")); //Label lblrecvd = ((Label)e.Row.FindControl("lblQuotReceived")); //string[] st = Sent.Split(')'); //string[] rcvd = Received.Split(')'); //lblrecvd.Text = (rcvd.Length - 1) >= 0 ? (rcvd.Length - 1).ToString() : "0"; //lblsent.Text = (st.Length - 1) >= 0 ? (st.Length - 1).ToString() : "0"; //lblsent.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[Quotation Sent To :] body=[" + Sent + "]"); //lblrecvd.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[Quotation Received From :] body=[" + Received + "]"); } }
protected void GridView_Tanker_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.DataItemIndex == 22) { e.Row.Cells[0].ForeColor = System.Drawing.Color.Red; e.Row.Cells[1].ForeColor = System.Drawing.Color.Red; } } }
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objContractList); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "HeaderStyle-css-2"; } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void gvInvoiceWithhold_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { string Supply_ID = DataBinder.Eval(e.Row.DataItem, "Supply_ID").ToString(); if (DataBinder.Eval(e.Row.DataItem, "Invoice_Type").ToString() == "WITHHOLD") { e.Row.BackColor = System.Drawing.Color.Yellow; } } }
protected void gvPurchase_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { TotReportUSDValue += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Report_USD_Value")); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblReportUSDValue = (Label)e.Row.FindControl("lblReportUSDValue"); lblReportUSDValue.Text = TotReportUSDValue.ToString(); } }
protected void GridView_CYL_RowCreated(object sender, GridViewRowEventArgs e) { try { if (Session["UTYPE"].ToString() != "MANNING AGENT") { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objMergeList); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "HeaderStyle-css-2"; } } } catch { } }
protected void gvVettingIndex_RowCreated(object sender, GridViewRowEventArgs e) { try { MergeGridviewHeader_Info objVetMerge = new MergeGridviewHeader_Info(); if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objVetMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
protected void gvPurchase_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { Label Line_Date = (Label)e.Row.FindControl("lblLine_Date"); Label Ref_Code = (Label)e.Row.FindControl("lblOffice_Ref_Code"); Label Display_Name = (Label)e.Row.FindControl("lblSupplier_Display_Name"); Label Line_Amount = (Label)e.Row.FindControl("lblLine_Amount"); Label Invoice_Ref = (Label)e.Row.FindControl("lblInvoice_Ref"); Label USD_Amount = (Label)e.Row.FindControl("lblPO_USD_Amount"); TotInvoiceUSDValue += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Invoice_Book_Value")); string SupplyID = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Supply_ID")); if (SupplyID == ViewState["SupplyID"].ToString()) { Line_Date.Visible = false; Ref_Code.Visible = false; Display_Name.Visible = false; Line_Amount.Visible = false; Invoice_Ref.Visible = false; USD_Amount.Visible = false; } else { TotPOUSDValue += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "PO_USD_Amount")); } ViewState["SupplyID"] = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Supply_ID")); } if (e.Row.RowType == DataControlRowType.Footer) { //MergeGridviewHeader.SetProperty(objChangeReqstMerge); //e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); Label lblPOUSDAmount = (Label)e.Row.FindControl("lblPOUSDAmount"); lblPOUSDAmount.Text = TotPOUSDValue.ToString(); Label lblInvBookValue = (Label)e.Row.FindControl("lblInvBookValue"); lblInvBookValue.Text = TotInvoiceUSDValue.ToString(); } }
protected void gvApprovedPaymentinvoice_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { DateTime Last_Payment_Date; // string ColorCode = DataBinder.Eval(e.Row.DataItem, "COLOR_CODE").ToString(); //System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml(ColorCode); string PaymentDate = DataBinder.Eval(e.Row.DataItem, "Last_Payment_Date").ToString(); Label lblLastPayment_Date = (Label)e.Row.FindControl("lblLPayment"); if (PaymentDate != "" && PaymentDate != null) { Last_Payment_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Last_Payment_Date").ToString()); int result = DateTime.Compare(Last_Payment_Date, System.DateTime.Now); if (result > 0) { e.Row.Cells[2].BackColor = System.Drawing.Color.Green; lblLastPayment_Date.ForeColor = System.Drawing.Color.White; } else { e.Row.Cells[2].BackColor = System.Drawing.Color.Red; lblLastPayment_Date.ForeColor = System.Drawing.Color.White; } } else { Last_Payment_Date = System.DateTime.Now; } //DateTime PO_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Last_Payment_Date").ToString()); //Button ViewRemarks = (Button)e.Row.FindControl("btnViewRemarks"); } }
protected void gvJobChangeRqst_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { if (ViewState["SORTBYCOLOUMN"] != null) { HtmlImage img = (HtmlImage)e.Row.FindControl(ViewState["SORTBYCOLOUMN"].ToString()); if (img != null) { if (ViewState["SORTDIRECTION"] == null || ViewState["SORTDIRECTION"].ToString() == "0") { img.Src = "~/purchase/Image/arrowUp.png"; } else { img.Src = "~/purchase/Image/arrowDown.png"; } img.Visible = true; } } } if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { ImageButton ImgApprove = (ImageButton)e.Row.FindControl("ImgApprove"); if (ImgApprove != null) { ImgApprove.Attributes.Add("onclick", "javascript:OpenRequestDetails(" + DataBinder.Eval(e.Row.DataItem, "Vessel_ID").ToString() + ", " + DataBinder.Eval(e.Row.DataItem, "ID").ToString() + " , '" + DataBinder.Eval(e.Row.DataItem, "Status").ToString() + "'); return false;"); } } }
protected void gvPendinginvoice_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { string ColorCode = DataBinder.Eval(e.Row.DataItem, "COLOR_CODE").ToString(); System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml(ColorCode); DateTime Invoice_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Invoice_Date").ToString()); DateTime PO_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Created_Date").ToString()); DateTime Payment_Due_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Payment_Due_Date").ToString()); Button ViewRemarks = (Button)e.Row.FindControl("btnViewRemarks"); Label lblUrgent = (Label)e.Row.FindControl("lblUrgent"); Label lblUrgentFlag = (Label)e.Row.FindControl("lblUrgentFlag"); LinkButton lblSupplier = (LinkButton)e.Row.FindControl("lbl_SupplierName"); LinkButton lblPO = (LinkButton)e.Row.FindControl("lblPOCode"); Label lblInvoiceStatus = (Label)e.Row.FindControl("lblInvoice_Status"); Button btnApprove = (Button)e.Row.FindControl("btnAprove"); Button btnunApprove = (Button)e.Row.FindControl("btnUnApprove"); Label lblApproveMsg = (Label)e.Row.FindControl("lblApproveMsg"); ImageButton btnonHold = (ImageButton)e.Row.FindControl("btnOnHold"); ImageButton btnHold = (ImageButton)e.Row.FindControl("btnhold"); Label lblDays = (Label)e.Row.FindControl("lblDays"); Label lblPaymentDate = (Label)e.Row.FindControl("lblPaymentDate"); Label lblInvoice_Value = (Label)e.Row.FindControl("lblInvoice_Value"); Label lblInvoice_Currency = (Label)e.Row.FindControl("lblInvoice_Currency"); if (Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Invoice_Value")) > Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "PO_Amount"))) { lblInvoice_Value.ForeColor = System.Drawing.Color.Red; } else { lblInvoice_Value.ForeColor = System.Drawing.Color.Black; } if (DataBinder.Eval(e.Row.DataItem, "CURRENCY").ToString() != DataBinder.Eval(e.Row.DataItem, "Invoice_Currency").ToString()) { e.Row.Cells[13].BackColor = System.Drawing.Color.Violet; } else { e.Row.Cells[13].BackColor = System.Drawing.Color.White; } if (DataBinder.Eval(e.Row.DataItem, "Supplier_Currency").ToString() != DataBinder.Eval(e.Row.DataItem, "CURRENCY").ToString()) { if (DataBinder.Eval(e.Row.DataItem, "Supplier_Currency") != null) { e.Row.Cells[4].BackColor = System.Drawing.Color.Violet; } } else { e.Row.Cells[4].BackColor = System.Drawing.Color.White; } if (DataBinder.Eval(e.Row.DataItem, "Urgent_Flag").ToString() == "URGENT") { lblUrgent.Visible = true; lblUrgentFlag.Visible = true; } else { lblUrgent.Visible = false; lblUrgentFlag.Visible = false; } int result = DateTime.Compare(PO_Date, Invoice_Date); if (result > 0) { e.Row.Cells[2].BackColor = System.Drawing.Color.Red; lblPO.ForeColor = System.Drawing.Color.White; } else { e.Row.Cells[1].BackColor = col; //lblSupplier.ForeColor = System.Drawing.Color.White; } DateTime TDate = System.DateTime.Now; int Diff = DateTime.Compare(Payment_Due_Date, TDate); if (Diff > 0) { System.TimeSpan diffResult = Payment_Due_Date - TDate; int differenceInDays = diffResult.Days; lblDays.Text = differenceInDays + " " + "Days"; lblDays.ForeColor = System.Drawing.Color.Black; lblPaymentDate.ForeColor = System.Drawing.Color.Black; } else { lblPaymentDate.ForeColor = System.Drawing.Color.Red; } if (DataBinder.Eval(e.Row.DataItem, "Invoice_Status").ToString() == "Approved") { e.Row.Cells[11].BackColor = System.Drawing.Color.Green; lblInvoiceStatus.ForeColor = System.Drawing.Color.White; btnunApprove.Visible = true; btnApprove.Visible = false; lblApproveMsg.Text = "No Dispute."; lblApproveMsg.ForeColor = System.Drawing.Color.Green; btnHold.Visible = false; btnonHold.Visible = false; } else if (DataBinder.Eval(e.Row.DataItem, "Dispute_Flag").ToString() == "YES") { e.Row.Cells[11].BackColor = System.Drawing.Color.White; lblInvoiceStatus.ForeColor = System.Drawing.Color.Black; btnApprove.Visible = true; btnApprove.Enabled = false; btnunApprove.Visible = false; lblApproveMsg.Text = "Cannot approve until Dispute status is removed."; lblApproveMsg.ForeColor = System.Drawing.Color.Red; } else if (DataBinder.Eval(e.Row.DataItem, "Invoice_Status").ToString() == "Hold") { e.Row.Cells[11].BackColor = System.Drawing.Color.White; lblInvoiceStatus.ForeColor = System.Drawing.Color.Black; btnApprove.Visible = true; btnApprove.Enabled = false; btnunApprove.Visible = false; lblApproveMsg.Text = "Cannot approve until Hold status is removed."; btnHold.Visible = true; btnonHold.Visible = false; lblApproveMsg.ForeColor = System.Drawing.Color.Black; } else { e.Row.Cells[11].BackColor = System.Drawing.Color.White; lblInvoiceStatus.ForeColor = System.Drawing.Color.Black; btnApprove.Visible = true; btnApprove.Enabled = true; btnunApprove.Visible = false; lblApproveMsg.Text = "No Dispute."; lblApproveMsg.ForeColor = System.Drawing.Color.Green; btnHold.Visible = false; btnonHold.Visible = true; } //e.Row.Cells[16].BackColor = System.Drawing.Color.Yellow; //string ID = UDFLib.ConvertStringToNull(gvPendinginvoice.DataKeys[e.Row.RowIndex].Value); //GridView gv = (GridView)e.Row.FindControl("gvRemarks"); //DataSet ds = BLL_POLOG_Register.POLOG_Get_Remarks_ByInvoiceID(ID); //if (ds.Tables[0].Rows.Count > 0) //{ // //ViewRemarks.Visible = true; // gv.DataSource = ds.Tables[0]; // gv.DataBind(); //} } }
protected void gvStatus_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblVesselCode = (Label)e.Row.FindControl("lblVesselCode"); Label lblCMS = (Label)e.Row.FindControl("lblCMS"); Label lblCritical = (Label)e.Row.FindControl("lblCritical"); Label lblJobTitle = (Label)e.Row.FindControl("lblJobTitle"); Label lblLocationID = (Label)e.Row.FindControl("lblLocationID"); Label lblLocation = (Label)e.Row.FindControl("lblLocation"); Label lblOverDueFlage = (Label)e.Row.FindControl("lblOverDueFlage"); Label lblNext30dayFlage = (Label)e.Row.FindControl("lblNext30dayFlage"); Label lblJobDescription = (Label)e.Row.FindControl("lblJobDescription"); Label lblJobHistoryRemaks = (Label)e.Row.FindControl("lblJobHistoryRemaks"); Label lblFullJobHistoryRemaks = (Label)e.Row.FindControl("lblFullJobHistoryRemaks"); Label lblJobHistoryID = (Label)e.Row.FindControl("lblJobHistoryID"); Label lblFreqType = (Label)e.Row.FindControl("lblFrequencyType"); Label lblJobCode = (Label)e.Row.FindControl("lblJobCode"); HyperLink ImgHistory = (HyperLink)e.Row.FindControl("ImgHistory"); if (ViewState["Qflag"].ToString() == "H") { ImgHistory.Visible = false; } else { ImgHistory.NavigateUrl = "PMSJOBProcess.aspx?Qflag=H&JOB_ID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "JOB_ID") + "&VESSEL_ID=" + DataBinder.Eval(e.Row.DataItem, "Vessel_ID").ToString() + "&Function_ID=" + DataBinder.Eval(e.Row.DataItem, "FunctionID").ToString() + "&System_ID=" + DataBinder.Eval(e.Row.DataItem, "SysID").ToString() + "&SubSystem_ID=" + DataBinder.Eval(e.Row.DataItem, "SubSysID").ToString() + "&Fleet_ID=" + DataBinder.Eval(e.Row.DataItem, "FleetID").ToString()); } if (lblJobHistoryID.Text == "") { lblJobHistoryID.Text = "0"; } HyperLink hlnkJobCode = (HyperLink)e.Row.FindControl("hlnkJobCode"); HyperLink hlnkNextDone = (HyperLink)e.Row.FindControl("hlnkNextDone"); if (UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "JobHistoryID")) > 0) { hlnkJobCode.NavigateUrl = "PMSAddAdhocJob.aspx?JOB_HISTORY_ID=" + DataBinder.Eval(e.Row.DataItem, "JobHistoryID").ToString() + "&VESSEL_ID=" + DataBinder.Eval(e.Row.DataItem, "Vessel_ID").ToString() + "&OFFICE_ID=" + DataBinder.Eval(e.Row.DataItem, "OFFICE_ID").ToString() + "&JOB_ID=" + DataBinder.Eval(e.Row.DataItem, "JOB_ID").ToString() + "&OD_DAYS=" + DataBinder.Eval(e.Row.DataItem, "OD_DAYS").ToString() + "&IsRAMandatory=" + DataBinder.Eval(e.Row.DataItem, "IsRAMandatory").ToString(); hlnkNextDone.NavigateUrl = "PMSAddAdhocJob.aspx?JOB_HISTORY_ID=" + DataBinder.Eval(e.Row.DataItem, "JobHistoryID").ToString() + "&VESSEL_ID=" + DataBinder.Eval(e.Row.DataItem, "Vessel_ID").ToString() + "&OFFICE_ID=" + DataBinder.Eval(e.Row.DataItem, "OFFICE_ID").ToString() + "&JOB_ID=" + DataBinder.Eval(e.Row.DataItem, "JOB_ID").ToString() + "&OD_DAYS=" + DataBinder.Eval(e.Row.DataItem, "OD_DAYS").ToString() + "&IsRAMandatory=" + DataBinder.Eval(e.Row.DataItem, "IsRAMandatory").ToString(); } else { hlnkJobCode.NavigateUrl = "PMSJobIndividualDetails.aspx?JobHistoryID=" + DataBinder.Eval(e.Row.DataItem, "JobHistoryID").ToString() + "&VID=" + DataBinder.Eval(e.Row.DataItem, "Vessel_ID").ToString() + "&Qflag=S&JobID=" + DataBinder.Eval(e.Row.DataItem, "JOB_ID").ToString(); hlnkNextDone.NavigateUrl = "PMSJobIndividualDetails.aspx?JobHistoryID=" + DataBinder.Eval(e.Row.DataItem, "JobHistoryID").ToString() + "&VID=" + DataBinder.Eval(e.Row.DataItem, "Vessel_ID").ToString() + "&Qflag=S&JobID=" + DataBinder.Eval(e.Row.DataItem, "JOB_ID").ToString(); } ImageButton ImgSpareUsed = (ImageButton)e.Row.FindControl("ImgSpareUsed"); ImgSpareUsed.Attributes.Add("onclick", "document.getElementById('iFrmJobsDetails').src ='../PMS/PMS_SparesUsed.aspx?JobID=" + DataBinder.Eval(e.Row.DataItem, "JOB_ID").ToString() + "&Vessel_ID=" + lblVesselCode.Text.Trim() + "';showModal('dvJobsDetails');return false;"); ImageButton ImgRHours = (ImageButton)e.Row.FindControl("ImgRHours"); if (lblFreqType.Text.ToString() == "2486") { ImgRHours.Visible = true; ImgRHours.Attributes.Add("onClick", "javascript:window.open('../PMS/PMSRunningHours.aspx?VESSEL_ID=" + DataBinder.Eval(e.Row.DataItem, "Vessel_ID").ToString() + "&Function_ID=" + DataBinder.Eval(e.Row.DataItem, "FunctionID").ToString() + "&System_ID=" + DataBinder.Eval(e.Row.DataItem, "SysID").ToString() + "&SubSystem_ID=" + DataBinder.Eval(e.Row.DataItem, "SubSysID").ToString() + "&Fleet_ID=" + DataBinder.Eval(e.Row.DataItem, "FleetID").ToString() + "','_blank');return false"); } if (lblFullJobHistoryRemaks.Text.Length > 15) { lblJobHistoryRemaks.Text = lblJobHistoryRemaks.Text + ".."; } if (lblJobDescription.Text != "") { lblJobTitle.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[Job Description] body=[" + lblJobDescription.Text + "]"); } if (lblFullJobHistoryRemaks.Text != "") { lblJobHistoryRemaks.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[Remarks] body=[" + lblFullJobHistoryRemaks.Text + "]"); } if (lblOverDueFlage.Text == "Y") { e.Row.Cells[12].BackColor = System.Drawing.Color.Red; e.Row.Cells[12].ForeColor = System.Drawing.Color.White; e.Row.Cells[12].Font.Bold = true; } if (lblNext30dayFlage.Text == "Y") { e.Row.Cells[12].BackColor = System.Drawing.Color.Orange; e.Row.Cells[12].ForeColor = System.Drawing.Color.Black; e.Row.Cells[12].Font.Bold = true; } if (lblCMS.Text == "Y") { e.Row.Cells[15].BackColor = System.Drawing.Color.Green; e.Row.Cells[15].ForeColor = System.Drawing.Color.White; e.Row.Cells[15].Font.Bold = true; } if (lblCritical.Text == "Y") { e.Row.Cells[16].BackColor = System.Drawing.Color.Red; e.Row.Cells[16].ForeColor = System.Drawing.Color.White; e.Row.Cells[16].Font.Bold = true; } } if (e.Row.RowType == DataControlRowType.DataRow) //Reshma - Remaining Running Hours - when the remaining running hours are negative (meaning the job is overdue), this field (Rem. RHRS) should be painted red. { Label lblRemHrs = (Label)e.Row.FindControl("lblRemRHrsdone"); if (lblRemHrs.Text != "") { if (Convert.ToInt32(lblRemHrs.Text.ToString()) < 0) { e.Row.Cells[14].BackColor = System.Drawing.Color.Red; e.Row.Cells[14].ForeColor = System.Drawing.Color.White; e.Row.Cells[14].Font.Bold = true; } } } if (e.Row.RowType == DataControlRowType.DataRow) { Label lblFilePathIfSingle = (Label)e.Row.FindControl("lblFilePathIfSingle"); ImageButton ImgJobDoneAtt = (ImageButton)e.Row.FindControl("ImgJobDoneAtt"); if (lblFilePathIfSingle.Text != "") { ImgJobDoneAtt.Attributes.Add("onclick", "DocOpen('" + lblFilePathIfSingle.Text + "'); return false;"); } else { ImgJobDoneAtt.Attributes.Add("onclick", "javascript:window.open('../PMS/PMSJobDone_Attachments.aspx?JobHistoryID=" + DataBinder.Eval(e.Row.DataItem, "JobHistoryID").ToString() + "&Vessel_ID=" + DataBinder.Eval(e.Row.DataItem, "VESSEL_ID").ToString() + "&OFFICE_ID=" + DataBinder.Eval(e.Row.DataItem, "OFFICE_ID").ToString() + "'); return false;"); } } if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objPMSMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "HeaderStyle-css"; } if (e.Row.RowType == DataControlRowType.Header) { if (ViewState["SORTBYCOLOUMN"] != null) { HtmlImage img = (HtmlImage)e.Row.FindControl(ViewState["SORTBYCOLOUMN"].ToString()); if (img != null) { if (ViewState["SORTDIRECTION"] == null || ViewState["SORTDIRECTION"].ToString() == "0") { img.Src = "../../purchase/Image/arrowUp.png"; } else { img.Src = "../../purchase/Image/arrowDown.png"; } img.Visible = true; } } } }
//protected void btnNewPO_Click(object sender, EventArgs e) //{ // int POID = 0; // string POType = ddlPOType.SelectedValue; // Response.Redirect("../ASL/PO_LOG.aspx?PO_ID=" + POID + "'&POType=" + POType + "'"); //} protected void gvPO_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { ImageButton ImageButton = (ImageButton)e.Row.FindControl("ImgView"); Button InvoiceButton = (Button)e.Row.FindControl("btnInvoice"); Button DeliveryButton = (Button)e.Row.FindControl("btnDelivery"); Image ImgStatus = (Image)e.Row.FindControl("ImgStatus"); //LinkButton lblOffice = (LinkButton)e.Row.FindControl("lblOffice"); Button btnSType = (Button)e.Row.FindControl("btnSType"); Label lblInvoice_Value = (Label)e.Row.FindControl("lblInvoice"); Label lblCurrency = (Label)e.Row.FindControl("lblCurrency"); if (Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Invoice_Amount")) > Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "TotalAmount"))) { lblInvoice_Value.ForeColor = System.Drawing.Color.Red; } else { lblInvoice_Value.ForeColor = System.Drawing.Color.Black; } if (DataBinder.Eval(e.Row.DataItem, "Supplier_Currency").ToString() != DataBinder.Eval(e.Row.DataItem, "Line_Currency").ToString()) { if (DataBinder.Eval(e.Row.DataItem, "Supplier_Currency") != null) { e.Row.Cells[4].BackColor = System.Drawing.Color.Violet; } } else { e.Row.Cells[4].BackColor = System.Drawing.Color.White; } if (DataBinder.Eval(e.Row.DataItem, "SType").ToString() == "") { btnSType.Visible = false; } if (DataBinder.Eval(e.Row.DataItem, "Line_Status").ToString() == "APPROVED") { InvoiceButton.Visible = true; DeliveryButton.Visible = true; ImgStatus.Visible = true; ImgStatus.ImageUrl = "~/Images/Green_Check.bmp"; } else if (DataBinder.Eval(e.Row.DataItem, "Line_Status").ToString() == "CANCELLED") { ImgStatus.Visible = true; ImgStatus.ImageUrl = "~/Images/Delete.png"; } else if (DataBinder.Eval(e.Row.DataItem, "PO_Closed_By").ToString() != "") { ImgStatus.Visible = true; ImgStatus.ImageUrl = "~/Images/locked.bmp"; } else { ImgStatus.Visible = false; } string ColorCode = DataBinder.Eval(e.Row.DataItem, "COLOR_CODE").ToString(); System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml(ColorCode); if (col.Name == "White") { e.Row.Cells[1].BackColor = col; } else { e.Row.Cells[1].BackColor = col; //lblOffice.ForeColor = System.Drawing.Color.Black; } e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvPO, "Select$" + e.Row.RowIndex); e.Row.Attributes["style"] = "cursor:pointer"; } }
protected void gvApprovedInvoice_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { string ColorCode = DataBinder.Eval(e.Row.DataItem, "COLOR_CODE").ToString(); System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml(ColorCode); DateTime Invoice_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Invoice_Date").ToString()); DateTime PO_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Created_Date").ToString()); //Button ViewRemarks = (Button)e.Row.FindControl("btnViewRemarks"); LinkButton lblPO = (LinkButton)e.Row.FindControl("lblPOCode"); Label lblUrgent = (Label)e.Row.FindControl("lblUrgent"); Label lblUrgentFlag = (Label)e.Row.FindControl("lblUrgentFlag"); Label lblDispute = (Label)e.Row.FindControl("lblDispute"); Button btnDispute = (Button)e.Row.FindControl("btnApprovedDispute"); int result = DateTime.Compare(PO_Date, Invoice_Date); if (result > 0) { e.Row.Cells[2].BackColor = System.Drawing.Color.Red; lblPO.ForeColor = System.Drawing.Color.White; } else { e.Row.Cells[1].BackColor = col; } if (DataBinder.Eval(e.Row.DataItem, "Urgent_Flag").ToString() == "URGENT") { lblUrgent.Visible = true; lblUrgentFlag.Visible = true; } else { lblUrgent.Visible = false; lblUrgentFlag.Visible = false; } if (DataBinder.Eval(e.Row.DataItem, "Dispute_Flag").ToString() == "YES") { btnDispute.Text = "Un-Dispute"; lblDispute.Text = DataBinder.Eval(e.Row.DataItem, "Dispute_Flag").ToString(); lblDispute.ForeColor = System.Drawing.Color.White; e.Row.Cells[19].BackColor = System.Drawing.Color.Red; } Label lblInvoice_Value = (Label)e.Row.FindControl("lblInvoice_Value"); Label lblInvoice_Currency = (Label)e.Row.FindControl("lblInvoice_Currency"); if (Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Invoice_Value")) > Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "PO_Amount"))) { lblInvoice_Value.ForeColor = System.Drawing.Color.Red; } else { lblInvoice_Value.ForeColor = System.Drawing.Color.Black; } if (DataBinder.Eval(e.Row.DataItem, "CURRENCY").ToString() != DataBinder.Eval(e.Row.DataItem, "Invoice_Currency").ToString()) { e.Row.Cells[13].BackColor = System.Drawing.Color.Violet; } else { e.Row.Cells[13].BackColor = System.Drawing.Color.White; } if (DataBinder.Eval(e.Row.DataItem, "Supplier_Currency") != DataBinder.Eval(e.Row.DataItem, "CURRENCY")) { if (DataBinder.Eval(e.Row.DataItem, "Supplier_Currency") != null) { e.Row.Cells[4].BackColor = System.Drawing.Color.Violet; } } else { e.Row.Cells[4].BackColor = System.Drawing.Color.White; } } }
protected void gvPendingInvoice_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { string ColorCode = DataBinder.Eval(e.Row.DataItem, "COLOR_CODE").ToString(); System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml(ColorCode); DateTime Invoice_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Invoice_Date").ToString()); DateTime PO_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Created_Date").ToString()); DateTime Payment_Due_Date = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "Payment_Due_Date").ToString()); Button ViewRemarks = (Button)e.Row.FindControl("btnViewRemarks"); Label lblUrgent = (Label)e.Row.FindControl("lblUrgent"); Label lblUrgentFlag = (Label)e.Row.FindControl("lblUrgentFlag"); LinkButton lblSupplier = (LinkButton)e.Row.FindControl("lbl_SupplierName"); LinkButton lblPO = (LinkButton)e.Row.FindControl("lblPOCode"); Label lblInvoiceStatus = (Label)e.Row.FindControl("lblInvoice_Status"); CheckBox chkinvoice = (CheckBox)e.Row.FindControl("chkInvoice"); Label lblDispute = (Label)e.Row.FindControl("lblDispute"); Button btnDispute = (Button)e.Row.FindControl("btnDispute"); Label lblDays = (Label)e.Row.FindControl("lblDays"); Label lblPaymentDate = (Label)e.Row.FindControl("lblPaymentDate"); Label lblInvoice_Value = (Label)e.Row.FindControl("lblInvoice_Value"); Label lblInvoice_Currency = (Label)e.Row.FindControl("lblInvoice_Currency"); if (Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Invoice_Value")) > Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "PO_Amount"))) { lblInvoice_Value.ForeColor = System.Drawing.Color.Red; } else { lblInvoice_Value.ForeColor = System.Drawing.Color.Black; } if (DataBinder.Eval(e.Row.DataItem, "CURRENCY").ToString() != DataBinder.Eval(e.Row.DataItem, "Invoice_Currency").ToString()) { e.Row.Cells[13].BackColor = System.Drawing.Color.Violet; } else { e.Row.Cells[13].BackColor = System.Drawing.Color.White; } if (DataBinder.Eval(e.Row.DataItem, "Supplier_Currency").ToString() != DataBinder.Eval(e.Row.DataItem, "CURRENCY").ToString()) { if (DataBinder.Eval(e.Row.DataItem, "Supplier_Currency") != null) { e.Row.Cells[4].BackColor = System.Drawing.Color.Violet; } } else { e.Row.Cells[4].BackColor = System.Drawing.Color.White; } if (DataBinder.Eval(e.Row.DataItem, "Urgent_Flag").ToString() == "URGENT") { lblUrgent.Visible = true; lblUrgentFlag.Visible = true; } else { lblUrgent.Visible = false; lblUrgentFlag.Visible = false; } int result = DateTime.Compare(PO_Date, Invoice_Date); if (result > 0) { e.Row.Cells[2].BackColor = System.Drawing.Color.Red; lblPO.ForeColor = System.Drawing.Color.White; } else { e.Row.Cells[1].BackColor = col; } DateTime TDate = System.DateTime.Now; int Diff = DateTime.Compare(Payment_Due_Date, TDate); if (Diff > 0) { System.TimeSpan diffResult = Payment_Due_Date - TDate; int differenceInDays = diffResult.Days; lblDays.Text = differenceInDays + " " + "Days"; lblDays.ForeColor = System.Drawing.Color.Black; lblPaymentDate.ForeColor = System.Drawing.Color.Black; } else { lblPaymentDate.ForeColor = System.Drawing.Color.Red; } if (DataBinder.Eval(e.Row.DataItem, "Invoice_Status").ToString() == "Approved") { e.Row.Cells[11].BackColor = System.Drawing.Color.Green; lblInvoiceStatus.ForeColor = System.Drawing.Color.White; chkinvoice.Enabled = true; lblDispute.Text = "No Dispute"; lblDispute.ForeColor = System.Drawing.Color.Green; } else if (DataBinder.Eval(e.Row.DataItem, "Dispute_Flag").ToString() == "YES") { e.Row.Cells[11].BackColor = System.Drawing.Color.White; lblInvoiceStatus.ForeColor = System.Drawing.Color.Black; chkinvoice.Enabled = false; btnDispute.Text = "Un-Dispute"; lblDispute.Text = DataBinder.Eval(e.Row.DataItem, "Dispute_Flag").ToString(); lblDispute.ForeColor = System.Drawing.Color.White; e.Row.Cells[19].BackColor = System.Drawing.Color.Red; btnApprove.Enabled = false; } else { e.Row.Cells[11].BackColor = System.Drawing.Color.White; lblInvoiceStatus.ForeColor = System.Drawing.Color.Black; lblDispute.Text = "No Dispute"; lblDispute.ForeColor = System.Drawing.Color.Green; btnDispute.Text = "Dispute"; chkinvoice.Enabled = true; } if (DataBinder.Eval(e.Row.DataItem, "Dispute_Flag").ToString() == "YES") { chkinvoice.Enabled = false; btnDispute.Text = "Un-Dispute"; lblDispute.Text = DataBinder.Eval(e.Row.DataItem, "Dispute_Flag").ToString(); lblDispute.ForeColor = System.Drawing.Color.White; e.Row.Cells[19].BackColor = System.Drawing.Color.Red; } } }
protected void gvVettingIndex_RowDataBound(object sender, GridViewRowEventArgs e) { try { MergeGridviewHeader_Info objVetMerge = new MergeGridviewHeader_Info(); if (e.Row.RowType == DataControlRowType.DataRow) { Label lblVettingId = (Label)e.Row.FindControl("lblVetting_Id"); Label lblOverDueRespondDate = (Label)e.Row.FindControl("lblOverDueRespondDate"); Label lblOverDueValidDate = (Label)e.Row.FindControl("lblOverDueValidDate"); Label lblVettingStatus = (Label)e.Row.FindControl("lblVetStatus"); Label lblOpenCloseResponse = (Label)e.Row.FindControl("lblResponse"); Label lblVettingDate = (Label)e.Row.FindControl("lblVetDate"); Label lblRespondDate = (Label)e.Row.FindControl("lblRespondDate"); Label lblValidDate = (Label)e.Row.FindControl("lblValidDate"); HyperLink hplinkPendingJob = (HyperLink)e.Row.FindControl("hplnkJobPending"); HyperLink hplinkJobCompleted = (HyperLink)e.Row.FindControl("hplnkJobCompleted"); HyperLink hplinkJobVerified = (HyperLink)e.Row.FindControl("hplnkJobVerified"); HyperLink hplinkJobDeffered = (HyperLink)e.Row.FindControl("hplnkJobDeffered"); HyperLink hplinkOpenJob = (HyperLink)e.Row.FindControl("hplnkOpenObs"); HyperLink hplinkCloseJob = (HyperLink)e.Row.FindControl("hplnkClosedObs"); HyperLink hplinkNote = (HyperLink)e.Row.FindControl("hplnkNote"); if (lblOverDueRespondDate.Text == "Y") { e.Row.Cells[5].BackColor = System.Drawing.Color.Red; e.Row.Cells[5].ForeColor = System.Drawing.Color.White; e.Row.Cells[5].Font.Bold = true; } if (lblOverDueValidDate.Text == "Y") { e.Row.Cells[6].BackColor = System.Drawing.Color.Red; e.Row.Cells[6].ForeColor = System.Drawing.Color.White; e.Row.Cells[6].Font.Bold = true; } ImageButton ImgDelete = (ImageButton)e.Row.FindControl("ImgDelete"); HyperLink ImgReport = (HyperLink)e.Row.FindControl("ImgReport"); if (lblVettingStatus.Text == "Planned") { ImgDelete.Visible = true; ImgReport.Visible = false; } else { ImgDelete.Visible = false; ImgReport.Visible = true; } ImageButton ImgRework = (ImageButton)e.Row.FindControl("ImgRework"); if (lblVettingStatus.Text == "Completed" || lblVettingStatus.Text == "Failed") { ImgRework.Visible = true; } else { ImgRework.Visible = false; } HyperLink ImgDetail = (HyperLink)e.Row.FindControl("ImgDetails"); ImgDetail.NavigateUrl = "../Vetting/Vetting_Details.aspx?Vetting_Id=" + DataBinder.Eval(e.Row.DataItem, "Vetting_ID").ToString(); if (lblVettingDate.Text != "") { lblVettingDate.Text = UDFLib.ConvertUserDateFormat(lblVettingDate.Text, UDFLib.GetDateFormat()); } if (lblRespondDate.Text != "") { lblRespondDate.Text = UDFLib.ConvertUserDateFormat(lblRespondDate.Text, UDFLib.GetDateFormat()); } if (lblValidDate.Text != "") { lblValidDate.Text = UDFLib.ConvertUserDateFormat(lblValidDate.Text, UDFLib.GetDateFormat()); } // if extra column is added need to changed in this condition for (int j = 0; j < 9; j++) { // Row should be clickable e.Row.Cells[j].Attributes.Add("onclick", "window.open('Vetting_Details.aspx?Vetting_Id=" + DataBinder.Eval(e.Row.DataItem, "Vetting_ID").ToString() + "','_blank');"); e.Row.Cells[j].Attributes.Add("style", "cursor:pointer;"); e.Row.Cells[j].Attributes["onmousedown"] = ClientScript.GetPostBackClientHyperlink(this.gvVettingIndex, "Select$" + e.Row.RowIndex); } // added hyperlink for response column e.Row.Cells[12].Attributes.Add("onclick", "window.open('Vetting_Details.aspx?Vetting_Id=" + DataBinder.Eval(e.Row.DataItem, "Vetting_ID").ToString() + "','_blank');"); e.Row.Cells[12].Attributes.Add("style", "cursor:pointer;"); e.Row.Cells[12].Attributes["onmousedown"] = ClientScript.GetPostBackClientHyperlink(this.gvVettingIndex, "Select$" + e.Row.RowIndex); for (int i = 9; i < e.Row.Controls.Count; i++) { string ObsOpenCount, ObsCloseCount, NotesCount, ResponseCount, PendJobCount, CompJobCount, VerifiedJobCount, DefferedJobCount; DataTable dtObservationCount = (DataTable)ViewState["dtObservationCount"]; string filteropnobsexpression = " Observation_Type_ID=2 and Status='Open' and Vetting_ID=" + lblVettingId.Text; DataRow[] drObsOpenCount = dtObservationCount.Select(filteropnobsexpression); if (drObsOpenCount.Length <= 0) { ObsOpenCount = "0"; hplinkOpenJob.Text = ObsOpenCount; } else { ObsOpenCount = drObsOpenCount[0][0].ToString(); hplinkOpenJob.Text = ObsOpenCount; } string filterclosedobsexpression = " Observation_Type_ID=2 and Status='Closed' and Vetting_ID=" + lblVettingId.Text; DataRow[] drObsCloseCount = dtObservationCount.Select(filterclosedobsexpression); if (drObsCloseCount.Length <= 0) { ObsCloseCount = "0"; hplinkCloseJob.Text = ObsCloseCount; } else { ObsCloseCount = drObsCloseCount[0][0].ToString(); hplinkCloseJob.Text = ObsCloseCount; } DataTable dtNotesCount = (DataTable)ViewState["dtNotesCount"]; string filternoteexpression = " Observation_Type_ID=1 and Vetting_ID=" + lblVettingId.Text; DataRow[] drNotesCount = dtNotesCount.Select(filternoteexpression); if (drNotesCount.Length <= 0) { NotesCount = "0"; hplinkNote.Text = NotesCount; } else { NotesCount = drNotesCount[0][0].ToString(); hplinkNote.Text = NotesCount; } DataTable dtResponseCount = (DataTable)ViewState["dtResponse"]; string filterresponseexpression = "Vetting_ID=" + lblVettingId.Text; DataRow[] drResponseCount = dtResponseCount.Select(filterresponseexpression); if (drResponseCount.Length <= 0) { ResponseCount = "0"; lblOpenCloseResponse.Text = ResponseCount; } else { ResponseCount = drResponseCount[0][0].ToString(); lblOpenCloseResponse.Text = ResponseCount; } DataTable dtJobCount = (DataTable)ViewState["dtJobsCount"]; string filterpendjobexpression = " Vetting_ID=" + lblVettingId.Text + " and Job_Status='PENDING'"; DataRow[] drPendJobCount = dtJobCount.Select(filterpendjobexpression); if (drPendJobCount.Length <= 0) { PendJobCount = "0"; hplinkPendingJob.Text = PendJobCount; } else { PendJobCount = drPendJobCount[0][0].ToString(); hplinkPendingJob.Text = PendJobCount; } string filtercompletedjobexpression = " Vetting_ID=" + lblVettingId.Text + " and Job_Status='COMPLETED'"; DataRow[] drComplJobCount = dtJobCount.Select(filtercompletedjobexpression); if (drComplJobCount.Length <= 0) { CompJobCount = "0"; hplinkJobCompleted.Text = CompJobCount; } else { CompJobCount = drComplJobCount[0][0].ToString(); hplinkJobCompleted.Text = CompJobCount; } string filterverifiedjobexpression = " Vetting_ID=" + lblVettingId.Text + " and Job_Status='VERIFY'"; DataRow[] drVerifiedJobCount = dtJobCount.Select(filterverifiedjobexpression); if (drVerifiedJobCount.Length <= 0) { VerifiedJobCount = "0"; hplinkJobVerified.Text = VerifiedJobCount; } else { VerifiedJobCount = drVerifiedJobCount[0][0].ToString(); hplinkJobVerified.Text = VerifiedJobCount; } string filterdefferedjobexpression = " Vetting_ID=" + lblVettingId.Text + " and Job_Status='DEFERRED'"; DataRow[] drDefferedJobCount = dtJobCount.Select(filterdefferedjobexpression); if (drDefferedJobCount.Length <= 0) { DefferedJobCount = "0"; hplinkJobDeffered.Text = DefferedJobCount; } else { DefferedJobCount = drDefferedJobCount[0][0].ToString(); hplinkJobDeffered.Text = DefferedJobCount; } } } if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objVetMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); ViewState["DynamicHeaderCSS"] = "GroupHeaderStyle-css HeaderStyle-css"; } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
protected void gvMachinery_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblDiffSysDescFlag = (Label)e.Row.FindControl("lblDiffSysDescFlag"); Label lblDiffSysParticularFlag = (Label)e.Row.FindControl("lblDiffSysPartFlag"); Label lblDiffSetInstalledFlag = (Label)e.Row.FindControl("lblDiffSetInstalledFlag"); Label lblDiffModelFlag = (Label)e.Row.FindControl("lblDiffModelFlag"); Label lblSystemParticular = (Label)e.Row.FindControl("lblSystemParticular"); Label lblCRSystemParticular = (Label)e.Row.FindControl("lblCRSystemParticular"); Label lblSystemName = (Label)e.Row.FindControl("lblSystemName"); Label lblCRSystemName = (Label)e.Row.FindControl("lblCRSystemName"); Label lblAddNewFlag = (Label)e.Row.FindControl("lblAddNewFlag"); Label lbl_CR_Actual = (Label)e.Row.FindControl("lbl_CR_Actual"); Label lblChangeReqstID = (Label)e.Row.FindControl("lblChangeReqstID"); Label lblVesselCode = (Label)e.Row.FindControl("lblVesselCode"); lblSystemName.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[Particulars] body=[" + lblSystemParticular.Text + "]"); if (lbl_CR_Actual.Text != "") { lblCRSystemName.Attributes.Add("Title", "cssbody=[dvbdy1] cssheader=[dvhdr1] header=[Change Reqst Actual] body=[" + lbl_CR_Actual.Text + "]"); } if (lblDiffSysDescFlag.Text == "N") { e.Row.Cells[2].ForeColor = System.Drawing.Color.Blue; e.Row.Cells[6].ForeColor = System.Drawing.Color.Blue; } if (lblDiffSetInstalledFlag.Text == "N") { e.Row.Cells[4].ForeColor = System.Drawing.Color.Blue; e.Row.Cells[8].ForeColor = System.Drawing.Color.Blue; } if (lblDiffModelFlag.Text == "N") { e.Row.Cells[5].ForeColor = System.Drawing.Color.Blue; e.Row.Cells[9].ForeColor = System.Drawing.Color.Blue; } if (lblAddNewFlag.Text == "Y") { } } if (e.Row.RowType == DataControlRowType.Header) { MergeGridviewHeader.SetProperty(objChangeReqstMerge); e.Row.SetRenderMethodDelegate(MergeGridviewHeader.RenderHeader); } if (e.Row.RowType == DataControlRowType.DataRow) { ImageButton ImgApprove = (ImageButton)e.Row.FindControl("ImgApprove"); if (ImgApprove != null) { ImgApprove.Attributes.Add("onclick", "javascript:OpenRequestDetails(" + DataBinder.Eval(e.Row.DataItem, "Vessel_ID").ToString() + ", " + DataBinder.Eval(e.Row.DataItem, "ID").ToString() + " , '" + DataBinder.Eval(e.Row.DataItem, "Status").ToString() + "'); return false;"); } } if (e.Row.RowType == DataControlRowType.Header) { if (ViewState["SORTBYCOLOUMN"] != null) { HtmlImage img = (HtmlImage)e.Row.FindControl(ViewState["SORTBYCOLOUMN"].ToString()); if (img != null) { if (ViewState["SORTDIRECTION"] == null || ViewState["SORTDIRECTION"].ToString() == "0") { img.Src = "~/purchase/Image/arrowUp.png"; } else { img.Src = "~/purchase/Image/arrowDown.png"; } img.Visible = true; } } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }