public bool Delete(int pCode) { JDataBase db = JGlobal.MainFrame.GetDBO(); try { if (JMessages.Question(" آیا می خواهید حذف شود ؟ ", "") == System.Windows.Forms.DialogResult.Yes) { if (GetChildsNode(pCode).Length == 0) { JFolderTable ActionTable = new JFolderTable(); JReferFolder tmpJReferFolder = new JReferFolder(); ActionTable.Code = pCode; db.beginTransaction("DeleteFolder"); if (ActionTable.Delete(db)) { if (tmpJReferFolder.Delete(pCode, db) >= 0) { if (db.Commit()) { Histroy.Save(this, ActionTable, Code, "Delete"); //Nodes.DeleteNodeInTreeView(Nodes.TreeNodes.CurrentNode); return(true); } else { db.Rollback("DeleteFolder"); return(false); } } else { db.Rollback("DeleteFolder"); return(false); } } else { db.Rollback("DeleteFolder"); return(false); } } else { JMessages.Error(" ابتدا پوشه های داخلی را حذف کنید ", ""); } } return(false); } catch (Exception ex) { JSystem.Except.AddException(ex); JMessages.Message("Delete Not Successfully", "Kartabl", JMessageType.Information); return(false); } finally { db.Dispose(); } }
public void AddHistroy(string npcName, string countent) { for (int i = 0; i < m_Histroy.Count; ++i) { if (countent == m_Histroy[i].countent) { return; } } Histroy histroy = new Histroy(); histroy.npcName = npcName; histroy.countent = countent; m_Histroy.Add(histroy); if (null != onAddHistroy) { onAddHistroy(histroy); } if (m_Histroy.Count > SaveCount) { m_Histroy.RemoveAt(0); if (null != onRemoveHistroy) { onRemoveHistroy(); } } }
private void GetFlowList(ViewType vt) { // 数据处理 BindData.Clear(); DataTable dt = new DataTable(); if (vt == ViewType.TheDay) { dt = Histroy.GetDataTale(DateTime.Now); } else if (vt == ViewType.Yesterday) { dt = Histroy.GetDataTale(DateTime.Now.AddDays(-1)); } else if (vt == ViewType.TheMonth) { dt = Histroy.GetDataTale(DateTime.Now.ToString("MM")); } foreach (DataRow data in dt.Rows) { Flow f = new Flow(); int id = Convert.ToInt32(data[0]); string name = (string)data[1]; string path = (string)data[2]; UInt32 up = Convert.ToUInt32(data[3]); UInt32 down = Convert.ToUInt32(data[4]); UInt32 total = up + down; System.Drawing.Icon icon = null; try { icon = System.Drawing.Icon.ExtractAssociatedIcon(path); } catch (Exception e) { icon = new System.Drawing.Icon("program_icon.ico"); } f.id = id; f.name = name; f.path = path; f.up = up; f.down = down; f.icon = icon; //f.iconPath = icon; BindData.Add(f); } }
protected override void SetData(byte[] data) { m_Histroy.Clear(); MemoryStream ms = new MemoryStream(data); BinaryReader _in = new BinaryReader(ms); _in.ReadInt32(); int count = _in.ReadInt32(); for (int i = 0; i < count; i++) { Histroy histroy = new Histroy(); histroy.npcName = _in.ReadString(); histroy.countent = _in.ReadString(); m_Histroy.Add(histroy); } _in.Close(); ms.Close(); }
// Insert , Update , Delete #region BaseFunctions public int Insert() { Create_Date_Time = DateTime.Now; User_post_code = JMainFrame.CurrentPostCode; JFolderTable ActionTable = new JFolderTable(); ActionTable.SetValueProperty(this); Code = ActionTable.Insert(); Nodes.InsertInTreeView(GetNode()); if (Code > 0) { Histroy.Save(this, ActionTable, Code, "Insert"); return(Code); } else { return(0); } }
void SaveHistroy() { var list = new List <int>(); for (int i = 0; i < GameSize.x; i++) { for (int j = 0; j < GameSize.y; j++) { var grid = Grids[i, j]; list.Add(grid.Num); } } var histroy = new Histroy(); histroy.score = Score; histroy.nums = list; Histroys.Insert(0, histroy); if (Histroys.Count >= 10) { print("记录大于10,删掉第10个"); Histroys.RemoveAt(9); } }