Example #1
0
        public bool Examine(DataBook dataBook, out string error)
        {
            error = string.Empty;
            if (dataBook.Span.Days > 0 || dataBook.Span.Hours > 0 || dataBook.Span.Minutes > 0 || dataBook.Span.Seconds > 0)
            {
                return(false);
            }
            string str = "";

            if (ADController.DeleteUserFromGroup(dataBook.sAMAccountName, dataBook.GroupName, out str))
            {
                dataBook.Label = true;
                try
                {
                    Edit(dataBook);
                }catch (Exception ex)
                {
                    error = ex.Message;
                    return(false);
                }
            }
            else
            {
                error = str;
                return(false);
            }
            return(true);
        }
Example #2
0
        public FindReplaceWidget(DataBook db, IFinder iFinder)
        {
            finder   = iFinder;
            dataBook = db;

            Glade.XML gxml = new Glade.XML(FileResourcePath.GetDataPath("bless.glade"), "FindReplaceTable", "bless");
            gxml.Autoconnect(this);

            this.Shown += OnWidgetShown;
            SearchPatternEntry.Activated  += OnSearchPatternEntryActivated;
            ReplacePatternEntry.Activated += OnReplacePatternEntryActivated;

            SearchPatternEntry.FocusGrabbed  += OnFocusGrabbed;
            ReplacePatternEntry.FocusGrabbed += OnFocusGrabbed;

            SearchAsComboBox.Active  = 0;
            ReplaceAsComboBox.Active = 0;

            SearchPatternEntry.Completion            = new EntryCompletion();
            SearchPatternEntry.Completion.Model      = new ListStore(typeof(string));
            SearchPatternEntry.Completion.TextColumn = 0;

            ReplacePatternEntry.Completion            = new EntryCompletion();
            ReplacePatternEntry.Completion.Model      = new ListStore(typeof(string));
            ReplacePatternEntry.Completion.TextColumn = 0;

            // initialize replace pattern
            replacePattern = new byte[0];

            this.Add(FindReplaceTable);
            this.ShowAll();
        }
Example #3
0
        public static bool Examine(DataBook book, out string Error)
        {
            Error = string.Empty;
            if (book.Span.Days > 0 || book.Span.Hours > 0 || book.Span.Minutes > 0 || book.Span.Seconds > 0)
            {
                return(false);
            }
            string str = string.Empty;

            if (ADController.DeleteUserFromGroup(book.Name, book.GroupName, out str))
            {
                book.Label = true;
                try
                {
                    Edit(book);
                }catch (Exception ex) {
                    Error = ex.Message;
                    return(false);
                }
            }
            else
            {
                Error = str;
                return(false);
            }
            return(true);
        }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null || Session["username"] == null)
        {
            Response.Redirect("/index.aspx", true);
        }
        b_id = int.Parse(Request.QueryString.Get("bookid"));

        if (!(b_name.Text.Equals("") && b_no.Text.Equals("") && b_total.Text.Equals("") && b_newnumber.Text.Equals("")))
        {
            name      = b_name.Text;
            no        = int.Parse(b_no.Text);
            total     = int.Parse(b_total.Text);
            newnumber = int.Parse(b_newnumber.Text);
        }

        Book book = new DataBook().GetOneBookInfo(int.Parse(Request.QueryString.Get("bookid")));

        b_name.Text      = book.B_name;
        b_no.Text        = "" + book.B_no;
        b_total.Text     = "" + book.B_total;
        b_newnumber.Text = "" + book.B_total;

        List <Booktype> booktypes = new DataBooktype().GetBooktypes();

        booklist.DataTextField  = "t_name";
        booklist.DataValueField = "t_id";
        booklist.DataSource     = booktypes;
        if (!booklist.SelectedValue.Equals(""))
        {
            t_id = int.Parse(booklist.SelectedValue);
        }
        booklist.DataBind();
    }
