public JsonResult Catalog(string MyChecked)
 {
     Catalog n = new Catalog();
     catalogData nd = new catalogData();
     var array = MyChecked.Split(',');
     if (MyChecked != "" && MyChecked != null)
     {
         for (var i = 0; i < array.Length; i++)
         {
             var Original = nd.Get().ToList().Where(a => a.num.ToString() == array[i]).SingleOrDefault();
             if (Original.filePath != "")
             {
                 var DelPath = System.IO.Path.Combine(Server.MapPath("~/upload/catalog/"), Original.filePath);
                 System.IO.File.Delete(DelPath);
             }
             //if (Original.jsonimg != "no_img.jpg")
             //{
             //    var jsonstr = JsonConvert.DeserializeObject<List<jsonSer>>(Original.jsonimg);
             //    var DelJsonPath = Server.MapPath("~/upload/photograhy/");
             //    foreach (var j in jsonstr)
             //    {
             //        var DelJsonPathing = System.IO.Path.Combine(DelJsonPath, j.content);
             //        System.IO.File.Delete(DelJsonPathing);
             //    }
             //}
             n.num = Convert.ToInt32(array[i]);
             n.isdel = 1;
             n.udate = DateTime.Now;
             nd.Delete(n);
         }
     }
     return Json("");
 }
示例#2
0
 void CheckOrUpdateCatalog()
 {
     var progress = Log.Action(2, "Checking and/or updating catalog...");
     var books = new BookSource { Log = Log };
     var volumes = new VolumeSource { Log = Log };
     if (!string.IsNullOrEmpty(ActualDirectory)) {
         books.SetDirectory(ActualDirectory);
         volumes.SetDirectory(ActualDirectory);
     }
     var updater = new CatalogUpdater { Log = Log };
     Date localDate = Date.MinValue;
     if (Always || updater.ShouldUpdate(books, volumes, out localDate)) {
         progress.Continue("Downloading remote catalog...");
         var catalog = new Catalog { Log = Log };
         if (!string.IsNullOrEmpty(URL))
             catalog.SetUrl(URL);
         using (var stream = catalog.Open())
             updater.TryUpdate(stream, books, volumes,
                 remoteDate => localDate == Date.MinValue || localDate < remoteDate,
                 () => ShouldProcess("Catalog", "Update") && (Force ||
                 ShouldContinue("Do you really want to update the local catalog?",
                                "Catalog Update")));
     }
     progress.Finish();
 }
示例#3
0
        public void Add_DuplicateAndNonDuplicateItems()
        {
            ICatalog catalog = new Catalog();
            for (int i = 0; i < 10; ++i)
            {
                catalog.Add(new Content(ContentType.Book, new string[]
                {
                    "TestTitle", "TestAuthor", "432943", @"http://www.testingcatalog.com/"
                }));
            }

            catalog.Add(new Content(ContentType.Application, new string[]
            {
                "TestTitle", "TestAppAuthor", "111", @"http://www.testingappcatalog.com/"
            }));

            catalog.Add(new Content(ContentType.Movie, new string[]
            {
                "TestTitle", "TestMoveAuthor", "22", @"http://www.testingmoviecatalog.com/"
            }));

            catalog.Add(new Content(ContentType.Music, new string[]
            {
                "TestTitle", "TestMusicAuthor", "3333", @"http://www.testingmusiccatalog.com/"
            }));

            IEnumerable<IContent> foundContent = catalog.GetListContent("TestTitle", 100);
            int numberOfItemsFound = this.CountContentFound(foundContent);

            Assert.AreEqual(13, numberOfItemsFound);
        }
示例#4
0
        public void GetListContent_CheckSorting()
        {
            ICatalog catalog = new Catalog();
            for (int i = 9; i >= 0; --i)
            {
                catalog.Add(new Content(ContentType.Book, new string[]
                {
                    "TestTitle", "TestAuthor" + i, "432943" + i, "http://www.testingcatalog.com/"
                }));
            }

            IEnumerable<IContent> foundContent = catalog.GetListContent("TestTitle", 100);

            bool contentIsSorted = true;
            int currentIndex = 0;
            foreach (var item in foundContent)
            {
                if (!item.Author.EndsWith(currentIndex.ToString()))
                {
                    contentIsSorted = false;
                    break;
                }
                currentIndex++;
            }

            Assert.IsTrue(contentIsSorted);
        }
示例#5
0
    public AddAlbumDialog(Catalog catalog)
        : base(catalog,
							"dialogaddalbum.glade",
							Mono.Posix.Catalog.GetString ("Add a new Album"),
							"albums")
    {
    }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //创建数据库文件
            ADOX.Catalog catalog = new Catalog();
            catalog.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\test.mdb;Jet OLEDB:Engine Type=5");
            Debug.WriteLine("DataBase created");

            //建表
            ADODB.Connection cn = new ADODB.Connection();
            cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\test.mdb", null, null, -1);
            catalog.ActiveConnection = cn;

            ADOX.Table table = new ADOX.Table();
            table.Name = "FirstTable";

            ADOX.Column column = new ADOX.Column();
            column.ParentCatalog = catalog;
            column.Name = "RecordId";
            column.Type = DataTypeEnum.adInteger;
            column.DefinedSize = 9;
            column.Properties["AutoIncrement"].Value = true;
            table.Columns.Append(column, DataTypeEnum.adInteger, 9);
            table.Keys.Append("FirstTablePrimaryKey", KeyTypeEnum.adKeyPrimary, column, null, null);
            table.Columns.Append("CustomerName", DataTypeEnum.adVarWChar, 50);
            table.Columns.Append("Age", DataTypeEnum.adInteger, 9);
            table.Columns.Append("Birthday", DataTypeEnum.adDate, 0);
            catalog.Tables.Append(table);

            cn.Close();
        }
示例#7
0
 public IEnumerable<PFD> Map(List<CropZone> cropZones, List<PFD> isoFields, Dictionary<int, string> keyToIsoId, Catalog setupCatalog)
 {
     if(cropZones == null)
         return null;
     int cropZoneIndex = isoFields.Count;
     return cropZones.Select(x => Map(x, keyToIsoId, cropZoneIndex++, setupCatalog));
 }
示例#8
0
        private PFD Map(CropZone cropZone, Dictionary<int, string> keyToIsoId, int cropZoneIndex, Catalog setupCatalog)
        {
            var pfd = new PFD
            {
                C = cropZone.Description,
                D = (ulong)Math.Round(cropZone.Area.Value.Value, 0)
            };
            pfd.A = pfd.GetIsoId(cropZoneIndex);
            if (cropZone.CropId != null)
            {
                pfd.G = keyToIsoId[cropZone.CropId.Value];
            }
            pfd.I = keyToIsoId[cropZone.FieldId];
            var field = setupCatalog.Fields.First(f => f.Id.ReferenceId == cropZone.FieldId);
            if (field.FarmId != null)
            {
                pfd.F = keyToIsoId[field.FarmId.Value];
                var farm = setupCatalog.Farms.First(f => f.Id.ReferenceId == field.FarmId.Value);
                if (farm.GrowerId != null)
                    pfd.E = keyToIsoId[farm.GrowerId.Value];
            }
            if (cropZone.BoundingRegion != null)
            {
                pfd.Items = new IWriter[] { _boundaryMapper.Map(cropZone.BoundingRegion, BoundaryType.CropZone, cropZone.Description) };
            }

            keyToIsoId.Add(cropZone.Id.ReferenceId, pfd.A);
            return pfd;
        }
		protected override void OnCreate(Bundle savedInstanceState)
		{
			// When extending the BrightcovePlayer, we must assign the BrightcoveVideoView before
			// entering the superclass. This allows for some stock video player lifecycle
			// management.
			SetContentView(Resource.layout.ima_activity_main);
			brightcoveVideoView = FindViewById<BrightcoveVideoView>(Resource.id.brightcove_video_view);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.brightcove.player.mediacontroller.BrightcoveMediaController mediaController = new com.brightcove.player.mediacontroller.BrightcoveMediaController(brightcoveVideoView);
			BrightcoveMediaController mediaController = new BrightcoveMediaController(brightcoveVideoView);

			// Add "Ad Markers" where the Ads Manager says ads will appear.
			mediaController.AddListener(GoogleIMAEventType.ADS_MANAGER_LOADED, new EventListenerAnonymousInnerClassHelper(this, mediaController));
			brightcoveVideoView.MediaController = mediaController;
			base.onCreate(savedInstanceState);
			eventEmitter = brightcoveVideoView.EventEmitter;

			// Use a procedural abstraction to setup the Google IMA SDK via the plugin.
			setupGoogleIMA();

			IDictionary<string, string> options = new Dictionary<string, string>();
			IList<string> values = new List<string>(Arrays.asList(VideoFields.DEFAULT_FIELDS));
			values.Remove(VideoFields.HLS_URL);
			options["video_fields"] = StringUtil.join(values, ",");

			BrightcoveSDK.Player.Media.Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A..");
			catalog.findVideoByReferenceID("shark", new VideoListenerAnonymousInnerClassHelper(this));
		}
示例#10
0
        public void ParsingTest()
        {
            Catalog cat = new Catalog();
            cat.Load("./Data/Test01.po");

            Assert.AreEqual(6, cat.Count, "Entries count");
            Assert.AreEqual(3, cat.PluralFormsCount, "Plurals entries count");

            int nonTranslatedCount = 0;
            int ctx = 0;
            foreach(CatalogEntry entry in cat)
            {
                if (!entry.IsTranslated)
                    nonTranslatedCount++;
                if (entry.HasPlural)
                {
                    Assert.AreEqual("{0} ошибка найдена", entry.GetTranslation(0));
                    Assert.AreEqual("{0} ошибки найдены", entry.GetTranslation(1));
                    Assert.AreEqual("{0} ошибок найдено", entry.GetTranslation(2));
                }
                if (entry.HasContext)
                    ctx++;
            }

            Assert.AreEqual(1, nonTranslatedCount, "Non translated strings count");
            Assert.AreEqual(2, ctx, "Contextes count");
        }
示例#11
0
		static async Task SendResponse (Catalog catalog, HttpListenerContext context, CancellationToken token)
		{
			try {
				string request;

				if (string.IsNullOrEmpty (context.Request.Url.Query))
					request = await DeserializeRequest (context.Request).ConfigureAwait (false);
				else {
					request = System.Uri.UnescapeDataString (context.Request.Url.Query.Substring (1));
				}

				long? rangeStart =null;
				long? rangeEnd = null;
				if (!string.IsNullOrEmpty (context.Request.Headers ["Range"])) {
					var part = context.Request.Headers ["Range"].Substring ("bytes=".Length);
					rangeStart = long.Parse (part.Split ('-') [0]);
					rangeEnd = long.Parse (part.Split ('-') [1]);
					if (rangeEnd <= 0)
						rangeEnd = null;
				}

				using (var responseStream = HandleRequest (request, catalog, rangeStart, rangeEnd)) {
					context.Response.ContentLength64 = responseStream.Length - responseStream.Position;
					context.Response.StatusCode = (int)HttpStatusCode.OK;
					await responseStream.CopyToAsync (context.Response.OutputStream, 4096, token).ConfigureAwait (false);
				}
			} catch {
				context.Response.Abort ();
				throw;
			}
		}
示例#12
0
        public Panel_Toc(Control parentControl, ComboBox comboBox, Catalog helpCatalog)
        {
            InitializeComponent();

            this._cbo = comboBox;
            this.HelpCatalog = helpCatalog;   //this will build the TOC

            // our oneshot timer
            oneshotTimer = new Timer();
            oneshotTimer.Interval = 10;
            oneshotTimer.Tick += new EventHandler(oneshotTimer_Tick);

            //Position under the ComboBox if one exists
            this.Parent = parentControl;
            if (_cbo != null)
            {
                // parent, size under the Cbo & Hide ourself
                Point cboPos = CalcCboPos();
                this.Left = cboPos.X;
                this.Width = _cbo.Width;
                this.Top = cboPos.Y + _cbo.Height;
                this.Height = _cbo.Width;
                this.Hide();
                _cbo.DropDownHeight = 1;  // We are replacing the current dropdown so make the cbo dropdown as small as posible
            }
            this.BringToFront();

            //Update style
            if (Native.SetWindowTheme(this.treeView1.Handle, "explorer"))
                treeView1.ShowLines = false;

            tocSync = new TocSync(treeView1);
        }
示例#13
0
 public void readFrameConcreteColumns(XmlNode node, Catalog<Section.Section> cat)
 {
     //// xml.WriteStartElement("Frame_Section_Properties_02_-_Concrete_Column");
     foreach (XmlNode child in node.ChildNodes)
         if ("SectionName".Equals(child.Name))
             readConcreteColumnSectionProps(child, cat);
 }
    public CatalogPropertiesDialog(Catalog catalog)
    {
        this.catalog = catalog;
        this.Title = String.Format (Mono.Posix.Catalog.GetString ("{0} properties"), catalog.Name);
        this.HasSeparator = false;

        cancelButton = (Button)this.AddButton (Stock.Cancel, 0);
        okButton     = (Button)this.AddButton (Stock.Ok, 1);
        cancelButton.Clicked += OnCancelButtonClicked;
        okButton.Clicked     += OnOkButtonClicked;
        VBox vBox = this.VBox;

        HBox titleBox = new HBox ();
        Gtk.Frame frame = new Frame ("<b>"+Mono.Posix.Catalog.GetString ("Columns to show")+"</b>");
        ((Label)(frame.LabelWidget)).UseMarkup = true;
        titleBox.PackEnd (frame);
        vBox.PackStart (titleBox);

        VBox columnsBox = new VBox ();

        columns = catalog.Columns;
        Hashtable columnsToShow = catalog.ColumnsToShow;
        checks = new Hashtable ();
        foreach (string colName in columns.Keys) {
            if (colName.Equals ("id")) continue;
            CheckButton check = new CheckButton ((string)columns[colName]);
            check.Active = (bool)columnsToShow[colName];
            checks.Add (columns[colName], check);
            columnsBox.PackStart (check);
        }

        frame.Add (columnsBox);

        this.ShowAll();
    }
