예제 #1
0
        private void SendOfferTable(int index, string departmentname)
        {
            lock (DepartmentList)
            {
                foreach (var department in DepartmentList)
                {
                    if (department.Name == departmentname)
                    {
                        var sendTable = department.OrderList.Clone();
                        if (index == -1)
                        {
                            foreach (DataRow row in department.OrderList.Rows)
                            {
                                if (row["Status"].ToString() == Global.UnKnown)
                                {
                                    row["Status"] = Global.Wait;
                                    sendTable.Rows.Add(row.ItemArray);
                                }
                            }
                        }
                        else if (index >= 0)
                        {
                            sendTable.Rows.Add(department.OrderList.Rows[index].ItemArray);
                        }

                        var content = Mode.SendOrder.ToString();
                        content += " " + _client.ClientIP.ToString();
                        content += " " + department.IP;
                        content += " " + CSVHelper.MakeCSV(sendTable);
                        _client.SendContent(content);
                    }
                }
            }
        }
예제 #2
0
        public static void SaveFile(DataTable table, string currentDept)
        {
            var path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            path += "\\LANTalk\\SaveFile\\" + currentDept;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            path += "\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".csv";
            File.WriteAllText(path, CSVHelper.MakeCSV(table), Encoding.GetEncoding("GB2312"));
        }
예제 #3
0
        private void SendOrder(int index = -1, Department dept = null)
        {
            Department department;

            if (dept == null)
            {
                department = GetCurrentDepartment();
            }
            else
            {
                department = dept;
            }



            if (department != null)
            {
                lock (department)
                {
                    var sendTable = department.OrderList.Clone();


                    if (index == -1)
                    {
                        foreach (DataRow row in department.OrderList.Rows)
                        {
                            if (row["Status"].ToString() == Global.UnKnown)
                            {
                                row["Send_Time"] = DateTime.Now.ToString("yyyy/MM/dd HH:mm");
                                sendTable.Rows.Add(row.ItemArray);
                            }
                        }
                    }
                    else if (index == -2)
                    {
                        sendTable = department.OrderList;
                    }
                    else if (index >= 0)
                    {
                        sendTable.Rows.Add(department.OrderList.Rows[index].ItemArray);
                    }

                    var content = Mode.SendOrder.ToString();
                    content += " " + _server._ip.ToString();
                    content += " " + department.IP;
                    content += " " + CSVHelper.MakeCSV(sendTable);
                    _server.CustomSend(department.Socketor, content);
                }
            }
        }
예제 #4
0
        public static void SaveConfig(DataTable table)
        {
            var path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            path += "\\LANTalk";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            path += "\\LANTalk.config";



            File.WriteAllText(path, CSVHelper.MakeCSV(table), Encoding.GetEncoding("GB2312"));
        }
예제 #5
0
        private void SaveOrderList()
        {
            var path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            foreach (var department in DepartmentList)
            {
                if (department.OrderList.Rows.Count > 0)
                {
                    var currentpath = path + "\\LANTalk\\OrderList";
                    currentpath += "\\" + department.Name;

                    if (!Directory.Exists(currentpath))
                    {
                        Directory.CreateDirectory(currentpath);
                    }

                    var now = DateTime.Now;

                    File.WriteAllText(currentpath + "\\" + now.ToString("yyyy-MM-dd") + ".csv", CSVHelper.MakeCSV(department.OrderList), Encoding.GetEncoding("GB2312"));

                    var DV = department.OrderList.DefaultView;
                    DV.RowFilter = string.Format("Status='{0}' OR Status='{1}'", Global.Wait, Global.Sending);
                    File.WriteAllText(currentpath + "\\" + now.AddDays(1).ToString("yyyy-MM-dd") + ".csv", CSVHelper.MakeCSV(DV.ToTable()), Encoding.GetEncoding("GB2312"));
                }
            }
        }