Пример #1
0
        // 체크아웃
        private void contextmenu4_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menuItem = (MenuItem)e.Source;
            ContextMenu contextMenu = (ContextMenu)menuItem.Parent;
            selectedListBox = (ListBox)contextMenu.PlacementTarget;

            List<RoomItem> _seccessRoom = new List<RoomItem>();
            string _failRoom = string.Empty;

            foreach (RoomItem item in selectedListBox.SelectedItems)
            {
                var pmsdata = item.PMSDATA;
                //pmsdata.allowedPrefix = string.Empty;
                //pmsdata.forbiddenPrefix = "all";
                //pmsdata.hour = -1;
                //pmsdata.minutes = -1;
                //pmsdata.try_interval = 3;
                //pmsdata.repeat_times = 5;
                //pmsdata.ring_duration = 120;
                //pmsdata.language = 0;
                //pmsdata.week = string.Empty;
                //pmsdata.cmd = STRUCTS.PMS_SET_ALL_REQ;

                bool _result = false;
                using (HotelHelper hh = new HotelHelper(util.PBXIP))
                {
                    _result = hh.CheckOut(pmsdata.extension);
                }

                if (_result)
                {
                    DataTable dt = util.CreateDT2SP();
                    dt.Rows.Add("@I_ROOM", item.RoomNum);
                    dt.Rows.Add("@I_STATUS", "0");

                    using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
                    {
                        try
                        {
                            db.BeginTran();
                            db.ExcuteSP("UDT_ROOM_STATUS", dt);
                            db.Commit();

                            item.PMSDATA = pmsdata;
                            item.IsChecked = false;
                            item.Languages = "0";
                            item.Hour = -1;
                            item.Minutes = -1;
                            item.States = "0";

                            _seccessRoom.Add(item);

                            util.Log2DB(item.RoomNum, string.Format("CHECK OUT : {0}", item.RoomNum), "0");
                        }
                        catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                        {
                            db.Rollback();
                        }
                    }

                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("update hroom set states_clean=0, states_laundary=0, states_parcel=0 where room={0}", item.RoomNum);
                    using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
                    {
                        try
                        {
                            db.BeginTran();
                            int c = db.GetEffectedCount();
                            db.Commit();
                        }
                        catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                        {
                            db.Rollback();
                        }
                    }
                }
                else
                {
                    item.IsChecked = false;
                    if (string.IsNullOrEmpty(_failRoom))
                        _failRoom = item.RoomNum;
                    else
                        _failRoom += string.Format(",{0}", item.RoomNum);
                }
            }

            var lbs = this.FindChild<ListBox>("listrooms");
            foreach (var itm in _seccessRoom)
            {
                lbs.SelectedItems.Remove(itm);
            }

            string alertmsg = string.Empty;
            int alertsec = 0;
            if (string.IsNullOrEmpty(_failRoom))
            {
                alertmsg = "체크아웃 설정이 완료 되었습니다.";
                alertsec = (int)AlertDelaySec.Success;
            }
            else
            {
                alertmsg = string.Format("체크아웃 실패\r\n방번호 : {0}", _failRoom);
                alertsec = (int)AlertDelaySec.Fail;
            }

            ShowAlertDialog(alertmsg, alertsec);
        }
