Exemplo n.º 1
0
        public List<API.LABURNUM.COM.LoginActivity> GetClassByAdvanceSearch(DTO.LABURNUM.COM.LoginActivityModel model)
        {
            IQueryable<API.LABURNUM.COM.LoginActivity> iQuery = null;
            if (model.LoginActivityId > 0)
            {
                iQuery = this._laburnum.LoginActivities.Where(x => x.LoginActivityId == model.LoginActivityId && x.IsActive == true);
            }
            if (iQuery != null)
            {
                if (model.StudentId > 0)
                {
                    iQuery = iQuery.Where(x => x.StudentId == model.StudentId && x.IsActive == true);
                }
            }
            else
            {
                if (model.StudentId > 0)
                {
                    iQuery = this._laburnum.LoginActivities.Where(x => x.StudentId == model.StudentId && x.IsActive == true);
                }
            }

            List<API.LABURNUM.COM.LoginActivity> dbLoginActivities = iQuery.ToList();
            return dbLoginActivities;
        }
Exemplo n.º 2
0
 public void Update(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         new FrontEndApi.LoginActivityApi().Update(model);
     }
 }
Exemplo n.º 3
0
 public void Update(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     model.LoginActivityId.TryValidate();
     IQueryable<API.LABURNUM.COM.LoginActivity> iQuery = this._laburnum.LoginActivities.Where(x => x.LoginActivityId == model.LoginActivityId && x.IsActive == true);
     List<API.LABURNUM.COM.LoginActivity> dbLoginActivities = iQuery.ToList();
     if (dbLoginActivities.Count == 0) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.NO_RECORD_FOUND); }
     if (dbLoginActivities.Count > 1) { throw new Exception(API.LABURNUM.COM.Component.Constants.ERRORMESSAGES.MORE_THAN_ONE_RECORDFOUND); }
     dbLoginActivities[0].LogoutAt = model.LogoutAt;
     dbLoginActivities[0].LastUpdated = System.DateTime.Now;
     this._laburnum.SaveChanges();
 }
Exemplo n.º 4
0
 public List <DTO.LABURNUM.COM.LoginActivityModel> SearchClassByAdvanceSearch(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new LoginActivityHelper(new FrontEndApi.LoginActivityApi().GetClassByAdvanceSearch(model)).Map());
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 5
0
 public long Add(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         return(new FrontEndApi.LoginActivityApi().Add(model));
     }
     else
     {
         return(-1);
     }
 }
Exemplo n.º 6
0
 public DTO.LABURNUM.COM.SessionModel DoLogin(DTO.LABURNUM.COM.LoginModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         DTO.LABURNUM.COM.SessionModel sessionmodel = new DTO.LABURNUM.COM.SessionModel();
         // model.Password = GetEncryptedPassword(model.Password);
         if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.STUDENT))
         {
             DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel()
             {
                 StudentUserName = model.UserName, StudentPassword = model.Password, ApiClientModel = model.ApiClientModel, IsStudentLogin = true
             };
             sessionmodel.StudentModel  = new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel);
             sessionmodel.LoginByUserId = sessionmodel.StudentModel.StudentId;
             sessionmodel.LoginBy       = model.LoginBy;
         }
         if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.PARENT))
         {
             DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel()
             {
                 ParentUserName = model.UserName, ParentPassword = model.Password, ApiClientModel = model.ApiClientModel
             };
             sessionmodel.StudentModel  = new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel);
             sessionmodel.LoginByUserId = sessionmodel.StudentModel.StudentId;
             sessionmodel.LoginBy       = model.LoginBy;
         }
         if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.FACULTY))
         {
             DTO.LABURNUM.COM.FacultyModel facultyModel = new DTO.LABURNUM.COM.FacultyModel()
             {
                 UserName = model.UserName, Password = model.Password, ApiClientModel = model.ApiClientModel
             };
             sessionmodel.FacultyModel  = new API.LABURNUM.COM.Controllers.FacultyController().FacultyLogin(facultyModel);
             sessionmodel.LoginByUserId = sessionmodel.FacultyModel.FacultyId;
             sessionmodel.LoginBy       = sessionmodel.FacultyModel.UserTypeId;
         }
         API.LABURNUM.COM.AcademicYearTable acy = new FrontEndApi.AcademicYearTableApi().GetAcademicYearByYear(new Component.Utility().GetISTDateTime().Year);
         sessionmodel.AcademicYear   = acy.AcademicYear;
         sessionmodel.AcademicYearId = acy.AcademicYearTableId;
         sessionmodel.LastLoginAt    = new FrontEndApi.LoginActivityApi().GetLastLogin(sessionmodel.LoginByUserId, sessionmodel.LoginBy);
         DTO.LABURNUM.COM.LoginActivityModel lmodel = new DTO.LABURNUM.COM.LoginActivityModel()
         {
             UserTypeId = sessionmodel.LoginBy, StudentId = sessionmodel.LoginByUserId, ClientId = new FrontEndApi.ApiClientApi().GetClientId(model.ApiClientModel.UserName, model.ApiClientModel.Password)
         };
         sessionmodel.LoginActivityId = new FrontEndApi.LoginActivityApi().Add(lmodel);
         return(sessionmodel);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 7
