Ejemplo n.º 1
0
        public void ADD(Firm item)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("insert into FIRMS");
            sb.Append("( title )");
            sb.Append(" values ");
            sb.AppendFormat("( {0} )", item.title);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    int count = db.GetEffectedCount();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} ADD ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            INIT();
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 4
0
        private void UpdateLaundaryStates(RoutedEventArgs e, string states)
        {
            // 프런트 > 세탁
            // states 1:요청, 0:완료

            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)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("update hroom set");
                sb.AppendFormat(" states_laundary={0}", 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_Laundary = states;

                        string _msg = string.Empty;

                        if (states == "1")
                        {
                            _msg = "REQUESTED";
                        }
                        else if (states == "0")
                        {
                            _msg = "COMPLETED";
                        }

                        util.Log2DB(item.RoomNum, string.Format("LAUNDARY {0} : {1}", _msg, item.RoomNum), "1");
                    }
                    catch
                    {
                        db.Rollback();
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void CdrToDB(CdrRequest_t _cdr, CdrList _cdrdata)
        {
            CDRData _cdrd = new CDRData() {
                OFFICE_NAME = _cdrdata.office_name
                ,
                STARTDATE = new DateTime(_cdrdata.start_yyyy, _cdrdata.start_month, _cdrdata.start_day, _cdrdata.start_hour, _cdrdata.start_min, _cdrdata.start_sec)
                ,
                ENDDATE = new DateTime(_cdrdata.end_yyyy, _cdrdata.end_month, _cdrdata.end_day, _cdrdata.end_hour, _cdrdata.end_min, _cdrdata.end_sec)
                ,
                CALLER = _cdrdata.caller
                ,
                CALLER_TYPE = _cdrdata.caller_type
                ,
                CALLER_IPN_NUMBER = _cdrdata.caller_ipn_number
                ,
                CALLER_GROUP_CODE = _cdrdata.caller_group_code
                ,
                CALLER_GROUP_NAME = _cdrdata.caller_group_name
                ,
                CALLER_HUMAN_NAME = _cdrdata.caller_human_name
                ,
                CALLEE = _cdrdata.callee
                ,
                CALLEE_TYPE = _cdrdata.callee_type
                ,
                CALLEE_IPN_NUMBER = _cdrdata.callee_ipn_number
                ,
                CALLEE_GROUP_CODE = _cdrdata.callee_group_code
                ,
                CALLEE_GROUP_NAME = _cdrdata.callee_group_name
                ,
                CALLEE_HUMAN_NAME = _cdrdata.callee_human_name
                ,
                RESULT = _cdrdata.result
                ,
                SEQ = _cdrdata.seq
            };

            StringBuilder __slqsb = new StringBuilder();

            __slqsb.Append(" insert into CDRINFO ");
            __slqsb.Append(" ( ");
            __slqsb.Append(" OFFICE_NAME ");
            __slqsb.Append(" , STARTDATE ");
            __slqsb.Append(" , ENDDATE ");
            __slqsb.Append(" , CALLER ");
            __slqsb.Append(" , CALLER_TYPE ");
            __slqsb.Append(" , CALLER_IPN_NUMBER ");
            __slqsb.Append(" , CALLER_GROUP_CODE ");
            __slqsb.Append(" , CALLER_GROUP_NAME ");
            __slqsb.Append(" , CALLER_HUMAN_NAME ");
            __slqsb.Append(" , CALLEE ");
            __slqsb.Append(" , CALLEE_TYPE ");
            __slqsb.Append(" , CALLEE_IPN_NUMBER ");
            __slqsb.Append(" , CALLEE_GROUP_CODE ");
            __slqsb.Append(" , CALLEE_GROUP_NAME ");
            __slqsb.Append(" , CALLEE_HUMAN_NAME ");
            __slqsb.Append(" , RESULT ");
            __slqsb.Append(" , SEQ ");
            __slqsb.Append(" ) values ( ");
            __slqsb.AppendFormat(" '{0}' ", _cdrd.OFFICE_NAME);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.STARTDATE.ToString("yyyy-MM-dd HH:mm:ss"));
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.ENDDATE.ToString("yyyy-MM-dd HH:mm:ss"));
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_TYPE);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_IPN_NUMBER);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_GROUP_CODE);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_GROUP_NAME);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_HUMAN_NAME);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_TYPE);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_IPN_NUMBER);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_GROUP_CODE);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_GROUP_NAME);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_HUMAN_NAME);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.RESULT);
            __slqsb.AppendFormat(" , '{0}' ", _cdrd.SEQ);
            __slqsb.Append(" ); ");

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

                    CdrResponse_t __cdrRes = this.GetCdrRtnMsg(_cdr);
                    byte[] __buffer = util.GetBytes(__cdrRes);

                    try
                    {
                        _sockCdrSrv.SendTo(__buffer, SocketFlags.None, _remoteep);
                    }
                    catch (SocketException __se)
                    {
                        util.WriteLog(string.Format("Socket send message error : {0}", __se.Message));
                    }
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException __fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} : {1}\r\nMessage : {2}", "Rollback Exception Type", __fex.GetType(), __fex.Message));
                }
                catch(SocketException __se)
                {
                    util.WriteLog(string.Format("Socket send message error : {0}", __se.Message));
                }
            }
        }