Example #5
0
        static void Main()
        {
            Author        author  = new Author("Лисюткин", "Михаил", "Юрьевич");
            Author        author1 = new Author("Живодер", "Илья", "");
            Publ          publ    = new Publ("Mir");
            List <Author> authors = new List <Author>
            {
                author,
                author1
            };
            Book book = new Book("Книга", 123, 1904, authors, publ);


            string json = JsonConvert.SerializeObject(authors, Formatting.Indented); //Оформление JSON файла и заполнение информацией об авторах

            Console.WriteLine(json);
            DataBook data = new DataBook("F:/books.json");

            data.Add(book);

            DataAuthors dataAuthors = new DataAuthors("F:/authors.json");

            dataAuthors.Add(author);
            dataAuthors.Add(author1);

            DataPubls dataPubls = new DataPubls("F:/publs.json");

            dataPubls.Add(publ);

            DB dB = new DB("F:/Database.db");
        }
Example #6
0
 public NullPatternHighlighter(DataBook db)
     : base(db)
 {
     findStrategy.Pattern = new byte[1] {
         0
     };                                                    // Null bytes
 }
Example #7
0
	public ExportDialog(DataBook db, Gtk.Window mw)
			: base(Catalog.GetString("Export Bytes"), null, 0)
	{
		Glade.XML gxml = new Glade.XML (FileResourcePath.GetDataPath("bless.glade"), "ExportDialogVBox", "bless");
		gxml.Autoconnect (this);

		dataBook = db;
		mainWindow = mw;
		pluginManager = PluginManager.GetForType(typeof(ExportPlugin));
		
		// initialize plugins if we have to
		if (pluginManager == null) {
			PluginManager.AddForType(typeof(ExportPlugin), new object[0]);
			pluginManager = PluginManager.GetForType(typeof(ExportPlugin));
		}
		
		exportFinishedEvent = new AutoResetEvent(false);

		SetupExportPlugins();

		ExportPatternComboEntry.Model = new ListStore (typeof (string));
		ExportPatternComboEntry.TextColumn = 0;
		LoadFromPatternFile((ListStore)ExportPatternComboEntry.Model);

		ProgressHBox.Visible = false;
		cancelClicked = false;

		this.Modal = false;
		this.BorderWidth = 6;
		this.HasSeparator = false;
		CloseButton = (Gtk.Button)this.AddButton(Gtk.Stock.Close, ResponseType.Close);
		ExportButton = (Gtk.Button)this.AddButton(Catalog.GetString("Export"), ResponseType.Ok);
		this.Response += new ResponseHandler(OnDialogResponse);
		this.VBox.Add(ExportDialogVBox);
	}
Example #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null || Session["username"] == null)
        {
            Response.Redirect("/index.aspx", true);
        }
        List <Book> books = new DataBook().GetBookInfo();

        booklist.DataTextField  = "b_name";
        booklist.DataValueField = "b_id";
        booklist.DataSource     = books;
        if (!booklist.SelectedValue.Equals(""))
        {
            b_id = int.Parse(booklist.SelectedValue);
        }
        booklist.DataBind();

        List <Reader> readers = new DataReader().GetReaderInfo();

        readerlist.DataTextField  = "r_name";
        readerlist.DataValueField = "r_id";
        readerlist.DataSource     = readers;
        if (!readerlist.SelectedValue.Equals(""))
        {
            r_id = int.Parse(readerlist.SelectedValue);
        }
        readerlist.DataBind();

        if (!numberfirst.Text.Equals(""))
        {
            number = int.Parse(numberfirst.Text);
        }
    }
        /**********************************************************
        *  имя процедуры:  AutorListBookMouseDoubleClick
        *  назначение:     Запуск книги
        *  входные данные:
        *  выходные данные:
        * ********************************************************/
        private void AutorListBookMouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DataBook pI = (DataBook)autorListBook.SelectedValue;

            Process.Start(_currentdirApplication + @"\\AlReader2\\AlReader2.exe",
                          _strFolderLib + "\\" + pI.Path + pI.Fname + ".zip");
        }
        public LayoutSelectionDialog(DataBook db)
            : base(Catalog.GetString("Select Layout"), null, 0)
        {
            Glade.XML gxml = new Glade.XML(FileResourcePath.GetDataPath("bless.glade"), "LayoutSelectionPaned", "bless");
            gxml.Autoconnect(this);

            dataBook = db;

            // create the preview area
            dataPreview = new DataView();
            ByteBuffer bb = new ByteBuffer();

            bb.Append(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, 0, 16);
            bb.Append(new byte[] { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }, 0, 16);
            dataPreview.Buffer = bb;

            PreviewFrame.Add(dataPreview.Display);
            PreviewFrame.ShowAll();

            layoutDir = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "bless");
            layoutDir = System.IO.Path.Combine(layoutDir, "layouts");

            // Initialize list
            PopulateLayoutList();

            this.DefaultWidth  = 600;
            this.DefaultHeight = 300;
            this.Modal         = false;
            this.BorderWidth   = 6;
            this.HasSeparator  = false;
            this.AddButton(Gtk.Stock.Close, ResponseType.Close);
            this.AddButton(Gtk.Stock.Ok, ResponseType.Ok);
            this.Response += new ResponseHandler(OnDialogResponse);
            this.VBox.Add(LayoutSelectionPaned);
        }
