Exemple #1
0
        private IViewComponentResult GetHolidayView()
        {
            IViewComponentResult HoldiayView = null;

            // check if it is a holiday and if so use the holiday splash screen
            if (HttpContext.Request.Cookies["ItsAHoliday"] == "true")
            {   // check cookies since it is less expensive then running the holiday service
                var todaysHoliday = HttpContext.Request.Cookies["TodaysHoliday"];

                // TODO - J - create all the holiday splash screen models and functionality
                SplashScreenModel holidaySplashScreen = new SplashScreenModel(true);
                return(View("BirthdaySplashScreen", holidaySplashScreen));
            }
            else
            {
                // check for holidays
                IEnumerable <Holiday> holidays;

                //DateTime dayToCheck = DateTime.Parse("12/12/2020"); // TODO - J - remove once testing is done
                //holidays = _holidayService.GetHolidays(dayToCheck); // TODO - J - remove once testing is done

                holidays = _holidayService.GetHolidays();

                if (holidays.Count() > 0)
                {
                    // TODO - J - create all the holiday splash screen model(s) and functionality
                    SplashScreenModel holidaySplashScreen = new SplashScreenModel(true);
                    HoldiayView = View("HolidaySplashScreen", holidaySplashScreen);
                }
            }
            return(HoldiayView);
        }
        private SplashScreenModel ConstructSplashScreenModel(string splashScreenId, string Splashtype, string title, string description, string validFrom, string validTo, string fileName, string saveMode, string mobileAttachmentUrl, string descHtml, bool hasAttachment, int assignToAllUsers, int isCompleted, DateTime lastModifiedDate)
        {
            try
            {
                SplashScreenModel objSplashScreenModel = new SplashScreenModel();

                if (saveMode.Trim().ToUpper() == EDIT)
                {
                    objSplashScreenModel.Splash_Screen_Id = Convert.ToInt32(splashScreenId);
                }
                objSplashScreenModel.Splash_Type            = Splashtype;
                objSplashScreenModel.Title                  = title;
                objSplashScreenModel.Description            = description;
                objSplashScreenModel.Date_From              = Convert.ToDateTime(validFrom.Split('/')[2] + "-" + validFrom.Split('/')[1] + "-" + validFrom.Split('/')[0]);
                objSplashScreenModel.Date_To                = Convert.ToDateTime(validTo.Split('/')[2] + "-" + validTo.Split('/')[1] + "-" + validTo.Split('/')[0]);
                objSplashScreenModel.File_Path              = fileName;
                objSplashScreenModel.Mobile_Attachment_Url  = mobileAttachmentUrl;
                objSplashScreenModel.Description_HTML       = descHtml;
                objSplashScreenModel.Has_Attachment         = hasAttachment;
                objSplashScreenModel.Assigned_To_All_Users  = assignToAllUsers;
                objSplashScreenModel.Is_Completed           = isCompleted;
                objSplashScreenModel.Last_Modified_DateTime = lastModifiedDate;

                return(objSplashScreenModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
        public IViewComponentResult Invoke()
        {
            // first check if it is the current users birthday and if so use the birthday splash screen
            // because birthdays take priority
            IViewComponentResult BirthdayView = GetBirthdayView();

            if (BirthdayView != null)
            {
                return(BirthdayView);
            }

            // check if it is a holiday and if so use the holiday splash screen
            IViewComponentResult HolidayView = GetHolidayView();

            if (HolidayView != null)
            {
                return(HolidayView);
            }

            // or just show the regular splash screen
            bool showSplashScreen = HttpContext.Request.Cookies["HideSplashScreen"] == null;
            SplashScreenModel splashScreenLoader = new SplashScreenModel(showSplashScreen);

            return(View("Default", splashScreenLoader));
            //return View(splashScreenLoader);
        }
        public string GetSplashScreenDataForEdit(string splashScreenId)
        {
            try
            {
                string            companyCode          = GetCompanyCode();
                SplashScreenModel objSplashScreenModel = new SplashScreenModel();
                JSONConverter     objJSON = new JSONConverter();

                objSplashScreenModel = _objDALSplashScreen.GetSplashScreenDataForEdit(companyCode, Convert.ToInt32(splashScreenId));

                return(objJSON.Serialize(objSplashScreenModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        public int CheckOverlappingSplashScreenData(string companyCode, SplashScreenModel objSplashScreenModel)
        {
            try
            {
                SqlCommand command = new SqlCommand(SP_SC_CHECK_OVERLAPPING_SPLASH);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@Date_From", ParameterDirection.Input, SqlDbType.Date, 30, objSplashScreenModel.Date_From);
                _objSPData.AddParamToSqlCommand(command, "@Date_To", ParameterDirection.Input, SqlDbType.Date, 30, objSplashScreenModel.Date_To);

                int count = _objData.GetIntegerValue(companyCode, command);

                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #6
0
        public int InsertSplashScreenData(string companyCode, SplashScreenModel objSplashScreenModel)
        {
            int result = 0;

            try
            {
                SqlCommand command = new SqlCommand(SP_SC_INSERT_SPLASH_SCREEN_DATA);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@Splash_Type", ParameterDirection.Input, SqlDbType.VarChar, 150, objSplashScreenModel.Splash_Type);
                _objSPData.AddParamToSqlCommand(command, "@Title", ParameterDirection.Input, SqlDbType.VarChar, 150, objSplashScreenModel.Title);
                _objSPData.AddParamToSqlCommand(command, "@Description", ParameterDirection.Input, SqlDbType.VarChar, 1000, objSplashScreenModel.Description);
                _objSPData.AddParamToSqlCommand(command, "@File_Path", ParameterDirection.Input, SqlDbType.VarChar, 250, objSplashScreenModel.File_Path);
                _objSPData.AddParamToSqlCommand(command, "@Date_From", ParameterDirection.Input, SqlDbType.Date, 30, objSplashScreenModel.Date_From);
                _objSPData.AddParamToSqlCommand(command, "@Date_To", ParameterDirection.Input, SqlDbType.Date, 30, objSplashScreenModel.Date_To);
                _objSPData.AddParamToSqlCommand(command, "@Has_Attachment", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Has_Attachment);
                _objSPData.AddParamToSqlCommand(command, "@Mobile_Attachment_Url", ParameterDirection.Input, SqlDbType.VarChar, 250, objSplashScreenModel.Mobile_Attachment_Url);
                _objSPData.AddParamToSqlCommand(command, "@Assigned_To_All_Users", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Assigned_To_All_Users);
                _objSPData.AddParamToSqlCommand(command, "@Is_Completed", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Is_Completed);
                _objSPData.AddParamToSqlCommand(command, "@Last_Modified_DateTime", ParameterDirection.Input, SqlDbType.DateTime, 20, objSplashScreenModel.Last_Modified_DateTime);
                _objSPData.AddParamToSqlCommand(command, "@Description_HTML", ParameterDirection.Input, SqlDbType.VarChar, -1, objSplashScreenModel.Description_HTML);
                SqlParameter returnValue = new SqlParameter("@Result", SqlDbType.Int);
                returnValue.Direction = ParameterDirection.Output;
                returnValue.Size      = 500;
                returnValue.Value     = "";
                command.Parameters.Add(returnValue);
                _objData.OpenConnection(companyCode);
                _objData.ExecuteNonQuery(command);
                result = Convert.ToInt32(returnValue.Value);
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Exemple #7
0
        public bool UpdateSplashScreenData(string companyCode, SplashScreenModel objSplashScreenModel)
        {
            try
            {
                SqlCommand command = new SqlCommand(SP_SC_UPDATE_SPLASH_SCREEN_DATA);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@Splash_Screen_Id", ParameterDirection.Input, SqlDbType.Int, 30, objSplashScreenModel.Splash_Screen_Id);
                _objSPData.AddParamToSqlCommand(command, "@Splash_Type", ParameterDirection.Input, SqlDbType.VarChar, 150, objSplashScreenModel.Splash_Type);
                _objSPData.AddParamToSqlCommand(command, "@Title", ParameterDirection.Input, SqlDbType.VarChar, 150, objSplashScreenModel.Title);
                _objSPData.AddParamToSqlCommand(command, "@Description", ParameterDirection.Input, SqlDbType.VarChar, 1000, objSplashScreenModel.Description);
                _objSPData.AddParamToSqlCommand(command, "@File_Path", ParameterDirection.Input, SqlDbType.VarChar, 250, objSplashScreenModel.File_Path);
                _objSPData.AddParamToSqlCommand(command, "@Date_From", ParameterDirection.Input, SqlDbType.Date, 30, objSplashScreenModel.Date_From);
                _objSPData.AddParamToSqlCommand(command, "@Date_To", ParameterDirection.Input, SqlDbType.Date, 30, objSplashScreenModel.Date_To);
                _objSPData.AddParamToSqlCommand(command, "@Has_Attachment", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Has_Attachment);
                _objSPData.AddParamToSqlCommand(command, "@Mobile_Attachment_Url", ParameterDirection.Input, SqlDbType.VarChar, 250, objSplashScreenModel.Mobile_Attachment_Url);
                _objSPData.AddParamToSqlCommand(command, "@Assigned_To_All_Users", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Assigned_To_All_Users);
                _objSPData.AddParamToSqlCommand(command, "@Is_Completed", ParameterDirection.Input, SqlDbType.Int, 4, objSplashScreenModel.Is_Completed);
                _objSPData.AddParamToSqlCommand(command, "@Last_Modified_DateTime", ParameterDirection.Input, SqlDbType.DateTime, 20, objSplashScreenModel.Last_Modified_DateTime);
                _objSPData.AddParamToSqlCommand(command, "@Description_HTML", ParameterDirection.Input, SqlDbType.VarChar, -1, objSplashScreenModel.Description_HTML);

                _objData.OpenConnection(companyCode);
                _objData.ExecuteNonQuery(command);

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Exemple #8
0
        public SplashScreenModel GetSplashScreenDataForEdit(string companyCode, int splashScreenId)
        {
            SqlConnection objSqlConnection = new SqlConnection();

            try
            {
                objSqlConnection = _objData.GetConnectionObject(companyCode);

                SqlCommand command = new SqlCommand(SP_SC_GET_SPLASH_SCREEN_DATA_FOR_EDIT);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@Splash_Screen_Id", ParameterDirection.Input, SqlDbType.Int, 30, splashScreenId);

                SplashScreenModel objSplashScreenModel = new SplashScreenModel();

                objSqlConnection.Open();

                command.Connection = objSqlConnection;

                using (SqlDataReader sqlReader = command.ExecuteReader())
                {
                    if (sqlReader.HasRows)
                    {
                        while (sqlReader.Read())
                        {
                            objSplashScreenModel = new SplashScreenModel();

                            objSplashScreenModel.Splash_Screen_Id      = Convert.ToInt32(sqlReader["Splash_Screen_Id"].ToString().Trim());
                            objSplashScreenModel.Splash_Type           = sqlReader["Splash_Type"].ToString().Trim();
                            objSplashScreenModel.Title                 = sqlReader["Title"].ToString().Trim();
                            objSplashScreenModel.Description           = sqlReader["Description"].ToString().Trim();
                            objSplashScreenModel.File_Path             = sqlReader["File_Path"].ToString().Trim();
                            objSplashScreenModel.Date_From             = Convert.ToDateTime(sqlReader["Date_From"].ToString().Trim());
                            objSplashScreenModel.Date_To               = Convert.ToDateTime(sqlReader["Date_To"].ToString().Trim());
                            objSplashScreenModel.Record_Status         = Convert.ToBoolean(sqlReader["Record_Status"].ToString().Trim());
                            objSplashScreenModel.Mobile_Attachment_Url = Convert.ToString(sqlReader["Mobile_Attachment_Url"].ToString().Trim());
                            objSplashScreenModel.Description_HTML      = Convert.ToString(sqlReader["Description_HTML"]).Trim();
                            objSplashScreenModel.Has_Attachment        = Convert.ToBoolean(sqlReader["Has_Attachment"].ToString().Trim());
                            objSplashScreenModel.Company_Code          = companyCode.ToLower();


                            if (Convert.ToBoolean(sqlReader["Record_Status"].ToString().Trim()) == true)
                            {
                                objSplashScreenModel.Record_Status_Display_Name = Active;
                            }
                            else
                            {
                                objSplashScreenModel.Record_Status_Display_Name = Inactive;
                            }
                        }
                    }
                }

                return(objSplashScreenModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objSqlConnection.Close();
            }
        }