public Market GetMarketObjectByGUID(string Guid) { Market result = null; foreach (DataRow row in dataSource.Rows) { if (row["guid"].ToString() == Guid) { result = new Market(row); } } return result; }
// public classSubmission submissionObject; // when LOADED or NEW this is the submission object. We overwrite only changed fields /// <summary> /// nice way of showing submission /// </summary> public void SubmissionSelected(Market market, int words) { if (market != null) { _Loading = true; WordCount = words; // reset font notes.Font = new Font ("Times", 12); decimal AmountOfPossibleSale = 0; string name = market.Caption;//row[Data.SubmissionIndexFields.MARKET_NAME].ToString(); sGUID = market.Guid; //row[Data.SubmissionIndexFields.MARKETGUID].ToString(); // string sPage = Data.GetPageNameByGUID(sGUID, false); try { // classPageMarket market = (classPageMarket)Data.GoToPage(sPage); string markettype = ""; string marketprint = ""; if (market != null) { if (market.MarketType != null && market.MarketType != "") { markettype = " | " + market.MarketType; } if (market.PublishType != null && market.PublishType != "") { marketprint = " | " + market.PublishType; } AmountOfPossibleSale = market.GetPossibleSale (words); market = null; } if (0 == words) { // if we have 0 words our price will be zero so we hide the fields // in this way we also get away with hiding these fiels on a Market page // without tracking extra data // march 2010 label10.Visible = false; textBoxSale.Visible = false; } else { label10.Visible = true; textBoxSale.Visible = true; } textBoxSale.Text = String.Format ("{0:0.##}", AmountOfPossibleSale); labelMarket.Text = String.Format ("{0} {1} {2}", name, markettype, marketprint); // // // // // panel1.Visible = true; // load submission details _NeedToSave = false; _Loading = false; } catch (Exception ex) { NewMessage.Show (Loc.Instance.GetString ("The market object was null ") + ex.ToString ()); } } else { NewMessage.Show (Loc.Instance.GetString ("Market was null")); } }
public static Market DefaultMarket() { Market defaultMarket = new Market(); defaultMarket.Guid = System.Guid.NewGuid().ToString (); defaultMarket.PublishType = LayoutDetails.Instance.TableLayout.GetListOfStringsFromSystemTable(Addin_Submissions.SYSTEM_PUBLISHTYPES,1)[0]; defaultMarket.MarketType = LayoutDetails.Instance.TableLayout.GetListOfStringsFromSystemTable(Addin_Submissions.SYSTEM_MARKETTYPES,1)[0];; defaultMarket.MinimumWord = 1000; defaultMarket.MaximumWord = 5000; defaultMarket.AcceptReprints = false; defaultMarket.AcceptsEmail = true; defaultMarket.LastUpdate = DateTime.Now; defaultMarket.ProfanityWarning = false; defaultMarket.Web="www.brentknowles.com"; defaultMarket.Payment = 0.05; return defaultMarket; }