Example #11
0
        public SelectRangeWidget(DataBook db)
        {
            dataBook = db;

            Gtk.Builder builder = new Gtk.Builder();
            builder.AddFromFile(FileResourcePath.GetDataPath("ui", "SelectRangePlugin.ui"));
            builder.Autoconnect(this);

            // set up entry completions
            FromEntry.Completion            = new EntryCompletion();
            FromEntry.Completion.Model      = new ListStore(typeof(string));
            FromEntry.Completion.TextColumn = 0;

            ToEntry.Completion            = new EntryCompletion();
            ToEntry.Completion.Model      = new ListStore(typeof(string));
            ToEntry.Completion.TextColumn = 0;

            // set button sensitivity
            OnEntryChanged(null, null);

            this.Shown += OnWidgetShown;

            this.Add(SelectRangeHBox);
            this.ShowAll();
        }
Example #12
0
        public FindReplaceWidget(DataBook db, IFinder iFinder)
        {
            finder   = iFinder;
            dataBook = db;

            Gtk.Builder builder = new Gtk.Builder();
            builder.AddFromFile(FileResourcePath.GetDataPath("ui", "FindReplacePlugin.ui"));
            builder.Autoconnect(this);

            this.Shown += OnWidgetShown;
            SearchPatternEntry.Activated  += OnSearchPatternEntryActivated;
            ReplacePatternEntry.Activated += OnReplacePatternEntryActivated;

            SearchPatternEntry.FocusGrabbed  += OnFocusGrabbed;
            ReplacePatternEntry.FocusGrabbed += OnFocusGrabbed;

            SearchAsComboBox.Active  = 0;
            ReplaceAsComboBox.Active = 0;

            SearchPatternEntry.Completion            = new EntryCompletion();
            SearchPatternEntry.Completion.Model      = new ListStore(typeof(string));
            SearchPatternEntry.Completion.TextColumn = 0;

            ReplacePatternEntry.Completion            = new EntryCompletion();
            ReplacePatternEntry.Completion.Model      = new ListStore(typeof(string));
            ReplacePatternEntry.Completion.TextColumn = 0;

            // initialize replace pattern
            replacePattern = new byte[0];

            this.Add(FindReplaceTable);
            this.ShowAll();
        }
Example #13
0
        public override bool Load()
        {
            dataBook = (DataBook)GetDataBook(mainWindow);

            widget         = new Infobar(dataBook);
            widget.Visible = true;

            Services.UI.Info = widget;

            ((VBox)mainWindow.Child).PackEnd(widget, false, false, 0);

            AddMenuItems(uiManager);

            dataBook.PageAdded  += new DataView.DataViewEventHandler(OnDataViewAdded);
            dataBook.Removed    += new RemovedHandler(OnDataViewRemoved);
            dataBook.SwitchPage += new SwitchPageHandler(OnSwitchPage);

            PreferencesChangedHandler handler = new PreferencesChangedHandler(OnPreferencesChanged);

            Preferences.Proxy.Subscribe("View.Statusbar.Show", "ib1", handler);
            Preferences.Proxy.Subscribe("View.Statusbar.Selection", "ib1", handler);
            Preferences.Proxy.Subscribe("View.Statusbar.Overwrite", "ib1", handler);
            Preferences.Proxy.Subscribe("View.Statusbar.Offset", "ib1", handler);

            loaded = true;
            return(true);
        }
