public void Clear() { this.StartTransaction(); try { this.Id = ulong.Parse(DateTime.Now.ToString("yyyyMMddHHmmss")); this.Terminalid = 0; this.UserID = 1; this.CountBill = 0; this.CountBill10 = 0; this.CountBill50 = 0; this.CountBill100 = 0; this.CountBill500 = 0; this.CountBill1000 = 0; this.CountBill5000 = 0; this.CountPay = 0; this._amount = 0; this.Datestarted = DateTime.Now; this.Bytesrecieved = 0; this.Bytessend = 0; this.Commit(); } catch { RollBack(); } old = null; }
public void Commit() { // Записываем на диск и закрываем транзакцию. ToDisk(); old = null; _txn_started = false; }
public void StartTransaction() { old = this; if (_txn_started == true) { throw new Exception("Текущая транзакция не закрыта."); } else { _txn_started = true; } }
public void RollBack() { this.Id = old.Id; this.Terminalid = old.Terminalid; this.UserID = old.UserID; this.CountBill = old.CountBill; this.CountBill10 = old.CountBill10; this.CountBill50 = old.CountBill50; this.CountBill100 = old.CountBill100; this.CountBill500 = old.CountBill500; this.CountBill1000 = old.CountBill1000; this.CountBill5000 = old.CountBill5000; this.CountPay = old.CountPay; this.Datestarted = old.Datestarted; this.Bytesrecieved = old.Bytesrecieved; this.Bytessend = old.Bytessend; old = null; // Записываем на диск и закрываем транзакцию. _txn_started = false; }
public static void LoadIncass() { Incassation = new zeus.HelperClass.Incass(IPayBox.Settings.StartupPath.TrimEnd('\\') + "\\config\\incass.xml"); Incassation.AutoCommit = true; IPayBox.Import = new zeus.HelperClass.Import(); if (IPayBox.XML_Statistic == null) { IPayBox.XML_Statistic = new XmlDocument(); } bool isstart = false; try { IPayBox.XML_Statistic.Load(IPayBox.Settings.StartupPath.TrimEnd('\\') + "\\config\\incass.xml"); XmlElement root = (XmlElement)IPayBox.XML_Statistic.DocumentElement; for (int i = 0; i < root.ChildNodes.Count; i++) { XmlElement row = (XmlElement)root.ChildNodes[i]; switch (row.Name) { case "count_bill": Incass.count = int.Parse(row.InnerText); break; case "count10": Incass.CountR10 = int.Parse(row.InnerText); break; case "count50": Incass.CountR50 = int.Parse(row.InnerText); break; case "count100": Incass.CountR100 = int.Parse(row.InnerText); break; case "count500": Incass.CountR500 = int.Parse(row.InnerText); break; case "count1000": Incass.CountR1000 = int.Parse(row.InnerText); break; case "count5000": Incass.CountR5000 = int.Parse(row.InnerText); break; case "count_check": Incass.countchecks = int.Parse(row.InnerText); break; case "bytes_read": Incass.bytesRead = int.Parse(row.InnerText); break; case "bytes_send": Incass.bytesSend = int.Parse(row.InnerText); break; case "amount": Incass.incass_amount = int.Parse(row.InnerText); break; case "incass-start-date": isstart = true; if (!DateTime.TryParse(row.InnerText, out Incass.incass_date_start)) { Incass.incass_date_start = DateTime.Now; } break; //case "count_bill": Incass.count = int.Parse(row.InnerText); break; } } } catch { } if (!isstart) { Incass.incass_date_start = DateTime.Now; FlushStatistic(); } }