Beispiel #1
0
        private void cmbMovieTime_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ManageLoadingDataVisibility(true);

                IEnumerable <Screen> screens = new SeatLayoutConfig().GetScreens(Convert.ToDateTime(dprStartingDate.SelectedDate), Convert.ToInt32((cmbMovieTime.SelectedItem as Movie).Id));

                if (screens == null || screens.Count() == 0)
                {
                    ManageLoadingDataVisibility(false);
                    return;
                }

                Dispatcher.Invoke(DispatcherPriority.Background, new Action(() => Helper.LoadDropDownSource(cmbScreen, screens, "ScreenName", "Id")));
            }
            catch (Exception ex)
            {
                ManageLoadingDataVisibility(false);
                LogExceptions.LogException(ex);
            }
        }
Beispiel #2
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                lblMessage.Content = string.Empty;
                if (string.IsNullOrEmpty(txtUserName.Text.Trim()) && string.IsNullOrEmpty(txtPassword.Password.Trim()))
                {
                    lblMessage.Content = "Please Enter User name and Password";
                }
                else if (string.IsNullOrEmpty(txtUserName.Text.Trim()))
                {
                    lblMessage.Content = "Please Enter User name";
                }
                else if (string.IsNullOrEmpty(txtPassword.Password.Trim()))
                {
                    lblMessage.Content = "Please Enter Password";
                }
                else
                {
                    IEnumerable <User> objUser = new SeatLayoutConfig().LoginUser(txtUserName.Text, txtPassword.Password);

                    if (objUser == null || objUser.Count() == 0)
                    {
                        lblMessage.Content = "Invalid User name or Password";
                        return;
                    }

                    Helper.Theater             = (cmbTheatres.SelectedItem as Theatres).THEATRENAME;
                    Helper.UserName            = objUser.FirstOrDefault().UserName;
                    lblUserDisplayName.Content = objUser.FirstOrDefault().UserName;

                    string[] userPermissions = objUser.FirstOrDefault().Permissions.Split(',');

                    LAYOUTDESIGN.Visibility                 =
                        MANAGERBLOCKING.Visibility          =
                            SCHEDULING.Visibility           =
                                BOOKING.Visibility          =
                                    REPORTS.Visibility      =
                                        HOLDTRAY.Visibility = Visibility.Collapsed;

                    foreach (string tabId in userPermissions)
                    {
                        switch (tabId)
                        {
                        case "1":
                            LAYOUTDESIGN.Visibility = Visibility.Visible;
                            break;

                        case "2":
                            MANAGERBLOCKING.Visibility = Visibility.Visible;
                            break;

                        case "3":
                            SCHEDULING.Visibility = Visibility.Visible;
                            break;

                        case "4":
                            BOOKING.Visibility = Visibility.Visible;
                            break;

                        case "5":
                            REPORTS.Visibility = Visibility.Visible;
                            break;

                        case "6":
                            HOLDTRAY.Visibility = Visibility.Visible;
                            break;
                        }
                    }

                    TabMaster.SelectedIndex = userPermissions.Contains("4") ? 3 : Convert.ToInt32(userPermissions[0]) - 1;

                    LoginGrid.Visibility = Visibility.Collapsed;
                    UserGrid.Visibility  = Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
                LogExceptions.LogException(ex);
            }
        }
        private void GeneratingLayout()
        {
            try
            {
                IEnumerable <Seat> objScreenSeats = new SeatLayoutConfig().GetScreeSeats(Convert.ToInt32(cmbScreen.SelectedValue), 0, 0);

                if (objScreenSeats == null || objScreenSeats.Count() == 0)
                {
                    itmSeats.ItemsSource = Seats;
                    return;
                }

                int columns = objScreenSeats.ToList <Seat>().Max(w => w.ColumnValue);

                var groupList = objScreenSeats.ToList <Seat>().GroupBy(l => l.ScreenClassId)
                                .Select(cl => new Seat
                {
                    ScreenClassId = cl.First().ScreenClassId,
                    RowValue      = cl.Max(c => c.RowValue),
                    ColumnValue   = cl.Max(c => c.ColumnValue),
                    DisplayOrder  = cl.First().DisplayOrder,
                    ScreenClass   = cl.First().ScreenClass
                }).ToList();

                int rowsforAllClasses = groupList.Sum(w => w.RowValue);
                foreach (Seat objscreenClass in groupList.OrderBy(w => w.DisplayOrder))
                {
                    int rows = objscreenClass.RowValue;
                    IEnumerable <Seat> objSubClassSeatsList = objScreenSeats.Where(w => w.ScreenClassId == objscreenClass.ScreenClassId);

                    Seats.Add(new SeatProperties()
                    {
                        CheckboxVisibility = Visibility.Visible,
                        Column             = objscreenClass.ScreenClassId,
                        ColumnText         = Convert.ToString(objscreenClass.ScreenClassId),
                        DisplayText        = objscreenClass.ScreenClass,
                        Id              = 0,
                        IsChecked       = false,
                        IsEnabled       = false,
                        Row             = objscreenClass.ScreenClassId,
                        RowNum          = objscreenClass.ScreenClassId,
                        RowText         = Convert.ToString(objscreenClass.ScreenClassId),
                        ScreenClassId   = objSubClassSeatsList.FirstOrDefault().ScreenClassId,
                        SeatColor       = Helper.ReturnColor("INACTIVE"),
                        SeatHeight      = 25,
                        SeatOrientation = Orientation.Horizontal,
                        SeatWidth       = (25 * columns) + 50,
                        TextVisibility  = Visibility.Visible,
                        VendorId        = objscreenClass.VendorId
                    });

                    for (int row = 1; row <= rows; row++)
                    {
                        GenerateRowNameColumn(objSubClassSeatsList.Where(w => w.RowValue == row).FirstOrDefault(), true, objSubClassSeatsList.Where(w => w.RowValue == row && w.FK_SeatStatus_ID == 1).Count() > 0);
                        foreach (Seat objSeat in objSubClassSeatsList.Where(w => w.RowValue == row).OrderBy(w => w.ColumnValue))
                        {
                            GenerateRowNameColumn(objSeat, false);
                        }

                        int currentRowColumns = objSubClassSeatsList.ToList <Seat>().Where(w => w.RowValue == row).Count() > 0 ? objSubClassSeatsList.ToList <Seat>().Where(w => w.RowValue == row).Count() : 0;

                        if (groupList.Where(w => w.ColumnValue == columns).Count() != groupList.Count())
                        {
                            currentRowColumns = currentRowColumns - 1;
                        }

                        if (currentRowColumns > 0 && currentRowColumns < columns)
                        {
                            for (int i = currentRowColumns; i <= columns; i++)
                            {
                                GenerateRowNameColumn(new Seat(), false);
                            }
                        }
                    }
                }

                itmSeats.Width       = (25 * (columns + (groupList.Count > 1 ? 2 : 1)));// + 50;
                itmSeats.Height      = (30 * (rowsforAllClasses + groupList.Count()));
                itmSeats.ItemsSource = Seats;
            }
            catch (Exception ex)
            {
                ManageLoadingDataVisibility(false);
                LogExceptions.LogException(ex);
            }
        }