Example #14
0
        public override bool Load()
        {
            dataBook = (DataBook)GetDataBook(mainWindow);

            // create the finder object
            ProgressDialog findProgressDialog = new ProgressDialog("", mainWindow);

            finder            = new DataBookFinder(dataBook, findProgressDialog.Update);
            finder.Strategy   = new BMFindStrategy();
            finder.FirstFind += OnFirstFind;

            // create the FindReplaceWidget (hidden)
            widget         = new FindReplaceWidget(dataBook, finder);
            widget.Visible = false;

            WidgetGroup wgroup = (WidgetGroup)GetWidgetGroup(mainWindow, 0);

            wgroup.Add(widget);

            // add the menu items
            AddActions(uiManager);

            dataBook.PageAdded   += new DataView.DataViewEventHandler(OnDataViewAdded);
            dataBook.PageRemoved += new DataView.DataViewEventHandler(OnDataViewRemoved);
            dataBook.SwitchPage  += new SwitchPageHandler(OnSwitchPage);

            loaded = true;
            return(true);
        }
Example #15
0
 public void Add(DataBook book, string Sender)
 {
     Add(new Message()
     {
         Sender   = Sender,
         Info     = String.Format("申请{0}的权限已经确认!", book.GroupName),
         Receiver = book.Name
     });
 }
Example #16
0
        public override bool Load()
        {
            dataBook = (DataBook)GetDataBook(mainWindow);

            AddMenuItems(uiManager);

            loaded = true;
            return(true);
        }
Example #17
0
        public void Check(int ID, string Reason, string Checker, int?Day, bool?Check, CheckStatus status)
        {
            if (string.IsNullOrEmpty(Checker))
            {
                return;
            }
            DataBook Book = Get(ID);

            if (Book == null)
            {
                throw new ArgumentException("内部服务器错误!");
            }
            if (status == CheckStatus.Agree)
            {
                try
                {
                    Core.ADManager.AddUserToGroup(Book.Name, Book.GroupName);
                }
                catch (Exception ex)
                {
                    throw new ArgumentException(ex.Message);
                }
            }
            if (status != CheckStatus.Wait)
            {
                Book.Checker   = Checker;
                Book.Reason    = Reason;
                Book.CheckTime = DateTime.Now;
                Book.Status    = status;
                DateTime time = Book.CheckTime;
                if (Day.HasValue)
                {
                    time = time.AddDays(Day.Value);
                }
                TimeSpan span = time.Subtract(Book.CheckTime);
                if (span.Days == 0 && span.Minutes == 0 && span.Hours == 0 && span.Seconds == 0)
                {
                    time = new DateTime(9999, 12, 31, 12, 00, 00);
                }
                if (Check.HasValue)
                {
                    if (Check.Value)
                    {
                        time = new DateTime(9999, 12, 31, 12, 00, 00);
                    }
                }
                Book.MaturityTime = time;
                try
                {
                    Edit(Book);
                }
                catch (Exception ex)
                {
                    throw new ArgumentException(ex.Message);
                }
            }
        }
Example #18
0
 public int Add(DataBook Book)
 {
     using (var db = GetDbContext())
     {
         db.DataBooks.Add(Book);
         db.SaveChanges();
         return(Book.ID);
     }
 }
Example #19
0
        public HelpOperationsPlugin(Window mw, UIManager uim)
        {
            mainWindow = mw;
            dataBook   = (DataBook)GetDataBook(mainWindow);
            uiManager  = uim;

            name        = "HelpOperations";
            author      = "Alexandros Frantzis";
            description = "Provides access to basic help operations";
        }
Example #20
0
        public override bool Load()
        {
            dataBook = (DataBook)GetDataBook(mainWindow);

            patternHighlighter = new NullPatternHighlighter(dataBook);

            Preferences.Proxy.Subscribe("Highlight.Focus", "fc", new PreferencesChangedHandler(OnPreferencesChanged));

            loaded = true;
            return(true);
        }
        public BitwiseOperationsPlugin(Window mw, UIManager uim)
        {
            mainWindow = mw;
            uiManager  = uim;

            dataBook = (DataBook)GetDataBook(mw);

            name        = "BitwiseOperations";
            author      = "Alexandros Frantzis";
            description = "Bitwise operations on data";
        }
