private void ProccessNextSite(Dictionary <string, object> dic) { if (this.InvokeRequired) { var delg = new delProccessing(ProccessNextSite); this.Invoke(delg, new object[] { dic }); } else { var url = dic["url"].ToString(); WebSurf.Url = new Uri(url); tlsCurrentSite.Text = url; Progress.Value = 0; VisitTimer.Enabled = true; } }
protected void UpdateStatus(Dictionary <string, object> dic) { if (this.InvokeRequired) { var delg = new delProccessing(UpdateStatus); this.Invoke(delg, new object[] { dic }); } else { int totalUers = (int)dic["totalUsers"]; int sites = (int)dic["sites"]; int onlines = (int)dic["onlines"]; int scores = (int)dic["scores"]; tlsOnlines.Text = string.Format("{0:#,##0}", onlines); tlsTotalSites.Text = string.Format("{0:#,##0}", sites); tlsUsers.Text = string.Format("{0:#,##0}", totalUers); tlsScores.Text = string.Format("{0:#,##0}", scores); } }
public void DoLogin(Dictionary <string, object> dic) { if (this.InvokeRequired) { delProccessing delg = new delProccessing(DoLogin); this.Invoke(delg, new object[] { dic }); } else { int totalUers = (int)dic["totalUsers"]; int sites = (int)dic["sites"]; int onlines = (int)dic["onlines"]; int scores = (int)dic["scores"]; string url = dic["url"].ToString(); DataSet ds = new DataSet(); ds.ReadXml(new StringReader(dic["dtSites"].ToString())); DataTable dt = (ds.Tables.Count > 0) ? ds.Tables[0] : new DataTable(); tlsCurentUser.Text = txtEmail.Text.ToLower(); tlsOnlines.Text = string.Format("{0:#,##0}", onlines); tlsTotalSites.Text = string.Format("{0:#,##0}", sites); tlsUsers.Text = string.Format("{0:#,##0}", totalUers); tlsScores.Text = string.Format("{0:#,##0}", scores); tlsCurrentSite.Text = url; WebSurf.Url = new Uri(url); dtgUserWebSites.DataSource = dt; SurfPanel.Visible = true; MyWesitePanel.Visible = false; MainPanel.Visible = true; StartPanel.Visible = false; VisitTimer.Enabled = true; } }
private void ProccessProductList(Dictionary <string, object> dic) { if (this.InvokeRequired) { var delg = new delProccessing(ProccessProductList); this.Invoke(delg, new object[] { dic }); } else { ProductsLoaded = true; double totalRowScores = 0; double totalRowSteps = 0; DataSet ds = new DataSet(); ds.ReadXml(new StringReader(dic["list"].ToString())); DataTable dt = (ds.Tables.Count > 0) ? ds.Tables[0] : new DataTable(); for (int i = 0; i < dt.Rows.Count; i++) { var row = dt.Rows[i]; var ProductType = int.Parse(row["ProductTypeId"].ToString()); var ProductName = int.Parse(row["ProductName"].ToString()); var ProductCost = int.Parse(row["Cost"].ToString()); var ProductDiscount = int.Parse(row["Discount"].ToString()); var ProductPeriod = int.Parse(row["Period"].ToString()); var panel = new Panel(); panel.BackColor = Color.FromArgb(252, 238, 33); panel.ForeColor = Color.FromArgb(64, 64, 64); panel.Padding = new Padding(10); panel.Size = new Size(240, 180); var lblProductName = new Label(); lblProductName.Text = (ProductType == 1) ? String.Format("{0:#,##0} امتیاز", ProductName) : String.Format("بازدید + {0}", ProductName); lblProductName.Font = new Font("Tahoma", 25F, FontStyle.Bold, GraphicsUnit.Pixel, ((byte)(178))); lblProductName.Dock = DockStyle.Top; lblProductName.Size = new Size(220, 45); lblProductName.TextAlign = ContentAlignment.MiddleCenter; var lblCost = new Label(); lblCost.Text = String.Format("{0:#,##0} تومان", ProductCost); lblCost.Font = new Font("Tahoma", 21F, FontStyle.Regular, GraphicsUnit.Pixel, ((byte)(178))); lblCost.Dock = DockStyle.Top; lblCost.Size = new Size(220, 35); lblCost.TextAlign = ContentAlignment.MiddleCenter; var lblDiscount = new Label(); if (ProductType == 1) { lblDiscount.Text = (ProductDiscount > 0) ? String.Format("{0:#,##0} درصد تخفیف!", ProductDiscount) : "بدون تخفیف"; } else { lblDiscount.Text = String.Format("{0} روز", ProductPeriod); } lblDiscount.Font = new Font("Tahoma", 17F, FontStyle.Regular, GraphicsUnit.Pixel, ((byte)(178))); lblDiscount.Dock = DockStyle.Top; lblDiscount.Size = new Size(220, 35); lblDiscount.TextAlign = ContentAlignment.MiddleCenter; var btnPay = new Button(); btnPay.BackColor = Color.Transparent; btnPay.BackgroundImage = global::Parsnet.Properties.Resources.paybtn; btnPay.Cursor = Cursors.Hand; btnPay.FlatAppearance.BorderSize = 0; btnPay.FlatStyle = FlatStyle.Flat; btnPay.Font = new Font("Tahoma", 18F, FontStyle.Bold, GraphicsUnit.Pixel, ((byte)(178))); btnPay.Location = new Point(57, 135); btnPay.Tag = row["ProductId"]; //btnPay.Name = "button1"; btnPay.Size = new Size(127, 33); btnPay.UseVisualStyleBackColor = false; btnPay.Click += new System.EventHandler(this.btnSale_Click); panel.Controls.Add(lblDiscount); panel.Controls.Add(lblCost); panel.Controls.Add(lblProductName); panel.Controls.Add(btnPay); if (ProductType == 1) { flpScores.Controls.Add(panel); totalRowScores += 1; } else { flpSteps.Controls.Add(panel); totalRowSteps += 1; } } var pCount = pnlScores.Width / 240; flpScores.Width = pCount * 250; flpScores.Height = (int)(Math.Ceiling(totalRowScores / pCount) * 190); var x = (pnlScores.Width / 2) - (flpScores.Width / 2); flpScores.Location = new Point(x, 0); pCount = pnlSteps.Width / 240; flpSteps.Width = pCount * 250; flpSteps.Height = (int)(Math.Ceiling(totalRowSteps / pCount) * 190); x = (pnlSteps.Width / 2) - (flpSteps.Width / 2); flpSteps.Location = new Point(x, 0); } }