0
 private long AddLoginActivity(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     API.LABURNUM.COM.LoginActivity apiLoginActivity = new LoginActivity()
     {
         StudentId = model.StudentId,
         LoginAt = System.DateTime.Now,
         CreatedOn = System.DateTime.Now,
         IsActive = true
     };
     this._laburnum.LoginActivities.Add(apiLoginActivity);
     this._laburnum.SaveChanges();
     return apiLoginActivity.LoginActivityId;
 }
Exemplo n.º 8
0
 private DTO.LABURNUM.COM.LoginActivityModel MapCore(API.LABURNUM.COM.LoginActivity apiLoginActivity)
 {
     DTO.LABURNUM.COM.LoginActivityModel dtoClass = new DTO.LABURNUM.COM.LoginActivityModel()
     {
         LoginActivityId = apiLoginActivity.LoginActivityId,
         LoginAt         = apiLoginActivity.LoginAt,
         LogoutAt        = apiLoginActivity.LogoutAt,
         CreatedOn       = apiLoginActivity.CreatedOn,
         IsActive        = apiLoginActivity.IsActive,
         LastUpdated     = apiLoginActivity.LastUpdated
     };
     return(dtoClass);
 }
Exemplo n.º 9
0
 private long AddLoginActivity(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     API.LABURNUM.COM.LoginActivity apiLoginActivity = new LoginActivity()
     {
         StudentId  = model.StudentId,
         UserTypeId = model.UserTypeId,
         LoginAt    = new Component.Utility().GetISTDateTime(),
         ClientId   = model.ClientId,
         CreatedOn  = new Component.Utility().GetISTDateTime(),
         IsActive   = true
     };
     this._laburnum.LoginActivities.Add(apiLoginActivity);
     this._laburnum.SaveChanges();
     return(apiLoginActivity.LoginActivityId);
 }
Exemplo n.º 10
0
 public dynamic UpdateLoginActivity(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
     {
         if (model.LoginActivityId == 0)
         {
             return(GetApiResponseModel("Login Activity Id Cannot be Zero", true, null));
         }
         new FrontEndApi.LoginActivityApi().Update(model);
         return(GetApiResponseModel("Logout Activity Update SuccessFully", true, null));
     }
     else
     {
         return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null));
     }
 }
Exemplo n.º 11
0
        private DTO.LABURNUM.COM.LoginActivityModel MapCore(API.LABURNUM.COM.LoginActivity apiLoginActivity)
        {
            DTO.LABURNUM.COM.LoginActivityModel dtoClass = new DTO.LABURNUM.COM.LoginActivityModel()
            {
                LoginActivityId = apiLoginActivity.LoginActivityId,
                UserTypeId      = apiLoginActivity.UserTypeId,
                UserTypeText    = apiLoginActivity.UserType.Text,
                LoginAt         = apiLoginActivity.LoginAt,
                LogoutAt        = apiLoginActivity.LogoutAt,
                CreatedOn       = apiLoginActivity.CreatedOn,
                IsActive        = apiLoginActivity.IsActive,
                LastUpdated     = apiLoginActivity.LastUpdated,
                ClientId        = apiLoginActivity.ClientId,
                ClientName      = apiLoginActivity.ApiClient.ClientName,
                StudentId       = apiLoginActivity.StudentId
            };

            dtoClass.UserName = GetUserName(apiLoginActivity);
            return(dtoClass);
        }
