public static List<PurchasingProducts> GetAll() { DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); List<PurchasingProducts> lstPurchasingProducts = new List<PurchasingProducts>(); PurchasingProducts objPurchasingProducts = new PurchasingProducts(); string strGetOneRecord = "SELECT * FROM [PurchasingProducts]"; string[] strAddParameterName = new string[] { }; object[] objAddparametervalue = new object[] { }; DataTable objtab = new DataTable(); objtab = objdb.ExecuteGetAllQuery(strGetOneRecord, strAddParameterName, objAddparametervalue); for (int i = 0; i < objtab.Rows.Count; i++) { int intId; int intQuantity; decimal decPrice; objPurchasingProducts = new PurchasingProducts(); int.TryParse(objtab.Rows[i]["Id"].ToString(), out intId); objPurchasingProducts.Id = intId; objPurchasingProducts.Name = objtab.Rows[i]["Name"] != null ? objtab.Rows[i]["Name"].ToString() : string.Empty; int.TryParse(objtab.Rows[i]["Quqntity"].ToString(), out intQuantity); objPurchasingProducts.Quantity = intQuantity; decimal.TryParse(objtab.Rows[i]["Price"].ToString(), out decPrice); objPurchasingProducts.Price = decPrice; lstPurchasingProducts.Add(objPurchasingProducts); } return lstPurchasingProducts; }
public static List<Transaction> GetAll() { DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); List<Transaction> lstTransaction = new List<Transaction>(); Transaction objTransaction = new Transaction(); string strGetOneRecord = "SELECT * FROM [Transaction]"; string[] strAddParameterName = new string[] { }; object[] objAddparametervalue = new object[] { }; DataTable objtab = new DataTable(); objtab = objdb.ExecuteGetAllQuery(strGetOneRecord, strAddParameterName, objAddparametervalue); for (int i = 0; i < objtab.Rows.Count; i++) { int intId; DateTime dtDate; int intQuqntity; decimal decProfit; objTransaction = new Transaction(); int.TryParse(objtab.Rows[i]["Id"].ToString(), out intId); objTransaction.Id = intId; objTransaction.Name = objtab.Rows[i]["Name"] != null ? objtab.Rows[i]["Name"].ToString() : string.Empty; DateTime.TryParse(objtab.Rows[i]["Date"].ToString(), out dtDate); objTransaction.Date = dtDate; int.TryParse(objtab.Rows[i]["Quantity"].ToString(), out intQuqntity); objTransaction.Quqntity = intQuqntity; decimal.TryParse(objtab.Rows[i]["Profit"].ToString(), out decProfit); objTransaction.Profit = decProfit; lstTransaction.Add(objTransaction); } return lstTransaction; }
protected void Page_Load(object sender, EventArgs e) { dbOps = DBOperations.Instance; links = Links.Instance; general = General.Instance; gui = GUIVariables.Instance; categories = Categories.Instance; engine = ProcessingEngine.Instance; imageEngine = ImageEngine.Instance; tagger = Tagger.Instance; log = Logger.Instance; seperator = gui.Seperator; // QueryString Param Names. // ratingID // value string iid = string.Empty; string value = string.Empty; #region CookieAlreadyExists // START: If a getputsCookie with the Username already exists, do not show the Login Page. if (Request.Cookies["getputsCookie"] != null) { HttpCookie getputsCookie = Request.Cookies["getputsCookie"]; UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim()); } if (string.IsNullOrEmpty(UID)) { } else { } // END: If a getputsCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists if (Request.QueryString != null && Request.QueryString.Count > 0) { // ratingID is the Item IID. if (!string.IsNullOrEmpty(Request.QueryString["ratingID"])) { iid = Request.QueryString["ratingID"]; } // Value is the Rating given by the user. Value: [0, 1, 2, 3, 4]. So add +1 so as to convert Value: [1, 2, 3, 4, 5] if (!string.IsNullOrEmpty(Request.QueryString["value"])) { int intValue = -1; value = int.TryParse(Request.QueryString["value"], out intValue) ? (intValue + 1).ToString() : "-1"; } } if (!string.IsNullOrEmpty(UID) && !string.IsNullOrEmpty(iid) && !string.IsNullOrEmpty(value)) { UpdateRatings(UID, iid, value); } }
protected void Page_Load(object sender, EventArgs e) { dbOps = (DBOperations)Application["dbOps"]; log = (Logger)Application["log"]; links = (Links)Application["links"]; general = (General)Application["general"]; }
protected void Page_Load(object sender, EventArgs e) { dbOps = DBOperations.Instance; links = Links.Instance; gui = GUIVariables.Instance; log = Logger.Instance; general = General.Instance; engine = ProcessingEngine.Instance; #region CookieAlreadyExists // START: If a getputsCookie with the Username already exists, do not show the Login Page. string UID = string.Empty; if (Request.Cookies["getputsCookie"] != null) { HttpCookie getputsCookie = Request.Cookies["getputsCookie"]; UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim()); } if (!string.IsNullOrEmpty(UID)) { Response.Redirect(links.FrontPageLink, false); } // END: If a getputsCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists if (!IsPostBack) { Control MasterPageLoginTable = this.Master.FindControl("LoginTable"); MasterPageLoginTable.Visible = false; } UsernameTB.Focus(); Page.Form.DefaultButton = SLoginButton.UniqueID; }
protected void Page_Load(object sender, EventArgs e) { links = Links.Instance; gui = GUIVariables.Instance; dbOps = DBOperations.Instance; categories = Categories.Instance; log = Logger.Instance; engine = ProcessingEngine.Instance; general = General.Instance; imageEngine = ImageEngine.Instance; seperator = gui.Seperator; if (string.IsNullOrEmpty(Request.QueryString["UID"])) { } else { queryStringUID = Request.QueryString["UID"].Trim().ToLower(); } if (string.IsNullOrEmpty(queryStringUID)) { } else { LoadComments(queryStringUID); } }
public ProcessingEngine() { dbOps = new DBOperations(); log = new Logger(); _initialExpertise = (int)ExpertiseLevel.Intermediate; _initialPerStockExpertise = (int)ExpertiseLevel.Intermediate; }
public static UsersTable Get(int Id) { DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); UsersTable objUsersTable = new UsersTable(); string strGetOneRecord = "SELECT * FROM [Transaction] where Id=@Id"; string[] strAddParameterName = new string[] { "Id" }; object[] objAddparametervalue = new object[] { objUsersTable.Id }; System.Data.DataTable objtab = objdb.ExecuteGetAllQuery(strGetOneRecord, strAddParameterName, objAddparametervalue); return objUsersTable; }
public static PurchasingProducts Get(int Id) { DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); PurchasingProducts objPurchasingProducts = new PurchasingProducts(); string strGetOneRecord = "SELECT * FROM [PurchasingProducts] where Id=@Id"; string[] strAddParameterName = new string[] { "Id" }; object[] objAddparametervalue = new object[] { objPurchasingProducts.Id }; System.Data.DataTable objtab = objdb.ExecuteGetAllQuery(strGetOneRecord, strAddParameterName, objAddparametervalue); return objPurchasingProducts; }
public static UsersTable GetByID(UsersTable objUsersTable) { DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); // objUsersTable = new UsersTable(); string strGetOneRecord = "SELECT * FROM [UsersTable] where Name=@Name"; string[] strAddParameterName = new string[] { "Name" }; object[] objAddparametervalue = new object[] { objUsersTable.Name }; System.Data.DataTable objtab = objdb.ExecuteGetAllQuery(strGetOneRecord, strAddParameterName, objAddparametervalue); return objUsersTable; }
protected void Page_Load(object sender, EventArgs e) { engine = ProcessingEngine.Instance; dbOps = DBOperations.Instance; links = Links.Instance; Random random = new Random(); bool isDone = false; string link = string.Empty; //string queryString = "SELECT COUNT(*) FROM item WHERE Spam = 0;"; //int retInt = dbOps.ExecuteScalar(queryString); int retInt = engine.ItemRowCount; if (retInt > 0) { int rowCount = retInt; int rowNumber = random.Next(0, rowCount); while (!isDone) { string queryString = "SELECT Link FROM item WHERE Spam = 0 AND IID = " + rowNumber + ";"; MySqlDataReader retList = dbOps.ExecuteReader(queryString); if (retList != null && retList.HasRows) { // DB Hit. while (retList.Read()) { link = Convert.ToString(retList["Link"]); } retList.Close(); isDone = true; } else { // DB Miss. Select another random number. rowNumber = random.Next(0, rowCount); } } if (isDone && !string.IsNullOrEmpty(link)) { Response.Redirect(link, true); } } else { // Not decided what to do. // May be redirect back to getputs. Response.Redirect(links.FrontPageLink, true); } }
protected void Page_Load(object sender, EventArgs e) { links = Links.Instance; gui = GUIVariables.Instance; dbOps = DBOperations.Instance; categories = Categories.Instance; log = Logger.Instance; engine = ProcessingEngine.Instance; WriteRSSFile(); Response.Redirect(links.RssFeedLink, false); }
public Response Create(UsersTable objUsersTable) { SQLConnector.DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); string stInsert = @"INSERT INTO [UsersTable]([Name] ,[Password]) VALUES (@Name,@Password)"; string[] strAddParameterName = new string[] { "Name", "Password"}; object[] objAddparametervalue = new object[] { objUsersTable.Name, objUsersTable.Password }; if (!objdb.ExecuteQuery(stInsert, strAddParameterName, objAddparametervalue)) return new Response(9999, string.Format(Failure_MSG, "insert")); else return new Response(5555, string.Format(SUCCESS_MSG, "inserted")); }
protected void Page_Load(object sender, EventArgs e) { dbOps = DBOperations.Instance; links = Links.Instance; general = General.Instance; gui = GUIVariables.Instance; engine = ProcessingEngine.Instance; // If not using ReCaptcha Project, but using the other Captcha Library. //if (!IsPostBack) //{ // HttpContext.Current.Session["CaptchaImageText"] = general.GenerateRandomCode(); //} }
public void Execute() { dbOps = DBOperations.Instance; // Update the DB. UpdateDB(); UpdateClickDataDB(); UpdatePopularCategories(); UpdateItemRowCount(); ReLoadLists(); // Log the time at which the Scheduler runs the Execute() Method // And the DB was Updated using the UpdateDB() Method. log.Log("Run Execute(). DB Updated. Yay!"); }
protected void Page_Load(object sender, EventArgs e) { dbOps = (DBOperations)Application["dbOps"]; links = (Links)Application["links"]; general = (General)Application["general"]; gui = (GUIVariables)Application["gui"]; engine = (ProcessingEngine)Application["engine"]; AboutStoockerLabel.Text = gui.GrayFontStart + gui.StoocksFont + " is a Stock Recommendation Engine." + gui.LineBreak + "Maintain a " + gui.GreenFontStart + "Portfolio" + gui.GreenFontEnd + " of your stocks." + gui.LineBreak + "Get updated " + gui.GreenFontStart + "News" + gui.GreenFontEnd + " about the latest happenings in the Stock Market." + gui.LineBreak + gui.GreenFontStart + "Predict" + gui.GreenFontEnd + " tomorrows movement of your favorite stocks." + gui.LineBreak + "See what the other users " + gui.GreenFontStart + "Recommend" + gui.GreenFontEnd + " about the stock movement for tomorrow." + gui.GrayFontEnd; }
public static List<UsersTable> GetAll() { DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); List<UsersTable> lstUsersTable = new List<UsersTable>(); UsersTable objUsersTable = new UsersTable(); string strGetOneRecord = "SELECT * FROM [UsersTable]"; string[] strAddParameterName = new string[] { }; object[] objAddparametervalue = new object[] { }; DataTable objtab = new DataTable(); objtab = objdb.ExecuteGetAllQuery(strGetOneRecord, strAddParameterName, objAddparametervalue); for (int i = 0; i < objtab.Rows.Count; i++) { int intId; objUsersTable = new UsersTable(); int.TryParse(objtab.Rows[i]["Id"].ToString(), out intId); objUsersTable.Id = intId; objUsersTable.Name = objtab.Rows[i]["Name"] != null ? objtab.Rows[i]["Name"].ToString() : string.Empty; objUsersTable.Password = objtab.Rows[i]["Password"] != null ? objtab.Rows[i]["Password"].ToString() : string.Empty; lstUsersTable.Add(objUsersTable); } return lstUsersTable; }
///<summary> ///A simple example of a job that sends out an email message. ///</summary> public void Execute() { // IF Day == Saturday | Sunday Then Scheduler should run exactly once. // Currently Not running the scheduler on Friday. if ( (DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday) && DateTime.Now.Hour == schedulerTimeInHours) // This task has to run at 9:00 A.M. (EST) // if ((DateTime.Now.Hour % 2) != 0) // This task has to run at 12:00 A.M. (Midnight EST) { dbOps = new DBOperations(); stockService = new StockService(); yesterday = DateTime.Now.AddDays(-1).ToString(dateFormatString); today = DateTime.Now.ToString(dateFormatString); tomorrow = DateTime.Now.AddDays(+1).ToString(dateFormatString); // Update the DB. This task has to run between 9:00 A.M. and 10:00 A.M. (Morning EST) UpdateDB(); // Log the time at which the Scheduler runs the Execute() Method // And the DB was Updated using the UpdateDB() Method. log.Log("Run Execute(). DB Updated. Yay!"); } }
protected void Page_Load(object sender, EventArgs e) { dbOps = DBOperations.Instance; links = Links.Instance; gui = GUIVariables.Instance; log = Logger.Instance; general = General.Instance; engine = ProcessingEngine.Instance; #region CookieAlreadyExists // START: If a getputsCookie with the Username already exists, do not show the Login Page. string UID = string.Empty; if (Request.Cookies["getputsCookie"] != null) { HttpCookie getputsCookie = Request.Cookies["getputsCookie"]; UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim()); } if (!string.IsNullOrEmpty(UID)) { Response.Redirect(links.FrontPageLink, false); } // END: If a getputsCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists }
protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken) { string memberId = turnContext.Activity.Recipient.Id; string[] message = turnContext.Activity.Text.Split(' ').Select(a => a.ToLower()).ToArray(); switch (message[0].ToLower()) { case "/subscribe": if (message.Length == 1) { await turnContext.SendActivityAsync(MessageFactory.Text("Please type /subscribe and Name of subreddit after space"), cancellationToken); break; } if (!RedditSubscription.RedditHot.IsKeyCorrect(message[1])) { await turnContext.SendActivityAsync(MessageFactory.Text ("Please take existing SubReddit (NOTE: maybe you typed \"r\\*subreddit_name*\" instead of \"*subreddit*\"?")); break; } if (!DBOperations.DoesSubExist(memberId, "RedditHot", message[1])) { DBOperations.AddSub(memberId, "RedditHot", message[1]); } else { await turnContext.SendActivityAsync(MessageFactory.Text("You're already subscribed, retart")); } break; case "/unsubscribe": if (message.Length == 1) { await turnContext.SendActivityAsync(MessageFactory.Text("Please type /unsubscribe and Name of subreddit after space"), cancellationToken); break; } if (DBOperations.DoesSubExist(memberId, "RedditHot", message[1])) { DBOperations.RemoveSub(memberId, "RedditHot", message[1]); } break; default: var replyText = "I'm the f*****g bot. I can't talk with you, sorry"; await turnContext.SendActivityAsync(MessageFactory.Text(replyText, replyText), cancellationToken); break; } if (isLoopStarted) { return; } isLoopStarted = true; while (true) { var sub = DBOperations.GetSubWithZeroPriority(memberId); if (sub == null) { continue; } var subName = sub.Subscription; var subKey = sub.SubscriptionKey; if (subName == "RedditHot") { var subreddit = RedditSubscription.RedditHot; var content = subreddit.Content(subKey).First(content => !DBOperations.HaveUserSeenContent(memberId, content.UniqueID)); string text = subKey + ": " + content.ToMessage; await turnContext.SendActivityAsync(MessageFactory.Text(text), cancellationToken); DBOperations.AddSeenContent(memberId, content.UniqueID); DBOperations.ShiftPriority(memberId); Thread.Sleep(5000); } } }
protected void Page_Load(object sender, EventArgs e) { dbOps = (DBOperations)Application["dbOps"]; gui = (GUIVariables)Application["gui"]; links = (Links)Application["links"]; engine = (ProcessingEngine)Application["engine"]; // username = Convert.ToString(Session["username"]); if (Request.Cookies["stoockerCookie"] != null) { HttpCookie stoockerCookie = Request.Cookies["stoockerCookie"]; username = dbOps.Decrypt(stoockerCookie["username"].ToString().Trim()); } if (string.IsNullOrEmpty(username)) { Response.Redirect(links.SessionExpiredPageLink); } FindStockTB.Attributes.Add("onkeypress", "if ((event.which ? event.which : event.keyCode) == 13){document.getElementById('" + FindStockButton.UniqueID + "').click(); }"); // InterestsLabel.Text = "Select the Stocks you would like to <font color=\"Red\">Stoock!!<\font>"; InterestsLabel.Text = "Other User's have been making predictions for the stocks shown." + "Select the Stocks you would like to " + gui.StoockFont + gui.LineBreak + "(Max. of " + gui.RedFontStart + maxStocksPerUser.ToString() + gui.RedFontEnd + " stocks allowed)"; string findStockMessage = "Could not find the Symbol you were looking for?" + gui.LineBreak + gui.StoocksFont + " only shows the Stocks which other Stoockers have predicted." + gui.LineBreak + "Type the Symbol of the Stock you want to analyze and " + gui.StoocksFont + " will add the Symbol for You."; FindStockLabel.Text = findStockMessage; if (!Page.IsPostBack) { FillStocksCBL(); ShowAlreadySelectedStocks(username); // AlphabeticButton.Attributes.Add("onmouseover", "this.style.backgroundColor='red'"); // AlphabeticButton.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); } for (int i = 0; i < StocksCBL.Items.Count; i++) { StocksCBL.Items[i].Attributes.Add("onmouseover", "this.style.backgroundColor='red'"); StocksCBL.Items[i].Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); } FindStockTB.Attributes.Add("onkeypress", "if ((event.which ? event.which : event.keyCode) == 13){var sendElem = document.getElementById(\"FindStockButton\"); if(!sendElem.disabled) FindStockButton_Click(); }"); }
// ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns; // ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized; protected void Page_Load(object sender, EventArgs e) { dbOps = DBOperations.Instance; links = Links.Instance; general = General.Instance; gui = GUIVariables.Instance; categories = Categories.Instance; engine = ProcessingEngine.Instance; imageEngine = ImageEngine.Instance; itemDisplayer = ItemDisplayer.Instance; seperator = gui.Seperator; if (!string.IsNullOrEmpty(Request.QueryString["startItem"])) { bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem); if (!isStartItemInt) { startItem = 0; } if (startItem < 0) { startItem = 0; } } else { startItem = 0; } if (!string.IsNullOrEmpty(Request.QueryString["sort"])) { string sortStr = Convert.ToString(Request.QueryString["sort"]); sort = engine.GetSortType(sortStr); } if (Request.Cookies["getputsLayoutCookie"] != null) { HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"]; itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim())); } #region CookieAlreadyExists // START: If a getputsCookie with the Username already exists, do not show the Login Page. if (Request.Cookies["getputsCookie"] != null) { HttpCookie getputsCookie = Request.Cookies["getputsCookie"]; UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim()); } if (string.IsNullOrEmpty(UID)) { Response.Redirect(links.LoginLink, false); } else { MessageLabel.Text = gui.GreenFontStart + UID + "'s Saved Items" + gui.GreenFontEnd; } // END: If a getputsCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists LoadItemDB(sort); }
protected void Page_Load(object sender, EventArgs e) { try { OutputTB.Text = string.Empty; dbOps = DBOperations.Instance; links = Links.Instance; general = General.Instance; gui = GUIVariables.Instance; engine = ProcessingEngine.Instance; categories = Categories.Instance; imageEngine = ImageEngine.Instance; } catch (Exception ex) { OutputTB.Text = "Error in PageLoad: " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace; } }
private void cmdOK_Click(object sender, RoutedEventArgs e) { DBOperations.UpdateFlag(idKnowledge, 1, 0); //Update useful in DB to TRUE(1) DBOperations.UpdateFlag(idKnowledge, 1, 1); //Update checked in DB to TRUE(1) }
public bool UpdateTest(string RunID, string endTime) { DBOperations DBCalls = new DBOperations(); return(DBCalls.RunUpdateQuery("UPDATE TestRunTable SET EndTime='" + endTime + "' where RunID='" + RunID + "';")); }
public Response Create(PurchasingProducts objPurchasingProducts) { SQLConnector.DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); string stInsert = @"INSERT INTO [PurchasingProducts]([Name],[Quantity] ,[Price]) VALUES(@Name,@Quantity,@Price)"; string[] strAddParameterName = new string[] { "Name", "Quantity", "Price" }; object[] objAddparametervalue = new object[] { objPurchasingProducts.Name, objPurchasingProducts.Quantity, objPurchasingProducts.Price }; if (!objdb.ExecuteQuery(stInsert, strAddParameterName, objAddparametervalue)) return new Response(9999, string.Format(Failure_MSG, "insert")); else return new Response(5555, string.Format(SUCCESS_MSG, "inserted")); }
protected void Page_Load(object sender, EventArgs e) { dbOps = (DBOperations)Application["dbOps"]; links = (Links)Application["links"]; gui = (GUIVariables)Application["gui"]; log = (Logger)Application["log"]; general = (General)Application["general"]; engine = (ProcessingEngine)Application["engine"]; #region CookieAlreadyExists // START: If a stoockerCookie with the Username already exists, do not show the Login Page. string username = ""; if (Request.Cookies["stoockerCookie"] != null) { HttpCookie stoockerCookie = Request.Cookies["stoockerCookie"]; username = dbOps.Decrypt(stoockerCookie["username"].ToString().Trim()); } if (!string.IsNullOrEmpty(username)) { Response.Redirect(links.HomePageLink); } // END: If a stoockerCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists AboutStoockerLabel.Text = gui.GrayFontStart + gui.StoocksFont + " is a Stock Recommendation Engine." + gui.LineBreak + "Maintain a " + gui.GreenFontStart + "Portfolio" + gui.GreenFontEnd + " of your stocks." + gui.LineBreak + "Get updated " + gui.GreenFontStart + "News" + gui.GreenFontEnd + " about the latest happenings in the Stock Market." + gui.LineBreak + gui.GreenFontStart + "Predict" + gui.GreenFontEnd + " tomorrows movement of your favorite stocks." + gui.LineBreak + "See what the other users " + gui.GreenFontStart + "Recommend" + gui.GreenFontEnd + " about the stock movement for tomorrow." + gui.GrayFontEnd; yesterday = DateTime.Now.AddDays(-1).ToString(dateFormatString); today = DateTime.Now.ToString(dateFormatString); tomorrow = DateTime.Now.AddDays(+1).ToString(dateFormatString); dayOfWeekTomorrow = DateTime.Now.AddDays(+1).DayOfWeek.ToString(); // If Today=Friday Then Tomorrow=Monday. Why? Because Stock Markets are closed on Weekends. if (DateTime.Now.DayOfWeek == DayOfWeek.Friday || DateTime.Now.DayOfWeek == DayOfWeek.Saturday || DateTime.Now.DayOfWeek == DayOfWeek.Sunday) { if (DateTime.Now.DayOfWeek == DayOfWeek.Friday) { tomorrow = DateTime.Now.AddDays(+3).ToString(dateFormatString); dayOfWeekTomorrow = DateTime.Now.AddDays(+3).DayOfWeek.ToString(); } if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday) { tomorrow = DateTime.Now.AddDays(+2).ToString(dateFormatString); dayOfWeekTomorrow = DateTime.Now.AddDays(+2).DayOfWeek.ToString(); } if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday) { tomorrow = DateTime.Now.AddDays(+1).ToString(dateFormatString); dayOfWeekTomorrow = DateTime.Now.AddDays(+1).DayOfWeek.ToString(); } } FillRecommendedStocksTable(); }
protected void Page_Load(object sender, EventArgs e) { MessageLabel.Text = string.Empty; dbOps = DBOperations.Instance; links = Links.Instance; general = General.Instance; gui = GUIVariables.Instance; engine = ProcessingEngine.Instance; #region CookieAlreadyExists // START: If a getputsCookie with the Username already exists, do not show the Login Page. if (Request.Cookies["getputsCookie"] != null) { HttpCookie getputsCookie = Request.Cookies["getputsCookie"]; UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim()); } if (string.IsNullOrEmpty(UID)) { if (general.IsUserAdministrator(UID)) { } else { Response.Redirect(links.FrontPageLink, false); } } // END: If a getputsCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists //if (!IsPostBack) //{ // string queryString = @"SELECT * FROM getputs.item;"; // PopulateItemGridView(queryString); //} if(!IsPostBack) MaxRowsTB.Text = maxRows.ToString(); }
public Response Update(PurchasingProducts objPurchasingProducts) { DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); string strUpsate = @"UPDATE [PurchasingProducts] SET [Name] = @Name, [Quantity] = @Quantity, [Price] = @Price WHERE Id=@Id"; string[] strAddParameterName = new string[] { "Name", "Quantity", "Price", "Id" }; object[] objAddparametervalue = new object[] { objPurchasingProducts.Name, objPurchasingProducts.Quantity, objPurchasingProducts.Price, objPurchasingProducts.Id }; if (!objdb.ExecuteQuery(strUpsate, strAddParameterName, objAddparametervalue)) return new Response(9999, string.Format(Failure_MSG, "update")); else return new Response(5555, string.Format(SUCCESS_MSG, "updated")); }
public Response Delete(PurchasingProducts objPurchasingProducts) { DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString); string strDelete = "DELETE FROM [PurchasingProducts] WHERE Id=@Id"; string[] strAddParameterName = new string[] { "Id" }; object[] objAddparametervalue = new object[] { objPurchasingProducts.Id }; if (!objdb.ExecuteQuery(strDelete, strAddParameterName, objAddparametervalue)) return new Response(9999, string.Format(Failure_MSG, "delete")); else return new Response(5555, string.Format(SUCCESS_MSG, "deleted")); }
public string RegisterCase(string Testcasename, string Runid) { DBOperations DBCalls = new DBOperations(); return(DBCalls.RunInsertQuery("INSERT INTO TestCaseTable (TestCaseName,RunID,Status) Values('" + Testcasename + "','" + Runid + "','Pass');")); }
protected void Page_Load(object sender, EventArgs e) { dbOps = DBOperations.Instance; links = Links.Instance; general = General.Instance; categories = Categories.Instance; engine = ProcessingEngine.Instance; log = Logger.Instance; UID = string.Empty; url = string.Empty; // log.Log("PathInfo: " + Request.PathInfo); #region CookieAlreadyExists // START: If a getputsCookie with the Username already exists, do not show the Login Page. if (Request.Cookies["getputsCookie"] != null) { HttpCookie getputsCookie = Request.Cookies["getputsCookie"]; UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim()); } if (string.IsNullOrEmpty(UID)) { Response.Redirect(links.LoginLink); } else { } // END: If a getputsCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists // Update the SavedItems DB if (!string.IsNullOrEmpty(UID) && !string.IsNullOrEmpty(Request.QueryString["iid"])) { string IID = Request.QueryString["iid"]; // Make sure that the IID is a valid integer. if (general.IsValidInt(IID)) { string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string queryString = "INSERT INTO saveditems VALUES ('" + UID + "' , " + IID + " , '" + date + "');"; int retInt = dbOps.ExecuteNonQuery(queryString); // Also update the getputs.item NSaved Field. queryString = "UPDATE item SET NSaved=NSaved+1 WHERE IID=" + IID + ";"; retInt = dbOps.ExecuteNonQuery(queryString); Response.Redirect(Context.Request.UrlReferrer.OriginalString); } else { Response.Redirect(links.FrontPageLink); } } else { Response.Redirect(links.FrontPageLink); } }
protected void Page_Load(object sender, EventArgs e) { dbOps = DBOperations.Instance; links = Links.Instance; general = General.Instance; gui = GUIVariables.Instance; engine = ProcessingEngine.Instance; imageEngine = ImageEngine.Instance; categories = Categories.Instance; tagger = new Tagger(); seperator = gui.Seperator; #region CookieAlreadyExists // START: If a getputsCookie with the Username already exists, do not show the Login Page. if (Request.Cookies["getputsCookie"] != null) { HttpCookie getputsCookie = Request.Cookies["getputsCookie"]; user = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim()); } if (string.IsNullOrEmpty(user)) { // Response.Redirect(links.LoginLink, false); MessageLabel.Text = gui.RedFontStart + "Please login to enter a comment." + gui.RedFontEnd; } else { } // END: If a getputsCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists if (string.IsNullOrEmpty(Request.QueryString["uid"]) || string.IsNullOrEmpty(Request.QueryString["iid"]) || string.IsNullOrEmpty(Request.QueryString["cid"])) { Response.Redirect(links.FrontPageLink, true); } else { uid = Request.QueryString["uid"].Trim(); iid = Request.QueryString["iid"].Trim(); cid = Request.QueryString["cid"].Trim(); } if (!general.IsValidInt(iid) || !general.IsValidInt(cid) || !uid.Equals(user)) { Response.Redirect(links.FrontPageLink, true); } else { string comment = LoadComment(uid, iid, cid); if (string.IsNullOrEmpty(comment)) { Response.Redirect(links.FrontPageLink, true); } else { MessageLabel.Text = gui.GreenFontStart + "Your comment cannot be edited." + gui.LineBreak + "However, you can append more details to your previous comment." + gui.GreenFontEnd; CurrentCommentLabel.Text = gui.GreenFontStart + "Your comment: " + gui.GreenFontEnd + gui.LineBreak + comment; } } }
protected void Page_Load(object sender, EventArgs e) { dbOps = DBOperations.Instance; links = Links.Instance; general = General.Instance; gui = GUIVariables.Instance; engine = ProcessingEngine.Instance; imageEngine = ImageEngine.Instance; seperator = gui.Seperator; if (string.IsNullOrEmpty(Request.QueryString["IID"])) { EMailDiv.Visible = false; ItemTitleLabel.Text = "No such item found."; } else { iid = Request.QueryString["IID"].Trim().ToLower(); } if (!general.IsValidInt(iid)) { EMailDiv.Visible = false; } else { item = new Item(); string queryString = "SELECT Title, Link, Text, Date, UID, NComments, Category FROM item WHERE IID=" + iid + ";"; MySqlDataReader retList; retList = dbOps.ExecuteReader(queryString); if (retList != null && retList.HasRows) { while (retList.Read()) { item.IID = Convert.ToInt32(iid); item.UID = Convert.ToString(retList["UID"]); item.Title = Convert.ToString(retList["Title"]); item.Link = Convert.ToString(retList["Link"]); item.Text = Convert.ToString(retList["Text"]); item.Date = Convert.ToString(retList["Date"]); item.NComments = Convert.ToInt32(retList["NComments"]); item.Category = Convert.ToString(retList["Category"]); if (!string.IsNullOrEmpty(item.Link)) { item.Text = string.Empty; } } retList.Close(); } ItemTitleLabel.Text = "Title: " + gui.GrayFontStart + item.Title + gui.GrayFontEnd; } #region CookieAlreadyExists // START: If a getputsCookie with the Username already exists, do not show the Login Page. if (Request.Cookies["getputsCookie"] != null) { HttpCookie getputsCookie = Request.Cookies["getputsCookie"]; user = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim()); } if (string.IsNullOrEmpty(user)) { } else { } // END: If a getputsCookie with the Username already exists, do not show the Login Page. #endregion CookieAlreadyExists // If the user has logged in, populate the 'EMail From' TextBox. // The variable 'user' = Logged in User. EMailOutputMessageLabel.Text = string.Empty; if (!string.IsNullOrEmpty(user)) { string queryString = "SELECT EMail FROM user WHERE UID='" + user + "';"; MySqlDataReader retList = dbOps.ExecuteReader(queryString); if (retList != null && retList.HasRows) { while (retList.Read()) { FromTB.Text = Convert.ToString(retList["EMail"]); } retList.Close(); } } // If not using ReCaptcha Project, but using the Captcha Library. //if (!IsPostBack) //{ // HttpContext.Current.Session["CaptchaImageText"] = general.GenerateRandomCode(); //} }
public string RegisterTest(string RunName, string startTime) { DBOperations DBCalls = new DBOperations(); return(DBCalls.RunInsertQuery("INSERT INTO TestRunTable (RunName,Status,StartTime) Values('" + RunName + "','Pass','" + startTime + "');")); }