Example #22
0
 public static void Edit(DataBook Book)
 {
     using (var db = GetJURDataContext())
     {
         var entry = db.DataBooks.Find(Book.ID);
         if (entry != null)
         {
             db.Entry(entry).CurrentValues.SetValues(Book);
             db.SaveChanges();
         }
     }
 }
Example #23
0
        public override bool Load()
        {
            clipboard = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", true));
            dataBook  = (DataBook)GetDataBook(mainWindow);

            Preferences.Proxy.Subscribe("CopyOffset.NumberBase", "co",
                                        new PreferencesChangedHandler(OnPreferencesChanged));

            AddActions(uiManager);

            loaded = true;
            return(true);
        }
        public PatternHighlighter(DataBook db)
        {
            dataBook     = db;
            findStrategy = new BMFindStrategy();

            foreach (DataViewDisplay dvd in dataBook.Children)
            {
                OnDataViewAdded(dvd.View);
            }

            dataBook.PageAdded += new DataView.DataViewEventHandler(OnDataViewAdded);
            dataBook.Removed   += new RemovedHandler(OnDataViewRemoved);
        }
Example #25
0
        public override bool Load()
        {
            dataBook = (DataBook)GetDataBook(mainWindow);

            AddActions(uiManager);

            dataBook.PageAdded   += new DataView.DataViewEventHandler(OnDataViewAdded);
            dataBook.PageRemoved += new DataView.DataViewEventHandler(OnDataViewRemoved);
            dataBook.SwitchPage  += new SwitchPageHandler(OnSwitchPage);

            loaded = true;
            return(true);
        }
Example #26
0
        public override bool Load()
        {
            dataBook = (DataBook)GetDataBook(mainWindow);

            AddMenuItems(uiManager);

            dataBook.PageRemoved += new DataView.DataViewEventHandler(OnDataViewRemoved);
            dataBook.SwitchPage  += new SwitchPageHandler(OnSwitchPage);

            exportDialog = new ExportDialog(dataBook, mainWindow);

            loaded = true;
            return(true);
        }
Example #27
0
        public override bool Load()
        {
            dataBook       = (DataBook)GetDataBook(mainWindow);
            widget         = new SelectRangeWidget(dataBook);
            widget.Visible = false;

            WidgetGroup wgroup = (WidgetGroup)GetWidgetGroup(mainWindow, 0);

            wgroup.Add(widget);

            AddMenuItems(uiManager);

            loaded = true;
            return(true);
        }
Example #28
0
        public override bool Load()
        {
            dataBook = (DataBook)GetDataBook(mainWindow);
            WidgetGroup wg = (WidgetGroup)GetWidgetGroup(mainWindow, 1);

            sw = new StatisticsWidget(dataBook);

            wg.Add(sw);

            AddMenuItems(uiManager);

            Preferences.Proxy.Subscribe("Tools.Statistics.Show", "stats1", new PreferencesChangedHandler(OnPreferencesChanged));

            loaded = true;
            return(true);
        }
Example #29
0
 public void Edit(DataBook Book)
 {
     using (var db = GetJURDataContext())
     {
         var entry = db.DataBooks.Find(Book.ID);
         if (entry != null)
         {
             //entry.Reason = Book.Reason;
             //entry.Checker = Book.Checker;
             //entry.Check = Book.Check;
             Book.ID = entry.ID;
             db.Entry(entry).CurrentValues.SetValues(Book);
             db.SaveChanges();
         }
     }
 }
Example #30
0
        public RegisteredBook RegisterBook(DataBook dataBook)
        {
            var book = new Book
            {
                Id             = Guid.NewGuid(),
                Title          = dataBook.Title,
                ISBN           = dataBook.ISBN,
                PublishingYear = dataBook.PublishingYear
            };


            Repository.SaveBook(book);

            return(new RegisteredBook
            {
                Book = book
            });
        }