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; } }
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 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 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 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 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 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(); } } }
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(); } } }