Пример #1
0
        private iRstSrv.TableData[] CreateTableData(List <TableInfo> tableInfo)
        {
            List <iRstSrv.TableData> list = new List <iRstSrv.TableData>();

            // order by chair
            tableInfo = tableInfo.OrderBy(info => info.ChairNo).ToList();

            for (int i = 0; i < tableInfo.Count; i++)
            {
                //int tableNo = tableInfo[i].TableNo;

                for (int j = 0; j < tableInfo[i].TableNo; j++)
                {
                    iRstSrv.TableData tableObj = new iRstSrv.TableData();

                    tableObj.TableID    = -1;
                    tableObj.LayoutCode = "-1";
                    tableObj.NoOfChairs = Convert.ToInt32(tableInfo[i].ChairNo);
                    tableObj.PosL       = i * (Constants.SmallestTableWidth + Constants.WidthDifferent * i + 50) + j * 5 + 5 + "";
                    tableObj.PosT       = Constants.InitialTableTop + j * 5 + "";

                    list.Add(tableObj);
                }
            }

            return(list.ToArray());
        }
Пример #2
0
        private iRstSrv.TableData[] CreateTablesFromInput(string tableText)
        {
            List <iRstSrv.TableData> list = new List <iRstSrv.TableData>();

            // check has value
            if (!string.IsNullOrEmpty(tableText))
            {
                string[] tables = tableText.Split('|');
                //string[] chairs = chairText.Split(',');
                //string[] tables = tableText.Split(',');

                List <TableInfo> tableInfo = new List <TableInfo>();

                for (int i = 0; i < tables.Length; i++)
                {
                    string[] info = tables[i].Split(',');
                    tableInfo.Add(new TableInfo()
                    {
                        ChairNo = Convert.ToInt32(info[0]),
                        TableNo = Convert.ToInt32(info[1])
                    });
                }

                // order by chair
                tableInfo = tableInfo.OrderBy(info => info.ChairNo).ToList();

                for (int i = 0; i < tableInfo.Count; i++)
                {
                    //int tableNo = tableInfo[i].TableNo;

                    for (int j = 0; j < tableInfo[i].TableNo; j++)
                    {
                        iRstSrv.TableData tableObj = new iRstSrv.TableData();

                        tableObj.NoOfChairs = Convert.ToInt32(tableInfo[i].ChairNo);
                        tableObj.PosL       = i * (Constants.SmallestTableWidth + Constants.WidthDifferent * i + 50) + j * 5 + 5 + "";
                        tableObj.PosT       = 300 + j * 5 + "";

                        list.Add(tableObj);
                    }
                }
            }

            return(list.ToArray());
        }