Beispiel #1
0
        private void RoomData_Click(object sender, MouseEventArgs e)
        {
            // Задава defaut ст-ст на последно избраната клетка
            if (_CurrentCell != null)
            {
                Label lbCellOld = _CellsData[_CurrentCell.GridPos_X, _CurrentCell.GridPos_Y];
                lbCellOld.Left   -= 1;
                lbCellOld.Top    -= 1;
                lbCellOld.Width  += 2;
                lbCellOld.Height += 2;
            }
            // Маркира избраната клетка
            Label lbCell = ((Label)sender);

            _CurrentCell = ((RoomDetail)lbCell.Tag);
            // Променя размера на избраната клетка
            lbCell.Left   += 1;
            lbCell.Top    += 1;
            lbCell.Width  -= 2;
            lbCell.Height -= 2;
            //
            if (e.Button == MouseButtons.Right)
            {
                Control cntrl = (Control)sender;
                cntxtMnStrp.Show(cntrl, 0, cntrl.Height - 1);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Зарежда редовете на грида с данни
        /// </summary>
        public void SetRowsData()
        {
            if ((_DataRooms != null) && (_DataReservation != null))
            {
                ClearRoomsState();
                //
                for (int i = 0; i < _DataRooms.Rows.Count; i++)
                {
                    bool bIsClean = _DataRooms.Rows[i]["is_clean"].ToString().Equals("Y");
                    ((RoomData)(_CellsHData[0, i].Tag)).IsClean = bIsClean;
                    if (bIsClean)
                    {
                        _CellsHData[0, i].BackColor = _HeaderRowA_BackColor;
                    }
                    else
                    {
                        _CellsHData[0, i].BackColor = _HeaderRowA_BCClean;
                    }
                }
                // обхожда списъка с резервации и регистрации
                foreach (DataRow dr in _DataReservation.Rows)
                {
                    // клетка: начало
                    int cell_from = Convert.ToInt32(dr["cell_from"]);
                    // клетка: край
                    int cell_to = Convert.ToInt32(dr["cell_to"]) - 1;
                    // валидация
                    if (cell_from < 0)
                    {
                        cell_to  += cell_from;
                        cell_from = 0;
                    }
                    int aCellFrom = _HeaderRow_Count + cell_from;
                    // ред от грида
                    int iRowNo = FindRowNo(dr["room_id"]);

                    // Допълнителна информация
                    if (iRowNo != -1)
                    {
                        RoomDetail aRS = (RoomDetail)_CellsData[aCellFrom, iRowNo].Tag;
                        aRS.RoomID        = Convert.ToInt32(dr["room_id"]);
                        aRS.RoomName      = dr["room_name"].ToString();
                        aRS.BusyID        = Convert.ToInt64(dr["rwrk_id"]);
                        aRS.BusyType      = ConvertRStatus.GetStatus(dr["rwrk_kind"]);
                        aRS.ClientID      = Convert.ToInt64(dr["client_id"]);
                        aRS.ClientName    = dr["client_name"].ToString();
                        aRS.BusyDateFrom  = Convert.ToDateTime(dr["date_from"]);
                        aRS.BusyDateTo    = Convert.ToDateTime(dr["date_to"]);
                        aRS.RateRemaining = Convert.ToDecimal(dr["rate_remaining"]) / 100;
                        aRS.HasLeft       = dr["has_left"].ToString().Equals("Y");

                        // Задава статус за стаята
                        SetRoomData(iRowNo, aCellFrom, cell_to, aRS);
                    }
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Демаркира последно избраната позиция
 /// </summary>
 private void UnSelectSell()
 {
     if (_CurrentCell != null)
     {
         Label lbCell = _CellsData[_CurrentCell.GridPos_X, _CurrentCell.GridPos_Y];
         lbCell.Left   -= 1;
         lbCell.Top    -= 1;
         lbCell.Width  += 2;
         lbCell.Height += 2;
         //
         _CurrentCell = null;
     }
 }
Beispiel #4
0
 private void RoomData_Enter(object sender, EventArgs e)
 {
     if (_SelectCell != null)
     {
         _CellsSHeader[_SelectCell.GridPos_X - 2].BackColor = _HeaderColumn_BackColor;
         _CellsHData[1, _SelectCell.GridPos_Y].BackColor    = _HeaderRowB_BackColor;
     }
     //
     _SelectCell = ((RoomDetail)((Label)sender).Tag);
     // Маркира заглавието на клетката
     _CellsSHeader[_SelectCell.GridPos_X - 2].BackColor = Color.FromArgb(244, 200, 113);
     _CellsHData[1, _SelectCell.GridPos_Y].BackColor    = Color.FromArgb(244, 200, 113);
     //
     if (!_SelectCell.BusyType.Equals(RStatus.fsEmpty))
     {
         tTip.ToolTipTitle = _SelectCell.ClientName;
         tTip.SetToolTip((Label)sender, "Дължи: " + _SelectCell.RateRemaining.ToString("#0.00"));
     }
 }
Beispiel #5
0
        /// <summary>
        /// Изчиства статуса на стаите
        /// </summary>
        private void ClearRoomsState()
        {
            for (int rw = 0; rw < _DataRooms.Rows.Count; rw++)
            {
                for (int cln = 0; cln < _ViewDays; cln++)
                {
                    Label lbCellData = _CellsData[_HeaderRow_Count + cln, rw];
                    //
                    lbCellData.BackColor = Color.White;
                    lbCellData.Width     = _HeaderColumn_Width + 1;
                    lbCellData.Visible   = true;
                    //
                    RoomDetail rdCellData = (RoomDetail)lbCellData.Tag;
                    rdCellData.BusyType = RStatus.fsEmpty;
                    rdCellData.BusyID   = 0;

                    //_CellsData[_HeaderRow_Count + cln, rw].BackColor = Color.White;
                    // _CellsData[_HeaderRow_Count + cln, rw].Width = _HeaderColumn_Width + 1;
                    // _CellsData[_HeaderRow_Count + cln, rw].Visible = true;
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Задава статус на стаята
        /// </summary>
        private void SetRoomData(int aRowNo, int aCellFrom, int aCellTo, RoomDetail aRDetail)
        {
            if (aCellTo > -1)
            {
                // валидация
                int iCellTo = aCellTo;
                if ((aCellFrom + iCellTo) > _ViewDays)
                {
                    iCellTo = (_ViewDays - aCellFrom) + 1;
                }
                //
                Label lbSelectCell = _CellsData[aCellFrom, aRowNo];
                switch (aRDetail.BusyType)
                {
                case RStatus.fsRegister:
                    if (aRDetail.HasLeft)
                    {
                        lbSelectCell.BackColor = _RoomRegisterFree_BackColor;
                    }
                    else
                    {
                        lbSelectCell.BackColor = _RoomRegister_BackColor;
                    }
                    break;

                case RStatus.fsReserve:
                    lbSelectCell.BackColor = _RoomReserve_BackColor;
                    break;
                }
                lbSelectCell.Text  = aRDetail.ClientName;
                lbSelectCell.Width = ((iCellTo + 1) * _HeaderColumn_Width) + 1;
                //
                for (int i = 1; i <= iCellTo; i++)
                {
                    _CellsData[aCellFrom + i, aRowNo].Visible = false;
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// Добавя ред към грида
        /// </summary>
        private void AddRow(int aRowNo)
        {
            // Данни за стаята
            RoomData dRoom = new RoomData();

            dRoom.RoomID    = Convert.ToInt32(_DataRooms.Rows[aRowNo]["room_id"]);
            dRoom.RoomName  = _DataRooms.Rows[aRowNo]["room_name"].ToString();
            dRoom.GridRowNo = aRowNo;
            dRoom.IsClean   = _DataRooms.Rows[aRowNo]["is_clean"].ToString().Equals("Y");
            dRoom.TypeName  = _DataRooms.Rows[aRowNo]["type_name"].ToString();

            // Тип стая
            Label lRT = new Label();

            lRT.Text        = _DataRooms.Rows[aRowNo]["type_name"].ToString();
            lRT.TextAlign   = ContentAlignment.MiddleCenter;
            lRT.Height      = _HeaderRow_Height + 1;
            lRT.Width       = 36;
            lRT.Left        = _GridPadding.Left;
            lRT.Top         = _HeaderColumn_Height + (int)(aRowNo * _HeaderRow_Height);
            lRT.Margin      = new Padding(0);
            lRT.BorderStyle = BorderStyle.FixedSingle;
            lRT.BackColor   = _HeaderRowA_BackColor;
            lRT.Tag         = dRoom;

            _CellsHData[0, aRowNo] = lRT;
            this.Controls.Add(lRT);

            // Номер стая
            Label lRN = new Label();

            lRN.Text        = _DataRooms.Rows[aRowNo]["room_name"].ToString();
            lRN.TextAlign   = ContentAlignment.MiddleCenter;
            lRN.Height      = _HeaderRow_Height + 1;
            lRN.Width       = 36;
            lRN.BorderStyle = BorderStyle.FixedSingle;
            lRN.BackColor   = _HeaderRowB_BackColor;
            lRN.Left        = _GridPadding.Left + 35;
            lRN.Top         = _HeaderColumn_Height + (int)(aRowNo * _HeaderRow_Height);
            lRN.Margin      = new Padding(0);
            lRN.Tag         = dRoom;

            _CellsHData[1, aRowNo] = lRN;
            this.Controls.Add(lRN);

            // Данни за стаите
            for (int i = 0; i < _ViewDays; i++)
            {
                Label lRD = new Label();
                lRD.Text        = "";
                lRD.TextAlign   = ContentAlignment.MiddleLeft;
                lRD.BackColor   = Color.White;
                lRD.ForeColor   = Color.White;
                lRD.Cursor      = Cursors.Hand;
                lRD.Font        = new Font(FontFamily.GenericSansSerif, (float)8.25, FontStyle.Bold);
                lRD.Height      = (_HeaderColumn_Height / 2) + 1;
                lRD.Width       = _HeaderColumn_Width + 1;
                lRD.Left        = _GridPadding.Left + _HeaderRow_Width + (int)(i * _HeaderColumn_Width);
                lRD.Top         = _HeaderColumn_Height + (int)(aRowNo * _HeaderRow_Height);
                lRD.BorderStyle = BorderStyle.FixedSingle;

                // Детайлна информация за стаята
                RoomDetail aRS = new RoomDetail();
                aRS.GridPos_X    = _HeaderRow_Count + i;
                aRS.GridPos_Y    = aRowNo;
                aRS.RoomID       = Convert.ToInt32(_DataRooms.Rows[aRowNo]["room_id"]);
                aRS.RoomName     = _DataRooms.Rows[aRowNo]["room_name"].ToString();
                aRS.GridRowNo    = aRowNo;
                lRD.Tag          = (object)aRS;
                lRD.MouseEnter  += RoomData_Enter;
                lRD.MouseClick  += RoomData_Click;
                lRD.DoubleClick += RoomData_DoubleClick;
                //
                _CellsData[_HeaderRow_Count + i, aRowNo] = lRD;
                this.Controls.Add(lRD);
            }
        }