Example #1
0
 private int initializeUser()
 {
     try
     {
         Core.User.UserCore objUserCore = new Core.User.UserCore(ConnectionStringAppKey);
         using (objUserCore as IDisposable)
         {
             objUserCoreEntity = objUserCore.GetByLoginID(_strLoggedInID);
         }
         objUserCore      = null;
         _objLoggedInUser = this;
         Core.BasicInfo.BasicInfoCore objBasicInfoCore = new BasicInfo.BasicInfoCore(ref _objLoggedInUser);
         using (objBasicInfoCore as IDisposable)
             objBasicInfoCoreEntity = objBasicInfoCore.GetByProfileID(_strLoggedInID);
         objBasicInfoCore = null;
         if (objUserCoreEntity.SangamID != null)
         {
             Core.Sangam.SangamCore objSangamCore = new Sangam.SangamCore(this.ConnectionStringAppKey);
             using (objSangamCore as IDisposable)
             {
                 objSangamCoreEntity = objSangamCore.GetByID(objUserCoreEntity.SangamID);
             }
             objSangamCore = null;
         }
         else
         {
             return(-1);
         }
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return(0);
 }
Example #2
0
        public int GetAll(ref List <UserCoreEntity> objUserCoreEntityList)
        {
            IUnitOfWork objIUnitOfWork = new UnitOfWork(_ConnectionStringAppKey);

            try
            {
                using (objIUnitOfWork as IDisposable)
                {
                    foreach (Mugurtham.DTO.User.User objSangam in objIUnitOfWork.RepositoryUser.GetAll().ToList())
                    {
                        Mugurtham.DTO.User.User _objSangam = objSangam;
                        using (_objSangam as IDisposable)
                        {
                            UserCoreEntity objUserCoreEntity = new UserCoreEntity();
                            using (objUserCoreEntity as IDisposable)
                            {
                                AssignEntityFromDTO(ref _objSangam, ref objUserCoreEntity);
                                Sangam.SangamCore objSangamCore = new Sangam.SangamCore(_ConnectionStringAppKey);
                                using (objSangamCore as IDisposable)
                                {
                                    Sangam.SangamCoreEntity objSangamCoreEntity = new Sangam.SangamCoreEntity();
                                    using (objSangamCoreEntity as IDisposable)
                                    {
                                        objSangamCoreEntity          = objSangamCore.GetByID(objUserCoreEntity.SangamID);
                                        objUserCoreEntity.SangamName = objSangamCoreEntity.Name;
                                    }
                                    objSangamCoreEntity = null;
                                }
                                objSangamCore = null;
                                objUserCoreEntityList.Add(objUserCoreEntity);
                            }
                            objUserCoreEntity = null;
                        }
                        _objSangam = null;
                    }
                }
            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            return(0);
        }
Example #3
0
 public int getLookup(ref LookupEntity objLookupEntity)
 {
     try
     {
         List<Mugurtham.Core.Sangam.SangamCoreEntity> objSangamCoreEntityList = new List<Sangam.SangamCoreEntity>();
         List<Mugurtham.Core.Role.RoleCoreEntity> objRoleCoreEntityList = new List<Role.RoleCoreEntity>();
         Mugurtham.Core.Sangam.SangamCore objSangamCore = new Sangam.SangamCore();
         using (objSangamCore as IDisposable)
             objSangamCore.GetAll(ref objSangamCoreEntityList);
         objSangamCore = null;
         Mugurtham.Core.Role.RoleCore objRoleCore = new Role.RoleCore();
         using (objRoleCore as IDisposable)
             objRoleCore.GetAll(ref objRoleCoreEntityList);
         objRoleCore = null;
         objLookupEntity.RoleCoreEntity = objRoleCoreEntityList;
         objLookupEntity.SangamCoreEntity = objSangamCoreEntityList;
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return 0;
 }
Example #4
0
 public int getLookup(ref LookupEntity objLookupEntity)
 {
     try
     {
         List <Mugurtham.Core.Sangam.SangamCoreEntity> objSangamCoreEntityList = new List <Sangam.SangamCoreEntity>();
         List <Mugurtham.Core.Role.RoleCoreEntity>     objRoleCoreEntityList   = new List <Role.RoleCoreEntity>();
         Mugurtham.Core.Sangam.SangamCore objSangamCore = new Sangam.SangamCore(_objLoggedInUser.ConnectionStringAppKey);
         using (objSangamCore as IDisposable)
             objSangamCore.GetAll(ref objSangamCoreEntityList);
         objSangamCore = null;
         Mugurtham.Core.Role.RoleCore objRoleCore = new Role.RoleCore(ref _objLoggedInUser);
         using (objRoleCore as IDisposable)
             objRoleCore.GetAll(ref objRoleCoreEntityList);
         objRoleCore = null;
         objLookupEntity.RoleCoreEntity   = objRoleCoreEntityList;
         objLookupEntity.SangamCoreEntity = objSangamCoreEntityList;
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return(0);
 }
Example #5
0
        /*========================================================================================================*/
        /*BUSINESS FUNCTIONS - APART CRUD*/
        /*========================================================================================================*/
        public int validateLogin(ref Mugurtham.Core.User.UserCoreEntity objUserCoreEntity, out bool boolLogin)
        {
            /*
             1 -> Success
             2 -> Invalid User
             3 -> Invalid Password
             4 -> DeActivated Sangam
             5 -> DeActivated Profile
             */
            int intLoginStatus = 0;
            boolLogin = false;

            try
            {
                Mugurtham.Core.User.UserCoreEntity _objUserCoreEntity = null;
                _objUserCoreEntity = GetByLoginID(objUserCoreEntity.LoginID);
                if (_objUserCoreEntity.LoginID == null)
                {
                    intLoginStatus = 2;
                    objUserCoreEntity.LoginStatus = "2";
                    return intLoginStatus;
                }
                // Validate if Sangam is activated
                Sangam.SangamCore objSangamCore = new Sangam.SangamCore();
                using (objSangamCore as IDisposable)
                {
                    Sangam.SangamCoreEntity objSangamCoreEntity = new Sangam.SangamCoreEntity();
                    using (objSangamCoreEntity as IDisposable)
                    {
                        objSangamCoreEntity = objSangamCore.GetByID(_objUserCoreEntity.SangamID);
                        if (objSangamCoreEntity.IsActivated == "0")
                        {
                            intLoginStatus = 4;
                            objUserCoreEntity.LoginStatus = "4";
                        }
                    }
                    objSangamCoreEntity = null;
                }
                objSangamCore = null;
                if (intLoginStatus == 4)
                    return intLoginStatus;
                // Validate if User is activated
                if (_objUserCoreEntity.IsActivated == "0")
                {
                    intLoginStatus = 5;
                    objUserCoreEntity.LoginStatus = "5";
                    return intLoginStatus;
                }
                //Validate if loginid and password matches
                if (_objUserCoreEntity.Password.Trim() == Helpers.EncodePasswordToBase64(objUserCoreEntity.Password.Trim()))
                {
                    intLoginStatus = 1;
                    _objUserCoreEntity.LoginStatus = "1";
                    objUserCoreEntity = _objUserCoreEntity;
                    boolLogin = true;
                }
                else
                {
                    intLoginStatus = 3;
                    objUserCoreEntity.LoginStatus = "3";
                }
            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            return intLoginStatus;
        }
Example #6
0
 public int GetAllSangamUsers(ref List<UserCoreEntity> objUserCoreEntityList, string strSangamID)
 {
     try
     {
         IUnitOfWork objIUnitOfWork = new UnitOfWork();
         using (objIUnitOfWork as IDisposable)
         {
             foreach (Mugurtham.DTO.User.User objSangam in objIUnitOfWork.RepositoryUser.GetAll().Where(p => p.SangamID == strSangamID).ToList())
             {
                 Mugurtham.DTO.User.User _objSangam = objSangam;
                 using (_objSangam as IDisposable)
                 {
                     UserCoreEntity objUserCoreEntity = new UserCoreEntity();
                     using (objUserCoreEntity as IDisposable)
                     {
                         AssignEntityFromDTO(ref _objSangam, ref objUserCoreEntity);
                         Sangam.SangamCore objSangamCore = new Sangam.SangamCore();
                         using (objSangamCore as IDisposable)
                         {
                             Sangam.SangamCoreEntity objSangamCoreEntity = new Sangam.SangamCoreEntity();
                             using (objSangamCoreEntity as IDisposable)
                             {
                                 objSangamCoreEntity = objSangamCore.GetByID(objUserCoreEntity.SangamID);
                                 objUserCoreEntity.SangamName = objSangamCoreEntity.Name;
                             }
                             objSangamCoreEntity = null;
                         }
                         objSangamCore = null;
                         objUserCoreEntityList.Add(objUserCoreEntity);
                     }
                     objUserCoreEntity = null;
                 }
                 _objSangam = null;
             }
         }
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     return 0;
 }
Example #7
0
        /*========================================================================================================*/
        /*BUSINESS FUNCTIONS - APART CRUD*/
        /*========================================================================================================*/
        public int validateLogin(ref Mugurtham.Core.User.UserCoreEntity objUserCoreEntity, out bool boolLogin)
        {
            /*
             * 1 -> Success
             * 2 -> Invalid User
             * 3 -> Invalid Password
             * 4 -> DeActivated Sangam
             * 5 -> DeActivated Profile
             * 6 -> Connection Timed Out
             * 7 -> Payment Subscription expired
             */
            int intLoginStatus = 0;

            boolLogin = false;

            try
            {
                Mugurtham.Core.User.UserCoreEntity _objUserCoreEntity = null;
                _objUserCoreEntity             = GetByLoginID(objUserCoreEntity.LoginID);
                _objUserCoreEntity.CommunityID = objUserCoreEntity.CommunityID;
                if (_objUserCoreEntity.PaymentDate != null)
                {
                    if (DateTime.Today >= _objUserCoreEntity.PaymentDate.Value.AddMonths(6))
                    {
                        Helpers.LogMessageInFlatFile(_objUserCoreEntity.PaymentDate + "<====== Payment Date");
                        Helpers.LogMessageInFlatFile(_objUserCoreEntity.PaymentDate.Value.AddMonths(6).ToString() + "<======Added Date");
                        Helpers.LogMessageInFlatFile(DateTime.Today.ToString() + "<======Added Date");
                        intLoginStatus = 7;
                        return(intLoginStatus);
                    }
                }
                if (_objUserCoreEntity.LoginStatus == "6")
                {
                    intLoginStatus = 6;
                    return(intLoginStatus);
                }
                if (_objUserCoreEntity.LoginID == null)
                {
                    intLoginStatus = 2;
                    objUserCoreEntity.LoginStatus = "2";
                    return(intLoginStatus);
                }
                // Validate if Sangam is activated
                Sangam.SangamCore objSangamCore = new Sangam.SangamCore(_ConnectionStringAppKey);
                using (objSangamCore as IDisposable)
                {
                    Sangam.SangamCoreEntity objSangamCoreEntity = new Sangam.SangamCoreEntity();
                    using (objSangamCoreEntity as IDisposable)
                    {
                        objSangamCoreEntity = objSangamCore.GetByID(_objUserCoreEntity.SangamID);
                        if (objSangamCoreEntity.IsActivated == "0")
                        {
                            intLoginStatus = 4;
                            objUserCoreEntity.LoginStatus = "4";
                        }
                    }
                    objSangamCoreEntity = null;
                }
                objSangamCore = null;
                // Validate Connection Timed Out - Server connectivity
                if (_objUserCoreEntity.LoginStatus == "6")
                {
                    intLoginStatus = 6;
                    return(intLoginStatus);
                }
                if (intLoginStatus == 4)
                {
                    return(intLoginStatus);
                }
                // Validate if User is activated
                if (_objUserCoreEntity.IsActivated == "0")
                {
                    intLoginStatus = 5;
                    objUserCoreEntity.LoginStatus = "5";
                    return(intLoginStatus);
                }
                //Validate if loginid and password matches
                if (_objUserCoreEntity.Password.Trim() == Helpers.EncodePasswordToBase64(objUserCoreEntity.Password.Trim()))
                {
                    intLoginStatus = 1;
                    _objUserCoreEntity.LoginStatus = "1";
                    objUserCoreEntity = _objUserCoreEntity;
                    boolLogin         = true;
                }
                else
                {
                    intLoginStatus = 3;
                    objUserCoreEntity.LoginStatus = "3";
                }
            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            return(intLoginStatus);
        }