Ejemplo n.º 6
0
        public void MODIFY(Firm item)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("update FIRMS set title={0} where idx={1}", item.title, item.idx);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    int count = db.GetEffectedCount();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} MODIFY ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            INIT();
        }
Ejemplo n.º 7
0
        public void REMOVE(INTERNATIONAL item)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("delete from INTERNATIONAL where idx={0}", item.idx);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    db.BeginTran();
                    int count = db.GetEffectedCount();
                    db.Commit();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} REMOVE ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            INIT();
        }
Ejemplo n.º 8
0
        public void ADD(INTERNATIONAL item)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("insert into INTERNATIONAL");
            sb.Append("( areacode, nation_num, nation_local_num, natione, nationk, lm )");
            sb.Append(" values ");
            sb.AppendFormat("( {0}, '{1}', '{2}', '{3}', '{4}', '{5}' )", item.areacode, item.nation_num, item.nation_local_num, item.natione, item.nationk, item.lm);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    db.BeginTran();
                    int count = db.GetEffectedCount();
                    db.Commit();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} ADD ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            INIT();
        }
Ejemplo n.º 9
0
        public void MODIFY(INTERNATIONAL item)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("update INTERNATIONAL set");
            sb.AppendFormat(" areacode={0}, nation_num='{1}', nation_local_num='{2}', natione='{3}', nationk='{4}', lm='{5}' where idx={6}", item.areacode, item.nation_num, item.nation_local_num, item.natione, item.nationk, item.lm, item.idx);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    db.BeginTran();
                    int count = db.GetEffectedCount();
                    db.Commit();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} MODIFY ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            INIT();
        }
Ejemplo n.º 10
0
        public void MODIFY(DOMESTICRATE item)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("update DOMESTIC_RATE set");
            sb.AppendFormat(" type='{0}', rate={1}, sec={2} where prefix='{3}'", item.type, item.rate, item.sec, item.prefix);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    db.BeginTran();
                    int count = db.GetEffectedCount();
                    db.Commit();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} MODIFY ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            //INIT();
        }
Ejemplo n.º 11
0
        public void REMOVE(DOMESTICRATE item)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("delete from DOMESTIC_RATE where prefix={0}", item.prefix);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    db.BeginTran();
                    int count = db.GetEffectedCount();
                    db.Commit();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} REMOVE ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            _list.Remove(item);
            //INIT();
        }
Ejemplo n.º 12
0
        public void ADD(DOMESTICRATE item)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("insert into DOMESTIC_RATE");
            sb.Append(" ( prefix, type, rate, sec )");
            sb.Append(" values ");
            sb.AppendFormat("( '{0}', '{1}', {2}, {3} )", item.prefix, item.type, item.rate, item.sec);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    db.BeginTran();
                    int count = db.GetEffectedCount();
                    db.Commit();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} ADD ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            //INIT();
            _list.Add(item);
        }
Ejemplo n.º 13
0
        public void REMOVE(INTERNATIONALRATE item)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("delete from INTERNATIONAL_RATE where areacode={0}", item.areacode);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    int count = db.GetEffectedCount();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} REMOVE ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            _list.Remove(item);

            //INIT();
        }
Ejemplo n.º 14
0
        public void MODIFY(INTERNATIONALRATE item)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("update INTERNATIONAL_RATE set");
            sb.AppendFormat(" lrate={0}, lsec={1}, mrate={2}, msec={3} where areacode={4}", item.lrate, item.lsec, item.mrate, item.msec, item.areacode);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    int count = db.GetEffectedCount();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} MODIFY ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            INTERNATIONALRATE _tmpobj = (INTERNATIONALRATE)_list.Where(x => x.areacode == item.areacode);
            _tmpobj.lrate = item.lrate;
            _tmpobj.lsec = item.lsec;
            _tmpobj.mrate = item.mrate;
            _tmpobj.msec = item.msec;

            //INIT();
        }
Ejemplo n.º 15
0
        public void ADD(INTERNATIONALRATE item)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("insert into INTERNATIONAL_RATE");
            sb.Append("( areacode, lrate, lsec, mrate, msec )");
            sb.Append(" values ");
            sb.AppendFormat("( {0}, {1}, {2}, {3}, {4} )", item.areacode, item.lrate, item.lsec, item.mrate, item.msec);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    int count = db.GetEffectedCount();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} ADD ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            _list.Add(item);

            //INIT();
        }
Ejemplo n.º 16
0
        public void REMOVE(BILLException item)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("delete from EXCEPTIONS where innertel={0}", item.innertel);

            using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn))
            {
                try
                {
                    int count = db.GetEffectedCount();
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fex)
                {
                    db.Rollback();
                    util.WriteLog(string.Format("{0} REMOVE ERR : {1}", this.GetType(), fex.Message));
                    return;
                }
            }

            INIT();
        }