protected void CMGridView_RowDataBound(object sender, GridViewRowEventArgs e) { Label lbSDate = (Label)(e.Row.FindControl("lbSDate")); if (lbSDate != null) { lbSDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "cm_detail_sdate")); } Label lbStatus = (Label)(e.Row.FindControl("lbStatus")); if (lbStatus != null) { lbStatus.Text = function.GetStatusCM(DataBinder.Eval(e.Row.DataItem, "cm_detail_status_id").ToString()); } Label btnDateEditCM = (Label)(e.Row.FindControl("btnDateEditCM")); if (btnDateEditCM != null) { if (!DataBinder.Eval(e.Row.DataItem, "cm_detail_edate").Equals(DBNull.Value)) { btnDateEditCM.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "cm_detail_edate")); } } Label btnTimeEditCM = (Label)(e.Row.FindControl("btnTimeEditCM")); if (btnTimeEditCM != null) { if (!DataBinder.Eval(e.Row.DataItem, "cm_detail_etime").Equals(DBNull.Value)) { btnTimeEditCM.Text = (string)DataBinder.Eval(e.Row.DataItem, "cm_detail_etime"); if (btnTimeEditCM.Text != "") { btnTimeEditCM.Text += " น."; } } } LinkButton btnStatusUpdate = (LinkButton)(e.Row.FindControl("btnStatusUpdate")); if (btnStatusUpdate != null) { btnStatusUpdate.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "cm_detail_id").ToString(); if (DataBinder.Eval(e.Row.DataItem, "cm_detail_status_id").ToString() == "1") { btnStatusUpdate.Text = ""; btnStatusUpdate.CssClass = "fas text-warning"; btnStatusUpdate.ToolTip = "แก้ไข"; } } }
protected void CMGridView_RowDataBound(object sender, GridViewRowEventArgs e) { Label lbSDate = (Label)(e.Row.FindControl("lbSDate")); if (lbSDate != null) { lbSDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "cm_detail_sdate")); } Label lbStatus = (Label)(e.Row.FindControl("lbStatus")); if (lbStatus != null) { lbStatus.Text = function.GetStatusCM(DataBinder.Eval(e.Row.DataItem, "cm_detail_status_id").ToString()); } LinkButton btnEditCM = (LinkButton)(e.Row.FindControl("btnEditCM")); if (btnEditCM != null) { btnEditCM.CommandName = DataBinder.Eval(e.Row.DataItem, "cm_detail_id").ToString(); if (DataBinder.Eval(e.Row.DataItem, "cm_detail_status_id").ToString() != "0") { btnEditCM.Visible = false; } } }
protected void ClaimGridView_RowDataBound(object sender, GridViewRowEventArgs e) { LinkButton lbCpoint = (LinkButton)(e.Row.FindControl("lbCpoint")); if (lbCpoint != null) { lbCpoint.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id"); } LinkButton lbEquipment = (LinkButton)(e.Row.FindControl("lbEquipment")); if (lbEquipment != null) { lbEquipment.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id"); lbEquipment.ToolTip = (string)DataBinder.Eval(e.Row.DataItem, "claim_equipment"); } Label _lbDateStart = (Label)(e.Row.FindControl("_lbDateStart")); if (_lbDateStart != null) { _lbDateStart.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "claim_start_date")); } Label lbStartDate = (Label)(e.Row.FindControl("lbStartDate")); if (lbStartDate != null) { lbStartDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "detail_date_start")); } Label lbDay = (Label)(e.Row.FindControl("lbDay")); if (lbDay != null) { string[] data = DataBinder.Eval(e.Row.DataItem, "detail_date_start").ToString().Split('-'); DateTime dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture); DateDifference differnce = new DateDifference(dateStart); if (differnce.ToString() == "") { lbDay.CssClass = "badge badge-danger"; lbDay.Text = "NEW!!"; } else { lbDay.Text = differnce.ToString(); } } Label lbCountdown = (Label)(e.Row.FindControl("lbCountdown")); if (lbDay != null) { string[] data = DataBinder.Eval(e.Row.DataItem, "detail_date_end").ToString().Split('-'); DateTime dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture); DateDifference differnce = new DateDifference(dateStart); if (dateStart < DateTime.Now.Date) { lbCountdown.Text = "เกินกำหนดมา " + differnce.ToString(); lbCountdown.CssClass = "text-danger"; } else { if (differnce.ToString() != "") { lbCountdown.Text = "ครบกำหนดอีก " + differnce.ToString(); lbCountdown.CssClass = "text-success"; } else { lbCountdown.Text = "ครบกำหนดวันนี้ "; lbCountdown.CssClass = "text-warning"; } } if ((string)DataBinder.Eval(e.Row.DataItem, "status_name") == "ส่งงาน/เสร็จสิ้น") { lbCountdown.Text = "เสร็จสิ้น"; lbCountdown.CssClass = "text-success"; } } Label lbStatus = (Label)(e.Row.FindControl("lbStatus")); if (lbStatus != null) { lbStatus.CssClass = "badge badge-" + (string)DataBinder.Eval(e.Row.DataItem, "status_alert"); } LinkButton btnChangeStatus = (LinkButton)(e.Row.FindControl("btnChangeStatus")); if (btnChangeStatus != null) { btnChangeStatus.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id"); } }
protected void ClaimGridView_RowDataBound(object sender, GridViewRowEventArgs e) { LinkButton lbCpoint = (LinkButton)(e.Row.FindControl("lbCpoint")); if (lbCpoint != null) { lbCpoint.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id"); } LinkButton lbNoteCom = (LinkButton)(e.Row.FindControl("lbNoteCom")); if (lbNoteCom != null) { lbNoteCom.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id"); } LinkButton lbEquipment = (LinkButton)(e.Row.FindControl("lbEquipment")); if (lbEquipment != null) { lbEquipment.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id"); lbEquipment.ToolTip = (string)DataBinder.Eval(e.Row.DataItem, "claim_equipment");; } Label lbCpointDate = (Label)(e.Row.FindControl("lbCpointDate")); if (lbCpointDate != null) { lbCpointDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "claim_cpoint_date")); } Label lbStartDate = (Label)(e.Row.FindControl("lbStartDate")); if (lbStartDate != null) { lbStartDate.Text = function.ConvertDateShortThai((string)DataBinder.Eval(e.Row.DataItem, "claim_start_date")); } Label lbDay = (Label)(e.Row.FindControl("lbDay")); if (lbDay != null) { string[] data = DataBinder.Eval(e.Row.DataItem, "claim_start_date").ToString().Split('-'); DateTime dateStart = DateTime.ParseExact(data[0] + "-" + data[1] + "-" + (int.Parse(data[2]) - 543), "dd-MM-yyyy", CultureInfo.InvariantCulture); DateDifference differnce = new DateDifference(dateStart); if (differnce.ToString() == "") { lbDay.CssClass = "badge badge-danger"; lbDay.Text = "NEW!!"; } else { lbDay.Text = differnce.ToString(); } } Label lbStatus = (Label)(e.Row.FindControl("lbStatus")); if (lbStatus != null) { lbStatus.CssClass = "badge badge-" + (string)DataBinder.Eval(e.Row.DataItem, "status_alert"); } LinkButton printReport1 = (LinkButton)(e.Row.FindControl("printReport1")); if (printReport1 != null) { printReport1.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id"); //printReport1.OnClientClick = "document.forms[0].target ='_blank';"; //printReport1.t } LinkButton printReport2 = (LinkButton)(e.Row.FindControl("printReport2")); if (printReport2 != null) { printReport2.CommandName = (string)DataBinder.Eval(e.Row.DataItem, "claim_id"); //printReport1.t } //*** Edit ***' if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList txtStatusEdit = (DropDownList)e.Row.FindControl("txtStatusEdit"); if ((txtStatusEdit != null)) { string sql_status = "SELECT * FROM tbl_status"; function.getListItem(txtStatusEdit, sql_status, "status_name", "status_id"); txtStatusEdit.SelectedIndex = txtStatusEdit.Items.IndexOf(txtStatusEdit.Items.FindByValue((string)DataBinder.Eval(e.Row.DataItem, "status_id").ToString())); } } }