示例#15
0
 public void Add_AddOneBookWithParamsNull()
 {
     string[] testContentParams = new string[] { null };
     IContent testContent = new Content(ContentType.Book, testContentParams);
     ICatalog currentCatalog = new Catalog();
     currentCatalog.Add(testContent);
 }
        private static void RunTest(Type message)
        {
            Catalog catalog = new Catalog();
            catalog.RegisterBuilder<ObjectPropertyWithCustomValue>().WithPostConstruction(o => ((ObjectPropertyWithCustomValue)o).Value = catalog.CreateInstance<CustomObject>());
            catalog.RegisterBuilder<ArrayField>().WithConstructor(() => ArrayField.CreateInstance());

            IAssertEquality instance = (IAssertEquality)catalog.CreateInstance(message);
            Assert.IsType(message, instance);

            ObjectDataTree messageTree = new ObjectDataTree(instance);

            using (MemoryStream ms = new MemoryStream())
            {
                Serialize(new IndisposableStream(ms), instance);
                ms.Flush();
                ms.Seek(0, SeekOrigin.Begin);
                object result = Deserialize(new IndisposableStream(ms), message);

                ObjectDataTree resultTree = new ObjectDataTree(result);

                resultTree.StringValue().Should().Be(messageTree.StringValue());

                instance.AssertEquality(result);
            }
        }
示例#17
0
        public void Add_AddTwoIndenticalBooksAndThreeOtherItems()
        {
            string[] testBookContentParams = new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
            IContent testBookContent = new Content(ContentType.Book, testBookContentParams);
            ICatalog currentCatalog = new Catalog();
            currentCatalog.Add(testBookContent);
            currentCatalog.Add(testBookContent);

            string[] testMovieContentParams = new string[] { "The Secret", "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://t.co/dNV4d" };
            IContent testMovieContent = new Content(ContentType.Book, testMovieContentParams);
            currentCatalog.Add(testMovieContent);

            string[] testApplicationContentParams = new string[] { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" };
            IContent testApplicationContent = new Content(ContentType.Book, testApplicationContentParams);
            currentCatalog.Add(testApplicationContent);

            string[] testSongContentParams = new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" };
            IContent testSongContent = new Content(ContentType.Book, testSongContentParams);
            currentCatalog.Add(testSongContent);

            IEnumerable<IContent> currentContent = currentCatalog.GetListContent("One", 10);
            int numberOfRenurnedResults = currentContent.Count();

            Assert.AreEqual(1, numberOfRenurnedResults);
        }
示例#18
0
    public AddFilmDialog(Catalog catalog)
        : base(catalog,
						       "dialogaddfilm.glade",
						       Mono.Posix.Catalog.GetString ("Add a new film"),
						       "films")
    {
    }
示例#19
0
        public void Can_search_with_filters()
        {
            Property property = new Property { Id = Guid.NewGuid(), Name = "Property Name", BedroomCount = 3 };
            Catalog catalog = new Catalog() { Id = Guid.NewGuid(), Type = "Waterfront", PropertyId = property.Id };

            using(var store = NewDocumentStore())
            using(var _session = store.OpenSession())
            {

                _session.Store(property);
                _session.Store(catalog);
                _session.SaveChanges();

                var catalogs = _session.Advanced.DocumentQuery<Catalog>().WhereEquals("Type", "Waterfront").Select(c => c.PropertyId);
                var properties = _session.Advanced.DocumentQuery<Property>();
                properties.OpenSubclause();
                var first = true;
                foreach (var guid in catalogs)
                {
                    if (first == false)
                        properties.OrElse(); 
                    properties.WhereEquals("__document_id", guid);
                    first = false;
                }
                properties.CloseSubclause();
                var refinedProperties = properties.AndAlso().WhereGreaterThanOrEqual("BedroomCount", "2").Select(p => p.Id);

                Assert.NotEqual(0, refinedProperties.Count());
            }
        }
        protected void btnExecute_Click(object sender, EventArgs e)
        {
            //Define a workbook to store null value initially
            Workbook workbook = null;

            string path = MapPath(".");
            path = path.Substring(0, path.LastIndexOf("\\"));

            Catalog catalog = new Catalog(path);

            //Create a workbook based on the custom method of a class
            workbook = catalog.CreateCatalog();

            if (ddlFileVersion.SelectedItem.Value == "XLS")
            {
                ////Save file and send to client browser using selected format
                workbook.Save(HttpContext.Current.Response, "Catalog.xls", ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));
            }
            else
            {
                workbook.Save(HttpContext.Current.Response, "Catalog.xlsx", ContentDisposition.Attachment, new OoxmlSaveOptions(SaveFormat.Xlsx));
            }

            //end response to avoid unneeded html
            HttpContext.Current.Response.End();
        }
示例#21
0
    public ExportDialog(Catalog catalog, bool searchOn)
        : base(Mono.Posix.Catalog.GetString ("Export"), null, DialogFlags.NoSeparator | DialogFlags.Modal)
    {
        this.catalog = catalog;
        this.templates = new Hashtable ();
        this.searchOn = searchOn;

        Glade.XML gxml = new Glade.XML (null, "dialogexport.glade", "hbox1", null);
        gxml.Autoconnect(this);

        cancelButton = (Button)this.AddButton (Gtk.Stock.Cancel, 0);
        okButton     = (Button)this.AddButton (Gtk.Stock.Ok, 1);
        cancelButton.Clicked += OnCancelButtonClicked;
        okButton.Clicked     += OnOkButtonClicked;

        VBox vBox = this.VBox;
        vBox.Add ((Box)gxml["hbox1"]);

        PopulateComboBox ();

        if (!searchOn) {
            radioButtonSearch.Sensitive = false;
        }

        radioButtonActive.Label = String.Format (Mono.Posix.Catalog.GetString ("Export the whole {0} catalog"),catalog.ShortDescription);

        this.ShowAll();
    }