Пример #2
0
        private void btn_checkin_save_Click(object sender, RoutedEventArgs e)
        {
            List<RoomItem> _seccessRoom = new List<RoomItem>();
            string _failRoom = string.Empty;

            foreach (RoomItem item in checkinFlyout_lb.ItemsSource)
            {
                var pmsdata = item.PMSDATA;
                pmsdata.cmd = STRUCTS.CGI_PMS_SET_ALL_REQ;
                pmsdata.repeat_times = 5;
                pmsdata.ring_duration = 120;
                pmsdata.try_interval = 3;

                bool _result = false;
                using (HotelHelper hh = new HotelHelper(util.PBXIP))
                {
                    _result = hh.CheckIn(pmsdata);
                }

                if (_result)
                {
                    if (NOWACT == PMSBEH.DO_MODIFY)
                    {
                        item.PMSDATA = pmsdata;
                        item.IsChecked = false;
                        item.Languages = pmsdata.language.ToString();
                        item.Hour = pmsdata.hour;
                        item.Minutes = pmsdata.minutes;
                        item.States = "1";

                        util.Log2DB(item.RoomNum, string.Format("MODIFY : {0}", item.RoomNum), "2");
                        continue;
                    }

                    DataTable dt = util.CreateDT2SP();
                    dt.Rows.Add("@I_ROOM", item.RoomNum);
                    dt.Rows.Add("@I_STATUS", "1");

                    using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
                    {
                        try
                        {
                            db.BeginTran();
                            db.ExcuteSP("UDT_ROOM_STATUS", dt);
                            db.Commit();

                            item.PMSDATA = pmsdata;
                            item.IsChecked = false;
                            item.Languages = pmsdata.language.ToString();
                            item.Hour = pmsdata.hour;
                            item.Minutes = pmsdata.minutes;
                            item.States = "1";

                            _seccessRoom.Add(item);

                            util.Log2DB(item.RoomNum, string.Format("CHECK IN : {0}", item.RoomNum), "1");
                        }
                        catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                        {
                            db.Rollback();
                        }
                    }
                }
                else
                {
                    item.IsChecked = false;
                    if (string.IsNullOrEmpty(_failRoom))
                        _failRoom = item.RoomNum;
                    else
                        _failRoom += string.Format(",{0}", item.RoomNum);
                }
            }

            var lbs = this.FindChild<ListBox>("listrooms");
            foreach (var itm in _seccessRoom)
            {
                lbs.SelectedItems.Remove(itm);
            }

            ToggleFlyout(0);

            string alertmsg = string.Empty;
            int alertsec = 0;
            if (string.IsNullOrEmpty(_failRoom))
            {
                if (NOWACT == PMSBEH.DO_CHECKIN)
                {
                    alertmsg = "체크인 설정이 완료 되었습니다.";
                }
                else
                {
                    alertmsg = "설정 수정이 완료 되었습니다.";
                }
                
                alertsec = (int)AlertDelaySec.Success;
            }
            else
            {
                if (NOWACT == PMSBEH.DO_CHECKIN)
                {
                    alertmsg = string.Format("체크인 실패\r\n방번호 : {0}", _failRoom);
                }
                else
                {
                    alertmsg = string.Format("실패\r\n방번호 : {0}", _failRoom);
                }
                
                alertsec = (int)AlertDelaySec.Success;
            }

            ShowAlertDialog(alertmsg, alertsec);

            if (NOWACT == PMSBEH.DO_CHECKIN)
            {
                NOWACT = PMSBEH.NONE;
            }
            else if (NOWACT == PMSBEH.DO_MODIFY)
            {
                NOWACT = PMSBEH.NONE;
            }
        }
Пример #3
0
        private void UpdateParcelStates(RoutedEventArgs e, ParcelStates states)
        {
            // 프런트 > 우편물
            // states 1:요청, 0:완료

            // 우편물 수령 요청 (PMS > PBX > 객실전화)
            MenuItem menuItem = (MenuItem)e.Source;
            ContextMenu contextMenu = (ContextMenu)((MenuItem)menuItem.Parent).Parent;
            selectedListBox = (ListBox)contextMenu.PlacementTarget;

            List<RoomItem> _successRoom = new List<RoomItem>();
            string _failRoom = string.Empty;

            foreach (RoomItem item in selectedListBox.SelectedItems)
            {
                bool result = false;
                using (HotelHelper hh = new HotelHelper(util.PBXIP))
                {
                    result = hh.SetParcel(item.RoomNum, (int)states);
                }

                if (result)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("update hroom set");
                    sb.AppendFormat(" states_parcel={0}", (int)states);
                    sb.AppendFormat(" where room='{0}'", item.RoomNum);

                    using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
                    {
                        try
                        {
                            db.BeginTran();
                            int count = db.GetEffectedCount();
                            db.Commit();

                            item.States_Parcel = ((int)states).ToString();
                            _successRoom.Add(item);
                        }
                        catch
                        {
                            db.Rollback();
                        }
                    }

                    string _msg = string.Empty;
                    if (states == ParcelStates.GETREQUESTED)
                    {
                        _msg = "REQUESTED";
                    }
                    else if (states == ParcelStates.NONE)
                    {
                        _msg = "DELIVERED";
                    }

                    util.Log2DB(item.RoomNum, string.Format("PARCEL {0} : {1}", _msg, item.RoomNum), "1");
                }
                else
                {
                    if (string.IsNullOrEmpty(_failRoom))
                        _failRoom = item.RoomNum;
                    else
                        _failRoom += string.Format(",{0}", item.RoomNum);
                }
            }
        }