public StartWindowViewModel() { OpenTableNumberCommand = new CustomCommand(OpenTableNumber, CanOpenTableNumber); ShowMenuCategoriesCommand = new CustomCommand(ShowMenuCategories, CanShowMenuCategories); PrintReceiptCommand = new CustomCommand(PrintReceipt, CanPrintReceipt); OpenOptionsStartersCommand = new CustomCommand(OpenOptionsStarters, CanOptionsOpenStarters); OpenOptionsMainsCommand = new CustomCommand(OpenOptionsMains, CanOpenOptionsMains); OpenOptionsDessertsCommand = new CustomCommand(OpenOptionsDesserts, CanOpenOptionsDesserts); OpenOptionsDrinksCommand = new CustomCommand(OpenOptionsDrinks, CanOpenOptionsDrinks); receiptService = new ReceiptService(); getMoneyService = new GetMoneyService(); options = new Options(); dataHandling = new DataHandling(); TableList = StartUp(@"C:\Users\Public\Documents\NumberOfTables.txt"); IsAddOrderButtonEnabled = "False"; IsPrintButtonEnabled = "False"; SendNumberOfTablesMessenger.Default.Register <int>(this, OnReceiveTableNumber); RequestTableNumberCloseMessenger.Default.Register <Object>(this, OnReceiveTableNumberClose); OpenMenuItemsViewMessenger.Default.Register <Object>(this, OnReceiveOpenMenuItems); AddSelectedItemMessenger.Default.Register <MenuItemModel>(this, OnReceiveMenuItem); ReturnToMenuCategoriesMessenger.Default.Register <Object>(this, OnReceiveReturnToCategories); RequestMenuItemsCloseMessenger.Default.Register <Object>(this, OnReceiveMenuItemsClose); RequestGetMoneyCloseMessenger.Default.Register <Object>(this, OnReceiveGetMoneyClose); RequestReceiptCloseMessenger.Default.Register <Object>(this, OnReceiveReceiptClose); UpdateSelectedTableAfterRemoveOrderMessenger.Default.Register <TableModel>(this, OnReceiveUpdateSelectedTable); }
static void Main(string[] args) { /* * This program primarily demonstrates how to wrap and calibrate a model written * in a native language. While technological aspects of what it demonstrates * are not inherently limited nor specific to optimisation, this is * a use case often encountered (e.g. to calibrate existing models written in * C++ , C, or Fortran) */ IClonableObjectiveEvaluator <IHyperCube <double> > evaluator; IEvolutionEngine <IHyperCube <double> > uniformRandomSampling; NativeModelWrapper.AwbmWrapper.PermitMultiThreading = true; using (var simulation = new AwbmWrapper()) { var data = DataHandling.GetSampleClimate(); SimulationFactory.SetSampleSimulation(simulation, data); int from = simulation.GetStart(); int to = simulation.GetEnd(); evaluator = AWBM_URS.MainClass.BuildUrsEvaluator(simulation, data.Runoff, from, to); var paramSpace = AWBM_URS.MainClass.CreateFeasibleAwbmParameterSpace(simulation); uniformRandomSampling = new UniformRandomSampling <IHyperCube <double> >(evaluator, new BasicRngFactory(0), paramSpace, 3000); var ursResults = uniformRandomSampling.Evolve(); Console.WriteLine(MetaheuristicsHelper.GetHumanReadable(ursResults)); } }
public Oscilloscope() { InitializeComponent(); //初始化元件 InitializeContext(); //初始化关系 dataHandling = new DataHandling(); dataHandling.PropertyChanged += new PropertyChangedEventHandler(UsbState_PropertyChanged); }
static void Main(string[] args) { Board board = new Board(10); board.SetupLiveNeighbors(board); board.CalculateLiveNeighbors(board); DataHandling dh = new DataHandling(); /* List<PlayerStats> myList = new List<PlayerStats>(); * * myList.Add(new PlayerStats("Frank", 2, 5)); * myList.Add(new PlayerStats("Tom", 1, 8)); * myList.Add(new PlayerStats("Luke", 3, 7)); * myList.Add(new PlayerStats("Nick", 3, 4)); * myList.Add(new PlayerStats("John", 2, 2)); * myList.Add(new PlayerStats("Mary", 2, 9)); * * myList.Sort(); * * dh.WriteToJSON(myList);*/ List <PlayerStats> test2 = new List <PlayerStats>(); string fileName = @"C:\Users\Raymond\Source\Repos\homefront16\Milestone1\MinesweeperGUI2\Data\PlayerStats.json"; test2 = dh.ReadJSONFile(fileName); foreach (PlayerStats playerStat in test2) { Console.WriteLine(playerStat.Name); } /* * A while loop runs as long as the game is not over. Hitting * a mine will end the game along with finding all the non-mine squares * and making them visible. User attempts a valid row and column. If a game * ending move is not played than the board will be printed showing the updated * visible square and the while loop will continue until the game ends. */ /*while(!board.GetGameOver()) * { * * Cell attemptedSquare = board.UserCheckSquare(board); * * board.FloodFill(attemptedSquare.GetRow(attemptedSquare), attemptedSquare.GetColumn(attemptedSquare)); * * if (attemptedSquare.IsCellLive(attemptedSquare)) * { * Console.WriteLine("You Hit a Mine! GAME OVER..."); * board.SetGameOver(board); * } * * if (board.CheckVisitedSquaresLeft(board)) * { * Console.WriteLine("There are no squares left. You Won!!!!!!"); * board.SetGameOver(board); * } * * PrintBoardDuringGame(board); * * }*/ }
// Update is called once per frame void Update() { if (Enemy == null) { foreach (UITarget enemy in DataHandling.forIdentifing) { if (enemy.classIdentifier == Identifier) { enemy.isActive = false; } } DataHandling.UIMarkersRelist(); Destroy(gameObject); } OnCameraPosition = cam.WorldToViewportPoint(Enemy.transform.position); Vector3 OnCanvasPosition = new Vector3(OnCameraPosition.x, OnCameraPosition.y, 0); if (OnCameraPosition.z >= 0 && OnCameraPosition.x >= 0 && OnCameraPosition.x <= 1 && OnCameraPosition.y >= 0 && OnCameraPosition.y <= 1) { currentMarker.sprite = currentUISprite; currentRectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, OnCanvasPosition.x * Canvasx - 25, 50); currentRectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, OnCanvasPosition.y * Canvasy - 25, 50); currentRectTransform.localEulerAngles = new Vector3(0, 0, 0); } else { currentMarker.sprite = emptyUISprite; } }
public void endGame(int[] shipCounts, Player player, Window window) { swapPlayer(ref player, _gameType); if (!shipCounts.Contains(1)) { string name = (string)Application.Current.Properties["playerName"]; string numberOfRounds = rounds.ToString(); string win; if (player == Player.FirstPlayer) { win = "win"; } else { win = "defeat"; } Result result = new Result(name, numberOfRounds, win); DataHandling dataHandling = new DataHandling(); dataHandling.AddResultToJson(result); Ranking ranking = new Ranking(); ranking.Show(); window.Close(); //Remove -> navigate to scoreboard string winSentance = $"{player} is the winner"; MessageBox.Show(winSentance); } }
public static void Main(string[] args) { /* * The context of this tutorial is that you have an existing time stepping simulation * model. */ IClonableObjectiveEvaluator <IHyperCube <double> > evaluator; IEvolutionEngine <IHyperCube <double> > uniformRandomSampling; var simulation = SimulationFactory.CreateAwbmSimulation(); var data = DataHandling.GetSampleClimate(); SimulationFactory.SetSampleSimulation(simulation, data); int from = simulation.GetStart(); int to = simulation.GetEnd(); evaluator = BuildUrsEvaluator(simulation, data.Runoff, from, to); var paramSpace = CreateFeasibleAwbmParameterSpace(simulation); uniformRandomSampling = new UniformRandomSampling <IHyperCube <double> >(evaluator, new BasicRngFactory(0), paramSpace, 3000); var ursResults = uniformRandomSampling.Evolve(); Console.WriteLine(MetaheuristicsHelper.GetHumanReadable(ursResults)); }
public MainWindow() { InitializeComponent(); ListBox_Signal.ItemsSource = ChannelManager.Channels; dataHandling = new DataHandling(); dataHandling.PropertyChanged += new PropertyChangedEventHandler(UsbState_PropertyChanged); this.InitTool(); }
private void GetHighscores() { _mostWins = (short)DataHandling.ReadData(DataHandling.MOSTWINS); _mostWinsName = (string)DataHandling.ReadData(DataHandling.MOSTWINSNAME); //Console.WriteLine("MOST WINS: " + _mostWins + " by " + _mostWinsName); _fastestTimes = (long[])DataHandling.ReadData(DataHandling.BESTTIMES); _fastestTimesNames = (string[])DataHandling.ReadData(DataHandling.BESTTIMESNAMES); }
// Use this for initialization void Start() { dataList = DataHandling.GetList(); for (int i = 0; i < 20; i++) { levelButtons[i].enabled = dataList[i].unlockCheck(); locks = levelButtons[i].GetComponentsInChildren <Image>(); locks[1].enabled = !dataList[i].unlockCheck(); } }
/// <summary> /// A no argument constructor /// </summary> public AddContactViewModel() { InitializeNewContact(); dataHandling = new DataHandling(); openFileDialog = new OpenFileDialog(); AddImageCommand = new CustomCommand(AddImage, CanAddImage); AddContactCommand = new CustomCommand(AddContact, CanAddContact); CancelCommand = new CustomCommand(Cancel, CanCancel); }
public void Completed() { if (IsCrashed) { return; } IsComplete = true; FinishLine.enabled = true; Time.timeScale = 0.0f; DataHandling.Complete(Application.loadedLevel - 3); }
public List <ProductDetail> ProductsInStore() { DataHandling dataHandling = new DataHandling(); List <ProductDetail> StoreProducts = dataHandling.productRetrieval(); foreach (ProductDetail productsFromStore in StoreProducts) { details.Add(productsFromStore); } return(StoreProducts); }
public ManageMenuViewModel() { AddNewMenuItemCommand = new CustomCommand(AddNewMenuItem, CanAddNewMenuItem); RemoveMenuItemCommand = new CustomCommand(RemoveMenuItem, CanRemoveMenuItem); UpdateMenuItemCommand = new CustomCommand(UpdateMenuItem, CanUpdateMenuItem); dataHandling = new DataHandling(); IsRemoveButtonEnabled = "False"; IsUpdateButtonEnabled = "False"; ToBeUpdated = false; SendMenuCategoryItemsToOptions.Default.Register <string>(this, OnReceiveMenuItems); }
public MenuItemsViewModel() { dataHandling = new DataHandling(); AddSelectedItemCommand = new CustomCommand(AddSelectedItem, CanAddSelectedItem); ReturnButtonCommand = new CustomCommand(Return, CanReturn); CloseMenuItemsCommand = new CustomCommand(CloseMenuItems, CanCloseMenuItems); OpenStartersMessenger.Default.Register <Object>(this, OnReceiveOpenStarters); OpenMainsMessenger.Default.Register <Object>(this, OnReceiveOpenMains); OpenDessertsMessenger.Default.Register <Object>(this, OnReceiveOpenDesserts); OpenDrinksMessenger.Default.Register <Object>(this, OnReceiveOpenDrinks); }
protected void Page_Load (object sender, EventArgs e) { InternetSecurityFunctions.RunRequestStarupSecurity(Request, Session, ref LogicalUserName, ref LogicalRollen); Dh = new DataHandling(); //Dh.DataBase.DefaultConnectionStringName = "WPMediaAddOnDataConnectionString"; if (Request.QueryString ["Search"] != null) { ProcessTreeSearchEntered (); return; } if (!IsPostBack) ShowSelectionTree (); // ShowCalendarFrame (DateTime.Now); }
void Update() { DataHandling.CheckMissile(); speedTextMesh.text = "Speed:" + playerMovement.CurrentSpeed; hpTextMesh.text = "Hp:" + playerDamage.currentHp; missileTextMesh.text = "Missiles:" + missileStatus.missileAmount; if (DataHandling.IsChasedByMissile) { missileWarningTextMesh.text = "WARNING"; } else { missileWarningTextMesh.text = ""; } }
/// <summary> /// If the CanUpdateContact() return true it will update the database /// </summary> /// <param name="obj"></param> private void UpdateContact(object obj) { if (string.IsNullOrEmpty(ContactDetails.FirstName) || string.IsNullOrWhiteSpace(ContactDetails.FirstName)) { MessageBox.Show("Please type in a First Name!"); } else { dataHandling = new DataHandling(); dataHandling.UpdateContact(ContactDetails); UpdateListMessenger.Default.Send <Object>(new object()); CloseContactDetailDialogMessenger.Default.Send <Object>(new object()); } }
/// <summary> /// A basic no argument constructor /// </summary> public MainContactListViewModel() { dataHandling = new DataHandling(); DeleteContactCommand = new CustomCommand(DeleteContact, CanDeleteContact); AddNewContactCommand = new CustomCommand(AddNewContact, CanAddNewContact); ContactDetailsCommand = new CustomCommand(OpenDetail, CanOpenDetail); SearchCommand = new CustomCommand(Search, CanSearch); ButtonReset(); FillUpContactDetailsForComboBox(); LoadContactList(); CloseAddContactDialogMessenger.Default.Register <Object>(this, OnCloseAddContactDialogReceived); CloseContactDetailDialogMessenger.Default.Register <Object>(this, OnCloseContactDetailDialogReceived); UpdateListMessenger.Default.Register <Object>(this, OnUpdateListReceived); }
/// <summary> /// This method reads a json file. That file is deserialized in to a list of /// PlayerStat objects. Those objects are sorted to the top 5 scores via a /// LINQ query. The display data can be changed with other LINQ querys if requested. /// </summary> /// <param name="obj"></param> private void InsertStatistics(object obj) { _dataHandling = new DataHandling(); string fileName = @"C:\Users\Raymond\Source\Repos\homefront16\Milestone1\MinesweeperGUI2\Data\PlayerStats.json"; _playerStats = new List <PlayerStats>(); _playerStats = _dataHandling.ReadJSONFile(fileName); // Deserializing file in to list of PlayerStats objects var topFivePlayers = (from playerStat in _playerStats orderby playerStat.Score descending select playerStat).Take(5); // LINQ query for TOP 5 Scores. foreach (PlayerStats playerStat in topFivePlayers) { playerStatisticsList.Add(playerStat); // Adding to display list of PlayerStats objects. } }
/// <summary> /// Manages all incoming data from the connection. /// When new data arrives a new DataHandling instance is created. /// </summary> void HandleConnection() { Closed = false; try { while (!closing) { byte[] bytes = new byte[1024]; int a = handler.Receive(bytes); string data = Encoding.UTF8.GetString(bytes, 0, a); int handled = -1; if (data != "") { handled = 0; if (!closing) { handled = 1; totalThreads++; DataHandling dataHandle = new DataHandling(data, this, closing); } } if (handled == 0) { unhandledData++; } } } catch (Exception e) { if (handler != null) { Console.WriteLine(e.Message); } } Closed = true; }
void Move() { if (Mathf.Abs(transform.position.x) > 60 + Mathf.Abs(transform.localScale.x)) { transform.position = new Vector2(transform.position.x * -1, transform.position.y); } if (Mathf.Abs(transform.position.y) > 60 + Mathf.Abs(transform.localScale.y)) { transform.position = new Vector2(transform.position.x, transform.position.y * -1); } if (exploring == null) { exploring = StartCoroutine(Exploration()); } if (!targeting) { moveDirection = FindTargetDirection(); } transform.Translate(moveDirection * traits.movementSpeed * Time.deltaTime, Space.World); lookAngle = 90 - Mathf.Atan2(moveDirection.y, moveDirection.x * -1) * Mathf.Rad2Deg; transform.eulerAngles = Vector3.forward * lookAngle; //Deactivated code for testing energy cost per second //accumulatedCost += DetermineEnergyCost(); //if (previousSecond + 1 < Time.timeSinceLevelLoad) //{ // print(accumulatedCost); // accumulatedCost = 0; // previousSecond = Time.timeSinceLevelLoad; //} energy -= DetermineEnergyCost() * Time.deltaTime / 5; if (energy <= 0) { DataHandling.RemoveCreature(traits.creatureID); Destroy(gameObject); } }
private DataMap SetupForTableBuild(String TableName, Headers headers) { DataTable table = new DataTable(); table.TableName = TableName; DataMap map = new DataMap() { Name = TableName, Table = table, Headers = headers }; IDataHandling cb = new DataHandling(); // Create Columns foreach (Header heading in headers.HeaderList) { table.Columns.Add(cb.BuildTableColumn(heading.DisplayName)); } return(map); }
private void Start() { targeting = false; transform.localScale = Vector2.one * traits.size; if (traits.isMale) { transform.GetChild(0).gameObject.GetComponent <Renderer>().material = maleMat; gameObject.tag = "Male"; Color col = Color.Lerp(Color.white, Color.red, traits.maledesirability); transform.GetChild(0).GetComponent <Renderer>().material.color = col; } else { transform.GetChild(0).gameObject.GetComponent <Renderer>().material = femaleMat; gameObject.tag = "Female"; } energy = startingEnergy; offSpringStartingEnergy = 0; traits.creatureID = DataHandling.GiveID(); DataHandling.creatureData.Add(traits); transform.GetChild(0).GetChild(0).GetComponent <Renderer>().material.color = new Color(traits.rCol, traits.gCol, traits.bCol); }
void PerformShowProgramm (String SenderNameID) { Dh = new DataHandling (); //XmlDocument XmlSchema = Dh.GetSenderProgrammDescription (SenderNameID); Label HeadLineLabel = new Label (); this.LinkToVideosContentPlace.Controls.Add (HeadLineLabel); String SenderName = Dh.GetXSenderName (); String SenderEMail = Dh.GetXSenderEMail (); String SenderHomePage = Dh.GetXSenderHomePage (); String SenderImmediateRemark = Dh.GetXSenderImmediateRemark (); String SenderHomePageEntry = "<a href=\"" + SenderHomePage + "\">zur " + SenderName + " Homepage - </a>"; String SenderImmediateRemarkElement = ""; if (SenderImmediateRemark != "") { SenderImmediateRemarkElement = "<p align=\"center\"><b><font size=\"2\" color=\"#0080C0\">" + SenderImmediateRemark + "</font></b></p>\r\n"; } String AktualisierungsZeit = "<font size=\"1\" color=\"#0080C0\"> (per " + DateTime.Now.ToShortDateString () + " " + DateTime.Now.ToShortTimeString () + ")</font>"; String HeadLine = "Das aktuelle " + SenderName + "-Programm"; String WPTVeMail = "<a href=\"mailto:" + SenderEMail + "\">eMail an " + SenderName + "</a>"; HeadLineLabel.Text = "<a Name=\"TopPosition\"> </a>\r\n" + "<p align=\"center\"><b><font size=\"4\" color=\"#0080C0\">" + HeadLine + "</font>" + AktualisierungsZeit + "</b></p>\r\n" + "<p align=\"center\"><b><font size=\"2\" >" + SenderHomePageEntry + WPTVeMail + "</font> </b></p>\r\n" + SenderImmediateRemarkElement + CVM.CommonValues.ORDER_MESSAGE; HeadLineLabel.Width = Unit.Percentage (99); CreateBeitraege Formatieren = new CreateBeitraege (); Formatieren.SetData (this.LinkToVideosContentPlace, Dh); }
public void ClearGameData() { bs(); DataHandling.GameReset(); Settings.ResetSettings(); }
private void SetHighscores() { DataHandling.SaveData(_mostWins, _mostWinsName); DataHandling.SaveData(_fastestTimes, _fastestTimesNames); }
/// <summary> /// This method handles the a left mouse click by the User on a button. /// It contains the game play logic. The stopwatch is started. The Floodfill method is called to /// set the value of Visted to true for cells that have 0 neighboring mines and were next to the clicked /// button. The IsCellLive method is then called to see if a user clicked on a mine (if they did a mine will be displayed /// and the game is over. The CheckVistedSquaresLeft method is called to see if there are any cells left that have not been /// visted. If the user finds all squares without a mine the user wins and is shown all mine locations with a flag showing. /// Lastly, the ShowLiveNeighbors method is called to display the number of neighboring mines next to the recently revealed Cells. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { // Starts the dispatch and stopwatch if time hasn't already started. if (!Stopwatch.IsRunning) { dispatchTime.Start(); Stopwatch.Start(); } var btn = (Button)sender; var cell = btn.DataContext as Cell; //Binds the clicked button to a Cell Cell attemptedSquare = cell; //Floodfill method called recursively to show all squares without neighboring mines. _board.FloodFillUpgraded(_board, attemptedSquare.GetRow(attemptedSquare), attemptedSquare.GetColumn(attemptedSquare)); //Checks to see if the user clicked on a mine. If they do click on a mine than a mine will be shown if (attemptedSquare.IsCellLive(attemptedSquare)) { btn.Content = new Image { Source = new BitmapImage(new Uri("C:\\Users\\Raymond\\Source\\Repos\\homefront16\\Milestone1\\MinesweeperGUI2\\Pictures\\mine.jpg")), VerticalAlignment = VerticalAlignment.Center }; dispatchTime.Stop(); Stopwatch.Stop(); MessageBox.Show("You Lost!" + TimeElapsed + " seconds"); } //Checks if there are any squares left for the user to click on that are not mines. User wins if they find all squares without mines. if (_board.CheckVisitedSquaresLeft(_board)) { foreach (var button in ButtonCells) { var cellHolder = button.DataContext as Cell; // cellHolder.SetCellToVisited(cellHolder); if (cellHolder.IsCellLive(cellHolder)) { button.Content = new Image { Source = new BitmapImage(new Uri("C:\\Users\\Raymond\\Source\\Repos\\homefront16\\Milestone1\\MinesweeperGUI2\\Pictures\\flag.jpg")), VerticalAlignment = VerticalAlignment.Center }; } } dispatchTime.Stop(); Stopwatch.Stop(); MessageBox.Show("You Won in " + TimeElapsed + " seconds"); /* After the game is over and a player wins. There name, score, time, and difficulty are stored. * A PlayerStats object is instanitated and then added to a list of PlayerStats objects. This list * is then written to a JSON file. The json file is the file read by the PlayerStatistics View Model. */ _dataHandling = new DataHandling(); _playerStats = new List <PlayerStats>(); string fileName = @"C:\Users\Raymond\Source\Repos\homefront16\Milestone1\MinesweeperGUI2\Data\PlayerStats.json"; _playerStats = _dataHandling.ReadJSONFile(fileName); // File is read and deserialized so that the list is always up to date. _playerStat = new PlayerStats { Difficulty = GameLevel, Time = Int32.Parse(Stopwatch.ElapsedMilliseconds.ToString()) / 100 }; _playerStat.Score = _playerStat.Time / _playerStat.Difficulty; _playerStat.Name = Name; _playerStats.Add(_playerStat); // Instantiated PlayerStats object added to the _PlyaerStats list _dataHandling.WriteToJSON(_playerStats); //List written to a JSON file. } btn.Background = Brushes.Gray; // Setting the clicked buttons background as grey symbolized visted square. foreach (var button in ButtonCells) { var cell2 = button.DataContext as Cell; if (cell2.GetCellVisited(cell2)) { button.Background = Brushes.Gray; // all visited squares set to a grey background. } } ShowLiveNeighbors(btn); }
/// <summary> /// 补打运单 /// </summary> /// <param name="gr"></param> /// <param name="S"></param> /// <returns></returns> private Model.GeneralReturns SupplementPrint(Model.GeneralReturns gr, Model.M_Print.Request S) { if (String.IsNullOrEmpty(S.operateMan) || String.IsNullOrEmpty(S.operateSite)) { gr.MsgText = "缺少操作人或站点"; gr.State = false; return(gr); } pmw_billcode billcodeInfo = new DAL.Dal_Print().SupplementGetBillCodeInfo(S.repair); if (billcodeInfo == null || string.IsNullOrEmpty(billcodeInfo.packed_billcode)) { gr.MsgText = "无法获取快递单信息"; return(gr); } List <Model.M_Print.Return> reqList = new List <Model.M_Print.Return>(); pmw_order orderInfo = new DAL.Dal_Print().SupplementGetOrderInfo(billcodeInfo.order_code); if (orderInfo == null) { gr.MsgText = "无法获取订单信息"; return(gr); } CFHMPring pringInfo = new DAL.Dal_Print().SupplementGetPrintInfo(billcodeInfo.packed_billcode); if (pringInfo == null) { gr.MsgText = "无法获取打印信息"; return(gr); } pmw_timeBar flightInfo = new DAL.Dal_Print().getFlightTime(orderInfo.timeBarID); if (flightInfo == null) { gr.MsgText = "无法获取航班信息"; return(gr); } GoodsCatalog goodsInfo = new DAL.Dal_Print().getGoodsTypeInfo(orderInfo.goodsType); if (goodsInfo == null) { gr.MsgText = "无法获取货物类型"; return(gr); } string SignerCode = string.Empty, VersionCode = string.Empty, addressCode = string.Empty; secondEJSPushData(pringInfo.deliveryCom, pringInfo.recipientsAdd, out SignerCode, out VersionCode, out addressCode); reqList.Add(new Model.M_Print.Return { WaybillNo = pringInfo.CForHM_number, billcode = pringInfo.KD_billcodeList, employee = S.operateMan, Js_number = (int)pringInfo.TurnNumber, briefCode = goodsInfo.briefCode, goodsType = billcodeInfo.goodsTyep, goodsName = pringInfo.goods, shopName = pringInfo.consolidator, OrderGoodsNotes = orderInfo.OrderGoodsNotes, CusCode = pringInfo.deliveryCode, timeBarName = flightInfo.timeBarName, orderID = orderInfo.id.ToString(), z_weight = pringInfo.netWeight.ToString(), address = pringInfo.recipientsAdd, Phone = pringInfo.recipientsPhone, recipients = pringInfo.recipients, IdentificationGoods = billcodeInfo.goodsTyep.Contains("特") ? "T" : "", ds_mdgj_Free = orderInfo.pay_type == 1 ? pringInfo.freightPayable.ToString() : "0", DFFeer = pringInfo.freightPayable.ToString(), addressCode = addressCode, SignerCode = SignerCode, VersionCode = VersionCode, chargedWeight = orderInfo.Free_Weight.ToString() }); if (reqList.Count > 0) { gr.ReturnJson = DataHandling.ObjToJson(reqList); gr.State = true; gr.Mb = pringInfo.deliveryCom; gr.MsgText = S.operateMan; } else { gr.MsgText = "无法获取打印信息"; } return(gr); }
public void SetData (System.Web.UI.WebControls.PlaceHolder Anchor, DataHandling DhExisting, int NumberOfDisplayableEntries) { m_Anchor = Anchor; m_Dh = DhExisting; m_NumberOfDisplayableEntries = NumberOfDisplayableEntries; }
void CreateSelectionTree (DataHandling Dh) { DataTable ZuordnungenUndDerenHaeufigkeit = Dh.GetZuordnungenUndDerenHaeufigkeit (); Label SelectedIs = new Label (); SelectedIs.CssClass = "CSS_SelectionLabel"; SelectedIs.Text = Session ["Selection"].ToString (); this.SelectionContentPlace.Controls.Add (SelectedIs); Label DateFromLabel = new Label (); DateFromLabel.CssClass = "CSS_SelectionLabel"; String Von = Session ["PrimaryFromDate"].ToString ().Substring (0, 10); if (Von == "01.01.0001") Von = "Beginn an"; DateFromLabel.Text = "<br>Zeit von: " + Von; this.SelectionContentPlace.Controls.Add (DateFromLabel); Label DateToLabel = new Label (); DateToLabel.CssClass = "CSS_SelectionLabel"; DateToLabel.Text = "<br>Zeit bis: " + Session ["PrimaryToDate"].ToString ().Substring (0, 10); this.SelectionContentPlace.Controls.Add (DateToLabel); TreeView AuswahlTree = new TreeView (); AuswahlTree.CssClass = "CSS_AuswahlTree"; this.SelectionContentPlace.Controls.Add (AuswahlTree); foreach (DataRow Entry in ZuordnungenUndDerenHaeufigkeit.Rows) { TreeNode Node = new TreeNode (Entry ["Name"].ToString () + " (" + Convert.ToString (Entry ["AnzahlDerEintraege"]) + ")", "", "", "Default.aspx?Selection=" + Entry ["Name"].ToString (), "_self"); AuswahlTree.Nodes.Add (Node); } AuswahlTree.Nodes.Add (new TreeNode ("Alle", "", "", "Default.aspx?Selection=All", "_self")); }
int CreateVideoPlusBackGroundProgrammGenerationEntry (String BackGroundID, Table MaterialTable) { Dh = new DataHandling (); if (!Dh.SetBeitrag (BackGroundID)) { Label MessageLabel = new Label (); this.LinkToVideosContentPlace.Controls.Add (MessageLabel); MessageLabel.Text = "Für die mitgegebene BackGroundBeitragsID war kein Beitrag zu finden\r\n" + Dh.GetErrorMessage (); MessageLabel.Width = Unit.Percentage (99); return 0; } DataTable MaterialDataTable = Dh.GetMaterialDataTable (); DataTable MaterialTypeDataTable = Dh.GetMaterialTypeDataTable (); DataView MaterialTypenDataView = new DataView (MaterialTypeDataTable, "ShowInInternetOrder > '00'", "ShowInInternetOrder", DataViewRowState.CurrentRows); TableRow MaterialTableRow = new TableRow (); MaterialTableRow.CssClass = "CSS_MaterialRow"; MaterialTable.Controls.Add (MaterialTableRow); DataTable VideoFiles = Dh.GetFileDataTable (); int NumberOfPresentedRows = 0; int MaterialIndex = 0; foreach (DataRow VideoFile in VideoFiles.Rows) { NumberOfPresentedRows += FillTheFileEntries (Dh, VideoFile, MaterialTypenDataView, MaterialDataTable, MaterialTable, MaterialIndex, VideoFiles.Rows.Count, ""); MaterialIndex++; } return NumberOfPresentedRows; }
List<String> GetStandBildIndizessFiles (DataHandling Dh, WPMediaStandbildPlayingData StandBildPlayingData) { List<String> Names = WMB.Basics.GetFilesFromDirectory (WMB.Basics.GetRemoteWPMediaRoot () + "\\WPMediaFinalInternetSource\\" + StandBildPlayingData.TableName, new string[ ] {"*StandBildArchiv*.xml"}, 1); Names.Sort (); return Names; }
int FillTheFileEntries(DataHandling Dh, DataRow VideoFile, DataView MaterialTypenDataView, DataTable MaterialDataTable, Table MaterialTable, int MaterialIndex, int NumberOfVideoFiles, String BackGroundID) { int NumberOfPresentedFiles = 0; int TypenIndex = 0; while (TypenIndex < MaterialTypenDataView.Count) { DataRow TypenRow = MaterialTypenDataView[TypenIndex].Row; TypenIndex++; String TechnicalTyp = TypenRow["TechnicalTyp"].ToString(); DataRow[] ShowAbleFiles = MaterialDataTable.Select ("FileID = '" + VideoFile ["FileID"].ToString () + "' and TechnicalTyp = '" + TechnicalTyp + "'"); if (ShowAbleFiles.Length == 0) { continue; } NumberOfPresentedFiles++; } if (NumberOfPresentedFiles == 0) return NumberOfPresentedFiles; TypenIndex = 0; while (TypenIndex < MaterialTypenDataView.Count) { DataRow TypenRow = MaterialTypenDataView[TypenIndex].Row; TypenIndex++; String TechnicalTyp = TypenRow["TechnicalTyp"].ToString(); DataRow[] ShowAbleFiles = MaterialDataTable.Select ("FileID = '" + VideoFile["FileID"].ToString() + "' and TechnicalTyp = '" + TechnicalTyp + "'"); if (ShowAbleFiles.Length == 0) { continue; } if ((TechnicalTyp == "SCALAGeneration") || (TechnicalTyp == "BilderGalerie")) { //CreateSCALAGenerationEntry (ShowAbleFiles, MaterialTable.Controls); CreateExternesProgrammGenerationEntry (ShowAbleFiles, MaterialTable.Controls); continue; } if (TechnicalTyp == "ExternesProgramm") { CreateExternesProgrammGenerationEntry (ShowAbleFiles, MaterialTable.Controls); continue; } TableRow MaterialRow = new TableRow (); MaterialRow.CssClass = "CSS_MaterialRow"; MaterialTable.Controls.Add(MaterialRow); if (TypenIndex == 1) { TableCell FileNameCell = new TableCell(); FileNameCell.CssClass = "CSS_FileNameCell"; MaterialRow.Controls.Add(FileNameCell); if (NumberOfVideoFiles == 1) FileNameCell.Text = "Das Video in folgenden Qualitäten"; else { FileNameCell.Text = "Das Video - Teil " + Convert.ToString(MaterialIndex + 1) + " in folgenden Qualitäten"; } FileNameCell.RowSpan = NumberOfPresentedFiles; } TableCell MaterialFormatCell = new TableCell(); MaterialFormatCell.CssClass = "CSS_MaterialFormatCell"; MaterialRow.Controls.Add(MaterialFormatCell); if (String.Compare(TypenRow ["StorageFormat"].ToString (), "*.wmv", true) == 0) { Image WindowsMediaPlayer = new Image(); WindowsMediaPlayer.ImageUrl = "WMV_Logo.png"; WindowsMediaPlayer.ToolTip = TypenRow ["TechnicalDescription"].ToString (); MaterialFormatCell.Controls.Add(WindowsMediaPlayer); } else { MaterialFormatCell.Text = TypenRow["StorageFormat"].ToString(); } TableCell MaterialNameCell = new TableCell(); MaterialNameCell.CssClass = "CSS_MaterialNameCell"; MaterialRow.Controls.Add(MaterialNameCell); MaterialNameCell.Text = "<a href=\"" + Request.Url + "&BeitragQuality=" + TechnicalTyp + "&FileIndex=" + Convert.ToString(MaterialIndex) + "\" target=\"_self\">" + TypenRow ["ReadableDescription"].ToString () + "</a>"; MaterialNameCell.ToolTip = TypenRow["TechnicalDescription"].ToString(); TableCell MaterialQualityCell = new TableCell(); MaterialQualityCell.CssClass = "CSS_MaterialQualityCell"; MaterialRow.Controls.Add(MaterialQualityCell); MaterialQualityCell.Text = TechnicalTyp; TableCell MaterialSizeCell = new TableCell(); MaterialSizeCell.CssClass = "CSS_MaterialSizeCell"; MaterialRow.Controls.Add(MaterialSizeCell); MaterialSizeCell.Text = ShowAbleFiles [0] ["FileSizeInkB"].ToString () + "kB"; } if (String.IsNullOrEmpty (BackGroundID) == false) { NumberOfPresentedFiles += CreateVideoPlusBackGroundProgrammGenerationEntry (BackGroundID, MaterialTable); } return NumberOfPresentedFiles; }
void PerformBeitragSelected (String BeitragID) { Dh = new DataHandling (); if (!Dh.SetBeitrag (BeitragID)) { Label MessageLabel = new Label (); this.LinkToVideosContentPlace.Controls.Add (MessageLabel); MessageLabel.Text = "Für die mitgegebene BeitragsID war kein Beitrag zu finden\r\n" + Dh.GetErrorMessage (); MessageLabel.Width = Unit.Percentage (99); return; } Table GlobalTable = new Table (); GlobalTable.CssClass = "CSS_GlobalTable"; this.LinkToVideosContentPlace.Controls.Add (GlobalTable); { TableRow GlobalTableRow = new TableRow (); GlobalTableRow.CssClass = "CSS_GlobalTableRow"; GlobalTable.Controls.Add (GlobalTableRow); { TableCell BeitragsPictureCell = new TableCell (); GlobalTableRow.Controls.Add (BeitragsPictureCell); BeitragsPictureCell.CssClass = "CSS_BeitragsPictureCell"; { Image BeitragsImage = new Image (); BeitragsPictureCell.Controls.Add (BeitragsImage); String ApplPath = Server.MapPath ("~"); BeitragsImage.ImageUrl = String.Format ("GetThumbnailPicture.aspx?BeitragID={0}&Width=400", BeitragID); } TableCell BeitragsTextCell = new TableCell (); GlobalTableRow.Controls.Add (BeitragsTextCell); BeitragsTextCell.Attributes ["valign"] = "top"; BeitragsTextCell.CssClass = "CSS_BeitragsTextCell"; Table BeitragsTextTable = new Table (); BeitragsTextTable.CssClass = "CSS_BeitragsTextTable"; BeitragsTextCell.Controls.Add (BeitragsTextTable); { TableRow BeitragsTitleTableRow = new TableRow (); BeitragsTitleTableRow.CssClass = "CSS_BeitragsTitleTableRow"; BeitragsTextTable.Controls.Add (BeitragsTitleTableRow); { TableCell BeitragsTitleCell = new TableCell (); BeitragsTitleTableRow.Controls.Add (BeitragsTitleCell); BeitragsTitleCell.CssClass = "CSS_BeitragsTitleCell"; BeitragsTitleCell.Text = Dh.GetTitle (); } } { TableRow BeitragsShortDescTableRow = new TableRow (); BeitragsShortDescTableRow.CssClass = "CSS_BeitragsShortDescTableRow"; BeitragsTextTable.Controls.Add (BeitragsShortDescTableRow); { TableCell BeitragsShortDescCell = new TableCell (); BeitragsShortDescTableRow.Controls.Add (BeitragsShortDescCell); BeitragsShortDescCell.CssClass = "CSS_BeitragsShortDescCell"; BeitragsShortDescCell.Text = Dh.GetShortDescription (); } } { TableRow BeitragsLongDescTableRow = new TableRow (); BeitragsLongDescTableRow.CssClass = "CSS_BeitragsLongDescTableRow"; BeitragsTextTable.Controls.Add (BeitragsLongDescTableRow); { TableCell BeitragsLongDescCell = new TableCell (); BeitragsLongDescTableRow.Controls.Add (BeitragsLongDescCell); BeitragsLongDescCell.CssClass = "CSS_BeitragsLongDescCell"; BeitragsLongDescCell.Text = Dh.GetLongDescription (); } } { TableRow BeitragsAdditionalTableRow = new TableRow (); BeitragsAdditionalTableRow.CssClass = "CSS_BeitragsAdditionalTableRow"; BeitragsTextTable.Controls.Add (BeitragsAdditionalTableRow); { TableCell BeitragsAdditionalCell = new TableCell (); BeitragsAdditionalTableRow.Controls.Add (BeitragsAdditionalCell); BeitragsAdditionalCell.CssClass = "CSS_BeitragsAdditionalCell"; BeitragsAdditionalCell.Text = "Beitrag von: " + Dh.GetAuthor () + "<br>\r\n" + "Länge: " + Dh.GetDurationString () + "\r\n"; } } } } { TableRow MaterialTableRow = new TableRow (); MaterialTableRow.CssClass = "CSS_GlobalTableRow"; GlobalTable.Controls.Add (MaterialTableRow); TableCell MaterialTableCell = new TableCell (); MaterialTableCell.CssClass = "CSS_MaterialTableCell"; MaterialTableCell.Attributes ["colspan"] = "2"; MaterialTableRow.Controls.Add (MaterialTableCell); DataTable MaterialDataTable = Dh.GetMaterialDataTable (); DataTable MaterialTypeDataTable = Dh.GetMaterialTypeDataTable(); DataView MaterialTypenDataView = new DataView(MaterialTypeDataTable, "ShowInInternetOrder > '00'", "ShowInInternetOrder", DataViewRowState.CurrentRows); Table MaterialTable = new Table(); MaterialTable.CssClass = "CSS_MaterialTable"; MaterialTableCell.Controls.Add(MaterialTable); DataTable VideoFiles = Dh.GetFileDataTable (); int NumberOfPresentedRows = 0; int MaterialIndex = 0; String BackGroundID = Dh.GetBackGroundBeitragID (); foreach (DataRow VideoFile in VideoFiles.Rows) { NumberOfPresentedRows += FillTheFileEntries(Dh, VideoFile, MaterialTypenDataView, MaterialDataTable, MaterialTable, MaterialIndex, VideoFiles.Rows.Count, BackGroundID); MaterialIndex++; } if (NumberOfPresentedRows == 0) { Label NoMaterialMessage = new Label(); NoMaterialMessage.CssClass = "CSS_NoMaterialMessage"; MaterialTableCell.Controls.Add(NoMaterialMessage); NoMaterialMessage.Text = "Für diesen Beitrag sind im Internet keine VideoTeile verfügbar"; } } }
/// <summary> /// Request Constructor. /// </summary> /// <param name="data">The incomed data.</param> public Request(string data, DataHandling dataHandling) { this.dataHandler = dataHandling; ProcessWords(GetWords(data)); }
void PerformShowSelectionGrid (String [] Selectionen, DateTime FromDate, DateTime ToDate, int StartingIndex) { Dh = new DataHandling (); CreateSelectionTree (Dh); int NumberOfUnifiedEntries = Dh.LoadSelections (Selectionen, 0, FromDate, ToDate, "Grid"); if (NumberOfUnifiedEntries == 0) { return; } DataGrid BeitraegeGrid = new DataGrid (); this.LinkToVideosContentPlace.Controls.Add (BeitraegeGrid); BeitraegeGrid.Width = Unit.Percentage (99); BeitraegeGrid.CssClass = "CSS_BeitraegeGrid"; BeitraegeGrid.AutoGenerateColumns = true; //BeitraegeGrid.AllowPaging = true; BeitraegeGrid.AllowSorting = true; DataTable BeitraegeTable = Dh.GetBeitraegeAusArchiv (); BeitraegeGrid.DataSource = BeitraegeTable; BeitraegeGrid.DataBind (); }
void PerformShowSelectionFull (String [] Selectionen, DateTime FromDate, DateTime ToDate, int StartingIndex) { Dh = new DataHandling (); CreateSelectionTree (Dh); int NumberOfUnifiedEntries = Dh.LoadSelections (Selectionen, 100, FromDate, ToDate, "Full"); if (NumberOfUnifiedEntries == 0) { return; } int NumberOfPages = 5; int NumberOfEntriesPerPage = NumberOfUnifiedEntries / NumberOfPages; while ((NumberOfEntriesPerPage < 15) && (NumberOfPages > 1)) { NumberOfPages--; NumberOfEntriesPerPage = NumberOfUnifiedEntries / NumberOfPages; } int [] TableForEntriesPerPage = new int [NumberOfPages]; String [] ReturnDates = new String [NumberOfPages]; int Reminder = NumberOfUnifiedEntries - (NumberOfEntriesPerPage * NumberOfPages); int AddOnPerPage = Reminder / NumberOfPages; int RunningLastDateIndex = 0; int Index = 0; while (Index < NumberOfPages) { if (Reminder > AddOnPerPage) TableForEntriesPerPage [Index] = NumberOfEntriesPerPage + AddOnPerPage; else TableForEntriesPerPage [Index] = NumberOfEntriesPerPage + Reminder; Reminder -= AddOnPerPage; ReturnDates [Index] = Dh.GetFromDate (RunningLastDateIndex); RunningLastDateIndex += TableForEntriesPerPage [Index]; Index++; } if (Index == 0) return; String PagingMessage = ""; if (TableForEntriesPerPage.Length > 1) PagingMessage = CreatePagingMessage (ReturnDates, FromDate, Dh.MoreEntriesAvailable (), false, StartingIndex); Label FollowUpStartLabel = new Label (); this.LinkToVideosContentPlace.Controls.Add (FollowUpStartLabel); FollowUpStartLabel.Text = PagingMessage; FollowUpStartLabel.Width = Unit.Percentage (99); FollowUpStartLabel.CssClass = "CSS_FollowUpLabel"; CreateBeitragCover Formatieren = new CreateBeitragCover (); Formatieren.SetData (this.LinkToVideosContentPlace, Dh, TableForEntriesPerPage [0]); Formatieren.Create (CreateBeitragCover.FormatingStyle.ARCHIV); Label FollowUpLabel = new Label (); this.LinkToVideosContentPlace.Controls.Add (FollowUpLabel); FollowUpLabel.Text = PagingMessage; FollowUpLabel.Width = Unit.Percentage (99); FollowUpLabel.CssClass = "CSS_FollowUpLabel"; }
public void SetData (System.Web.UI.WebControls.PlaceHolder Anchor, DataHandling DhExisting) { }
void PerformDirectLink (String BeitragID, String BeitragQuality, int FileIndex) { Dh = new DataHandling (); if (!Dh.SetBeitrag (BeitragID)) { Label MessageLabel = new Label (); this.LinkToVideosContentPlace.Controls.Add (MessageLabel); MessageLabel.Text = "Für die mitgegebene BeitragsID war kein Beitrag zu finden\r\n" + Dh.GetErrorMessage (); MessageLabel.Width = Unit.Percentage (99); return; } DataTable VideoFilesDataTable = Dh.GetFileDataTable (); if (FileIndex >= VideoFilesDataTable.Rows.Count) return; DataRow FileEntry = VideoFilesDataTable.Rows[FileIndex]; DataTable MaterialDataTable = Dh.GetMaterialDataTable(); DataRow[] ShowAbleFiles = MaterialDataTable.Select ("FileID = '" + FileEntry["FileID"].ToString() + "' and TechnicalTyp = '" + BeitragQuality + "'"); if (ShowAbleFiles.Length == 0) FillForIlegalUse(); //if (BeitragQuality == "ExternesProgramm") // { // String ResponsePath = GetExternesProgrammMaterial (ShowAbleFiles [0] ["SubPathAndName"].ToString ()); // } Response.Redirect (CVM.CommonValues.WEB_ROOT_SITE + "BeitragsMaterial/" + ShowAbleFiles [0] ["SubPathAndName"].ToString ()); return; }