示例#22
0
 public void TestAddContent_WithSingleItem()
 {
     Catalog catalog = new Catalog();
     Content item = new Content(ContentType.Book, new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" });
     catalog.AddContent(item);
     Assert.AreEqual(1, catalog.Count);
 }
示例#23
0
        public void Run()
        {
            Catalog catalog = new Catalog();
            foreach(string fileName in Options.InputFiles)
            {
                Catalog temp = new Catalog();
                temp.Load(fileName);
                catalog.Append(temp);
            }

            using (ResourceWriter writer = new ResourceWriter(Options.OutFile))
            {
                foreach (CatalogEntry entry in catalog)
                {
                    try
                    {
                        writer.AddResource(entry.Key, entry.IsTranslated ? entry.GetTranslation(0) : entry.String);
                    }
                    catch (Exception e)
                    {
                        string message = String.Format("Error adding item {0}", entry.String);
                        if (!String.IsNullOrEmpty(entry.Context))
                            message = String.Format("Error adding item {0} in context '{1}'",
                                                    entry.String, entry.Context);
                        throw new Exception(message, e);
                    }
                }
                writer.Generate();
            }
        }
示例#24
0
			public static CatalogController CreateCatalogController (Catalog catalog, PlayQueue<StreamingPlayer> playQueue)
			{
				var vc = (CatalogController) MainStoryboard.InstantiateViewController ("CatalogController");
				vc.Catalog = catalog;
				vc.PlayQueue = playQueue;
				return vc;
			}
示例#25
0
        private void PriceForSelections(Catalog.Product p, OptionSelectionList selections)
        {
            this.IsValid = true;
            this.VariantId = string.Empty;
            this._ModifierAdjustments = 0;

            if (selections == null) return;
            if (p == null) return;

            // Check for Option Price Modifiers
            if (!p.HasOptions()) return;
            this._ModifierAdjustments = selections.GetPriceAdjustmentForSelections(p.Options);
            this.BasePrice += this._ModifierAdjustments;

            // Check for Variant Changes
            if (!p.HasVariants()) return;
            Variant v = p.Variants.FindBySelectionData(selections, p.Options);
            if (v == null)
            {
                this.IsValid = false;
                return;
            }

            // Assign Variant Attributes to this price data
            this.VariantId = v.Bvin;
            if (v.Sku.Trim().Length > 0) this.Sku = v.Sku;
            if (v.Price >= 0) this.BasePrice = v.Price + this._ModifierAdjustments;

        }
示例#26
0
    public AddBookDialog(Catalog catalog)
        : base(catalog,
						       "dialogaddbook.glade",
						       Mono.Posix.Catalog.GetString ("Add a new book"),
						       "books")
    {
    }
示例#27
0
 public void LoadCatalog()
 {
     using (FileStream fs = new FileStream("Catalog.xml", FileMode.Open))
     {
         _catalog = (Catalog)(new XmlSerializer(typeof(Catalog)).Deserialize(fs));
     }
 }
示例#28
0
文件: MainForm.cs 项目: itsbth/DoIt
 public MainForm()
 {
     InitializeComponent();
     catalog = (Catalog)(new XmlSerializer(typeof(Catalog)).Deserialize(new FileStream("Catalog.xml", FileMode.Open)));
     searcher = new CatalogSearcher(catalog);
     images = new ImageList();
 }
示例#29
0
		public void WorkingWithCatalogTest()
		{
			var catalogService = GetCatalogService();
			var catalog = new Catalog
			{
				Name = "Test",
			};
			var languages = new CatalogLanguage[]
			{
				new CatalogLanguage { LanguageCode = "en-us"}
			};
			//Create catalog
			catalog.Languages = languages.ToList();
			catalog = catalogService.Create(catalog);
			//Add language
			catalog.Languages.Add( new  CatalogLanguage { LanguageCode = "fr-fr", IsDefault = true });
			catalog.Name = null; //not define should no changed
			catalogService.Update(new Catalog[] { catalog });
			//Clear languages
			catalog.Languages.Clear();
			catalogService.Update(new Catalog[] { catalog });
			//Verification
			catalog = catalogService.GetById(catalog.Id);

			Assert.IsTrue(catalog.Name == "Test");
			Assert.IsFalse(catalog.Languages.Any());
		}
示例#30
0
		public ArtistsDataSource (Catalog catalog)
		{
			Lookup = new List<Tuple<string, Artist[]>> ();
			if (catalog != null)
				foreach (var group in catalog.Artists.GroupBy (t => (t.SortKey.First ().ToString ().ToUpper ())))
					Lookup.Add (Tuple.Create (group.Key, group.OrderBy (t => (t.SortKey)).ToArray ()));
		}
示例#31
0
        /// <summary>
        /// A payment made to a supplier needs to be reversed.
        /// It's done by creating and posting a set of matching "negatives" -
        /// In the simplest case this is a single credit note matching an invoice
        /// but it could be more complex. These negative documents are payed using
        /// a standard call to PostAPPayments.
        ///
        /// After the reversal, I'll also create and post new copies of all
        /// the invoices / credit notes that made up the original payment.
        /// </summary>
        /// <param name="ALedgerNumber"></param>
        /// <param name="APaymentNumber"></param>
        public void ReversePayment(Int32 ALedgerNumber, Int32 APaymentNumber)
        {
            AccountsPayableTDS TempDS = TRemote.MFinance.AP.WebConnectors.LoadAPPayment(ALedgerNumber, APaymentNumber);

            if (TempDS.AApPayment.Rows.Count == 0) // Invalid Payment number?
            {
                MessageBox.Show(Catalog.GetString("The referenced payment Connot be loaded."), Catalog.GetString("Error"));
                return;
            }

            TempDS.AApDocument.DefaultView.Sort = AApDocumentTable.GetApDocumentIdDBName();

            //
            // First I'll check that the amounts add up:
            //
            Decimal PaidDocumentsTotal = 0.0m;

            foreach (AApDocumentPaymentRow PaymentRow in TempDS.AApDocumentPayment.Rows)
            {
                Int32          DocIdx      = TempDS.AApDocument.DefaultView.Find(PaymentRow.ApDocumentId);
                AApDocumentRow DocumentRow = TempDS.AApDocument[DocIdx];

                if (DocumentRow.CreditNoteFlag)
                {
                    PaidDocumentsTotal -= DocumentRow.TotalAmount;
                }
                else
                {
                    PaidDocumentsTotal += DocumentRow.TotalAmount;
                }
            }

            //
            // If this is a partial payment, I can't deal with that here...
            //
            if (PaidDocumentsTotal != TempDS.AApPayment[0].Amount)
            {
                String ErrorMsg =
                    String.Format(Catalog.GetString(
                                      "This Payment cannot be reversed automatically because the total amount of the referenced documents ({0:n2} {1}) differs from the amount in the payment ({2:n2} {3})."),
                                  PaidDocumentsTotal, TempDS.AApSupplier[0].CurrencyCode, TempDS.AApPayment[0].Amount, TempDS.AApSupplier[0].CurrencyCode);
                MessageBox.Show(ErrorMsg, Catalog.GetString("Reverse Payment"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Find out if this payment was already reversed,
            // because if it was, perhaps the user doesn't really want to
            // reverse it again?
            this.Cursor = Cursors.WaitCursor;

            if (TRemote.MFinance.AP.WebConnectors.WasThisPaymentReversed(ALedgerNumber, APaymentNumber))
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(Catalog.GetString("Cannot reverse Payment - there is already a matching reverse transaction."),
                                Catalog.GetString("Reverse Payment"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            this.Cursor = Cursors.Default;

            //
            // Ask the user to confirm reversal of this payment
            //
            String PaymentMsg = Catalog.GetString("Do you want to reverse this payment?");

            PaymentMsg += ("\r\n" + String.Format("Payment made {0} to {1}\r\n\r\nRelated invoices:",
                                                  TDate.DateTimeToLongDateString2(TempDS.AApPayment[0].PaymentDate.Value), TempDS.PPartner[0].PartnerShortName));

            foreach (AApDocumentPaymentRow PaymentRow in TempDS.AApDocumentPayment.Rows)
            {
                Int32          DocIdx      = TempDS.AApDocument.DefaultView.Find(PaymentRow.ApDocumentId);
                AApDocumentRow DocumentRow = TempDS.AApDocument[DocIdx];
                PaymentMsg += ("\r\n" + String.Format("     {2} ({3})  {0:n2} {1}",
                                                      DocumentRow.TotalAmount, TempDS.AApSupplier[0].CurrencyCode, DocumentRow.DocumentCode, DocumentRow.Reference));
            }

            PaymentMsg += ("\r\n\r\n" + String.Format("Total payment {0:n2} {1}", TempDS.AApPayment[0].Amount, TempDS.AApSupplier[0].CurrencyCode));
            DialogResult YesNo = MessageBox.Show(PaymentMsg, Catalog.GetString("Reverse Payment"), MessageBoxButtons.YesNo);

            if (YesNo == DialogResult.No)
            {
                return;
            }

            TDlgGLEnterDateEffective dateEffectiveDialog = new TDlgGLEnterDateEffective(
                ALedgerNumber,
                Catalog.GetString("Select posting date"),
                Catalog.GetString("The date effective for the reversal") + ":");

            if (dateEffectiveDialog.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show(Catalog.GetString("Reversal was cancelled."), Catalog.GetString("Reverse Payment"),
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DateTime PostingDate = dateEffectiveDialog.SelectedDate;
            TVerificationResultCollection Verifications;

            this.Cursor = Cursors.WaitCursor;

            if (TRemote.MFinance.AP.WebConnectors.ReversePayment(ALedgerNumber, APaymentNumber, PostingDate, out Verifications))
            {
                this.Cursor = Cursors.Default;
                // TODO: print reports on successfully posted batch
                MessageBox.Show(Catalog.GetString("The AP payment has been reversed."), Catalog.GetString("Reverse Payment"));
                TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcAPTransactionChanged);
                broadcastMessage.SetMessageDataAPTransaction(String.Empty);
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);
            }
            else
            {
                this.Cursor = Cursors.Default;
                string ErrorMessages = String.Empty;

                foreach (TVerificationResult verif in Verifications)
                {
                    ErrorMessages += "[" + verif.ResultContext + "] " +
                                     verif.ResultTextCaption + ": " +
                                     verif.ResultText + Environment.NewLine;
                }

                System.Windows.Forms.MessageBox.Show(ErrorMessages, Catalog.GetString("Reverse Payment Failed"));
            }
        }
示例#32
0
        private void MakePayment(object sender, EventArgs e)
        {
            //FSelectedDocumentRow.Amount = Decimal.Parse(txtAmountToPay.Text);
            FSelectedDocumentRow.Amount     = txtAmountToPay.NumberValueDecimal.Value;
            FSelectedPaymentRow.BankAccount = cmbBankAccount.GetSelectedString();
            AccountsPayableTDSAApPaymentTable AApPayment = FMainDS.AApPayment;

            //
            // I want to check whether the user is paying more than the due amount on any of these payments...
            //
            foreach (AccountsPayableTDSAApPaymentRow PaymentRow in AApPayment.Rows)
            {
                FMainDS.AApDocumentPayment.DefaultView.RowFilter = String.Format("{0}={1}",
                                                                                 AApDocumentPaymentTable.GetPaymentNumberDBName(), PaymentRow.PaymentNumber);

                foreach (DataRowView rv in FMainDS.AApDocumentPayment.DefaultView)
                {
                    AccountsPayableTDSAApDocumentPaymentRow DocPaymentRow = (AccountsPayableTDSAApDocumentPaymentRow)rv.Row;
                    Boolean overPayment = (DocPaymentRow.DocType == "INVOICE") ?
                                          (DocPaymentRow.Amount > DocPaymentRow.InvoiceTotal) : (DocPaymentRow.Amount < DocPaymentRow.InvoiceTotal);

                    if (overPayment)
                    {
                        String strMessage =
                            String.Format(Catalog.GetString(
                                              "Payment of {0} {1} to {2}: Payment cannot be more than the due amount."),
                                          StringHelper.FormatUsingCurrencyCode(DocPaymentRow.Amount, PaymentRow.CurrencyCode),
                                          PaymentRow.CurrencyCode, PaymentRow.SupplierName);

                        System.Windows.Forms.MessageBox.Show(strMessage, Catalog.GetString("OverPayment"));
                        return;
                    }
                }
            }

            TDlgGLEnterDateEffective dateEffectiveDialog = new TDlgGLEnterDateEffective(
                FMainDS.AApDocument[0].LedgerNumber,
                Catalog.GetString("Select payment date"),
                Catalog.GetString("The date effective for the payment") + ":");

            if (dateEffectiveDialog.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show(Catalog.GetString("The payment was cancelled."), Catalog.GetString(
                                    "No Success"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DateTime PaymentDate = dateEffectiveDialog.SelectedDate;
            TVerificationResultCollection Verifications;

            this.Cursor = Cursors.WaitCursor;

            if (!TRemote.MFinance.AP.WebConnectors.PostAPPayments(
                    ref FMainDS,
                    PaymentDate,
                    out Verifications))
            {
                this.Cursor = Cursors.Default;
                string ErrorMessages = String.Empty;

                foreach (TVerificationResult verif in Verifications)
                {
                    ErrorMessages += "[" + verif.ResultContext + "] " +
                                     verif.ResultTextCaption + ": " +
                                     verif.ResultText + Environment.NewLine;
                }

                System.Windows.Forms.MessageBox.Show(ErrorMessages, Catalog.GetString("Payment failed"));
            }
            else
            {
                this.Cursor = Cursors.Default;
                PrintPaymentReport(sender, e);
                PrintRemittanceAdvice();

                // TODO: show posting register of GL Batch?

                // After the payments screen, The status of this document may have changed.
                TFormsMessage broadcastMessage = new TFormsMessage(TFormsMessageClassEnum.mcAPTransactionChanged);
                broadcastMessage.SetMessageDataAPTransaction(String.Empty);
                TFormsList.GFormsList.BroadcastFormMessage(broadcastMessage);

                Close();
            }
        }
示例#33
0
        public SparkleSetupWindow() : base("")
        {
            Title          = Catalog.GetString("CmisSync Setup");
            BorderWidth    = 0;
            IconName       = "folder-sparkleshare";
            Resizable      = false;
            WindowPosition = WindowPosition.Center;
            Deletable      = false;

            DeleteEvent += delegate(object sender, DeleteEventArgs args) {
                args.RetVal = true;
            };

            SecondaryTextColor = SparkleUIHelpers.GdkColorToHex(Style.Foreground(StateType.Insensitive));

            SecondaryTextColorSelected =
                SparkleUIHelpers.GdkColorToHex(
                    MixColors(
                        new TreeView().Style.Foreground(StateType.Selected),
                        new TreeView().Style.Background(StateType.Selected),
                        0.15
                        )
                    );

            SetSizeRequest(680, 400);

            HBox = new HBox(false, 0);

            VBox = new VBox(false, 0);

            Wrapper = new VBox(false, 0)
            {
                BorderWidth = 0
            };

            OptionArea = new VBox(false, 0)
            {
                BorderWidth = 0
            };

            Buttons = CreateButtonBox();


            HBox layout_horizontal = new HBox(false, 0)
            {
                BorderWidth = 0
            };

            layout_horizontal.PackStart(OptionArea, true, true, 0);
            layout_horizontal.PackStart(Buttons, false, false, 0);

            VBox.PackStart(Wrapper, true, true, 0);
            VBox.PackStart(layout_horizontal, false, false, 15);

            EventBox box = new EventBox();

            Gdk.Color bg_color = new Gdk.Color();
            Gdk.Color.Parse("#000", ref bg_color);
            box.ModifyBg(StateType.Normal, bg_color);

            Image side_splash = SparkleUIHelpers.GetImage("side-splash.png");

            side_splash.Yalign = 1;

            box.Add(side_splash);

            HBox.PackStart(box, false, false, 0);
            HBox.PackStart(VBox, true, true, 30);

            base.Add(HBox);
        }
示例#34
0
        public static Boolean GetCurrentPostingRangeDates(Int32 ALedgerNumber,
                                                          out DateTime AStartDateCurrentPeriod,
                                                          out DateTime AEndDateLastForwardingPeriod)
        {
            Boolean dataIsOk = false;

            #region Validate Arguments

            if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                                                                                       "Function:{0} - The Ledger number must be greater than 0!"),
                                                                                   Utilities.GetMethodName(true)), ALedgerNumber);
            }

            #endregion Validate Arguments

            DateTime StartDateCurrentPeriod      = new DateTime();
            DateTime EndDateLastForwardingPeriod = new DateTime();

            TDBTransaction Transaction = new TDBTransaction();
            TDataBase      db          = DBAccess.Connect("GetCurrentPostingRangeDates");

            db.ReadTransaction(
                ref Transaction,
                delegate
            {
                ALedgerTable ledgerTable = ALedgerAccess.LoadByPrimaryKey(ALedgerNumber, Transaction);

                #region Validate Data

                if ((ledgerTable == null) || (ledgerTable.Count == 0))
                {
                    throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
                                                                                               "Function:{0} - Ledger data for Ledger number {1} does not exist or could not be accessed!"),
                                                                                           Utilities.GetMethodName(true),
                                                                                           ALedgerNumber));
                }

                #endregion Validate Data

                int firstPostingPeriod = -1;
                int lastPostingPeriod  = -1;

                // If final month end has been run but year end has not yet been run
                // then we cannot post to the current period as it is actually closed.
                if (ledgerTable[0].ProvisionalYearEndFlag)
                {
                    firstPostingPeriod = ledgerTable[0].CurrentPeriod + 1;
                }
                else
                {
                    firstPostingPeriod = ledgerTable[0].CurrentPeriod;
                }

                AAccountingPeriodTable accountingPeriodTable = AAccountingPeriodAccess.LoadByPrimaryKey(ALedgerNumber,
                                                                                                        firstPostingPeriod,
                                                                                                        Transaction);

                #region Validate Data 2

                if ((accountingPeriodTable == null) || (accountingPeriodTable.Count == 0))
                {
                    throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
                                                                                               "Function:{0} - Accounting Period data for Ledger number {1} and posting period {2} does not exist or could not be accessed!"),
                                                                                           Utilities.GetMethodName(true),
                                                                                           ALedgerNumber,
                                                                                           firstPostingPeriod));
                }

                #endregion Validate Data 2

                StartDateCurrentPeriod = accountingPeriodTable[0].PeriodStartDate;

                lastPostingPeriod     = ledgerTable[0].CurrentPeriod + ledgerTable[0].NumberFwdPostingPeriods;
                accountingPeriodTable = AAccountingPeriodAccess.LoadByPrimaryKey(ALedgerNumber,
                                                                                 lastPostingPeriod,
                                                                                 Transaction);

                #region Validate Data 3

                if ((accountingPeriodTable == null) || (accountingPeriodTable.Count == 0))
                {
                    throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
                                                                                               "Function:{0} - Accounting Period data for Ledger number {1} and posting period {2} does not exist or could not be accessed!"),
                                                                                           Utilities.GetMethodName(true),
                                                                                           ALedgerNumber,
                                                                                           lastPostingPeriod));
                }

                #endregion Validate Data 3

                EndDateLastForwardingPeriod = accountingPeriodTable[0].PeriodEndDate;
                dataIsOk = true;
            });

            AStartDateCurrentPeriod      = StartDateCurrentPeriod;
            AEndDateLastForwardingPeriod = EndDateLastForwardingPeriod;

            db.CloseDBConnection();

            return(dataIsOk);
        }
        private void DonorKeyChanged(Int64 APartnerKey,
                                     String APartnerShortName,
                                     bool AValidSelection)
        {
            if (!FAutoPopulatingGiftInProcess)
            {
                //This gets set to false when autopopulating gift
                txtDetailDonorKey.FocusTextBoxPartAfterFindScreenCloses = true;
            }

            if (FAutoPopulatingGiftInProcess)
            {
                return;
            }
            else if (!AValidSelection && (APartnerKey != 0))
            {
                //An invalid donor number can stop deletion of a new row, so need to stop invalid entries
                MessageBox.Show(String.Format(Catalog.GetString("Donor number {0} could not be found!"),
                                              APartnerKey));
                txtDetailDonorKey.Text = String.Format("{0:0000000000}", 0);
                return;
            }
            // At the moment this event is thrown twice
            // We want to deal only on manual entered changes, i.e. not on selections changes, and on non-zero keys
            else if (FPetraUtilsObject.SuppressChangeDetection || (APartnerKey == 0))
            {
                // FLastDonor should be the last donor key that has been entered for a gift (not 0)
                if (APartnerKey != 0)
                {
                    FLastDonor = APartnerKey;
                    mniDonorHistory.Enabled = true;
                }
                else
                {
                    mniDonorHistory.Enabled = false;
                    txtDonorInfo.Text       = string.Empty;

                    if (FNewGiftInProcess)
                    {
                        FLastDonor = 0;
                    }
                }
            }
            else
            {
                try
                {
                    Cursor = Cursors.WaitCursor;

                    // this is a different donor
                    if (APartnerKey != FLastDonor)
                    {
                        PPartnerRow pr = RetrieveDonorRow(APartnerKey);

                        if (pr == null)
                        {
                            string errMsg = String.Format(Catalog.GetString("Partner Key:'{0} - {1}' cannot be found in the Partner table!"),
                                                          APartnerKey,
                                                          APartnerShortName);
                            MessageBox.Show(errMsg, Catalog.GetString("Donor Changed"), MessageBoxButtons.OK, MessageBoxIcon.Error);

                            //An invalid donor number can stop deletion of a new row, so need to stop invalid entries
                            txtDetailDonorKey.Text = String.Format("{0:0000000000}", 0);
                            return;
                        }

                        chkDetailConfidentialGiftFlag.Checked = pr.AnonymousDonor;

                        Int32 giftTransactionNo = FPreviouslySelectedDetailRow.GiftTransactionNumber;

                        DataView giftDetailDV = new DataView(FMainDS.ARecurringGiftDetail);

                        giftDetailDV.RowFilter = string.Format("{0}={1} And {2}={3}",
                                                               ARecurringGiftDetailTable.GetBatchNumberDBName(),
                                                               FBatchNumber,
                                                               ARecurringGiftDetailTable.GetGiftTransactionNumberDBName(),
                                                               giftTransactionNo);

                        foreach (DataRowView drv in giftDetailDV)
                        {
                            GiftBatchTDSARecurringGiftDetailRow giftDetail = (GiftBatchTDSARecurringGiftDetailRow)drv.Row;

                            giftDetail.DonorKey   = APartnerKey;
                            giftDetail.DonorName  = APartnerShortName;
                            giftDetail.DonorClass = pr.PartnerClass;
                        }

                        //Point to current gift row and specify as not a new donor
                        FGift = GetRecurringGiftRow(giftTransactionNo);

                        //Only autopopulate if this is a donor selection on a clean gift,
                        //  i.e. determine this is not a donor change where other changes have been made
                        //Sometimes you want to just change the donor without changing what already has been entered
                        //  e.g. when you realise you have entered the wrong donor after entering the correct recipient data
                        if (!TRemote.MFinance.Gift.WebConnectors.DonorHasGiven(FLedgerNumber, APartnerKey))
                        {
                            // add donor key to list so that new donor warning can be shown
                            if (!FNewDonorsList.Contains(APartnerKey))
                            {
                                FNewDonorsList.Add(APartnerKey);
                            }
                        }
                        else if ((giftDetailDV.Count == 1) &&
                                 (Convert.ToInt64(txtDetailRecipientKey.Text) == 0) &&
                                 (txtDetailGiftAmount.NumberValueDecimal.Value == 0))
                        {
                            AutoPopulateGiftDetail(APartnerKey, APartnerShortName, giftTransactionNo);
                        }

                        mniDonorHistory.Enabled = true;
                    }

                    ShowDonorInfo(APartnerKey);

                    FLastDonor = APartnerKey;
                }
                finally
                {
                    Cursor = Cursors.Default;
                }
            }
        }
        public Dictionary <string, LevelScore> ReadScores()
        {
            var catalog = Catalog.GetItem <GameStorage>();

            return(catalog.Scores);
        }
