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(); } }
// 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); } }