软件的离线功能如何工作? [英] How offline feature of software works?

查看:100
本文介绍了软件的离线功能如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道软件的离线功能是如何工作的,因为我无法理解实现?



示例

如果我正在处理离线模式下的软件并且我正在创建一个交易,其中包含打印在账单上的发票编号(唯一编号)。然后如何维护发票号码,以便从多个来源插入数据不会发生冲突或换句话说发票号码不会发生冲突。







示例2

当软件处于离线模式时,我有 20个客户端插入记录并且在每个客户端插入一些记录后,如果软件上线,软件如何管理发票号码(因为以前软件是从真实数据中脱机,因此软件无法获取实时数据)和发票号码不能在内部进行管理,因为发票号码印在账单上







平台: - .Net Framework 3.5

数据库: - SQL Server 2008







提前致谢

I want to know how the offline feature of software works as i am not able to understand the implementation?

EXAMPLE
If i am working on a software in offline mode and i am creating a transaction which consists of an invoice number (unique number) which is printed on bill. Then how the invoice number is maintained so that inserting data from multiple source does not clash or in other words invoice number does not clash.



EXAMPLE 2
I have 20 client inserting records when the software is in offline mode and after each client inserts some records if the software comes online, how is the software going to manage the invoice number (as previously the software was offline from the real data so the software cannot fetch real time data) and invoice number cannot be managed internally because the invoice number is printed on the bill



Platform :- .Net Framework 3.5
Database :- SQL Server 2008



Thanks in advance

推荐答案

软件是离线应用程序,您只需在其中添加一项功能即可使用在线目录和数据库,例如聊天实际上处于脱机状态的应用程序,但一旦使用Internet连接,您就可以下载消息或发送消息。既然你在谈论.NET框架,那就有一个系统.Net [ ^ ]命名空间可用于网络(包括Internet),您可以使用它连接到Internet以使您的离线应用程序在线



正如您所说,离线应用程序保持脱机状态。您创建一个数据库,并为其分配几列以将数据存储在其中。例如,Invoice表将存储与您创建的Invoice相关的所有数据。您创建一个新记录,在表内创建一个新行,它将保存它的数据和所有数据,例如发票号



现在最后一件事,就是在线维护这种应用程序状态,这是一个棘手的事情,但并不多。如果您已经熟悉数据库,您可能知道 主键 [<需要一个href =https://en.wikipedia.org/wiki/Unique_target =_ blanktitle =New Window> ^ ]才能使数据易于查询(我真的因为我无法提出非重复数据,一致性或呃的确切词,我现在不知道了,我不知道。这就是为什么在在线数据库中你将创建表,就像存储客户端的ID一样。这是维护不同用户的InvoiceNumber状态的部分。您可以考虑创建复合键 [ ^ ],通过组合ClientID和InvoiceID,使每个客户端都可以拥有每个可能的整数ID,递增1.



记住,这只是我对创建表来存储来自不同客户端的数据的看法。所以,说这总是这样做的唯一方法是假的。
A software is an offline application, you just add a feature in it to work with online directories and databases, such as chat applications which are actually offline, but once using the Internet connection you can download the messages or send messages. Since you're talking about the .NET framework, there is a System.Net[^] namespace present to work with networks (including the Internet), which you can use to connect to the internet to make your offline applications online.

The offline application, as you say, is maintained offline. You create a database, and you assign a few columns to it to store the data in it. Such as, the Invoice table would store all of the data assosiated with the Invoice you create. You create a new record, a new row is created inside the table, which would hold the data for it and all of the data, such as invoice number.

Now the last thing, to maintain this state of the application online, is a tricky thing, but not much. If you're well introduced with databases, you might well know that a Primary key[^] is required to make the data easily query-able (I am really cracking up right now as I am not able to come up with the exact word for non-duplicate data, consistence or uh, I don't know). That is why, in the online database you will create the table, as if to store the client's ID too. This is the part which maintains the state of the InvoiceNumber for different users. You might consider creating a composite key[^], by combining the ClientID and the InvoiceID, so that every client can have every possible integer ID, incrementing by 1.

Remember, this is just my opinion of creating the tables to store the data coming from different clients. So, saying that this is always the only way of doing this would be false.


根据用户或计算生成发票号,例如

generate the invoice number based on user or compute, for example
<yyyymmdd><branchcode><usecode><sequencecode>



然后你有唯一的发票号码,即使全部也不会重复其他用户离线工作。您需要在本地存储发票数据,并在联机时与主数据库同步。可以使用最后插入的发票编号生成下一个发票编号。


then you have unique invoice number which will never duplicated even if all other users work on offline. you need to store invoice data locally and sync with main database when you connect online. next invoice number can be generated by using last inserted invoice number.


可能是您正在使用的软件正在您的计算机上存储数据,例如在XML文件或其他内容以及稍后系统上线时,软件将在检查数据库中是否存在Record后插入数据。
May be Software you are using is storing data on your computer for e.g. in XML file or something and later on when system comes online, Software will insert data after checking if Record is not present in database.


这篇关于软件的离线功能如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