示例#37
0
 public ExtractionContext(Catalog catalog, Dictionary <string, string> replacementRegistry)
 {
     Catalog = catalog;
     this.replacementsRegistry = replacementRegistry;
 }
示例#38
0
        private void ImportSongs(LibraryImportManager manager, XmlNodeList songs)
        {
            foreach (XmlElement song in songs)
            {
                if (CheckForCanceled())
                {
                    break;
                }

                processed++;

                string title         = String.Empty,
                       genre         = String.Empty,
                       artist        = String.Empty,
                       album         = String.Empty;
                int year             = 0,
                    rating           = 0,
                    play_count       = 0,
                    track_number     = 0;
                DateTime date_added  = DateTime.Now,
                         last_played = DateTime.MinValue;
                SafeUri uri          = null;

                foreach (XmlElement child in song.ChildNodes)
                {
                    if (child == null || child.InnerText == null || child.InnerText == String.Empty)
                    {
                        continue;
                    }

                    try {
                        switch (child.Name)
                        {
                        case "title":
                            title = child.InnerText;
                            break;

                        case "genre":
                            genre = child.InnerText;
                            break;

                        case "artist":
                            artist = child.InnerText;
                            break;

                        case "album":
                            album = child.InnerText;
                            break;

                        case "track-number":
                            track_number = Int32.Parse(child.InnerText);
                            break;

                        case "location":
                            uri = new SafeUri(child.InnerText);
                            break;

                        case "date":
                            if (child.InnerText != "0")
                            {
                                year = (new DateTime(1, 1, 1).AddDays(Double.Parse(child.InnerText))).Year;
                            }
                            break;

                        case "rating":
                            rating = Int32.Parse(child.InnerText);
                            break;

                        case "play-count":
                            play_count = Int32.Parse(child.InnerText);
                            break;

                        case "last-played":
                            last_played = Hyena.DateTimeUtil.ToDateTime(Int64.Parse(child.InnerText));
                            break;

                        case "first-seen":
                            date_added = Hyena.DateTimeUtil.ToDateTime(Int64.Parse(child.InnerText));;
                            break;
                        }
                    } catch (Exception) {
                        // parsing InnerText failed
                    }
                }

                if (uri == null)
                {
                    continue;
                }

                UpdateUserJob(processed, count, artist, title);

                try {
                    DatabaseTrackInfo track = manager.ImportTrack(uri);

                    if (track == null)
                    {
                        LogError(SafeUri.UriToFilename(uri), Catalog.GetString("Unable to import song."));
                        continue;
                    }

                    track.TrackTitle  = title;
                    track.ArtistName  = artist;
                    track.Genre       = genre;
                    track.AlbumTitle  = album;
                    track.TrackNumber = track_number;
                    track.Year        = year;
                    track.DateAdded   = date_added;

                    track.Rating     = (rating >= 0 && rating <= 5) ? rating : 0;
                    track.PlayCount  = (play_count >= 0) ? play_count : 0;
                    track.LastPlayed = last_played;

                    track.Save(false);
                } catch (Exception e) {
                    LogError(SafeUri.UriToFilename(uri), e);
                }
            }
        }
示例#39
0
        private void HandlePintaCoreActionsLayersDeleteLayerActivated(object sender, EventArgs e)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            PintaCore.Tools.Commit();

            DeleteLayerHistoryItem hist = new DeleteLayerHistoryItem("Menu.Layers.DeleteLayer.png", Catalog.GetString("Delete Layer"), doc.CurrentUserLayer, doc.CurrentUserLayerIndex);

            doc.DeleteLayer(doc.CurrentUserLayerIndex, false);

            doc.History.PushNewItem(hist);
        }
示例#40
0
        private void HandlePintaCoreActionsLayersMergeLayerDownActivated(object sender, EventArgs e)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            PintaCore.Tools.Commit();

            int bottomLayerIndex = doc.CurrentUserLayerIndex - 1;
            var oldBottomSurface = doc.UserLayers[bottomLayerIndex].Surface.Clone();

            CompoundHistoryItem    hist = new CompoundHistoryItem("Menu.Layers.MergeLayerDown.png", Catalog.GetString("Merge Layer Down"));
            DeleteLayerHistoryItem h1   = new DeleteLayerHistoryItem(string.Empty, string.Empty, doc.CurrentUserLayer, doc.CurrentUserLayerIndex);

            doc.MergeCurrentLayerDown();

            SimpleHistoryItem h2 = new SimpleHistoryItem(string.Empty, string.Empty, oldBottomSurface, bottomLayerIndex);

            hist.Push(h1);
            hist.Push(h2);

            doc.History.PushNewItem(hist);
        }
示例#41
0
        private void HandlePintaCoreActionsLayersMoveLayerDownActivated(object sender, EventArgs e)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            PintaCore.Tools.Commit();

            SwapLayersHistoryItem hist = new SwapLayersHistoryItem("Menu.Layers.MoveLayerDown.png", Catalog.GetString("Move Layer Down"), doc.CurrentUserLayerIndex, doc.CurrentUserLayerIndex - 1);

            doc.MoveCurrentLayerDown();
            doc.History.PushNewItem(hist);
        }
示例#42
0
        private void HandlePintaCoreActionsLayersImportFromFileActivated(object sender, EventArgs e)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            PintaCore.Tools.Commit();

            var fcd = new Gtk.FileChooserDialog(Catalog.GetString("Open Image File"), PintaCore.Chrome.MainWindow,
                                                FileChooserAction.Open, Stock.Cancel, ResponseType.Cancel,
                                                Stock.Open, ResponseType.Ok);

            fcd.SetCurrentFolder(PintaCore.System.GetDialogDirectory());
            fcd.AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel };

            fcd.AddImagePreview();

            int response = fcd.Run();

            if (response == (int)Gtk.ResponseType.Ok)
            {
                string file = fcd.Filename;
                PintaCore.System.LastDialogDirectory = fcd.CurrentFolder;

                // Open the image and add it to the layers
                UserLayer layer = doc.AddNewLayer(System.IO.Path.GetFileName(file));

                using (var fs = new FileStream(file, FileMode.Open))
                    using (Pixbuf bg = new Pixbuf(fs))
                        using (Cairo.Context g = new Cairo.Context(layer.Surface)) {
                            CairoHelper.SetSourcePixbuf(g, bg, 0, 0);
                            g.Paint();
                        }

                doc.SetCurrentUserLayer(layer);

                AddLayerHistoryItem hist = new AddLayerHistoryItem("Menu.Layers.ImportFromFile.png", Catalog.GetString("Import From File"), doc.UserLayers.IndexOf(layer));
                doc.History.PushNewItem(hist);

                doc.Workspace.Invalidate();
            }

            fcd.Destroy();
        }
示例#43
0
 public GameController(Catalog catalog, IWebHostEnvironment env)
 {
     _catalog = catalog;
     _env     = env;
 }
示例#44
0
 public void IncludeDependencies(CatalogDeviceSession session, Catalog sourceCatalog, Catalog targetCatalog, EmitMode mode)
 {
     TableType.IncludeDependencies(session, sourceCatalog, targetCatalog, mode);
 }
 private void ShowReportStatus()
 {
     MessageBox.Show(FStatusMsg, Catalog.GetString("Stewardship Reports"));
 }
        }  // Load Hosa Report Data

        private Boolean LoadStewardshipReportData(TRptCalculator ACalc)
        {
            Dictionary <String, TVariant> paramsDictionary = InitialiseDictionary(ACalc);
            DataTable ReportTable = TRemote.MReporting.WebConnectors.GetReportDataTable("Stewardship", paramsDictionary);

            if (this.IsDisposed)
            {
                return(false);
            }

            if (ReportTable == null)
            {
                FPetraUtilsObject.WriteToStatusBar("Report Cancelled.");
                return(false);
            }

            MyFastReportsPlugin.RegisterData(ReportTable, "Stewardship");

            Boolean HasData = (ReportTable.Rows.Count > 0);

            if (!HasData)
            {
                FStatusMsg += Catalog.GetString("No Stewardship entries found for selected Run Number.");
            }

            TParameterList Params = ACalc.GetParameters();

            if ((!Params.Get("param_design_template").ToBool()) &&
                (rbtEmailStewardship.Checked))
            {
                // This gets email defaults from the user settings table
                TUC_EmailPreferences.LoadEmailDefaults();

                // This gets some of the settings from the server configuration.  We no longer get these items from local PC.
                // SmtpUsername and SmtpPassword will usually be null
                string smtpHost, smtpUsername, smtpPassword;
                int    smtpPort;
                bool   smtpUseSSL;
                TRemote.MSysMan.Application.WebConnectors.GetServerSmtpSettings(out smtpHost,
                                                                                out smtpPort,
                                                                                out smtpUseSSL,
                                                                                out smtpUsername,
                                                                                out smtpPassword);

                if ((smtpHost == string.Empty) || (smtpPort < 0))
                {
                    FStatusMsg += Catalog.GetString(
                        "\r\nCannot send email because 'smtpHost' and/or 'smtpPort' are not configured in the OP server configuration file.");
                    return(false);
                }

                TSmtpSender EmailSender = new TSmtpSender(smtpHost, smtpPort, smtpUseSSL, smtpUsername, smtpPassword, "");

                EmailSender.CcEverythingTo = TUserDefaults.GetStringDefault("SmtpCcTo");
                EmailSender.ReplyTo        = TUserDefaults.GetStringDefault("SmtpReplyTo");

                if (!EmailSender.FInitOk)
                {
                    FStatusMsg += String.Format(
                        Catalog.GetString(
                            "\r\nFailed to set up the email server.\n    Please check the settings in Preferences / Email.\n    Message returned: \"{0}\""),
                        EmailSender.FErrorStatus
                        );
                    return(false);
                }

                String MyCostCentreCode = String.Format("{0:##00}00", FLedgerNumber);
                String PeriodEnd        = Params.Get("param_end_date").ToDate().ToString("dd/MM/yyyy");
                Int32  RunNumber        = Params.Get("param_cmbICHNumber").ToInt32();
                String CsvAttachment    = String.Format("\"{0}\",{1},\"{2}\",{3},\"{4}\",{5}\n", // "** Header **",30/11/2014,\"0200\",09/12/2014,\"USD\",0"

                                                        "** Header **",                          // software originator and version ID
                                                        PeriodEnd,
                                                        MyCostCentreCode,                        // Field Cost Centre Code
                                                        DateTime.Now.ToString("dd/MM/yyyy"),
                                                        FLedgerRow.BaseCurrency,                 // Stewardship Report CSV always in Base Currency
                                                        RunNumber                                // Run number
                                                        );

                foreach (DataRow Row in ReportTable.Rows)
                {
                    CsvAttachment += String.Format("\"{0}\",{1},{2},{3}\n",
                                                   Row["CostCentreCode"].ToString(),
                                                   Convert.ToDecimal(Row["Income"]).ToString("0.00", CultureInfo.InvariantCulture), // Stewardship Report CSV always in Base Currency
                                                   Convert.ToDecimal(Row["Expense"]).ToString("0.00", CultureInfo.InvariantCulture),
                                                   Convert.ToDecimal(Row["Xfer"]).ToString("0.00", CultureInfo.InvariantCulture)
                                                   );
                }

                // Andrea wants this systemj default to be manually added to database when we are ready for a system to send ICH emails
                if (!TSystemDefaults.IsSystemDefaultDefined(STEWARDSHIP_EMAIL_ADDRESS))
                {
                    FStatusMsg += Catalog.GetString("\r\n Stewardship email address not configured in System Defaults.");
                    return(false);
                }

                String EmailRecipient = TSystemDefaults.GetStringDefault(STEWARDSHIP_EMAIL_ADDRESS);

                String EmailBody = TUserDefaults.GetStringDefault("SmtpEmailBody");
                EmailSender.AttachFromStream(new MemoryStream(Encoding.ASCII.GetBytes(CsvAttachment)), "Stewardship_" + MyCostCentreCode + ".csv");
                Boolean SentOk = EmailSender.SendEmail(
                    TUserDefaults.GetStringDefault("SmtpFromAccount"),
                    TUserDefaults.GetStringDefault("SmtpDisplayName"),
                    EmailRecipient, //[email protected]
                    "Stewardship Report [" + MyCostCentreCode + "] Period end: " + PeriodEnd + " Run#: " + RunNumber,
                    EmailBody);

                if (SentOk)
                {
                    FStatusMsg += Catalog.GetString("\r\nStewardship report emailed to ICH.");
                }
                else
                {
                    FStatusMsg += Catalog.GetString("\r\nFailed to send Stewardship email to ICH.");
                }

                return(false);
            }

            return(HasData);
        } // Load Stewardship Report Data
