Exemple #1
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);
        }
Exemple #2
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;
        }
Exemple #3
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;
 }
Exemple #4
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);
        }