Exemplo n.º 1
0
        public CODashboardDTO GetDashboardDetails(string i_sConnectionString, int nLoggedInUserId)
        {
            CODashboardDTO objCODashboardDTO = new CODashboardDTO();

            try
            {
                //CODashboardDAL objCODashboardDAL = new CODashboardDAL();
                using (var objCODashboardDAL = new CODashboardDAL())
                {
                    objCODashboardDTO = objCODashboardDAL.GetDashboardDetails(i_sConnectionString, nLoggedInUserId);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
            return(objCODashboardDTO);
        }
Exemplo n.º 2
0
        public ActionResult Index(int acid)
        {
            int RequiredModuleID = 0;
            LoginUserDetails objLoginUserDetails = null;

            CODashboardDTO            objInsiderDashboardDTO   = null;
            PasswordExpiryReminderDTO objPassExpiryReminderDTO = null;
            DateTime  CurrentDate;
            ArrayList lst = new ArrayList();
            UserPolicyDocumentEventLogDTO objChangePasswordEventLogDTO = null;
            int noOfDays = 0;

            Common.Common.WriteLogToFile("Start Method", System.Reflection.MethodBase.GetCurrentMethod());

            try
            {
                objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails);

                // check IsUserLogin flag in session, and set flag true -- this will indicate user is login and redirect here for first time
                if (!objLoginUserDetails.IsUserLogin)
                {
                    objLoginUserDetails.IsUserLogin = true;

                    Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);
                }

                objInsiderDashboardModel = new CODashboardModel();
                using (var objInsiderInitialDisclosureSL = new InsiderInitialDisclosureSL())
                {
                    InsiderInitialDisclosureDTO objInsiderInitialDisclosureDTO = null;
                    objInsiderInitialDisclosureDTO = objInsiderInitialDisclosureSL.Get_mst_company_details(objLoginUserDetails.CompanyDBConnectionString);
                    RequiredModuleID = objInsiderInitialDisclosureDTO.RequiredModule;
                }

                ViewBag.UserTypeCodeId = objLoginUserDetails.UserTypeCodeId;
                objInsiderDashboardModel.objCODashboardModel_OS = new CODashboardModel_OS();
                switch (RequiredModuleID)
                {
                case ConstEnum.Code.RequiredModuleOwnSecurity:
                    ViewBag.RequiredModuleOwn   = true;
                    ViewBag.RequiredModuleBoth  = false;
                    ViewBag.RequiredModuleOther = false;
                    break;

                case ConstEnum.Code.RequiredModuleOtherSecurity:
                    ViewBag.RequiredModuleOwn   = false;
                    ViewBag.RequiredModuleBoth  = false;
                    ViewBag.RequiredModuleOther = true;
                    objInsiderDashboardModel.objCODashboardModel_OS = BindCODashboardForOtherSecurities();

                    break;

                case ConstEnum.Code.RequiredModuleBoth:
                    ViewBag.RequiredModuleOwn   = true;
                    ViewBag.RequiredModuleBoth  = true;
                    ViewBag.RequiredModuleOther = true;
                    objInsiderDashboardModel.objCODashboardModel_OS = BindCODashboardForOtherSecurities();
                    break;
                }


                using (CODashboardSL objInsiderDashboardSL = new CODashboardSL())
                {
                    objInsiderDashboardDTO = objInsiderDashboardSL.GetDashboardDetails(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID);

                    Common.Common.CopyObjectPropertyByName(objInsiderDashboardDTO, objInsiderDashboardModel);
                }
                using (InsiderDashboardSL objInsiderDashboardSL = new InsiderDashboardSL())
                {
                    CurrentDate = Convert.ToDateTime(DateTime.Now.Date.ToString("dd/MM/yyyy"), System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);
                    objPassExpiryReminderDTO = objInsiderDashboardSL.GetPasswordExpiryReminder(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID);
                    if (objLoginUserDetails.LoggedInUserID == objPassExpiryReminderDTO.UserID &&
                        objPassExpiryReminderDTO.ValidityDate.Date >= CurrentDate &&
                        objPassExpiryReminderDTO.ExpiryReminderDate.Date <= CurrentDate)
                    {
                        if ((objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days == 1)
                        {
                            noOfDays = (objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days;
                        }
                        else
                        {
                            noOfDays = (objPassExpiryReminderDTO.ValidityDate.Date - CurrentDate.Date).Days + 1;
                        }
                        lst.Add(noOfDays);
                        lst.Add(objPassExpiryReminderDTO.ValidityDate.Date.ToString("dd/MM/yyyy"));
                        ViewBag.PasswordReminderMsg = Common.Common.getResource("pc_msg_50569", lst);
                    }
                    else if (objPassExpiryReminderDTO.ValidityDate.Date < CurrentDate)
                    {
                        Common.Common.SetSessionValue("IsChangePassword", true);
                        return(RedirectToAction("ChangePassword", "UserDetails", new { acid = Convert.ToString(Common.ConstEnum.UserActions.CHANGE_PASSWORD) }));
                    }
                }
            }
            catch (Exception exp)
            {
                Common.Common.WriteLogToFile("Exception occurred ", System.Reflection.MethodBase.GetCurrentMethod(), exp);
            }
            finally
            {
                objLoginUserDetails = null;
            }

            Common.Common.WriteLogToFile("End Method", System.Reflection.MethodBase.GetCurrentMethod());

            return(View(objInsiderDashboardModel));
        }