示例#47
0
        private static string ReadConfigToString()
        {
            string  buffer    = string.Empty;
            string  zipBuffer = string.Empty;
            Catalog catalog   = new Catalog();

            catalog.Rows = 2;
            using (AvtoritetEntities ae = new AvtoritetEntities())
            {
                System.Collections.Generic.List <Group> groups = (from r in ae.Group
                                                                  where r.Enable
                                                                  select r into t
                                                                  orderby t.Order
                                                                  select t).ToList <Group>();
                catalog.Groups = new System.Collections.Generic.List <RelayServer.Models.Group>();
                using (System.Collections.Generic.List <Group> .Enumerator enumerator = groups.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Group group = enumerator.Current;
                        RelayServer.Models.Group catalogGroup = new RelayServer.Models.Group();
                        System.Collections.Generic.List <GroupBox> groupboxs = (from t in ae.GroupBox
                                                                                where t.GroupId == @group.GroupId && t.Enable
                                                                                select t into r
                                                                                orderby r.Title
                                                                                select r).ToList <GroupBox>();
                        catalogGroup.GroupBoxs = new System.Collections.Generic.List <RelayServer.Models.GroupBox>();
                        using (System.Collections.Generic.List <GroupBox> .Enumerator enumerator2 = groupboxs.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                GroupBox groupBox = enumerator2.Current;
                                RelayServer.Models.GroupBox             catalogGroupBox = new RelayServer.Models.GroupBox();
                                System.Collections.Generic.List <Brand> brands          = (from t in ae.Brand
                                                                                           where t.GroupBoxId == groupBox.GroupBoxId && t.Enable
                                                                                           select t into r
                                                                                           orderby r.NameAndFolder
                                                                                           select r).ToList <Brand>();
                                catalogGroupBox.Brands = new System.Collections.Generic.List <RelayServer.Models.Brand>();
                                using (System.Collections.Generic.List <Brand> .Enumerator enumerator3 = brands.GetEnumerator())
                                {
                                    while (enumerator3.MoveNext())
                                    {
                                        Brand brand = enumerator3.Current;
                                        RelayServer.Models.Brand catalogBrand = new RelayServer.Models.Brand();
                                        System.Collections.Generic.List <Provider> providers = (from t in ae.Provider
                                                                                                where t.BrandId == brand.BrandId && t.Enable
                                                                                                select t into r
                                                                                                orderby r.Order
                                                                                                select r).ToList <Provider>();
                                        catalogBrand.Providers = new System.Collections.Generic.List <RelayServer.Models.Provider>();
                                        using (System.Collections.Generic.List <Provider> .Enumerator enumerator4 = providers.GetEnumerator())
                                        {
                                            while (enumerator4.MoveNext())
                                            {
                                                Provider        provider = enumerator4.Current;
                                                ProviderAccount provAcc  = ae.ProviderAccount.FirstOrDefault(t => t.ProviderId == provider.ProviderId && t.Enable);
                                                System.Collections.Generic.List <RelayServer.Models.CommandFile> commandFiles = (from t in ae.CommandFile
                                                                                                                                 where t.ProviderId == (int?)provider.ProviderId
                                                                                                                                 select t into r
                                                                                                                                 select new RelayServer.Models.CommandFile
                                                {
                                                    FileName = r.FileName,
                                                    FileContent = r.FileContent
                                                }).ToList <RelayServer.Models.CommandFile>();
                                                System.Collections.Generic.List <RelayServer.Models.ProviderFile> providerFiles = (from t in ae.ProviderFile
                                                                                                                                   where t.ProviderId == (int?)provider.ProviderId
                                                                                                                                   select t into r
                                                                                                                                   select new RelayServer.Models.ProviderFile
                                                {
                                                    FileName = r.FileName,
                                                    FileExt = r.FileExt,
                                                    FileSize = (long)r.FileSize,
                                                    FileContent = r.FileContent
                                                }).ToList <RelayServer.Models.ProviderFile>();
                                                catalogBrand.Providers.Add(new RelayServer.Models.Provider
                                                {
                                                    Uri           = provider.Uri.Trim(),
                                                    IconPath      = provider.IconPath,
                                                    Title         = provider.Title,
                                                    Order         = (provider.Order ?? 0),
                                                    Commands      = provider.commandcontent,
                                                    Login         = ((provAcc != null) ? provAcc.Login.Trim() : string.Empty),
                                                    Password      = ((provAcc != null) ? provAcc.Password.Trim() : string.Empty),
                                                    CommandFiles  = commandFiles,
                                                    ProviderFiles = providerFiles
                                                });
                                            }
                                        }
                                        catalogBrand.NameAndFolder = brand.NameAndFolder;
                                        catalogBrand.IconPath      = brand.IconPath;
                                        catalogBrand.IconPath2     = brand.IconPath2;
                                        catalogBrand.IconPathImg   = brand.IconPathImg;
                                        catalogBrand.IconPath2Img  = brand.IconPath2Img;
                                        catalogBrand.Top           = (brand.Top ?? 0);
                                        catalogBrand.Left          = (brand.Left ?? 0);
                                        catalogBrand.Width         = (brand.Width ?? 0);
                                        catalogBrand.Height        = (brand.Height ?? 0);
                                        catalogBrand.BrandId       = brand.BrandId;
                                        catalogBrand.ButtonStyle   = brand.ButtonStyle;
                                        catalogBrand.MenuWindow    = brand.MenuWindow.Value;
                                        catalogGroupBox.Brands.Add(catalogBrand);
                                    }
                                }
                                catalogGroupBox.Left          = groupBox.Left.Value;
                                catalogGroupBox.Top           = groupBox.Top.Value;
                                catalogGroupBox.Width         = groupBox.Width.Value;
                                catalogGroupBox.Height        = groupBox.Height.Value;
                                catalogGroupBox.Title         = groupBox.Title;
                                catalogGroupBox.VisibleBorder = groupBox.VisibleBorder.Value;
                                catalogGroup.GroupBoxs.Add(catalogGroupBox);
                            }
                        }
                        catalogGroup.Name   = group.Name;
                        catalogGroup.Width  = group.Width.Value;
                        catalogGroup.Height = group.Height.Value;
                        catalogGroup.Order  = (group.Order ?? 0);
                        catalog.Groups.Add(catalogGroup);
                    }
                }
                buffer = StringZip.Zip(new JavaScriptSerializer
                {
                    MaxJsonLength = 2147483647
                }.Serialize(catalog));
            }
            return(buffer);
        }
        protected override void AddFields()
        {
            HBox box   = new HBox();
            VBox left  = EditorUtilities.CreateVBox();
            VBox right = EditorUtilities.CreateVBox();

            box.PackStart(left, true, true, 0);
            box.PackStart(new VSeparator(), false, false, 12);
            box.PackStart(right, false, false, 0);
            box.ShowAll();

            PackStart(box, false, false, 0);

            // Left

            PageNavigationEntry title_entry = new PageNavigationEntry(Dialog);

            AddField(left, title_entry, null,
                     delegate { return(Catalog.GetString("Track _Title:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((PageNavigationEntry)widget).Text = track.TrackTitle; },
                     delegate(EditorTrackInfo track, Widget widget) { track.TrackTitle = ((PageNavigationEntry)widget).Text; },
                     FieldOptions.NoSync
                     );

            PageNavigationEntry track_artist_entry = new PageNavigationEntry(Dialog, "CoreArtists", "Name");

            FieldPage.FieldSlot track_artist_slot = AddField(left, track_artist_entry,
                                                             Catalog.GetString("Set all track artists to this value"),
                                                             delegate { return(Catalog.GetString("Track _Artist:")); },
                                                             delegate(EditorTrackInfo track, Widget widget) { ((PageNavigationEntry)widget).Text = track.ArtistName; },
                                                             delegate(EditorTrackInfo track, Widget widget) { track.ArtistName = ((PageNavigationEntry)widget).Text; }
                                                             );

            AlbumArtistEntry album_artist_entry = new AlbumArtistEntry(track_artist_slot.SyncButton,
                                                                       title_entry, track_artist_entry);

            AddField(left, null, album_artist_entry,
                     Catalog.GetString("Set all compilation album artists to these values"), null,
                     delegate(EditorTrackInfo track, Widget widget) {
                AlbumArtistEntry entry = widget as AlbumArtistEntry;
                entry.IsCompilation    = track.IsCompilation;
                entry.Text             = track.AlbumArtist;
            },
                     delegate(EditorTrackInfo track, Widget widget) {
                AlbumArtistEntry entry = widget as AlbumArtistEntry;
                track.IsCompilation    = entry.IsCompilation;
                track.AlbumArtist      = entry.Text;
            }
                     );

            track_artist_entry.Changed += delegate {
                if (!album_artist_entry.IsCompilation)
                {
                    album_artist_entry.Text = track_artist_entry.Text;
                }
            };

            AddField(left, new TextEntry("CoreAlbums", "Title"),
                     Catalog.GetString("Set all album titles to this value"),
                     delegate { return(Catalog.GetString("Albu_m Title:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((TextEntry)widget).Text = track.AlbumTitle; },
                     delegate(EditorTrackInfo track, Widget widget) { track.AlbumTitle = ((TextEntry)widget).Text; }
                     );

            AddField(left, new GenreEntry(),
                     Catalog.GetString("Set all genres to this value"),
                     delegate { return(Catalog.GetString("_Genre:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((GenreEntry)widget).Value = track.Genre; },
                     delegate(EditorTrackInfo track, Widget widget) { track.Genre = ((GenreEntry)widget).Value; }
                     );

            // Right

            /* Translators: "of" is the word beteen a track/disc number and the total count. */
            AddField(right, new RangeEntry(Catalog.GetString("of"), !MultipleTracks
                ? null as RangeEntry.RangeOrderClosure
                : delegate(RangeEntry entry) {
                for (int i = 0, n = Dialog.TrackCount; i < n; i++)
                {
                    EditorTrackInfo track = Dialog.LoadTrack(i);

                    if (Dialog.CurrentTrackIndex == i)
                    {
                        // In this case the writeClosure is invoked,
                        // which will take care of updating the TrackInfo
                        entry.From.Value = i + 1;
                        entry.To.Value   = n;
                    }
                    else
                    {
                        track.TrackNumber = i + 1;
                        track.TrackCount  = n;
                    }
                }
            }, Catalog.GetString("Automatically set track number and count")),
                     null,
                     delegate { return(Catalog.GetString("Track _Number:")); },
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry = (RangeEntry)widget;
                entry.From.Value = track.TrackNumber;
                entry.To.Value   = track.TrackCount;
            },
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry  = (RangeEntry)widget;
                track.TrackNumber = (int)entry.From.Value;
                track.TrackCount  = (int)entry.To.Value;
            },
                     FieldOptions.NoSync
                     );

            AddField(right, new RangeEntry(Catalog.GetString("of")),
                     // Catalog.GetString ("Automatically set disc number and count"),
                     Catalog.GetString("Set all disc numbers and counts to these values"),
                     delegate { return(Catalog.GetString("_Disc Number:")); },
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry = (RangeEntry)widget;
                entry.From.Value = track.DiscNumber;
                entry.To.Value   = track.DiscCount;
            },
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry = (RangeEntry)widget;
                track.DiscNumber = (int)entry.From.Value;
                track.DiscCount  = (int)entry.To.Value;
            },
                     FieldOptions.None
                     );

            Label year_label = EditorUtilities.CreateLabel(null);

            album_artist_entry.LabelWidget.SizeAllocated += delegate {
                year_label.HeightRequest = album_artist_entry.LabelWidget.Allocation.Height;
            };
            SpinButtonEntry year_entry = new SpinButtonEntry(0, 3000, 1);

            year_entry.Numeric = true;
            AddField(right, year_label, year_entry,
                     Catalog.GetString("Set all years to this value"),
                     delegate { return(Catalog.GetString("_Year:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((SpinButtonEntry)widget).Value = track.Year; },
                     delegate(EditorTrackInfo track, Widget widget) { track.Year = ((SpinButtonEntry)widget).ValueAsInt; },
                     FieldOptions.Shrink
                     );

            AddField(right, new RatingEntry(),
                     Catalog.GetString("Set all ratings to this value"),
                     delegate { return(Catalog.GetString("_Rating:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((RatingEntry)widget).Value = track.Rating; },
                     delegate(EditorTrackInfo track, Widget widget) { track.Rating = ((RatingEntry)widget).Value; },
                     FieldOptions.Shrink | FieldOptions.NoSync
                     );
        }
示例#49
0
        public static void Main()
        {
            #region 自訂驗證規則
            FactoryProvider.RowFactory.Add(new ValidationRule.CounselRowValidatorFactory());
            #endregion

            // 異動
            if (FISCA.Permission.UserAcl.Current[UpdateRecordContentCode].Editable || FISCA.Permission.UserAcl.Current[UpdateRecordContentCode].Viewable)
            {
                K12.Presentation.NLDPanels.Student.AddDetailBulider(new FISCA.Presentation.DetailBulider <UpdateRecordItem>());
            }

            // 前籍畢業資訊
            if (FISCA.Permission.UserAcl.Current[BeforeEnrollmentContentCode].Editable || FISCA.Permission.UserAcl.Current[BeforeEnrollmentContentCode].Viewable)
            {
                K12.Presentation.NLDPanels.Student.AddDetailBulider(new FISCA.Presentation.DetailBulider <BeforeEnrollmentItem>());
            }

            Catalog detail = RoleAclSource.Instance["學生"]["資料項目"];
            detail.Add(new DetailItemFeature(typeof(UpdateRecordItem)));
            detail.Add(new DetailItemFeature(typeof(BeforeEnrollmentItem)));

            Catalog ribbon = RoleAclSource.Instance["教務作業"]["功能按鈕"];
            ribbon.Add(new RibbonFeature(UpdateRecordGovDocsCode, "函報名冊"));
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SmartSchool.Others.RibbonBars.NameList));
            var btnItemNameList = MotherForm.RibbonBarItems["教務作業", "批次作業/檢視"]["異動作業"];
            btnItemNameList.Image          = Properties.Resources.history_save_64;
            btnItemNameList.Size           = RibbonBarButton.MenuButtonSize.Large;
            btnItemNameList["函報名冊"].Enable = FISCA.Permission.UserAcl.Current[UpdateRecordGovDocsCode].Executable;
            btnItemNameList["函報名冊"].Click += delegate
            {
                new GovernmentalDocument.ListForm().ShowDialog();
            };

            // 匯出新生異動
            RibbonBarButton rbEnrollmentListExport = MotherForm.RibbonBarItems["學生", "資料統計"]["匯出"];
            rbEnrollmentListExport["異動相關匯出"]["匯出新生異動"].Enable = FISCA.Permission.UserAcl.Current["Button0200"].Executable;
            rbEnrollmentListExport["異動相關匯出"]["匯出新生異動"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter exporter = new UpdateRecordModule_KHSH_N.ImportExport.ExportEnrollmentList();
                ImportExport.ExportStudentV2           wizard   = new ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };

            // 匯入新生異動
            RibbonBarButton rbEnrollmentListImport = MotherForm.RibbonBarItems["學生", "資料統計"]["匯入"];
            rbEnrollmentListImport["異動相關匯入"]["匯入新生異動"].Enable = FISCA.Permission.UserAcl.Current["Button0280"].Executable;
            rbEnrollmentListImport["異動相關匯入"]["匯入新生異動"].Click += delegate
            {
                Global._AllStudentNumberStatusIDTemp = DAL.FDQuery.GetAllStudenNumberStatusDict();
                Global._StudentUpdateRecordTemp      = DAL.FDQuery.GetHasStudentUpdateRecord01Dict(1, 99);
                ImportExport.ImportEnrollmentList iel = new ImportExport.ImportEnrollmentList();
                iel.Execute();
            };


            // 匯出轉入異動
            RibbonBarButton rbTransferListExport = MotherForm.RibbonBarItems["學生", "資料統計"]["匯出"];
            rbTransferListExport["異動相關匯出"]["匯出轉入異動"].Enable = FISCA.Permission.UserAcl.Current["Button0200"].Executable;
            rbTransferListExport["異動相關匯出"]["匯出轉入異動"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter exporter = new UpdateRecordModule_KHSH_N.ImportExport.ExportTransferList();
                ImportExport.ExportStudentV2           wizard   = new ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };

            // 匯入轉入異動
            RibbonBarButton rbTransferListImport = MotherForm.RibbonBarItems["學生", "資料統計"]["匯入"];
            rbTransferListImport["異動相關匯入"]["匯入轉入異動"].Enable = FISCA.Permission.UserAcl.Current["Button0280"].Executable;
            rbTransferListImport["異動相關匯入"]["匯入轉入異動"].Click += delegate
            {
                Global._AllStudentNumberStatusIDTemp = DAL.FDQuery.GetAllStudenNumberStatusDict();
                Global._StudentUpdateRecordTemp      = DAL.FDQuery.GetHasStudentUpdateRecord01Dict(100, 199);
                ImportExport.ImportTransferList iel = new ImportExport.ImportTransferList();
                iel.Execute();
            };

            // 匯出學籍異動
            RibbonBarButton rbStudUpdateRecordExport = MotherForm.RibbonBarItems["學生", "資料統計"]["匯出"];
            rbStudUpdateRecordExport["異動相關匯出"]["匯出學籍異動"].Enable = FISCA.Permission.UserAcl.Current["Button0200"].Executable;
            rbStudUpdateRecordExport["異動相關匯出"]["匯出學籍異動"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter exporter = new UpdateRecordModule_KHSH_N.ImportExport.ExportStudUpdateRecordList();
                ImportExport.ExportStudentV2           wizard   = new ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };

            // 匯入學籍異動
            RibbonBarButton rbStudUpdateRecordImport = MotherForm.RibbonBarItems["學生", "資料統計"]["匯入"];
            rbStudUpdateRecordImport["異動相關匯入"]["匯入學籍異動"].Enable = FISCA.Permission.UserAcl.Current["Button0280"].Executable;
            rbStudUpdateRecordImport["異動相關匯入"]["匯入學籍異動"].Click += delegate
            {
                Global._AllStudentNumberStatusIDTemp = DAL.FDQuery.GetAllStudenNumberStatusDict();
                Global._StudentUpdateRecordTemp      = DAL.FDQuery.GetHasStudentUpdateRecord01Dict(200, 500);
                ImportExport.ImportStudUpdateRecordList iel = new ImportExport.ImportStudUpdateRecordList();
                iel.Execute();
            };


            // 匯出畢業異動
            RibbonBarButton rbGraduateExport = MotherForm.RibbonBarItems["學生", "資料統計"]["匯出"];
            rbGraduateExport["異動相關匯出"]["匯出畢業異動"].Enable = FISCA.Permission.UserAcl.Current["Button0200"].Executable;
            rbGraduateExport["異動相關匯出"]["匯出畢業異動"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter exporter = new UpdateRecordModule_KHSH_N.ImportExport.ExportGraduateList();
                ImportExport.ExportStudentV2           wizard   = new ImportExport.ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };

            // 匯入畢業異動
            RibbonBarButton rbGraduateImport = MotherForm.RibbonBarItems["學生", "資料統計"]["匯入"];
            rbGraduateImport["異動相關匯入"]["匯入畢業異動"].Enable = FISCA.Permission.UserAcl.Current["Button0280"].Executable;
            rbGraduateImport["異動相關匯入"]["匯入畢業異動"].Click += delegate
            {
                Global._AllStudentNumberStatusIDTemp = DAL.FDQuery.GetAllStudenNumberStatusDict();
                Global._StudentUpdateRecordTemp      = DAL.FDQuery.GetHasStudentUpdateRecord01Dict(500, 502);
                ImportExport.ImportGraduateList iel = new ImportExport.ImportGraduateList();
                iel.Execute();
            };

            Catalog ribbon1 = RoleAclSource.Instance["學生"]["功能按鈕"];
            ribbon1.Add(new RibbonFeature("SHSchool.Student.RibbonImportUpdateRecCode100", "匯入學籍異動"));
            ribbon1.Add(new RibbonFeature("Button0200", "匯出異動相關"));
            ribbon1.Add(new RibbonFeature("Button0280", "匯入異動相關"));

            // 批次新生異動
            RibbonBarButton rbBatchNewUpdateRec = MotherForm.RibbonBarItems["學生", "教務"]["新生作業"];
            rbBatchNewUpdateRec["批次新生異動"].Enable = FISCA.Permission.UserAcl.Current["SHSchool.Student.rbBatchNewUpdateRec001"].Executable;
            rbBatchNewUpdateRec["批次新生異動"].Click += delegate
            {
                Batch.BatchNewStudUpdateRecForm bnsur = new Batch.BatchNewStudUpdateRecForm();
                bnsur.ShowDialog();
            };
            ribbon1.Add(new RibbonFeature("SHSchool.Student.rbBatchNewUpdateRec001", "批次新生異動"));

            Catalog ribbon2 = RoleAclSource.Instance["學生"]["功能按鈕"];

            // 批次畢業異動
            RibbonBarButton rbBatchGraduateRec = MotherForm.RibbonBarItems["學生", "教務"]["畢業作業"];
            rbBatchGraduateRec["批次畢業異動"].Enable = FISCA.Permission.UserAcl.Current["Button0095"].Executable;
            rbBatchGraduateRec["批次畢業異動"].Click += delegate
            {
                Batch.BatchGraduateRecForm bgrf = new Batch.BatchGraduateRecForm();
                bgrf.ShowDialog();
            };
            //ribbon2.Add(new RibbonFeature("Button0095", "批次畢業異動"));

            // 加入權限代碼
            ribbon2.Add(new RibbonFeature("SHSchool.Student.UpdateRecordForm.Button01", "轉科"));
            ribbon2.Add(new RibbonFeature("SHSchool.Student.UpdateRecordForm.Button02", "學籍更正"));

            var btnStudentUR = K12.Presentation.NLDPanels.Student.RibbonBarItems["教務"]["異動作業"];
            btnStudentUR.Image = Properties.Resources.demographic_reload_64;
            btnStudentUR.Size  = RibbonBarButton.MenuButtonSize.Large;
            var btnChangeDept = btnStudentUR["轉科"];
            btnChangeDept.Click += new EventHandler(btnChangeDept_Click);
            btnChangeDept.Enable = K12.Presentation.NLDPanels.Student.SelectedSource.Count == 1;
            var btnChangeInfo = btnStudentUR["學籍更正"];
            btnChangeInfo.Click += new EventHandler(btnChangeInfo_Click);
            btnChangeInfo.Enable = K12.Presentation.NLDPanels.Student.SelectedSource.Count == 1;

            K12.Presentation.NLDPanels.Student.SelectedSourceChanged += delegate
            {
                btnChangeDept.Enable = K12.Presentation.NLDPanels.Student.SelectedSource.Count == 1 && FISCA.Permission.UserAcl.Current["SHSchool.Student.UpdateRecordForm.Button01"].Executable;
                btnChangeInfo.Enable = K12.Presentation.NLDPanels.Student.SelectedSource.Count == 1 && FISCA.Permission.UserAcl.Current["SHSchool.Student.UpdateRecordForm.Button02"].Executable;
            };
        }
示例#50
0
        public HeaderWidget(Shuffler shuffler, string shuffle_mode_id, string source_name) : base(0, 0, 0, 0)
        {
            ThreadAssist.AssertInMainThread();

            var box = new HBox();

            box.Spacing = 6;

            var fill_label = new Label(Catalog.GetString("_Fill"));

            mode_combo = new DictionaryComboBox <RandomBy> ();
            foreach (var random_by in shuffler.RandomModes.OrderBy(r => r.Adverb))
            {
                mode_combo.Add(random_by.Adverb, random_by);
                if (random_by.Id == "off")
                {
                    mode_combo.Default = random_by;
                }
            }

            fill_label.MnemonicWidget = mode_combo;
            mode_combo.Changed       += OnModeComboChanged;

            var from_label       = new Label(Catalog.GetString("f_rom"));
            var source_combo_box = new QueueableSourceComboBox(source_name);

            from_label.MnemonicWidget = source_combo_box;

            sensitive_widgets.Add(source_combo_box);
            sensitive_widgets.Add(from_label);

            source_combo_box.Changed += delegate {
                var handler = SourceChanged;
                if (handler != null)
                {
                    handler(this, new EventArgs <DatabaseSource> (source_combo_box.Source));
                }
            };

            box.PackStart(fill_label, false, false, 0);
            box.PackStart(mode_combo, false, false, 0);
            box.PackStart(from_label, false, false, 0);
            box.PackStart(source_combo_box, false, false, 0);
            this.SetPadding(0, 0, 6, 6);
            this.Add(box);

            // Select the saved population mode.
            var default_randomby = shuffler.RandomModes.FirstOrDefault(r => r.Id == shuffle_mode_id);

            if (default_randomby != null)
            {
                mode_combo.ActiveValue = default_randomby;
            }
            else if (mode_combo.Default != null)
            {
                mode_combo.ActiveValue = mode_combo.Default;
            }

            shuffler.RandomModeAdded   += (r) => mode_combo.Add(r.Adverb, r);
            shuffler.RandomModeRemoved += (r) => mode_combo.Remove(r);
        }
示例#51
0
        /// <summary>
        /// Enables and disables the UI. Invokes setting up of the Grid after a
        /// successful search operation.
        /// </summary>
        /// <returns>void</returns>
        private void EnableDisableUI(System.Object AEnable)
        {
            object[]          Args;
            TMyUpdateDelegate MyUpdateDelegate;

            // Since this procedure is called from a separate (background) Thread, it is
            // necessary to execute this procedure in the Thread of the GUI
            if (btnSearch.InvokeRequired)
            {
                Args = new object[1];

                try
                {
                    MyUpdateDelegate = new TMyUpdateDelegate(EnableDisableUI);
                    Args[0]          = AEnable;
                    btnSearch.Invoke(MyUpdateDelegate, new object[] { AEnable });
                }
                finally
                {
                    Args = new object[0];
                }
            }
            else
            {
                // Enable/disable according to how the search operation ended
                if (Convert.ToBoolean(AEnable))
                {
                    TProgressState ThreadStatus = FGLTransactionFindObject.Progress;

                    if (ThreadStatus.JobFinished)
                    {
                        // Search operation ended without interruption
                        if (FPagedDataTable.Rows.Count > 0)
                        {
                            btnSearch.Enabled = false;

                            // At least one result was found by the search operation
                            lblSearchInfo.Text = "";

                            //
                            // Setup result DataGrid
                            //
                            if (grdResult.Columns.Count < 1)
                            {
                                SetupGrid();
                            }

                            SetupDataGridDataBinding();
                            grdResult.AutoSizeCells();

                            grdResult.Selection.SelectRow(1, true);

                            // Scroll grid to first line (the grid might have been scrolled before to another position)
                            grdResult.ShowCell(new Position(1, 1), true);

                            // For speed reasons we must add the necessary amount of emtpy Rows only here (after .AutoSizeCells() has already
                            // been run! See XML Comment on the called Method TSgrdDataGridPaged.AddEmptyRows() for details!
                            grdResult.AddEmptyRows();

                            grdResult.BringToFront();

                            // set tooltips
                            grdResult.SetHeaderTooltip(3, MFinanceConstants.BATCH_POSTED);
                            grdResult.SetHeaderTooltip(5, Catalog.GetString("Confidential"));

                            // Make the Grid respond on updown keys
                            grdResult.Focus();

                            // Display the number of found gift details
                            UpdateRecordNumberDisplay();

                            Application.DoEvents();

                            btnSearch.Enabled = true;

                            this.Cursor = Cursors.Default;
                        }
                        else
                        {
                            // Search operation has found nothing
                            this.Cursor        = Cursors.Default;
                            lblSearchInfo.Text = Catalog.GetString("No GL Transactions found.");
                            Application.DoEvents();

                            btnSearch.Enabled = true;

                            UpdateRecordNumberDisplay();
                        }
                    }
                    else
                    {
                        // Search operation interrupted by user
                        // used to release server System.Object here
                        // (It isn't currently possible for the user to stop the search. I don't think this functionality is necessary)
                        this.Cursor        = Cursors.Default;
                        lblSearchInfo.Text = Catalog.GetString("Search stopped!");

                        btnSearch.Enabled = true;
                        Application.DoEvents();
                    }

                    // enable or disable btnView
                    if (FPagedDataTable.Rows.Count > 0)
                    {
                        btnView.Enabled = true;
                    }
                    else
                    {
                        btnView.Enabled = false;
                    }
                }
            }
        }
示例#52
0
        public PodcastActions(PodcastSource source) : base(ServiceManager.Get <InterfaceActionService> (), "Podcast")
        {
            this.podcast_source = source;
            ImportantByDefault  = false;

            Add(
                new ActionEntry(
                    "PodcastUpdateAllAction", Stock.Refresh,
                    Catalog.GetString("Refresh"), null,  //"<control><shift>U",
                    Catalog.GetString("Check all podcasts for new episodes"),
                    OnPodcastUpdateAll
                    ),
                new ActionEntry(
                    "PodcastAddAction", Stock.Add,
                    Catalog.GetString("Add Podcast..."), "<control><shift>F",
                    Catalog.GetString("Subscribe to a new podcast"),
                    OnPodcastAdd
                    )
                );

            Add(
                new ActionEntry("PodcastFeedPopupAction", null,
                                String.Empty, null, null, OnFeedPopup),

                new ActionEntry("EpisodePodcastMenu", null,
                                Catalog.GetString("Podcast"), null, null, null),

                new ActionEntry(
                    "PodcastDeleteAction", Stock.Delete,
                    Catalog.GetString("Unsubscribe and Delete"),
                    null, String.Empty,
                    OnPodcastDelete
                    ),
                new ActionEntry(
                    "PodcastUpdateFeedAction", Stock.Refresh,
                    Catalog.GetString("Check for New Episodes"),
                    null, String.Empty,
                    OnPodcastUpdate
                    ),
                new ActionEntry(
                    "PodcastDownloadAllAction", Stock.Save,
                    Catalog.GetString("Download All Episodes"),
                    null, String.Empty,
                    OnPodcastDownloadAllEpisodes
                    ),
                new ActionEntry(
                    "PodcastHomepageAction", Stock.JumpTo,
                    Catalog.GetString("Visit Podcast Homepage"),
                    null, String.Empty,
                    OnPodcastHomepage
                    ),
                new ActionEntry(
                    "PodcastPropertiesAction", Stock.Properties,
                    Catalog.GetString("Properties"),
                    null, String.Empty,
                    OnPodcastProperties
                    ),
                new ActionEntry(
                    "EpisodePodcastProperties", null,
                    Catalog.GetString("Podcast Properties"), null, String.Empty,
                    OnEpisodePodcastProperties
                    ),
                new ActionEntry(
                    "PodcastItemMarkNewAction", null,
                    Catalog.GetString("Mark as New"),
                    null, String.Empty,
                    OnPodcastItemMarkNew
                    ),
                new ActionEntry(
                    "PodcastItemMarkOldAction", null,
                    Catalog.GetString("Archive"), "y", String.Empty,
                    OnPodcastItemMarkOld
                    ),
                new ActionEntry(
                    "PodcastItemDownloadAction", Stock.Save,
                    /* Translators: this is a verb used as a button name, not a noun*/
                    Catalog.GetString("Download"),
                    "<control><shift>D", String.Empty,
                    OnPodcastItemDownload
                    ),
                new ActionEntry(
                    "PodcastItemCancelAction", Stock.Cancel,
                    Catalog.GetString("Cancel Download"),
                    "<control><shift>C", String.Empty,
                    OnPodcastItemCancel
                    ),
                new ActionEntry(
                    "PodcastItemDeleteFileAction", Stock.Remove,
                    "",
                    null, String.Empty,
                    OnPodcastItemDeleteFile
                    ),
                new ActionEntry(
                    "PodcastItemLinkAction", Stock.JumpTo,
                    Catalog.GetString("Visit Website"),
                    null, String.Empty,
                    OnPodcastItemLink
                    ),
                new ActionEntry(
                    "PodcastItemPropertiesAction", Stock.Properties,
                    Catalog.GetString("Properties"),
                    null, String.Empty,
                    OnPodcastItemProperties
                    )
                );

            this["PodcastAddAction"].ShortLabel = Catalog.GetString("Add Podcast");

            actions_id = Actions.UIManager.AddUiFromResource("GlobalUI.xml");
            Actions.AddActionGroup(this);

            ServiceManager.SourceManager.ActiveSourceChanged += HandleActiveSourceChanged;
            OnSelectionChanged(null, null);
        }
示例#53
0
 protected virtual void Build()
 {
     Gui.Initialize((Widget)this);
     this.WidthRequest                = 720;
     this.HeightRequest               = 615;
     this.Name                        = "Modules.Communal.Guide.GuideUC";
     this.Title                       = Catalog.GetString("GuideUC");
     this.WindowPosition              = WindowPosition.CenterOnParent;
     this.vbox_root                   = new VBox();
     this.vbox_root.Name              = "vbox_root";
     this.vbox_root.Spacing           = 6;
     this.label_occupy3               = new Label();
     this.label_occupy3.HeightRequest = 15;
     this.label_occupy3.Name          = "label_occupy3";
     this.vbox_root.Add((Widget)this.label_occupy3);
     ((Box.BoxChild) this.vbox_root[(Widget)this.label_occupy3]).Position = 0;
     this.label_title = new Label();
     this.label_title.HeightRequest = 35;
     this.label_title.Name          = "label_title";
     this.label_title.LabelProp     = Catalog.GetString("label1");
     this.vbox_root.Add((Widget)this.label_title);
     Box.BoxChild boxChild1 = (Box.BoxChild) this.vbox_root[(Widget)this.label_title];
     boxChild1.Position           = 1;
     boxChild1.Expand             = false;
     boxChild1.Fill               = false;
     this.imagebin1               = new ImageBin();
     this.imagebin1.WidthRequest  = 720;
     this.imagebin1.HeightRequest = 480;
     this.imagebin1.Events        = EventMask.ButtonPressMask;
     this.imagebin1.Name          = "imagebin1";
     this.vbox_root.Add((Widget)this.imagebin1);
     Box.BoxChild boxChild2 = (Box.BoxChild) this.vbox_root[(Widget)this.imagebin1];
     boxChild2.Position    = 2;
     boxChild2.Expand      = false;
     boxChild2.Fill        = false;
     this.hseparator1      = new HSeparator();
     this.hseparator1.Name = "hseparator1";
     this.vbox_root.Add((Widget)this.hseparator1);
     Box.BoxChild boxChild3 = (Box.BoxChild) this.vbox_root[(Widget)this.hseparator1];
     boxChild3.Position               = 3;
     boxChild3.Expand                 = false;
     boxChild3.Fill                   = false;
     this.hbox_bottom                 = new HBox();
     this.hbox_bottom.Name            = "hbox_bottom";
     this.hbox_checkBtnExpand         = new HBox();
     this.hbox_checkBtnExpand.Name    = "hbox_checkBtnExpand";
     this.hbox_checkBtnExpand.Spacing = 6;
     this.vbox_expand                 = new VBox();
     this.vbox_expand.Name            = "vbox_expand";
     this.vbox_expand.Spacing         = 6;
     this.cbtn_show                   = new CheckButton();
     this.cbtn_show.CanFocus          = true;
     this.cbtn_show.Name              = "cbtn_show";
     this.cbtn_show.Label             = Catalog.GetString("下次打开时不再显示该窗口");
     this.cbtn_show.DrawIndicator     = true;
     this.cbtn_show.UseUnderline      = true;
     this.vbox_expand.Add((Widget)this.cbtn_show);
     Box.BoxChild boxChild4 = (Box.BoxChild) this.vbox_expand[(Widget)this.cbtn_show];
     boxChild4.Position = 0;
     boxChild4.Fill     = false;
     this.hbox_checkBtnExpand.Add((Widget)this.vbox_expand);
     Box.BoxChild boxChild5 = (Box.BoxChild) this.hbox_checkBtnExpand[(Widget)this.vbox_expand];
     boxChild5.Position = 0;
     boxChild5.Expand   = false;
     this.hbox_bottom.Add((Widget)this.hbox_checkBtnExpand);
     Box.BoxChild boxChild6 = (Box.BoxChild) this.hbox_bottom[(Widget)this.hbox_checkBtnExpand];
     boxChild6.Position                  = 0;
     boxChild6.Padding                   = 18U;
     this.vbox_btnPreviousBorder         = new VBox();
     this.vbox_btnPreviousBorder.Name    = "vbox_btnPreviousBorder";
     this.vbox_btnPreviousBorder.Spacing = 6;
     this.btn_previous                   = new Button();
     this.btn_previous.WidthRequest      = 80;
     this.btn_previous.HeightRequest     = 35;
     this.btn_previous.CanFocus          = true;
     this.btn_previous.Name              = "btn_previous";
     this.btn_previous.UseUnderline      = true;
     this.btn_previous.Label             = Catalog.GetString("GtkButton");
     this.vbox_btnPreviousBorder.Add((Widget)this.btn_previous);
     Box.BoxChild boxChild7 = (Box.BoxChild) this.vbox_btnPreviousBorder[(Widget)this.btn_previous];
     boxChild7.Position = 0;
     boxChild7.Fill     = false;
     this.hbox_bottom.Add((Widget)this.vbox_btnPreviousBorder);
     Box.BoxChild boxChild8 = (Box.BoxChild) this.hbox_bottom[(Widget)this.vbox_btnPreviousBorder];
     boxChild8.Position              = 1;
     boxChild8.Expand                = false;
     boxChild8.Fill                  = false;
     this.vbox_btnNextBorder         = new VBox();
     this.vbox_btnNextBorder.Name    = "vbox_btnNextBorder";
     this.vbox_btnNextBorder.Spacing = 6;
     this.btn_next = new Button();
     this.btn_next.WidthRequest  = 80;
     this.btn_next.HeightRequest = 35;
     this.btn_next.CanFocus      = true;
     this.btn_next.Name          = "btn_next";
     this.btn_next.UseUnderline  = true;
     this.btn_next.Label         = Catalog.GetString("GtkButton");
     this.vbox_btnNextBorder.Add((Widget)this.btn_next);
     Box.BoxChild boxChild9 = (Box.BoxChild) this.vbox_btnNextBorder[(Widget)this.btn_next];
     boxChild9.Position = 0;
     boxChild9.Expand   = false;
     boxChild9.Fill     = false;
     this.hbox_bottom.Add((Widget)this.vbox_btnNextBorder);
     Box.BoxChild boxChild10 = (Box.BoxChild) this.hbox_bottom[(Widget)this.vbox_btnNextBorder];
     boxChild10.Position    = 2;
     boxChild10.Expand      = false;
     boxChild10.Fill        = false;
     boxChild10.Padding     = 10U;
     this.label_occupy      = new Label();
     this.label_occupy.Name = "label_occupy";
     this.hbox_bottom.Add((Widget)this.label_occupy);
     Box.BoxChild boxChild11 = (Box.BoxChild) this.hbox_bottom[(Widget)this.label_occupy];
     boxChild11.Position = 3;
     boxChild11.Expand   = false;
     boxChild11.Fill     = false;
     boxChild11.Padding  = 10U;
     this.vbox_root.Add((Widget)this.hbox_bottom);
     Box.BoxChild boxChild12 = (Box.BoxChild) this.vbox_root[(Widget)this.hbox_bottom];
     boxChild12.Position = 4;
     boxChild12.Expand   = false;
     boxChild12.Fill     = false;
     boxChild12.Padding  = 10U;
     this.Add((Widget)this.vbox_root);
     if (this.Child != null)
     {
         this.Child.ShowAll();
     }
     this.DefaultWidth  = 738;
     this.DefaultHeight = 615;
     this.Show();
     this.KeyPressEvent        += new KeyPressEventHandler(this.OnKeyDown);
     this.cbtn_show.Toggled    += new EventHandler(this.OnCbtnToggled);
     this.btn_previous.Clicked += new EventHandler(this.OnBtnPreviousClicked);
     this.btn_next.Clicked     += new EventHandler(this.OnBtnNextClicked);
 }
        private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
        {
            if ((AReportAction == TReportActionEnum.raGenerate) &&
                (rbtPartner.Checked && (txtRecipient.Text == "0000000000")))
            {
                TVerificationResult VerificationResult = new TVerificationResult(
                    Catalog.GetString("No recipient selected."),
                    Catalog.GetString("Please select a recipient."),
                    TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationResult);
            }

            if ((AReportAction == TReportActionEnum.raGenerate) &&
                rbtExtract.Checked &&
                (txtExtract.Text == ""))
            {
                TVerificationResult VerificationMessage = new TVerificationResult(
                    Catalog.GetString("Enter an extract name."),
                    Catalog.GetString("No extract name entered!"), TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationMessage);
            }

            if ((AReportAction == TReportActionEnum.raGenerate) &&
                rbtSelectedFields.Checked &&
                (clbFields.GetCheckedStringList().Length == 0))
            {
                TVerificationResult VerificationMessage = new TVerificationResult(
                    Catalog.GetString("Please select at least one field."),
                    Catalog.GetString("No fields selected!"), TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationMessage);
            }

            if ((AReportAction == TReportActionEnum.raGenerate) &&
                rbtSelectedTypes.Checked &&
                (clbTypes.GetCheckedStringList().Length == 0))
            {
                TVerificationResult VerificationMessage = new TVerificationResult(
                    Catalog.GetString("Please select at least one type."),
                    Catalog.GetString("No types selected!"), TResultSeverity.Resv_Critical);
                FPetraUtilsObject.AddVerificationResult(VerificationMessage);
            }

            ACalc.AddParameter("param_recipient_key", txtRecipient.Text);
            ACalc.AddParameter("param_extract_name", txtExtract.Text);

            ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);

            //TODO: Calendar vs Financial Date Handling - Confirm that these should not be ledger dates, i.e. allowing for >12 periods and non-calendar period boundaries
            DateTime FromDateThisYear     = new DateTime(DateTime.Today.Year, 1, 1);
            DateTime ToDatePreviousYear   = new DateTime(DateTime.Today.Year - 1, 12, 31);
            DateTime FromDatePreviousYear = new DateTime(DateTime.Today.Year - 1, 1, 1);

            ACalc.AddParameter("Year0", DateTime.Today.Year);
            ACalc.AddParameter("Year1", DateTime.Today.Year - 1);
            ACalc.AddParameter("Year2", DateTime.Today.Year - 2);
            ACalc.AddParameter("Year3", DateTime.Today.Year - 3);

            ACalc.AddParameter("param_to_date_0", DateTime.Today);
            ACalc.AddParameter("param_from_date_0", FromDateThisYear);
            ACalc.AddParameter("param_to_date_1", ToDatePreviousYear);
            ACalc.AddParameter("param_from_date_1", FromDatePreviousYear);
            ACalc.AddParameter("param_to_date_2", ToDatePreviousYear.AddYears(-1));
            ACalc.AddParameter("param_from_date_2", FromDatePreviousYear.AddYears(-1));
            ACalc.AddParameter("param_to_date_3", ToDatePreviousYear.AddYears(-2));
            ACalc.AddParameter("param_from_date_3", FromDatePreviousYear.AddYears(-2));

            int ColumnCounter = 0;

            ACalc.AddParameter("param_calculation", "PartnerKey", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.5, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "DonorName", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)6.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "DonorClass", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)3.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "Year-0", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "Year-1", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "Year-2", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
            ++ColumnCounter;
            ACalc.AddParameter("param_calculation", "Year-3", ColumnCounter);
            ACalc.AddParameter("ColumnWidth", (float)2.0, ColumnCounter);
            ++ColumnCounter;

            ACalc.SetMaxDisplayColumns(ColumnCounter);
        }
示例#55
0
        private void HandlePintaCoreActionsLayersAddNewLayerActivated(object sender, EventArgs e)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            PintaCore.Tools.Commit();

            UserLayer l = doc.AddNewLayer(string.Empty);

            // Make new layer the current layer
            doc.SetCurrentUserLayer(l);

            AddLayerHistoryItem hist = new AddLayerHistoryItem("Menu.Layers.AddNewLayer.png", Catalog.GetString("Add New Layer"), doc.UserLayers.IndexOf(l));

            doc.History.PushNewItem(hist);
        }
示例#56
0
        internal void LoadInventory()
        {
            floorItems.Clear();
            wallItems.Clear();

            DataTable Data;

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL)
                {
                    dbClient.setQuery("CALL getuseritems(@userid)");
                }
                else
                {
                    dbClient.setQuery("EXECUTE getuseritems @userid");
                }
                dbClient.addParameter("userid", (int)UserId);

                Data = dbClient.getTable();

                //dbClient.setQuery("SELECT item_id, song_id FROM user_items_songs WHERE user_id = " + UserId);
                //dSongs = dbClient.getTable();
            }

            uint   id;
            uint   baseitem;
            string extradata;

            foreach (DataRow Row in Data.Rows)
            {
                id       = Convert.ToUInt32(Row[0]);
                baseitem = Convert.ToUInt32(Row[1]);

                if (!DBNull.Value.Equals(Row[2]))
                {
                    extradata = (string)Row[2];
                }
                else
                {
                    extradata = string.Empty;
                }

                UserItem item = new UserItem(id, baseitem, extradata);

                if (item.GetBaseItem().InteractionType == InteractionType.musicdisc)
                {
                    discs.Add(id, item);
                }
                if (item.isWallItem)
                {
                    wallItems.Add(id, item);
                }
                else
                {
                    floorItems.Add(id, item);
                }
            }

            discs.Clear();

            //uint songItemID;
            //uint songID;
            //foreach (DataRow dRow in dSongs.Rows)
            //{
            //    songItemID = (uint)dRow[0];
            //    songID = (uint)dRow[1];

            //    SongItem song = new SongItem(songItemID, songID);
            //    songs.Add(songItemID, song);
            //}


            this.InventoryPets.Clear();
            DataTable Data2;

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                //dbClient.addParameter("userid", UserId);
                dbClient.setQuery("SELECT id, user_id, room_id, name, type, race, color, expirience, energy, nutrition, respect, createstamp, x, y, z FROM user_pets WHERE user_id = " + UserId + " AND room_id = 0");
                Data2 = dbClient.getTable();
            }

            if (Data2 != null)
            {
                foreach (DataRow Row in Data2.Rows)
                {
                    Pet newPet = Catalog.GeneratePetFromRow(Row);
                    InventoryPets.Add(newPet.PetId, newPet);
                }
            }
        }
示例#57
0
        internal static void SortByYear()
        {
            Console.Clear();

            ConsoleKey selectSortMenu = ConsoleKey.A;

            if (Catalog.IsNotEmpty)
            {
                bool exitSortYear = false;
                List <ItemCatalog> catalogAfterSort = new List <ItemCatalog>();
                var info = string.Empty;

                while (!exitSortYear)
                {
                    Console.Clear();
                    Screen.ShowText(Titles.MenuToSortYear);
                    selectSortMenu = Console.ReadKey().Key;

                    Sorter.Sorting sortByYear = null;

                    switch (selectSortMenu)
                    {
                    case ConsoleKey.D1:
                    case ConsoleKey.NumPad1:

                        sortByYear       = Sorter.SortByYearASC;
                        catalogAfterSort = Sorter.Sort(sortByYear, Catalog.AllItem);

                        exitSortYear = true;
                        break;

                    case ConsoleKey.D2:
                    case ConsoleKey.NumPad2:

                        sortByYear       = Sorter.SortByYearDESC;
                        catalogAfterSort = Sorter.Sort(sortByYear, Catalog.AllItem);

                        exitSortYear = true;
                        break;

                    case ConsoleKey.Q:
                        exitSortYear = true;
                        break;

                    default:
                        break;
                    }
                }

                if (MainMenu.ConditionToAdd(selectSortMenu))
                {
                    Console.Clear();
                    info = Catalog.GetInfoSelectedItem(catalogAfterSort);
                    Screen.ShowText(Titles.ShowCatalog, info, Titles.PressAnyKey);
                }
            }
            else
            {
                Screen.ShowText(Titles.EmptyCatalog);
            }

            if (selectSortMenu != ConsoleKey.Q)
            {
                Console.ReadKey();
            }
        }
        public LevelScore ReadScore(string level)
        {
            var catalog = Catalog.GetItem <GameStorage>();

            return(catalog.Scores[level]);
        }
示例#59
0
        private async Task <Embed> BuildEmbed(Deck deck)
        {
            Catalog homeCatalog = await CatalogService.GetHomeCatalog(deck.Version);

            LorFaction[] regions = deck.Cards
                                   .Where(cc => cc.Card.Region != null)
                                   .GroupBy(cc => cc.Card.Region !)
                                   .OrderByDescending(g => g.Count())
                                   .ThenBy(g => g.Key.Name)
                                   .Select(g => g.Key)
                                   .ToArray();

            var champions = new List <CardAndCount>();
            var followers = new List <CardAndCount>();
            var spells    = new List <CardAndCount>();
            var landmarks = new List <CardAndCount>();
            var other     = new List <CardAndCount>();

            var deckSize           = 0;
            var uncollectibleCount = 0;

            foreach (CardAndCount cc in deck.Cards)
            {
                (ICard card, int count) = cc;
                deckSize += count;
                if (!card.Collectible)
                {
                    uncollectibleCount += count;
                }

                if (!homeCatalog.Cards.TryGetValue(card.Code, out ICard? homeCard))
                {
                    Logger.LogWarning($"Couldn't find card {card.Code} in the home locale catalog. Using the provided deck card with locale {card.Locale} instead.");
                    homeCard = card;
                }

                if (homeCard.Supertype?.Name == "Champion")
                {
                    champions.Add(cc);
                }
                else
                {
                    switch (homeCard.Type?.Name)
                    {
                    case "Unit":
                        followers.Add(cc);
                        break;

                    case "Spell":
                        spells.Add(cc);
                        break;

                    case "Landmark":
                        landmarks.Add(cc);
                        break;

                    default:
                        other.Add(cc);
                        break;
                    }
                }
            }

            bool singleton = deckSize == deck.Cards.Count;

            var cardFieldBuilders = new List <EmbedFieldBuilder>();

            if (champions.Count > 0)
            {
                cardFieldBuilders.AddRange(GetFieldBuilders("Champions", champions, singleton));
            }

            if (followers.Count > 0)
            {
                cardFieldBuilders.AddRange(GetFieldBuilders("Followers", followers, singleton));
            }

            if (spells.Count > 0)
            {
                cardFieldBuilders.AddRange(GetFieldBuilders("Spells", spells, singleton));
            }

            if (landmarks.Count > 0)
            {
                cardFieldBuilders.AddRange(GetFieldBuilders("Landmarks", landmarks, singleton));
            }

            if (other.Count > 0)
            {
                cardFieldBuilders.AddRange(GetFieldBuilders("Other", other, singleton));
            }

            var regionsBuilder = new StringBuilder();

            foreach (LorFaction region in regions)
            {
                if (Settings.RegionIconEmotes.TryGetValue(region.Key, out ulong emote))
                {
                    regionsBuilder.AppendLine($"<:{region.Abbreviation}:{emote}> **{region.Name}**");
                }
            }

            var noticesBuilder = new StringBuilder();

            if (deckSize < 40)
            {
                noticesBuilder.AppendLine($"⚠️ Invalid constructed deck: too few cards ({deckSize}).");
            }
            else if (deckSize > 40)
            {
                noticesBuilder.AppendLine($"⚠️ Invalid constructed deck: too many cards ({deckSize}).");
            }

            if (uncollectibleCount > 0)
            {
                string copies = uncollectibleCount == 1 ? "copy" : "copies";
                noticesBuilder.AppendLine($"⚠️ Invalid deck: has {uncollectibleCount} uncollectible card {copies}.");
            }

            if (singleton)
            {
                noticesBuilder.AppendLine("ℹ️ Singleton deck.");
            }

            string desc;

            if (regionsBuilder.Length > 0)
            {
                desc = noticesBuilder.Length > 0 ? $"{regionsBuilder}\n{noticesBuilder}" : $"{regionsBuilder}";
            }
            else
            {
                desc = noticesBuilder.Length > 0 ? $"{noticesBuilder}" : "";
            }

            return(new EmbedBuilder()
                   .WithDescription(desc)
                   .WithFields(cardFieldBuilders)
                   .Build());
        }
示例#60
0
 public IndexBasedConstraintReaderState(Catalog catalog) : this()
 {
     Catalog         = catalog;
     Columns         = new List <TableColumn>();
     LastColumnIndex = -1;
 }