using ERP.Common; using ERP.Dal.Implemention; using ERP.Dal.Interface; using ERP.Helpers; using ERP.Model; using System; using System.Collections.Generic; using System.Web.UI; using System.Web.UI.WebControls; namespace ERP.Modules.BioMetricDevice.Employee { public partial class EmployeeList : System.Web.UI.Page { #region Variables private readonly log4net.ILog _Logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); IEmployeeService _IEmployeeService = new EmployeeService(); #endregion #region Page Events protected void Page_Load(object sender, EventArgs e) { if (SessionHelper.SessionDetail == null) { Response.Redirect("~/Modules/Login.aspx", true); } SessionHelper.SelectMenuSession = "liDeviceEmployee_liBioMetricDevice"; if (!IsPostBack) { if (!string.IsNullOrEmpty(SessionHelper.MessageSession)) { ScriptManager.RegisterStartupScript(this, typeof(Page), "SaveSuccessMsg", "$(document).ready(function() {Common.ShowToastrMessage(Common.Variable.Success, Common.Variable.Success, '" + SessionHelper.MessageSession + "');});", true); SessionHelper.RemoveMessageSession(); } } } #endregion #region Events protected void gvEmployee_PreRender(object sender, EventArgs e) { try { Result> _Result = _IEmployeeService.GetAllDeviceEmployeeList(); if (_Result.IsSuccess) { gvEmployee.DataSource = _Result.Data; gvEmployee.DataBind(); if (gvEmployee.Rows.Count > 0) { gvEmployee.UseAccessibleHeader = true; gvEmployee.HeaderRow.TableSection = TableRowSection.TableHeader; } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "GetFailMsg", " $(document).ready(function() {Common.ShowToastrMessage(Common.Variable.Error, Common.Variable.Error, '" + _Result.Message + "');});", true); } } catch (Exception _Exception) { _Logger.Error(GlobalMsg.ExceptionErrMsg, _Exception); ScriptManager.RegisterStartupScript(this, typeof(Page), "ExceptionMsg", " $(document).ready(function() {Common.ShowToastrMessage(Common.Variable.Error, Common.Variable.Error, '" + GlobalMsg.ExceptionErrMsg + "');});", true); } } #endregion } }