Exemplo n.º 12
0
        public List <API.LABURNUM.COM.LoginActivity> GetLoginActivityByAdvanceSearch(DTO.LABURNUM.COM.LoginActivityModel model)
        {
            IQueryable <API.LABURNUM.COM.LoginActivity> iQuery = null;

            //Search By LoginActivityId.
            if (model.LoginActivityId > 0)
            {
                iQuery = this._laburnum.LoginActivities.Where(x => x.LoginActivityId == model.LoginActivityId && x.IsActive == true);
            }

            //Search By Student Id.
            if (iQuery != null)
            {
                if (model.StudentId > 0)
                {
                    iQuery = iQuery.Where(x => x.StudentId == model.StudentId && x.IsActive == true);
                }
            }
            else
            {
                if (model.StudentId > 0)
                {
                    iQuery = this._laburnum.LoginActivities.Where(x => x.StudentId == model.StudentId && x.IsActive == true);
                }
            }

            //Search By User Type Id.
            if (iQuery != null)
            {
                if (model.UserTypeId > 0)
                {
                    iQuery = iQuery.Where(x => x.UserTypeId == model.UserTypeId && x.IsActive == true);
                }
            }
            else
            {
                if (model.UserTypeId > 0)
                {
                    iQuery = this._laburnum.LoginActivities.Where(x => x.UserTypeId == model.UserTypeId && x.IsActive == true);
                }
            }

            //Search By Client Id.
            if (iQuery != null)
            {
                if (model.ClientId > 0)
                {
                    iQuery = iQuery.Where(x => x.ClientId == model.ClientId && x.IsActive == true);
                }
            }
            else
            {
                if (model.ClientId > 0)
                {
                    iQuery = this._laburnum.LoginActivities.Where(x => x.ClientId == model.ClientId && x.IsActive == true);
                }
            }

            //Search By Date Range.
            if (iQuery != null)
            {
                if (model.StartDate.Year != 0001)
                {
                    model.StartDate = new Component.Utility().GetDate(model.StartDate);
                    if (model.EndDate.Year != 0001)
                    {
                        model.EndDate = new Component.Utility().GetDate(model.EndDate).AddDays(1).AddSeconds(-1);
                    }
                    if (model.EndDate.Year == 0001)
                    {
                        model.EndDate = model.StartDate.AddDays(1).AddSeconds(-1);
                    }

                    iQuery = iQuery.Where(x => x.CreatedOn >= model.StartDate && x.CreatedOn <= model.EndDate && x.IsActive == true);
                }
            }
            else
            {
                if (model.StartDate.Year != 0001)
                {
                    model.StartDate = new Component.Utility().GetDate(model.StartDate);

                    if (model.EndDate.Year != 0001)
                    {
                        model.EndDate = new Component.Utility().GetDate(model.EndDate).AddDays(1).AddSeconds(-1);
                    }
                    if (model.EndDate.Year == 0001)
                    {
                        model.EndDate = model.StartDate.AddDays(1).AddSeconds(-1);
                    }

                    if (model.StartDate.Year != 0001)
                    {
                        iQuery = this._laburnum.LoginActivities.Where(x => x.CreatedOn >= model.StartDate && x.CreatedOn <= model.EndDate && x.IsActive == true);
                    }
                }
            }

            List <API.LABURNUM.COM.LoginActivity> dbLoginActivities = iQuery.ToList();

            return(dbLoginActivities);
        }
Exemplo n.º 13
0
 public long Add(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     return(AddValidation(model));
 }
Exemplo n.º 14
0
 private long AddValidation(DTO.LABURNUM.COM.LoginActivityModel model)
 {
     model.StudentId.TryValidate();
     model.ClientId.TryValidate();
     return(AddLoginActivity(model));
 }
