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); } } }
private void FileName2DB(double idx, string fn, double fnlen, string ext, string peernum) { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { db.SetParameters("@EXTENTION", FbDbType.VarChar, ext); db.SetParameters("@PEERNUMBER", FbDbType.VarChar, peernum); db.SetParameters("@FN", FbDbType.VarChar, fn); db.SetParameters("@FNLEN", FbDbType.Double, fnlen); try { db.BeginTran(); db.ExcuteSP("INS_RECINFO3"); db.Commit(); } catch (FbException e) { util.WriteLog(string.Format("SQL INS ERROR (INS_RECINFO3)\r\nMessage : {0}", e.Message)); db.Rollback(); } } }
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(); } } } }
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(); }
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)); } } }
public int Modify(Account _item) { int result = -1; DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@I_ID_MASTER", util.userid); dt.Rows.Add("@I_ID", _item.ID); dt.Rows.Add("@I_PWD", util.GetSHA1(_item.PWD)); dt.Rows.Add("@I_PWD_NEW", util.GetSHA1(_item.PWD_NEW)); dt.Rows.Add("@I_NAME", _item.NAME); dt.Rows.Add("@I_MEMO", _item.MEMO); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); result = int.Parse(db.GetDataSP("UDT_USR", dt).ToString()); db.Commit(); Account __obj = _list.FirstOrDefault(x => x.ID == _item.ID); __obj.NAME = _item.NAME; __obj.MEMO = _item.MEMO; } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } return result; }
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(); }
public void Modify(InnerTel _itel) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@seq", _itel.Seq); dt.Rows.Add("@telnum", _itel.Telnum); dt.Rows.Add("@tellername", _itel.TellerName); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("UDT_INNERTELS", dt); db.Commit(); InnerTel __obj = _list.FirstOrDefault(x => x.Telnum == _itel.Telnum); __obj.TellerName = _itel.TellerName; } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
public void Remove(InnerTel _itel) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@seq", _itel.Seq); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("RMV_INNERTELS", dt); db.Commit(); InnerTel __obj = _list.FirstOrDefault(x => x.Seq == _itel.Seq); _list.Remove(__obj); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
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(); }
public void Add(InnerTel _itel) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@telnum", _itel.Telnum); dt.Rows.Add("@tellername", _itel.TellerName); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("INS_INNERTELS", dt); db.Commit(); _list.Add(_itel); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
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(); }
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); }
public void Remove(Account _item) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@I_ID", _item.ID); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("RMV_USR", dt); db.Commit(); Account __obj = _list.FirstOrDefault(x => x.ID == _item.ID); _list.Remove(__obj); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
// 체크아웃 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); }
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(); }
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; } }
public void Add(Account _item) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@I_ID", _item.ID); dt.Rows.Add("@I_PWD", util.GetSHA1(_item.PWD)); dt.Rows.Add("@I_NAME", _item.NAME); dt.Rows.Add("@I_MEMO", _item.MEMO); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("INS_USR", dt); db.Commit(); _list.Add(_item); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }