using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Cosmos.BaseFrame; using Cosmos.UserFrame; using Cosmos.ServiceProvider; using Cosmos.Common; using Cosmos.CommonManager; using Cosmos.UI; using Cosmos.Win; namespace TableConfiguration { /// /// 테이블 편집 /// public partial class frmTableEditor : Form { private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출 private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체) private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조 private ITableUs m_cTableSvr = null; private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스 /// /// 사용자ID /// private string userId = string.Empty; /// /// 사용자명 /// private string userNm = string.Empty; /// /// 원 사용자ID /// private string orgUserId = string.Empty; /// /// 원 사용자명 /// private string orgUserNm = string.Empty; /// /// 컨트롤 편집기 /// private ControlDesigner m_ctrlDesigner = null; /// /// 기능키 버튼 목록 /// private List m_btnFuncList; /// /// 현재 명령 /// private string m_currentOperation = string.Empty; #region ## 층 관련 변수 /// /// Floor Master Buffer /// private List m_floorMst = new List(); /// /// Floor Button Constrl List /// private List m_btnFloorList = new List(); /// /// Current Floor Code /// private string m_currentFloorCd = string.Empty; /// /// Total Floor Page /// private int m_totalFloorPage = 0; /// /// Current Floor Page /// private int m_currentFloorPage = -1; /// /// Floor Button Default BackColor /// private Color m_FloorDefaultBackColor = Color.FromArgb(115, 143, 165); //Color.FromArgb(236, 241, 249); /// /// Floor Button Default ForeColor /// private Color m_FloorDefaultForeColor = Color.White; //Color.FromArgb(64, 64, 64); /// /// Floor Button Select BackColor /// private Color m_FloorSelectBackColor = Color.FromArgb(22, 187, 238); //Color.FromArgb(101, 115, 126); /// /// Floor Button Select ForeColor /// private Color m_FloorSelectForeColor = Color.White; /// /// Max Floor Count /// private const int MAX_FLOOR_COUNT = 10; #endregion #region ## 테이블 관련 변수 /// /// Table Master Buffer /// private List m_tableMst = new List(); /// /// Table Default Color /// private Color m_tblDefaultColor = Color.FromArgb(75, 140, 229);// Color.FromArgb(187, 201, 222); /// /// Table Selected Color /// private Color m_tblSelectColor = Color.FromArgb(188, 106, 246); /// /// 선택된 테이블 번호 /// private string m_currentTableNo = string.Empty; #endregion #region ## 컨트롤 관련 변수 /// /// 화면 너비 (969) /// private const int SCR_SIZE_WIDTH = 986; /// /// 화면 높이 (477) /// private const int SCR_SIZE_HEIGHT = 550; /// /// 컨트롤 최대 가로 갯수 (6) /// private const int CTRL_MAX_COUNT_X = 6; /// /// 컨트롤 최대 세로 갯수 (5) /// private const int CTRL_MAX_COUNT_Y = 5; /// /// 테이블버튼 최소 너비 (150) /// private const int CTRL_MIN_WIDTH = 150; /// /// 테이블버튼 최소 높이 (90) /// private const int CTRL_MIN_HEIGHT = 90; /// /// 컨트롤 간격 (3) /// private const int CTRL_CAP = 3; #endregion private Color m_FuncDefaultBackColor = Color.FromArgb(45, 61, 74); private Color m_FuncDefalutForeColor = Color.White; private Color m_FuncClickBackColor = Color.FromArgb(115, 143, 165); private Color m_FuncClickForeColor = Color.White; /// /// 테이블 편집 생성자 /// public frmTableEditor() { InitializeComponent(); base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true); //this.UpdateStyles(); m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보 // 서비스 m_cTableSvr = (ITableUs)sManager.InitServiceInstance(ServiceLists.BSV_TABLE.DLL, ServiceLists.BSV_TABLE.TABLE_SERVICE); m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON); #region ## 층버튼 컨트롤 목록 생성 m_btnFloorList = new List(); m_btnFloorList.Add(this.btnFloor1); m_btnFloorList.Add(this.btnFloor2); m_btnFloorList.Add(this.btnFloor3); m_btnFloorList.Add(this.btnFloor4); m_btnFloorList.Add(this.btnFloor5); m_btnFloorList.Add(this.btnFloor6); m_btnFloorList.Add(this.btnFloor7); m_btnFloorList.Add(this.btnFloor8); m_btnFloorList.Add(this.btnFloor9); m_btnFloorList.Add(this.btnFloor10); #endregion #region ## 기능버튼 컨트롤 목록 생성 m_btnFuncList = new List(); m_btnFuncList.Add(this.btnOperation1); m_btnFuncList.Add(this.btnOperation2); m_btnFuncList.Add(this.btnOperation3); m_btnFuncList.Add(this.btnOperation4); m_btnFuncList.Add(this.btnOperation5); m_btnFuncList.Add(this.btnOperation6); m_btnFuncList.Add(this.btnOperation7); m_btnFuncList.Add(this.btnOperation8); m_btnFuncList.Add(this.btnOperation9); m_btnFuncList.Add(this.btnOperation10); #endregion } private void Form_Load(object sender, EventArgs e) { try { UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ""); PosOLEDevice.SetEventHandle(null); this.Tag = "START"; lblUser.Text = string.Format("{0} {1}", m_cPosStatus.Base.CashierNo, m_cPosStatus.Base.CashierName); // 컨트롤 편집기 생성 m_ctrlDesigner = new ControlDesigner(); //m_ctrlDesigner.MinSize = new Size(150, 90); m_ctrlDesigner.MinSize = new Size(50, 50); m_ctrlDesigner.HandleSize = 10; // 초기화 InitControl(); // 기능버트 설정 SetFuncMenu(); // 층 마스터 로드 if (LoadFloorMaster(false) == false) { WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0078); this.DialogResult = System.Windows.Forms.DialogResult.Abort; this.Close(); } // 테이블 마스터 로드 if (LoadTableMaster(false) == false) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0496); this.DialogResult = System.Windows.Forms.DialogResult.Abort; this.Close(); } string floorCd = string.Empty; FloorButtonClear(); DisplayFloorButton(); if (m_floorMst.Count > 0) floorCd = m_floorMst[0].FLOOR_CD; SelectFloorButton(floorCd); DisplayTableButton(floorCd); tmrSaleTimer.Enabled = true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private void Form_Activated(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(this.Tag.ToString()) == false) { this.Tag = string.Empty; } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private void Form_Closing(object sender, FormClosingEventArgs e) { try { tmrSaleTimer.Enabled = false; // 자원 해제 if (m_currentTableNo != null) m_currentTableNo = null; if (m_ctrlDesigner != null) m_ctrlDesigner.Dispose(); PanelTableClear(); UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ""); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private void tmrSaleTimer_Tick(object sender, EventArgs e) { try { tmrSaleTimer.Enabled = false; // 시간 처리 lblDateTime.Text = m_cPosStatus.Global.DateToCulture(DateTime.Now.ToString("yyyyMMdd")) + " " + DateTime.Now.ToString("HH:mm:ss"); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } finally { tmrSaleTimer.Enabled = true; } } /// /// 기능버튼 /// /// /// private void btnOperation_Click(object sender, EventArgs e) { try { CsmButton btn = (CsmButton)sender; if (string.IsNullOrWhiteSpace(btn.Text)) return; if (string.IsNullOrWhiteSpace(btn.Tag.ToString())) return; switch (btn.Tag.ToString()) { case PosKey.MENU_KEY.FLOOR_MANAGER: FloorManangerProcess(btn); break; case PosKey.MENU_KEY.TABLE_PROPERTY: TableManangerProcess(btn); break; case PosKey.MENU_KEY.TABLE_INSERT: TableInsertProcess(btn); break; case PosKey.MENU_KEY.TABLE_COPY: TableCopyProcess(btn); break; case PosKey.MENU_KEY.TABLE_DELETE: TableDeleteProcess(btn); break; case PosKey.MENU_KEY.TABLE_RESET: TableResetProcess(btn); break; case PosKey.MENU_KEY.TABLE_RESTORE: TableRestoreProcess(btn); break; case PosKey.MENU_KEY.TABLE_BACKUP: TableBackupProcess(btn); break; case PosKey.MENU_KEY.TABLE_SAVE: TableSaveProcess(btn); break; case PosKey.MENU_KEY.TABLE_EXIT: if (TableSaveProcess(btn) == false) return; OperationButtonSelect(true, btn); this.Close(); return; } ShowCurentTableCount(); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } /// /// 층버튼 /// /// /// private void btnFloor_Click(object sender, EventArgs e) { try { tmrSaleTimer.Enabled = false; string floorCd = string.Empty; int targetPage = m_currentFloorPage; if (sender == btnFloorPre) { targetPage--; if (targetPage < 0) targetPage = m_totalFloorPage - 1; DisplayFloorButton(targetPage); floorCd = m_btnFloorList[0].Tag.ToString(); } else if (sender == btnFloorNext) { targetPage++; if (targetPage >= m_totalFloorPage) targetPage = 0; DisplayFloorButton(targetPage); floorCd = m_btnFloorList[0].Tag.ToString(); } else { CsmButton btn = (CsmButton)sender; floorCd = btn.Tag.ToString(); } pnlTable_Click(null, null); //SetChangedTableProperty(); SelectFloorButton(floorCd); DisplayTableButton(floorCd); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } finally { tmrSaleTimer.Enabled = true; txtFixedX.Value = string.Empty; txtFixedY.Value = string.Empty; pnlTable.Focus(); } } /// /// Table Button Click Event /// /// /// private void TableButton_ClickEvent(object sender, string tableKey) { try { m_ctrlDesigner.Attach((Control)sender); m_currentTableNo = tableKey.Split('-')[1].Trim(); SetSelectInfo(m_currentFloorCd, m_currentTableNo); TableButton_DesignChanged(sender, null); if (string.IsNullOrWhiteSpace(m_currentOperation)) return; switch (m_currentOperation) { case PosKey.MENU_KEY.TABLE_PROPERTY: TableManangerProcess(null); break; case PosKey.MENU_KEY.TABLE_DELETE: TableDeleteProcess(null); break; } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } finally { pnlTable.Refresh(); } } private void TableButton_DesignChanged(object sender, EventArgs e) { var info = string.Empty; try { if (sender is CsmButtonTable) { if (string.IsNullOrWhiteSpace(m_currentTableNo) == false) { Column.MST_TABLE.TABLE_DATA cTable = m_tableMst.Find(x => x.FLOOR_CD == m_currentFloorCd && x.TABLE_NO == m_currentTableNo); if (cTable == null) return; var ctrl = (CsmButtonTable)sender; info = string.Format("【{0}】 X:{1} Y:{2} W:{3} H:{4}" , GetTableName(m_currentFloorCd, m_currentTableNo) , ctrl.Location.X, ctrl.Location.Y , ctrl.Size.Width, ctrl.Size.Height); if (ctrl.Location.X != cTable.X_COORD || ctrl.Location.Y != cTable.Y_COORD || ctrl.Size.Width != cTable.WIDTH || ctrl.Size.Height != cTable.HEIGHT) { cTable.X_COORD = ctrl.Location.X; cTable.Y_COORD = ctrl.Location.Y; cTable.WIDTH = ctrl.Size.Width; cTable.HEIGHT = ctrl.Size.Height; if (cTable.STATUS == PosConst.DB_ROW_STATUS.NONE) cTable.STATUS = PosConst.DB_ROW_STATUS.UPDATE; } // Debug logging //string log = DateTime.Now.ToString("hh:mm:ss ") // + " CtrlName:" + ctrl.Name + " Floor:" + cTable.FLOOR_CD + " Table:" + cTable.TABLE_NO // + " X:" + cTable.X_COORD.ToString() + " Y:" + cTable.Y_COORD.ToString() // + " W:" + cTable.WIDTH.ToString() + " H:" + cTable.HEIGHT.ToString() // + " STATUS:" + cTable.STATUS; //System.Diagnostics.Debug.Print(log); } } } catch { } finally { lblTableInfo.Text = info; } } private void btnFixedCreate_Click(object sender, EventArgs e) { try { if (CheckInputValue(null) == false) return; int x = CmUtil.IntParse(txtFixedX.Value); int y = CmUtil.IntParse(txtFixedY.Value); this.TableFixedCreate(x, y); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private void txtFixed_Enter(object sender, EventArgs e) { try { btnFixedCreate.BackColor = Color.FromArgb(22, 187, 238); } catch { } } private void txtFixed_Leave(object sender, EventArgs e) { try { btnFixedCreate.BackColor = Color.FromArgb(33, 33, 33); } catch { } } private void txtFixed_KeyDownEvent(object sender, string sFuncValue) { if (sFuncValue == PosKey.MENU_KEY.ENTER) { CheckInputValue(sender); } } private void btnFixedUp_Click(object sender, EventArgs e) { try { int value = 0; if (sender == btnUpY) { value = CmUtil.IntParse(txtFixedY.Value) + 1; if (value > 5) value = 1; txtFixedY.Value = value.ToString(); txtFixedY.Select(); } else if (sender == btnUpX) { value = CmUtil.IntParse(txtFixedX.Value) + 1; if (value > 6) value = 1; txtFixedX.Value = value.ToString(); txtFixedX.Select(); } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private bool CheckInputValue(object sender) { try { if (string.IsNullOrWhiteSpace(m_currentFloorCd)) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0079); return false; } int coord = 0; if (sender == null || sender == txtFixedX) { coord = CmUtil.IntParse(txtFixedX.Value); if (coord == 0) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0511); txtFixedX.Value = "0"; txtFixedX.Focus(); txtFixedX.SelectText(); return false; } if (coord > CTRL_MAX_COUNT_X) { WinManager.ErrorMessage(string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0512), CTRL_MAX_COUNT_X)); txtFixedX.Focus(); txtFixedX.SelectText(); return false; } if (sender != null) txtFixedY.Select(); } if (sender == null || sender == txtFixedY) { coord = CmUtil.IntParse(txtFixedY.Value); if (coord == 0) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0511); txtFixedY.Value = "0"; txtFixedY.Focus(); txtFixedY.SelectText(); return false; } if (coord > CTRL_MAX_COUNT_Y) { WinManager.ErrorMessage(string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0512), CTRL_MAX_COUNT_Y)); txtFixedY.Focus(); txtFixedY.SelectText(); return false; } if (sender != null) txtFixedX.Select(); } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } } /// /// 화면초기화 /// private void InitControl() { try { this.Location = new Point(0, 0); this.Size = new Size(1024, 768); //picTop.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MAIN_TOP_BG); picTop.Location = new Point(0, 0); picTop.Size = new Size(1024, 50); //picBtm.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MAIN_TOP_BG); picBtm.Location = new Point(0, 746); picBtm.Size = new Size(1024, 22); FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT); lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0810); lblStoreNm.Text = m_cPosStatus.Mst.StorName; lblTableInfo.Text = string.Empty; lblGuideMsg.Text = string.Empty; lblTableCnt.Text = string.Empty; m_totalFloorPage = 0; m_currentFloorPage = -1; m_currentFloorCd = string.Empty; m_currentTableNo = string.Empty; txtFixedX.Value = string.Empty; txtFixedY.Value = string.Empty; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } /// /// 기능버튼 화면 출력 /// /// private bool SetFuncMenu() { try { string btnText = string.Empty; // 메뉴버튼 초기화 for (var i = 0; i < m_btnFuncList.Count; i++) { m_btnFuncList[i].Tag = string.Empty; m_btnFuncList[i].Text = string.Empty; m_btnFuncList[i].BorderStyle = BorderStyle.FixedSingle; m_btnFuncList[i].BackColor = Color.FromArgb(70, 86, 99); m_btnFuncList[i].ForeColor = Color.White; m_btnFuncList[i].Visible = false; } // 후불 테이블 기능키 그룹 로딩 DataTable dtData = m_cDataCommon.SeletFuncKeyGroup(PosKey.MENU_KEY.TABLE_EDIT); if (dtData == null || dtData.Rows.Count <= 0) { // 기능키 마스터가 없으면, 기본값 설정. Dictionary funcKeys = new Dictionary(); funcKeys.Add(PosKey.MENU_KEY.FLOOR_MANAGER, "Floor\nManage"); funcKeys.Add(PosKey.MENU_KEY.TABLE_INSERT, "Table\nInsert"); funcKeys.Add(PosKey.MENU_KEY.TABLE_COPY, "Table\nCopy"); funcKeys.Add(PosKey.MENU_KEY.TABLE_DELETE, "Table\nDelete"); funcKeys.Add(PosKey.MENU_KEY.TABLE_PROPERTY, "Table\nProperty"); funcKeys.Add(PosKey.MENU_KEY.TABLE_RESTORE, "Restore"); funcKeys.Add(PosKey.MENU_KEY.TABLE_BACKUP, "Server\nBackup"); funcKeys.Add(PosKey.MENU_KEY.TABLE_SAVE, "Save"); funcKeys.Add(PosKey.MENU_KEY.TABLE_RESET, "Table\nReset"); funcKeys.Add(PosKey.MENU_KEY.TABLE_EXIT, "Exit"); for (var i = 0; i < funcKeys.Count; i++) { var func = funcKeys.ElementAt(i); m_btnFuncList[i].Tag = func.Key; m_btnFuncList[i].Text = func.Value; m_btnFuncList[i].BackColor = m_FuncDefaultBackColor; m_btnFuncList[i].ForeColor = m_FuncDefalutForeColor; m_btnFuncList[i].BorderStyle = BorderStyle.FixedSingle; m_btnFuncList[i].Visible = true; } return false; } int idx = 0; foreach (DataRow dr in dtData.Rows) { m_btnFuncList[idx].Tag = CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_ID); m_btnFuncList[idx].Text = CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_NM); m_btnFuncList[idx].BackColor = m_FuncDefaultBackColor; m_btnFuncList[idx].ForeColor =m_FuncDefalutForeColor; m_btnFuncList[idx].BorderStyle = BorderStyle.FixedSingle; m_btnFuncList[idx].Visible = true; idx++; } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } } private bool LoadFloorMaster(bool isShowMsg = true) { try { this.m_floorMst.Clear(); DataTable dtData = null; string ret = m_cTableSvr.SelectFloor(new string[] { PosConst.QueryTagDef.QueryFloorDef.FLOOR_ALL_SEARCH, string.Empty }, out dtData); if (ret == UserCom.RST_IGNORE) { if (isShowMsg) WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0079); return true; } if (ret != UserCom.RST_OK) { if (isShowMsg) WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0078); return false; } foreach (DataRow dr in dtData.Rows) { Column.MST_FLOOR.FLOOR_DATA cFloor = new Column.MST_FLOOR.FLOOR_DATA(); cFloor.FLOOR_CD = CmUtil.GetDataRowStr(dr, "FLOOR_CD"); cFloor.FLOOR_NM = CmUtil.GetDataRowStr(dr, "FLOOR_NM"); cFloor.UPD_DT = CmUtil.GetDataRowStr(dr, "UPD_DT"); cFloor.REG_DT = CmUtil.GetDataRowStr(dr, "REG_DT"); cFloor.STATUS = PosConst.DB_ROW_STATUS.NONE; this.m_floorMst.Add(cFloor); } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } } private bool LoadTableMaster(bool isShowMsg = true) { try { this.m_tableMst.Clear(); DataTable dtData = null; string ret = m_cTableSvr.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_ALL_SEARCH }, out dtData); if (ret == UserCom.RST_IGNORE) { if (isShowMsg) WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0495); return true; } if (ret != UserCom.RST_OK) { if (isShowMsg) WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0496); return false; } foreach (DataRow dr in dtData.Rows) { Column.MST_TABLE.TABLE_DATA cTable = new Column.MST_TABLE.TABLE_DATA(); m_cTableSvr.SetTableInfo(dr, ref cTable); this.m_tableMst.Add(cTable); } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } } private void FloorButtonClear() { try { // 층버튼 초기화 for (var i = 0; i < this.m_btnFloorList.Count; i++) { m_btnFloorList[i].BackColor = this.m_FloorDefaultBackColor; m_btnFloorList[i].ForeColor = this.m_FloorDefaultForeColor; m_btnFloorList[i].BorderStyle = BorderStyle.FixedSingle; m_btnFloorList[i].Text = string.Empty; m_btnFloorList[i].Tag = string.Empty; m_btnFloorList[i].Enabled = false; } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private bool DisplayFloorButton(int targetFloorPage = 0, bool force = false) { try { //this.SuspendLayout(); var tmpFloorMst = m_floorMst.Where(x => x.STATUS != PosConst.DB_ROW_STATUS.DELETE).ToList() .OrderBy(x => x.FLOOR_CD).ToList(); int totalCount = tmpFloorMst.Count; if (totalCount == 0 || m_btnFloorList.Count == 0) { FloorButtonClear(); return false; } m_totalFloorPage = (totalCount / MAX_FLOOR_COUNT) + (totalCount % MAX_FLOOR_COUNT != 0 ? 1 : 0); if (m_currentFloorPage == targetFloorPage && force == false) return false; if (targetFloorPage > totalCount) targetFloorPage = totalCount - 1; m_currentFloorPage = targetFloorPage; // 층버튼 초기화 FloorButtonClear(); // 층버튼 화면표시 var strIdx = targetFloorPage * MAX_FLOOR_COUNT; var endIdx = strIdx + MAX_FLOOR_COUNT; var btnIdx = 0; for (var i = strIdx; i < endIdx; i++) { if (i >= tmpFloorMst.Count) break; m_btnFloorList[btnIdx].BackColor = this.m_FloorDefaultBackColor; m_btnFloorList[btnIdx].ForeColor = this.m_FloorDefaultForeColor; m_btnFloorList[btnIdx].BorderStyle = BorderStyle.FixedSingle; m_btnFloorList[btnIdx].Text = tmpFloorMst[i].FLOOR_NM; m_btnFloorList[btnIdx].Tag = tmpFloorMst[i].FLOOR_CD; m_btnFloorList[btnIdx].Enabled = true; btnIdx++; } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { //this.ResumeLayout(false); } } private void SelectFloorButton(string floorCd) { try { if (string.IsNullOrWhiteSpace(floorCd)) return; for (var i = 0; i < m_btnFloorList.Count; i++) { if (floorCd == m_btnFloorList[i].Tag.ToString()) { m_btnFloorList[i].BackColor = m_FloorSelectBackColor; m_btnFloorList[i].ForeColor = m_FloorSelectForeColor; m_btnFloorList[i].BorderStyle = BorderStyle.FixedSingle; } else { m_btnFloorList[i].BackColor = this.m_FloorDefaultBackColor; m_btnFloorList[i].ForeColor = this.m_FloorDefaultForeColor; m_btnFloorList[i].BorderStyle = BorderStyle.FixedSingle; } } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private void DisplayTableButton(string floorCd) { try { this.pnlTable.SuspendLayout(); if (m_currentFloorCd != floorCd) { m_ctrlDesigner.Detach(); PanelTableClear(); } if (string.IsNullOrWhiteSpace(floorCd)) return; m_currentFloorCd = floorCd; SetSelectInfo(floorCd, string.Empty); foreach (var tmpTable in from x in m_tableMst where x.FLOOR_CD == floorCd orderby x.FLOOR_CD, x.TABLE_NO select x) { CsmButtonTable tableButton = null; var tableNm = string.Empty; var key = string.Format("{0}-{1}", tmpTable.FLOOR_CD, tmpTable.TABLE_NO); if (pnlTable.Controls.ContainsKey(key)) { tableButton = (CsmButtonTable)pnlTable.Controls[key]; if (tmpTable.STATUS == PosConst.DB_ROW_STATUS.DELETE) { this.PanelTableRemove(tableButton); continue; } tableNm = tmpTable.TABLE_NM; } else { if (tmpTable.STATUS == PosConst.DB_ROW_STATUS.DELETE) continue; tableButton = new CsmButtonTable(); tableButton.Name = key; tableButton.Tag = tmpTable.TABLE_NO; tableButton.TableKey = key; tableButton.DefaultColor = this.m_tblDefaultColor; tableButton.ClickColor = this.m_tblSelectColor; tableNm = string.Format("【{0}】", tmpTable.TABLE_NM); this.PanelTableAdd(tableButton); } tableButton.SetTableInfo(tmpTable.TABLE_NM , tableNm , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0137) , m_cPosStatus.Global.m_stCultureMaster.strCurrencySymbol + m_cPosStatus.Global.NumericTOCurrency(1000) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0755) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0812)); tableButton.Font = new Font(tmpTable.FONT_NM, tmpTable.FONT_SIZE); tableButton.SetBounds(tmpTable.X_COORD, tmpTable.Y_COORD, tmpTable.WIDTH, tmpTable.HEIGHT); if (tableButton != null) { tableButton.OccupancyLevel = -1; tableButton.BorderStyle = BorderStyle.None; tableButton.IsWaited = false; tableButton.BringToFront(); } } ShowCurentTableCount(); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } finally { this.pnlTable.ResumeLayout(); } } /// /// 선택한 층 및 테이블 정보 화면표시 /// /// /// private void SetSelectInfo(string floorCd, string tableNo) { string text = string.Empty; try { if (string.IsNullOrWhiteSpace(floorCd)) { lblTableInfo.Text = string.Empty; return; } text += string.Format("{0} : {1} [{2}]", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0175), floorCd, GetFloorName(floorCd)); if (string.IsNullOrWhiteSpace(tableNo)) { lblTableInfo.Text = string.Empty; return; } text += string.Format(" {0} : {1} [{2}]", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0176), tableNo, GetTableName(floorCd, tableNo)); } catch { } finally { lblSelectInfo.Text = text; } } private string GetFloorName(string floorCd) { string retValue = floorCd; try { string name = m_floorMst.Find(x => x.FLOOR_CD == floorCd).FLOOR_NM; if (string.IsNullOrWhiteSpace(name) == false) retValue = name; } catch { } return retValue; } private string GetTableName(string floorCd, string tableNo) { string retValue = tableNo; try { string name = m_tableMst.Find(x => x.FLOOR_CD == floorCd && x.TABLE_NO == tableNo).TABLE_NM; if (string.IsNullOrWhiteSpace(name) == false) retValue = name; } catch { } return retValue; } private void PanelTableAdd(CsmButtonTable tableButton) { try { tableButton.ButtonClickHandler += new CsmButtonTable.ButtonClickEventHandler(TableButton_ClickEvent); tableButton.LocationChanged += new EventHandler(TableButton_DesignChanged); tableButton.SizeChanged += new EventHandler(TableButton_DesignChanged); this.pnlTable.Controls.Add(tableButton); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private void PanelTableRemove(CsmButtonTable tableButton) { try { pnlTable.Controls.Remove(tableButton); tableButton.ButtonClickHandler -= new CsmButtonTable.ButtonClickEventHandler(TableButton_ClickEvent); tableButton.LocationChanged -= new EventHandler(TableButton_DesignChanged); tableButton.SizeChanged -= new EventHandler(TableButton_DesignChanged); tableButton.Dispose(); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private void PanelTableClear() { try { foreach (Control ctrl in pnlTable.Controls) { if (ctrl is CsmButtonTable) { PanelTableRemove((CsmButtonTable)ctrl); } else { pnlTable.Controls.Remove(ctrl); } } this.pnlTable.Controls.Clear(); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } } private void pnlTable_Click(object sender, EventArgs e) { try { // 테이블 선택 해제 m_ctrlDesigner.Detach(); m_currentTableNo = string.Empty; SetSelectInfo(m_currentFloorCd, string.Empty); //SetChangedTableProperty(); } catch { } } /// /// 기능버튼 선택효과 처리 /// /// private void OperationButtonSelect(bool selected, CsmButton button = null) { try { if (selected == false && button == null) { for (var i = 0; i < m_btnFuncList.Count; i++) { //m_btnFuncList[i].BorderStyle = BorderStyle.FixedSingle; m_btnFuncList[i].BackColor = m_FuncDefaultBackColor; m_btnFuncList[i].ForeColor = m_FuncDefalutForeColor; } return; } if (button is CsmButton) { button.BackColor = selected ? m_FuncClickBackColor : m_FuncDefaultBackColor; button.ForeColor = selected ? m_FuncClickForeColor : m_FuncDefalutForeColor; button.Update(); } } catch { } } /// /// 층 관리 /// /// private bool FloorManangerProcess(CsmButton button) { try { OperationButtonSelect(false); OperationButtonSelect(true, button); m_currentOperation = string.Empty; frmFloorManager frm = (frmFloorManager)FormManager.GetForm(FormManager.FORM_FLOOR_MGR); if (frm == null) { frm = new frmFloorManager(); FormManager.AddForm(FormManager.FORM_FLOOR_MGR, frm); } frm.FloorCode = m_currentFloorCd; frm.FloorMaster = m_floorMst; DialogResult dr = frm.ShowDialog(); m_floorMst = frm.FloorMaster; int count = m_floorMst.Count(x => x.STATUS != PosConst.DB_ROW_STATUS.DELETE); if (count > 0) { string floorCd = m_floorMst[0].FLOOR_CD; DisplayFloorButton(0, true); SelectFloorButton(floorCd); DisplayTableButton(floorCd); } else { DisplayFloorButton(0, true); DisplayTableButton(string.Empty); m_currentFloorCd = string.Empty; } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { m_currentOperation = string.Empty; OperationButtonSelect(false, button); } } /// /// 테이블 속성 관리 /// /// private bool TableManangerProcess(CsmButton button) { try { if (string.IsNullOrWhiteSpace(m_currentTableNo)) { if (m_currentOperation != PosKey.MENU_KEY.TABLE_PROPERTY) { OperationButtonSelect(false); OperationButtonSelect(true, button); lblGuideMsg.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0142); m_currentOperation = PosKey.MENU_KEY.TABLE_PROPERTY; } else { OperationButtonSelect(false, button); lblGuideMsg.Text = string.Empty; m_currentOperation = string.Empty; } return true; } frmTableManager frm = (frmTableManager)FormManager.GetForm(FormManager.FORM_TABLE_MGR); if (frm == null) { frm = new frmTableManager(); FormManager.AddForm(FormManager.FORM_TABLE_MGR, frm); } frm.TableMaster = m_tableMst; frm.FloorCode = m_currentFloorCd; frm.FloorName = GetFloorName(m_currentFloorCd); frm.TableNo = m_currentTableNo; DialogResult dr = frm.ShowDialog(); DisplayTableButton(m_currentFloorCd); lblGuideMsg.Text = string.Empty; m_currentOperation = string.Empty; m_ctrlDesigner.Detach(); OperationButtonSelect(false, button); return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { pnlTable_Click(null, null); } } /// /// 테이블 추가 처리 /// /// private bool TableInsertProcess(CsmButton button) { try { OperationButtonSelect(false); OperationButtonSelect(true, button); lblGuideMsg.Text = string.Empty; m_currentOperation = string.Empty; if (string.IsNullOrWhiteSpace(m_currentFloorCd)) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0079); return false; } string newCode = GetNewTableNo(); string key = string.Format("{0}-{1}", m_currentFloorCd, newCode); Point newPoint = GetNewTableLoation(); // 테이블 객체 생성 var cTable = m_tableMst.Find(x => x.FLOOR_CD == m_currentFloorCd && x.TABLE_NO == newCode); if (cTable == null) { cTable = new Column.MST_TABLE.TABLE_DATA(); m_tableMst.Add(cTable); } cTable.FLOOR_CD = m_currentFloorCd; cTable.TABLE_NO = newCode; cTable.TABLE_NM = newCode; cTable.FONT_NM = m_cPosStatus.Base.FONT; cTable.FONT_SIZE = 10; cTable.X_COORD = newPoint.X; cTable.Y_COORD = newPoint.Y; cTable.WIDTH = CTRL_MIN_WIDTH; cTable.HEIGHT = CTRL_MIN_HEIGHT; cTable.STATUS = PosConst.DB_ROW_STATUS.INSERT; // 테이블 컨트롤 생성 CsmButtonTable tableButton = new CsmButtonTable(); tableButton.Name = key; tableButton.Tag = cTable.TABLE_NO; tableButton.TableKey = key; tableButton.DefaultColor = this.m_tblDefaultColor; tableButton.ClickColor = this.m_tblSelectColor; tableButton.SetTableInfo(cTable.TABLE_NM , string.Format("【{0}】", cTable.TABLE_NM) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0137) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0231) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0812)); tableButton.Font = new Font(cTable.FONT_NM, cTable.FONT_SIZE); tableButton.SetBounds(cTable.X_COORD, cTable.Y_COORD, cTable.WIDTH, cTable.HEIGHT); tableButton.OccupancyLevel = -1; tableButton.IsWaited = false; tableButton.Visible = true; tableButton.BringToFront(); this.PanelTableAdd(tableButton); // 테이블 컨트롤 선택 TableButton_ClickEvent(tableButton, key); return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { OperationButtonSelect(false, button); } } /// /// 테이 고정갯수 생성 /// /// 가로갯수 /// 세로갯수 /// private bool TableFixedCreate(int xCnt, int yCnt) { const int MARGIN = 2; try { if (xCnt > CTRL_MAX_COUNT_X) return false; if (yCnt > CTRL_MAX_COUNT_Y) return false; // 객체 초기화 foreach (var tmpTable in from x in m_tableMst where x.FLOOR_CD == m_currentFloorCd select x) { tmpTable.STATUS = PosConst.DB_ROW_STATUS.DELETE; } // 컨트롤 초기화 m_ctrlDesigner.Detach(); PanelTableClear(); int table = 0; int w = (SCR_SIZE_WIDTH / xCnt); int h = (SCR_SIZE_HEIGHT / yCnt); for (var row = 0; row < yCnt; row++) { for (var col = 0; col < xCnt; col++) { var x = w * col; var y = h * row; var tableNo = (++table).ToString("000"); var key = string.Format("{0}-{1}", m_currentFloorCd, tableNo); // 객체생성 var cTable = m_tableMst.Find(c => c.FLOOR_CD == m_currentFloorCd && c.TABLE_NO == tableNo); if (cTable == null) { cTable = new Column.MST_TABLE.TABLE_DATA(); m_tableMst.Add(cTable); } cTable.FLOOR_CD = m_currentFloorCd; cTable.TABLE_NO = tableNo; cTable.TABLE_NM = tableNo; cTable.FONT_NM = m_cPosStatus.Base.FONT; cTable.FONT_SIZE = 10; cTable.X_COORD = x + CTRL_CAP; cTable.Y_COORD = y + CTRL_CAP; cTable.WIDTH = w - CTRL_CAP * MARGIN; cTable.HEIGHT = h - CTRL_CAP * MARGIN; cTable.STATUS = PosConst.DB_ROW_STATUS.UPDATE; // 테이블 컨트롤 생성 CsmButtonTable tableButton = new CsmButtonTable(); tableButton.Name = key; tableButton.Tag = cTable.TABLE_NO; tableButton.TableKey = key; tableButton.DefaultColor = this.m_tblDefaultColor; tableButton.ClickColor = this.m_tblSelectColor; tableButton.SetTableInfo(cTable.TABLE_NM , string.Format("【{0}】", cTable.TABLE_NM) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0137) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0231) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0812)); tableButton.Font = new Font(cTable.FONT_NM, cTable.FONT_SIZE); tableButton.SetBounds(cTable.X_COORD, cTable.Y_COORD, cTable.WIDTH, cTable.HEIGHT); tableButton.OccupancyLevel = -1; tableButton.IsWaited = false; tableButton.Visible = true; tableButton.BringToFront(); this.PanelTableAdd(tableButton); } } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { txtFixedX.Value = string.Empty; txtFixedY.Value = string.Empty; pnlTable.Focus(); } } /// /// 테이블 복사 처리 /// /// /// private bool TableCopyProcess(CsmButton button) { try { OperationButtonSelect(false); if (string.IsNullOrWhiteSpace(m_currentTableNo)) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0142); return false; } OperationButtonSelect(true, button); // 원본 string orgkey = string.Format("{0}-{1}", m_currentFloorCd, m_currentTableNo); Control orgCtrl = pnlTable.Controls.Find(orgkey, false)[0]; if (orgCtrl == null) { m_currentTableNo = string.Empty; m_ctrlDesigner.Detach(); return false; } Column.MST_TABLE.TABLE_DATA orgTable = m_tableMst.Find(x => x.FLOOR_CD == m_currentFloorCd && x.TABLE_NO == m_currentTableNo); if (orgTable == null) { m_currentTableNo = string.Empty; m_ctrlDesigner.Detach(); return false; } // 복사 string newCode = GetNewTableNo(); string newKey = string.Format("{0}-{1}", m_currentFloorCd, newCode); Point newPoint = GetNewTableLoation(); Column.MST_TABLE.TABLE_DATA cTable = m_tableMst.Find(x => x.FLOOR_CD == m_currentFloorCd && x.TABLE_NO == newCode); if (cTable == null) { cTable = new Column.MST_TABLE.TABLE_DATA(); m_tableMst.Add(cTable); } cTable.FLOOR_CD = m_currentFloorCd; cTable.TABLE_NO = newCode; cTable.TABLE_NM = newCode; cTable.FONT_NM = orgTable.FONT_NM; cTable.FONT_SIZE = orgTable.FONT_SIZE; cTable.X_COORD = newPoint.X; cTable.Y_COORD = newPoint.Y; cTable.WIDTH = orgTable.WIDTH; cTable.HEIGHT = orgTable.HEIGHT; cTable.STATUS = PosConst.DB_ROW_STATUS.INSERT; // 테이블 컨트롤 생성 CsmButtonTable tableButton = new CsmButtonTable(); tableButton.Name = newKey; tableButton.Tag = cTable.TABLE_NO; tableButton.TableKey = newKey; tableButton.DefaultColor = this.m_tblDefaultColor; tableButton.ClickColor = this.m_tblSelectColor; tableButton.SetTableInfo(cTable.TABLE_NM , string.Format("【{0}】", cTable.TABLE_NM) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0137) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0231) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0812)); tableButton.Font = new Font(cTable.FONT_NM, cTable.FONT_SIZE); tableButton.SetBounds(cTable.X_COORD, cTable.Y_COORD, cTable.WIDTH, cTable.HEIGHT); tableButton.OccupancyLevel = -1; tableButton.IsWaited = false; tableButton.Visible = true; tableButton.BringToFront(); this.PanelTableAdd(tableButton); lblGuideMsg.Text = string.Empty; m_currentOperation = string.Empty; this.TableButton_ClickEvent(tableButton, newKey); return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { ShowCurentTableCount(); OperationButtonSelect(false, button); } } /// /// 테이블 삭제 처리 /// /// /// private bool TableDeleteProcess(CsmButton button) { try { if (string.IsNullOrWhiteSpace(m_currentTableNo)) { if (m_currentOperation != PosKey.MENU_KEY.TABLE_DELETE) { OperationButtonSelect(false); OperationButtonSelect(true, button); lblGuideMsg.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0142); m_currentOperation = PosKey.MENU_KEY.TABLE_DELETE; return true; } else { OperationButtonSelect(false, button); lblGuideMsg.Text = string.Empty; m_currentOperation = string.Empty; } return true; } string key = string.Format("{0}-{1}", m_currentFloorCd, m_currentTableNo); Control ctrl = pnlTable.Controls.Find(key, false)[0]; if (ctrl is CsmButtonTable) { // 테이블 컨트롤 삭제 // pnlTable.Controls.RemoveByKey(key); this.PanelTableRemove((CsmButtonTable)ctrl); // 테이블 객체 상태 업데이트 Column.MST_TABLE.TABLE_DATA cTable = m_tableMst.Find(x => x.FLOOR_CD == m_currentFloorCd && x.TABLE_NO == m_currentTableNo); if (cTable != null) { cTable.STATUS = PosConst.DB_ROW_STATUS.DELETE; } } m_currentTableNo = string.Empty; m_ctrlDesigner.Detach(); //lblGuideMsg.Text = string.Empty; //m_currentOperation = string.Empty; //OperationButtonSelect(false, button); return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { ShowCurentTableCount(); } } private string GetNewTableNo() { try { for (var i = 1; i < 1000; i++) { string newCode = i.ToString("000"); Column.MST_TABLE.TABLE_DATA temp = m_tableMst.Find(x => x.FLOOR_CD == m_currentFloorCd && x.TABLE_NO == newCode); if (temp == null) return newCode; if (temp.STATUS == PosConst.DB_ROW_STATUS.DELETE) return newCode; } return string.Empty; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return string.Empty; } } private Point GetNewTableLoation() { Point retValue = new Point(50, 50); try { int x1 = 10, y1 = 10; int x2 = 10, y2 = 10; Point loc = new Point(x1, y1); for (var i = 0; i < 100; i++) { bool isEquals = false; loc = new Point(x1, y1); foreach (Control ctrl in pnlTable.Controls) { System.Diagnostics.Debug.Print(ctrl.Location.ToString()); if (loc == ctrl.Location) { isEquals = true; break; } } if (isEquals == false) break; x1 = x1 + 30; y1 = y1 + 30; if (x1 + 187 > pnlTable.Width) { x1 = x2; x2 = x2 + 100; y1 = y2 + 100; } if (y1 + 110 > pnlTable.Height) { x1 = x2 + 100; x2 = x2 + 100; y1 = y2; } } retValue = loc; } catch { } return retValue; } /// /// 테이블 초기화 /// /// /// private bool TableResetProcess(CsmButton button) { try { m_currentOperation = string.Empty; OperationButtonSelect(false); OperationButtonSelect(true, button); if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0497) == false) return false; foreach (var tmpTable in from x in m_tableMst where x.FLOOR_CD == m_currentFloorCd select x) { tmpTable.STATUS = PosConst.DB_ROW_STATUS.DELETE; } PanelTableClear(); return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { OperationButtonSelect(false, button); } } /// /// 층/테이블 저장 /// /// /// private bool TableSaveProcess(CsmButton button) { try { pnlTable_Click(null, null); OperationButtonSelect(false); OperationButtonSelect(true, button); m_currentOperation = string.Empty; if (CheckDataChanged() == false) return true; if (button.Tag.ToString() == PosKey.MENU_KEY.TABLE_SAVE) { // 저장버튼 if (m_cTableSvr.GetOrderDataCount() > 0) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0667); return false; } } else { // 종료버튼 if (m_cTableSvr.GetOrderDataCount() > 0) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0667); return true; } } if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0498) == false) { return true; } var ret = m_cTableSvr.TableMasterSave(this.m_floorMst, this.m_tableMst); if (ret != UserCom.RST_OK) { WinManager.ErrorMessage(ret); return false; } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { OperationButtonSelect(false, button); } } /// /// 데이터 변경여부 확인 /// /// private bool CheckDataChanged() { try { Column.MST_FLOOR.FLOOR_DATA cFloor = m_floorMst.Find(x => x.STATUS != PosConst.DB_ROW_STATUS.NONE); if (cFloor != null) return true; Column.MST_TABLE.TABLE_DATA cTable = m_tableMst.Find(x => x.STATUS != PosConst.DB_ROW_STATUS.NONE); if (cTable != null) return true; return false; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } } /// /// 현재 테이블 변경정보 메모리 저장 처리 (미사용) /// private void SetChangedTableProperty() { //foreach (Control ctrl in pnlTable.Controls) //{ // try // { // if (ctrl is CsmButtonTable) // { // string[] name = ctrl.Name.ToString().Split('-'); // string floorCd = name[0]; // string tableNo = name[1]; // var cTable = m_tableMst.Find(x => x.FLOOR_CD == floorCd && x.TABLE_NO == tableNo); // bool isChanged = false; // if (cTable.X_COORD != ctrl.Location.X) isChanged = true; // if (cTable.Y_COORD != ctrl.Location.Y) isChanged = true; // if (cTable.WIDTH != ctrl.Size.Width) isChanged = true; // if (cTable.HEIGHT != ctrl.Size.Height) isChanged = true; // cTable.X_COORD = ctrl.Location.X; // cTable.Y_COORD = ctrl.Location.Y; // cTable.WIDTH = ctrl.Size.Width; // cTable.HEIGHT = ctrl.Size.Height; // if (isChanged && cTable.STATUS == PosConst.DB_ROW_STATUS.NONE) // { // cTable.STATUS = PosConst.DB_ROW_STATUS.UPDATE; // } // } // } // catch (Exception ex) // { // WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // ex.Message); // } //} } /// /// 테이블 서버백업 /// /// /// private bool TableBackupProcess(CsmButton button) { try { pnlTable_Click(null, null); if (CheckDataChanged() == true) { if (m_cTableSvr.GetOrderDataCount() > 0) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0667); return false; } } if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0517) == false) return false; using (frmWaitMessage frm = new frmWaitMessage()) { OperationButtonSelect(false); OperationButtonSelect(true, button); lblGuideMsg.Text = MessageManager.GetGuideMessage(POS_MESSAGE.GUIDE.MSG_0004); m_currentOperation = string.Empty; frm.WorkType = PosKey.MENU_KEY.TABLE_BACKUP; frm.FloorMaster = m_floorMst; frm.TableMaster = m_tableMst; frm.ShowDialog(); } return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { lblGuideMsg.Text = string.Empty; OperationButtonSelect(false, button); } } private bool TableRestoreProcess(CsmButton button) { try { pnlTable_Click(null, null); if (m_cTableSvr.GetOrderDataCount() > 0) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0667); return false; } if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0518) == false) return false; using (frmWaitMessage frm = new frmWaitMessage()) { OperationButtonSelect(false); OperationButtonSelect(true, button); m_currentOperation = string.Empty; lblGuideMsg.Text = MessageManager.GetGuideMessage(POS_MESSAGE.GUIDE.MSG_0005); frm.WorkType = PosKey.MENU_KEY.TABLE_RESTORE; frm.FloorMaster = m_floorMst; frm.TableMaster = m_tableMst; frm.ShowDialog(); } string floorCd = string.Empty; m_currentFloorPage = -1; m_currentFloorCd = string.Empty; DisplayFloorButton(); if (m_floorMst.Count > 0) floorCd = m_floorMst[0].FLOOR_CD; SelectFloorButton(floorCd); DisplayTableButton(floorCd); return true; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); return false; } finally { lblGuideMsg.Text = string.Empty; OperationButtonSelect(false, button); } } private void ShowCurentTableCount() { try { int cnt = 0; foreach (Control c in this.pnlTable.Controls) { if (c is CsmButtonTable) cnt++; } this.lblTableCnt.Text = string.Format("Table Count : {0}", cnt); } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); this.lblTableCnt.Text = string.Empty; } } } }