Exemplo n.º 15
0
        public dynamic DoLogin(DTO.LABURNUM.COM.LoginModel model)
        {
            if (new FrontEndApi.ApiClientApi().IsClientValid(model.ApiClientModel.UserName, model.ApiClientModel.Password))
            {
                DTO.LABURNUM.COM.SessionModel sessionmodel = new DTO.LABURNUM.COM.SessionModel();
                //model.Password = GetEncryptedPassword(model.Password);
                try
                {
                    if (model.LoginBy == 0)
                    {
                        return(GetApiResponseModel("Login By Cannot Be Null.", false, null));
                    }
                    if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.STUDENT))
                    {
                        if (model.UserName == "" || model.Password == "")
                        {
                            return(GetApiResponseModel("Student UserName Or Password Cannnot Be Blank.", false, null));
                        }

                        DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel()
                        {
                            StudentUserName = model.UserName, StudentPassword = model.Password, ApiClientModel = model.ApiClientModel, IsStudentLogin = true
                        };

                        sessionmodel.StudentModel  = new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel);
                        sessionmodel.LoginByUserId = sessionmodel.StudentModel.StudentId;
                    }
                    if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.PARENT))
                    {
                        if (model.UserName == "" || model.Password == "")
                        {
                            return(GetApiResponseModel("Parent UserName Or Password Cannnot Be Blank.", false, null));
                        }

                        DTO.LABURNUM.COM.StudentModel studentmodel = new DTO.LABURNUM.COM.StudentModel()
                        {
                            ParentUserName = model.UserName, ParentPassword = model.Password, ApiClientModel = model.ApiClientModel
                        };
                        sessionmodel.StudentModel  = new API.LABURNUM.COM.Controllers.StudentController().ParentStudentLogin(studentmodel);
                        sessionmodel.LoginByUserId = sessionmodel.StudentModel.StudentId;
                    }
                    if (model.LoginBy == DTO.LABURNUM.COM.Utility.UserType.GetValue(DTO.LABURNUM.COM.Utility.EnumUserType.FACULTY))
                    {
                        if (model.UserName == "" || model.Password == "")
                        {
                            return(GetApiResponseModel("Faculty UserName Or Password Cannnot Be Blank.", false, null));
                        }

                        DTO.LABURNUM.COM.FacultyModel facultyModel = new DTO.LABURNUM.COM.FacultyModel()
                        {
                            UserName = model.UserName, Password = model.Password, ApiClientModel = model.ApiClientModel
                        };
                        sessionmodel.FacultyModel  = new API.LABURNUM.COM.Controllers.FacultyController().FacultyLogin(facultyModel);
                        sessionmodel.LoginByUserId = sessionmodel.FacultyModel.FacultyId;
                    }

                    sessionmodel.LoginBy = model.LoginBy;
                    API.LABURNUM.COM.AcademicYearTable acy = new FrontEndApi.AcademicYearTableApi().GetAcademicYearByYear(new Component.Utility().GetISTDateTime().Year);
                    sessionmodel.AcademicYear   = acy.AcademicYear;
                    sessionmodel.AcademicYearId = acy.AcademicYearTableId;
                    sessionmodel.LastLoginAt    = new FrontEndApi.LoginActivityApi().GetLastLogin(sessionmodel.LoginByUserId, sessionmodel.LoginBy);
                    DTO.LABURNUM.COM.LoginActivityModel lmodel = new DTO.LABURNUM.COM.LoginActivityModel()
                    {
                        UserTypeId = sessionmodel.LoginBy, StudentId = sessionmodel.LoginByUserId, ClientId = new FrontEndApi.ApiClientApi().GetClientId(model.ApiClientModel.UserName, model.ApiClientModel.Password)
                    };
                    sessionmodel.LoginActivityId = new FrontEndApi.LoginActivityApi().Add(lmodel);
                    return(GetApiResponseModel("SuccessFully Performed", true, sessionmodel));
                }
                catch (Exception ex)
                {
                    return(GetApiResponseModel(ex.Message.ToString(), false, null));
                }
            }
            else
            {
                return(GetApiResponseModel("Api Access User Name or Password Invalid.", false, null));
            }
        }