public EmployeeData LoginDomain([FromBody] JObject LogInData)
        {
            EmployeeData authenRs = null;

            try
            {
                LDAPHelper authen = new LDAPHelper(WebConfigurationManager.AppSettings["ADDomainName"]
                                                   , WebConfigurationManager.AppSettings["ADIPAddress"]
                                                   , Convert.ToInt32(WebConfigurationManager.AppSettings["ADPort"]));

                authenRs = authen.Authenticate(LogInData["username"].ToString(), LogInData["password"].ToString());
            }
            catch (Exception e)
            {
                if (authenRs != null)
                {
                    authenRs.Result  = false;
                    authenRs.Message = e.Message;
                    return(authenRs);
                }
                else
                {
                    authenRs         = new EmployeeData();
                    authenRs.Result  = false;
                    authenRs.Message = e.Message;
                    return(authenRs);
                }
            }

            if (authenRs.Result == true)
            {
                UserLogSvr svr = ServiceContainer.GetService <UserLogSvr>();
                try
                {
                    svr.EmployeeActivityLog(authenRs.EmployeeID, "LOGIN");
                    var         header = ServiceContainer.GetService <PesWeb.Service.Modules.EvaManage>();
                    tblEmployee emp    = header.getEmployees().Where(a => a.EmployeeNo.Trim() == authenRs.EmployeeID.Trim()).FirstOrDefault();
                    authenRs.positionNo = (emp != null)?(int)emp.PositionNo:0;
                }
                catch (Exception e)
                {
                    authenRs.Result  = false;
                    authenRs.Message = e.Message;
                    return(authenRs);
                }
            }


            return(authenRs);
        }
        public EmployeeData LoginDomain([FromBody] JObject LogInData)
        {
            EmployeeData authenRs = null;

            try
            {
                LDAPHelper authen = new LDAPHelper(WebConfigurationManager.AppSettings["ADDomainName"]
                                                   , WebConfigurationManager.AppSettings["ADIPAddress"]
                                                   , Convert.ToInt32(WebConfigurationManager.AppSettings["ADPort"]));

                authenRs = authen.Authenticate(LogInData["username"].ToString(), LogInData["password"].ToString());
            }
            catch (Exception e)
            {
                if (authenRs != null)
                {
                    authenRs.Result  = false;
                    authenRs.Message = e.Message;
                    return(authenRs);
                }
                else
                {
                    authenRs         = new EmployeeData();
                    authenRs.Result  = false;
                    authenRs.Message = e.Message;
                    return(authenRs);
                }
            }

            if (authenRs.Result == true)
            {
                UserLogSvr svr = ServiceContainer.GetService <UserLogSvr>();
                try
                {
                    svr.EmployeeActivityLog(authenRs.EmployeeID, "LOGIN");
                }
                catch (Exception e)
                {
                    authenRs.Result  = false;
                    authenRs.Message = e.Message;
                    return(authenRs);
                }
            }
            return(authenRs);
        }