示例#1
0
        public static void transfer2Server()
        {
            int total   = 0;
            int success = 0;

            TransactionDao          dao       = new TransactionDao();
            int                     StationID = Convert.ToInt16(ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID"));
            String                  cri       = " Where t.LoungePlace=" + StationID;
            List <ModelTransaction> lists     = dao.SelectOffine(cri + " order by t.update_date desc", StationID);

            if (lists != null)
            {
                total = lists.Count;
                logger.Debug("# Start Transfer data to server.");
                logger.Debug("Local transaction have " + lists.Count + " records.");
                if (lists.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (ModelTransaction model in lists)
                    {
                        bool result = dao.Insert(model, StationID);
                        if (result)
                        {
                            logger.Debug("Local transaction have " + lists.Count + " records.");
                            //Delete local data when transfer to ser success.
                            if (dao.DeleteOffline(model, StationID))
                            {
                                success++;
                            }
                        }
                    }
                }
                logger.Debug("# Summary=> Total transfer total: " + total + " success: " + success + " fail: " + (total - success));
                logger.Debug("# End Transfer data to server.");
            }
        }