private void CheckStateActionHistory() { try { if (string.IsNullOrEmpty(hdfAppraisalStatus.Value.Trim()) || !hdfAppraisalStatus.Value.Trim().Equals("Rejected")) { ActionHistory_Manage hisManage = new ActionHistory_Manage(); List <ActionHistory> lResult = new List <ActionHistory>(); lResult = hisManage.ListActionHistory(hdfEmployeeID.Value.Trim(), DateTime.Now.Year); if (lResult != null && lResult.Count > 0) { string FirstManager = (string.IsNullOrEmpty(hdfFirstManager.Value.Trim()) ? "" : hdfFirstManager.Value.Trim()); string SecondManager = (string.IsNullOrEmpty(hdfSecondManager.Value.Trim()) ? "" : hdfSecondManager.Value.Trim()); foreach (var item in lResult) { string _status = string.IsNullOrWhiteSpace(item.Status) ? "" : item.Status.Trim(); /* Check status of First Manager */ if (item.Responsibility.Trim().Equals("FirstManager") && (_status == "")) { lblFirstManager.ForeColor = System.Drawing.Color.Green; } /* Check status of Seccound Manager */ if (item.Responsibility.Trim().Equals("SecondManager") && (_status == "")) { lblSecondManager.ForeColor = System.Drawing.Color.Green; } } } } else { if (hdfAppraisalStatus.Value.Trim().Equals("Rejected")) { lblFirstManager.ForeColor = System.Drawing.Color.Green; } } } catch (Exception ex) { logger.Error(ex.Message); logger.Error(ex.StackTrace); } }
private void DisableButton() { ActionHistory_Manage manage = new ActionHistory_Manage(); List <ActionHistory> lData = new List <ActionHistory>(); lData = manage.ListActionHistory(hdfEmployeeID.Value.Trim(), DateTime.Now.Year); if (lData != null && lData.Count > 0) { ActionHistory data = lData.Where(c => c.Responsibility == "Creator").FirstOrDefault(); lblCreator.Text = string.IsNullOrEmpty(data.CreatedBy) ? "(Creator)" : data.CreatedBy + " (Creator)"; btnSubmit.Visible = false; } else { lblCreator.Text = "(Creator)"; btnSubmit.Visible = true; } }