Пример #1
0
        public bool DeleteEvent(string Column, object value)
        {
            bool returnvalue = false;

            if (ExistsEvent(Column, value) == true)
            {
                returnvalue = ThisDatabase.Delete(table_name, Column, value.ToString());
            }
            return(returnvalue);
        }
Пример #2
0
        /// <summary>
        /// Deletes the layout.
        /// </summary>
        /// <param name='guid'>
        /// GUID.
        /// </param>
        public static void DeleteLayout(string guid)
        {
            BaseDatabase MyDatabase = CreateDatabase();

            if (MyDatabase.Exists(dbConstants.table_name, dbConstants.GUID, guid) == true)
            {
                if (MyDatabase.Delete(dbConstants.table_name, dbConstants.GUID, guid) == true)
                {
                    LayoutDetails.Instance.TransactionsList.AddEvent(new Transactions.TransactionDeleteLayout(DateTime.Now, guid));

                    //now DELETE  any page with the GUId as their ParentGuid

                    // we have to grab the actual list of children and delete each individually
                    List <object[]> Deletable = MyDatabase.GetValues(dbConstants.table_name, new string[1] {
                        dbConstants.GUID
                    }, dbConstants.PARENT_GUID, guid);
                    if (Deletable != null)
                    {
                        foreach (object[] oArray  in Deletable)
                        {
                            if (oArray.Length > 0)
                            {
                                DeleteLayout(oArray[0].ToString());
                            }
                        }
                    }

                    //MyDatabase.Delete(dbConstants.table_name, dbConstants.PARENT_GUID, guid);


//					List<object> children = MyDatabase.GetValues(dbConstants.table_name, dbConstants.PARENT_GUID, guid);
//
//					if (children != null && children.Count > 0) {
//						for (int i = 0; i < children.Count; i++)
//						{
//							WriteFile (String.Format ("{1}__child{0}.txt", i.ToString (),FileName),children[i]);
//						}
//					}
                }
                else
                {
                    NewMessage.Show(Loc.Instance.GetStringFmt("Unable to delete layout {0}", guid));
                }
            }


            //if (MyDatabase.Exists (dbConstants.table_name, dbConstants.GUID, guid) == true) NewMessage.Show ("Did not delete"); else NewMessage.Show ("Was deleted!");

            MyDatabase.Dispose();
        }