示例#1
0
        private void btnListado1_Click(object sender, EventArgs e)
        {
            bindingSource.Clear();
            dataGridEstadisticas.Columns.Clear();
            bindingSource = new BindingSource();
            if (String.IsNullOrEmpty(txtBoxAnio.Text))
            {
                MessageBox.Show("Por favor escriba el año a evaluar.");
                return;
            }
            LoadGradoFilter form   = new LoadGradoFilter();
            DialogResult    result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                int gradoid = form.grado.Id;
                top5          = repo.GetTop5Empresas(Convert.ToInt32(txtBoxAnio.Text), Convert.ToInt32(comboBoxTrimestre.Text), gradoid);
                bindingSource = new BindingSource(top5, String.Empty);
                dataGridEstadisticas.DataSource = bindingSource;
            }
            else
            {
                MessageBox.Show("Debe completar el filtro para buscar el top 5");
                return;
            }
        }
示例#2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            Documento doc;

            doc = (Documento)dataGridView1.CurrentRow.DataBoundItem;
            if (string.IsNullOrEmpty(doc.Clave2))
            {
                doc.Clave2 = null;
            }
            if (string.IsNullOrEmpty(doc.Clave3))
            {
                doc.Clave3 = null;
            }
            if (con.EliminarDocumento(doc))
            {
                MessageBoxButtons botons   = MessageBoxButtons.OK;
                MessageBoxIcon    icon     = MessageBoxIcon.Exclamation;
                string            cuerpo   = "Se ha eliminado el documento correctamente.";
                string            cabecera = "ERROR";
                MessageBox.Show(cuerpo, cabecera, botons, icon);
            }
            else
            {
                MessageBoxButtons botons   = MessageBoxButtons.OK;
                MessageBoxIcon    icon     = MessageBoxIcon.Exclamation;
                string            cuerpo   = "No se ha eliminado correctamente.";
                string            cabecera = "ERROR";
                MessageBox.Show(cuerpo, cabecera, botons, icon);
            }

            con.EliminarDocumento(doc);
            bd.Clear();
            Documentos();
        }
示例#3
0
        private void BtnStart_Click(object sender, EventArgs e)
        {
            bindingSource.Clear();

            crawler.StartUrl = TbxStartUrl.Text;
            if (crawler.StartUrl != "")
            {
                Match match = Regex.Match(crawler.StartUrl, SimpleCrawler.urlParseRegex);
                if (match.Length == 0)
                {
                    LblInfo.Text = "invaild input";
                    return;
                }
                string host = match.Groups["host"].Value;
                crawler.HostFilter = @"^" + host + "$";
                crawler.FileFilter = @".html?$";

                LblInfo.Text = "Start";
                t            = new Thread(crawler.Start);
                sw.Restart();
                t.Start();
            }
            else
            {
                LblInfo.Text = "Input url";
            }
        }
        private void RefreshDataGridView()
        {
            var processes       = Process.GetProcesses();
            var applicationName = "";

            if (textBox1.Text != null && textBox1.Text.Length > 0)
            {
                bindingSource.Clear();
                int counter = 0;
                foreach (var process in processes.Where(p => p.ProcessName.ToLower().Contains(textBox1.Text.ToLower()) && p.MainWindowTitle != null && p.MainWindowTitle.Length > 1).OrderBy(p => p.ProcessName))
                {
                    counter++;
                    applicationName = GetApplicationName(process.ProcessName);
                    bindingSource.Add(new ProcessClass(process.Id, process.ProcessName, process.MainWindowTitle, applicationName, counter));
                }
            }
            else if (textBox1.Text == null || textBox1.Text.Length == 0)
            {
                bindingSource.Clear();
                int counter = 0;
                foreach (var process in processes.Where(p => p.MainWindowTitle != null && p.MainWindowTitle.Length > 1).OrderBy(p => p.ProcessName))
                {
                    counter++;
                    applicationName = GetApplicationName(process.ProcessName);
                    bindingSource.Add(new ProcessClass(process.Id, process.ProcessName, process.MainWindowTitle, applicationName, counter));
                }
            }
        }
示例#5
0
        public void fillDataGridView(TPF menuTPF, DRB menuDRB)
        {
            iconBindingSource.Clear();
            textures = new List <string>();
            foreach (TPF.Texture entry in menuTPF.Textures)
            {
                textures.Add(entry.Name);
            }

            List <string> sortedNames = new List <string>(textures);

            sortedNames.Sort();
            dgvIconsTextureCol.DataSource = sortedNames;

            drb     = menuDRB;
            sprites = new List <SpriteWrapper>();

            DRB.Dlg icons = menuDRB.Dlgs.Find(dlg => dlg.Name == "Icon");
            foreach (DRB.Dlgo dlgo in icons.Dlgos.Where(dlgo => dlgo.Shape is DRB.Shape.Sprite))
            {
                sprites.Add(new SpriteWrapper(dlgo, textures));
            }
            sprites.Sort();
            iconBindingSource.DataSource = sprites;
        }
 private void BuscarReservaciones()
 {
     if (!string.IsNullOrWhiteSpace(buscadorTb.Text))
     {
         List <ReservacionMesas> tempList = new List <ReservacionMesas>();
         reservaBindingSource.Clear();
         for (int i = 0; i < DatosEstaticos.reservacionesList.Count; i++)
         {
             if ((DatosEstaticos.reservacionesList[i].nombreCliente.ToUpper()).IndexOf(buscadorTb.Text.ToUpper()) == 0)
             {
                 reservaBindingSource.Add(DatosEstaticos.reservacionesList[i]);
             }
             if ((DatosEstaticos.reservacionesList[i].numMesa.ToString().ToUpper()).IndexOf(buscadorTb.Text.ToUpper()) == 0)
             {
                 reservaBindingSource.Add(DatosEstaticos.reservacionesList[i]);
             }
             if ((DatosEstaticos.reservacionesList[i].hora.ToUpper()).IndexOf(buscadorTb.Text.ToUpper()) == 0)
             {
                 reservaBindingSource.Add(DatosEstaticos.reservacionesList[i]);
             }
         }
         //productosDg.DataSource = productoBindingSource;
     }
     else
     {
         reservaBindingSource.Clear();
         foreach (ReservacionMesas item in DatosEstaticos.reservacionesList)
         {
             reservaBindingSource.Add(item);
         }
         reservacionesDg.DataSource = reservaBindingSource;
     }
 }
示例#7
0
        /// <summary>
        /// Implements a single user search by SAMAccountID.  No longer used, but left for an example
        /// </summary>
        /// <param name="userID">User ID for which to search</param>
        private void Single_User_Search(string userID)
        {
            //Clear the bindings
            userBinding.Clear();

            if (userID != "")
            {
                try
                {
                    //Add the user object if it's found
                    userBinding.Add(new ADUser(ad, ad.GetUser(userID)));
                }
                catch (ADNotFound ex)
                {
                    //Not found, write out a message
                    Write(ex.Message);
                }
                catch (Exception ex)
                {
                    //Unknown error, pop up an error box
                    Error_Message(ex.Message);
                }

                //Set the status box accordingly
                Set_Status("Search " + toSucceeded(userBinding.Count > 0));
            }

            //Update the display
            update_Display();
        }
示例#8
0
 private void BuscarProducto()
 {
     if (!string.IsNullOrWhiteSpace(buscarTb.Text))
     {
         List <Productos> tempList = new List <Productos>();
         productoBindingSource.Clear();
         for (int i = 0; i < DatosEstaticos.productosList.Count; i++)
         {
             if ((DatosEstaticos.productosList[i].nombre.ToUpper()).IndexOf(buscarTb.Text.ToUpper()) == 0)
             {
                 productoBindingSource.Add(DatosEstaticos.productosList[i]);
             }
             if ((DatosEstaticos.productosList[i].descripcion.ToUpper()).IndexOf(buscarTb.Text.ToUpper()) == 0)
             {
                 productoBindingSource.Add(DatosEstaticos.productosList[i]);
             }
         }
         //productosDg.DataSource = productoBindingSource;
     }
     else
     {
         productoBindingSource.Clear();
         foreach (Productos item in DatosEstaticos.productosList)
         {
             productoBindingSource.Add(item);
         }
         productosDg.DataSource = productoBindingSource;
     }
 }
示例#9
0
文件: Form1.cs 项目: czhhhhh/homework
        private void btnStart_Click(object sender, EventArgs e)
        {
            resultBindingSource.Clear();
            crawler.StartURL = txtUrl.Text;

            Match match = Regex.Match(crawler.StartURL, Crawler.urlParseRegex);

            if (match.Length == 0)
            {
                return;
            }
            string host = match.Groups["host"].Value;

            crawler.HostFilter = "^" + host + "$";
            crawler.FileFilter = ".html?$";

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            lblInfo.Text = "爬虫已启动....";
            crawler.Start();

            stopWatch.Stop();
            string time = stopWatch.ElapsedMilliseconds.ToString();

            timelable.Text = "Time: " + time;
        }
        private void btnStart_Click(object sender, EventArgs e)
        {
            resultBindingSource.Clear();
            crawler.StartURL = txtUrl.Text;

            Match match = Regex.Match(crawler.StartURL, Crawler.urlParseRegex);

            if (match.Length == 0)
            {
                return;
            }
            string host = match.Groups["host"].Value;

            crawler.HostFilter = "^" + host + "$";
            crawler.FileFilter = ".html?$";

            if (thread != null)
            {
                thread.Abort();
            }
            thread = new Thread(crawler.Start);
            thread.Start();
            lblInfo.Text = "爬虫已启动....";
            sw           = new Stopwatch();
            sw.Start();
        }
示例#11
0
        void BtnLoadClick(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Filter = "Json Files|*.json|All Files|*.*";
            if (rdbA.Checked == true)
            {
                if (open.ShowDialog() == DialogResult.OK)
                {
                    string sFileName = open.FileName;
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    StreamReader         reader     = new StreamReader(sFileName);
                    string json = reader.ReadToEnd();
                    reader.Close();
                    var deserializeObject = serializer.Deserialize <List <clsA> >(json);
                    source.Clear();
                    foreach (var element in deserializeObject)
                    {
                        source.Add(element);
                    }
                    MessageBox.Show("Load OK !");
                }
            }
            if (rdbB.Checked == true)
            {
                if (open.ShowDialog() == DialogResult.OK)
                {
                    string sFileName = open.FileName;
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    StreamReader         reader     = new StreamReader(sFileName);
                    string json = reader.ReadToEnd();
                    reader.Close();
                    var deserializeObject = serializer.Deserialize <List <clsB> >(json);
                    source.Clear();
                    foreach (var element in deserializeObject)
                    {
                        source.Add(element);
                    }
                    MessageBox.Show("Load OK !");
                }
            }
            if (rdbC.Checked == true)
            {
                if (open.ShowDialog() == DialogResult.OK)
                {
                    string sFileName = open.FileName;
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    StreamReader         reader     = new StreamReader(sFileName);
                    string json = reader.ReadToEnd();
                    reader.Close();
                    var deserializeObject = serializer.Deserialize <List <clsC> >(json);
                    source.Clear();
                    foreach (var element in deserializeObject)
                    {
                        source.Add(element);
                    }
                    MessageBox.Show("Load OK !");
                }
            }
        }
示例#12
0
        private void ReportDisplayForm_Load(object sender, EventArgs e)
        {
            reportViewer1.ProcessingMode = ProcessingMode.Local;

            if (_requestedReport == "TimecardRollup")
            {
                List <ReportParameter> rpList = new List <ReportParameter>();
                rpList.Add(new ReportParameter("ParamReportYear", "Year " + _reportParms[0]));
                rpList.Add(new ReportParameter("ParamReportWeekBegin", "Week " + _reportParms[1]));
                rpList.Add(new ReportParameter("ParamReportWeekEnd", "Week " + _reportParms[2]));

                // If we have 4 parameters then we are to display the Employee Rollup
                if (_reportParms.Length > 3)
                {
                    rpList.Add(new ReportParameter("ParamReportEmployee", "Employee " + _reportParms[3] + " " + _reportParms[4]));
                    reportViewer1.LocalReport.ReportPath = Directory.GetCurrentDirectory() + @"\Report5.rdlc";
                }
                else
                {
                    // We are to display the Timecard Rollup Report
                    reportViewer1.LocalReport.ReportPath = Directory.GetCurrentDirectory() + @"\Report3.rdlc";
                }
                reportViewer1.LocalReport.SetParameters(rpList.ToArray());

                _bindingSource.Clear();
                _bindingSource.DataSource = _rollupDataArray;
            }
            if (_requestedReport == "AllEmployees")
            {
                reportViewer1.LocalReport.ReportPath  = Directory.GetCurrentDirectory() + @"\Report4.rdlc";
                reportViewer1.LocalReport.DisplayName = "All Employees Report";

                _bindingSource.Clear();
                _bindingSource.DataSource = _allEmployeesArray;
            }
            if (_requestedReport == "ActiveTasksBudgetSummary")
            {
                reportViewer1.LocalReport.ReportPath  = Directory.GetCurrentDirectory() + @"\Report1.rdlc";
                reportViewer1.LocalReport.DisplayName = "All Active Tasks Budget Summary";

                _bindingSource.Clear();
                _bindingSource.DataSource = _taskArray;
            }

            _bindingSource.ResetBindings(false);

            ReportDataSource rds = new ReportDataSource();

            rds.Name  = "DataSet1";
            rds.Value = _bindingSource;
            reportViewer1.LocalReport.DataSources.Clear();
            reportViewer1.LocalReport.DataSources.Add(rds);

            this.reportViewer1.RefreshReport();
        }
示例#13
0
 private void btnProcess_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < dgJournals.Rows.Count; i++)
     {
         Journal journal = (Journal)bs[i];
         String  pString;
         String  pastelReturn = Controller.pastel.PostBatch(journal.trnDate, journal.buildPeriod, journal.trustPath, journal.buildPath, journal.trustType, journal.buildType, journal.bc, journal.buildAcc, journal.trustContra, journal.buildContra, journal.reference, journal.description, journal.amt, journal.trustAcc, journal.rAcc, out pString);
     }
     ClearForm();
     bs.Clear();
 }
示例#14
0
 //重置事件
 void Reset()
 {
     this.State = false;     //设置状态
     listAn.Clear();         //清空容器
     listSs.Clear();
     BS.Clear();             //清空数据绑定
     richTextBox1.Text = ""; //清空数据部分
     treeView.Nodes.Clear(); //清空解析节点部分
     toolStripComboBox1.Text = "";
     No       = 0;
     Filter   = "";
     FilterIP = "";
 }
示例#15
0
        /// <summary>
        /// This method calls WinFormStandardItems form as a dialog and
        /// on return from the form presents all items stored in the order in
        /// the data grid view.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void orderStdPizzaBtn_Click(object sender, EventArgs e)
        {
            WinFormStandardItems winFormStandardPizza = new WinFormStandardItems(this, customerOrder);

            winFormStandardPizza.ShowDialog();
            bs.Clear();
            foreach (OrderItem orderItem in customerOrder.getItems())
            {
                bs.Add(orderItem);
                Debug.WriteLine($"... adding order item to the list {orderItem.Name}!");
            }
            labelOrderCost.Text = customerOrder.getOrderPrice().ToString("C");
        }
示例#16
0
 private void новыйToolStripMenuItem_Click(object sender, EventArgs e)
 {
     source.Clear();
     source.Add(new Rabotnik("", "", new decimal[6], new DateTime()));
     dataGridView1.DataSource           = source;
     dataGridView1.Font                 = new Font("Arial", 10);
     dataGridView1.Visible              = true;
     сохранитьToolStripMenuItem.Visible = true;
     обработкаToolStripMenuItem.Visible = true;
     диаграммаToolStripMenuItem.Visible = true;
     label2.Visible         = true;
     numericUpDown2.Visible = true;
     numericUpDown2.Value   = source.Count;
 }
示例#17
0
        private void AllTableSummaryForm_Load(object sender, EventArgs e)
        {
            // generate summary data and bind to form
            dgViewSummary.AutoGenerateColumns = false;
            dgViewSummary.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;  // ColumnHeader;  //AllCells;

            InstallGridViewColumns();

            dgViewBindingSource.Clear();

            stripText.Text = "";

            LoadGrid();
        }
示例#18
0
        /// <summary>
        /// 当用户点击爬取按钮后就会调用该方法,对相应网址进行资源爬取
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CrawButton_Click(object sender, EventArgs e)
        {
            //每一次新爬取时清空上一次爬取记录的所有图片的index,避免下一次爬取保存index时出现错误
            pictureIndex.Clear();
            resourceBindingSource.Clear();
            saveResourceBindingSource.Clear();
            if (pictureBox.Count > 0)
            {
                for (int j = 0; j < pictureBox.Count; j++)
                {
                    pictureBox[j].Dispose();
                }
            }
            pictureBox.Clear();
            if (checkBoxes.Count > 0)
            {
                for (int j = 0; j < checkBoxes.Count; j++)
                {
                    checkBoxes[j].Dispose();
                }
            }
            checkBoxes.Clear();
            //每一次新爬取时都要把以前爬取得到的图片列表给清空
            CrawlerProject.ImgResourcesContainer.RowImages.Clear();
            CrawlerProject.ImgInputData.Url = this.urlTextBox.Text;
            //此处填入其他的输入
            //bool crawlResult = CrawlerService.StartCrawl(CrawlerProject/*,crawlerService*/);
            //此处填入其他的输入
            Crawl crawl = new Crawl(CrawlerProject);

            CrawlThread = new Thread(crawl.CrawlFun);
            CrawlThread.Start();
            //bool crawlResult = CrawlerService.StartCrawl(CrawlerProject/*,crawlerService*/);
            bool crawlResult = true;


            //if (!crawlResult)            //爬取失败
            //{
            //    //中间还应加上爬取失败的网址,这个网址要得到
            //    messageLabel.Text = this.urlTextBox.Text + "网页爬取失败";
            //}
            //else                //爬取成功
            //{
            //    //中间还应加上成功爬取的网址,这个网址要得到
            //    messageLabel.Text = this.urlTextBox.Text + "网页爬取成功";

            //}
        }
示例#19
0
        private void txtPOBillNo_ButtonCustomClick(object sender, EventArgs e)
        {
            frmSelectPurchaseOrder frmSelectPurchaseOrder = new frmSelectPurchaseOrder(false,
                                                                                       new ORD_PurchaseOrderParam()
            {
                StkInOccStatusArr = new string[] { "全部占有", "部分占有" }
            });

            frmSelectPurchaseOrder.SupplierID = txtSupplierID.Text.ToInt32();
            frmSelectPurchaseOrder.BringToFront();
            frmSelectPurchaseOrder.StartPosition = FormStartPosition.CenterScreen;

            DialogResult rst = frmSelectPurchaseOrder.ShowDialog();

            if (rst == DialogResult.OK)
            {
                List <ORD_PurchaseOrderResult> rstList = frmSelectPurchaseOrder.GetSelectList <ORD_PurchaseOrderResult>();
                if (rstList != null && rstList.Count > 0)
                {
                    bsPurchaseReturnLine.Clear();
                    tempList.Clear();
                    delList.Clear();
                    addOrModifyList.Clear();
                    ORD_PurchaseOrderResult orderResult = rstList[0];
                    InitSourceData(orderResult);
                }
            }
        }
示例#20
0
        private void RefreshProcessList()
        {
            _processList.Clear();
            List <ProcessGUIPresenter> innerList = new List <ProcessGUIPresenter>();

            _processList.SuspendBinding();
            try
            {
                foreach (Process process in Process.GetProcesses())
                {
                    try
                    {
                        if (!process.HasExited)
                        {
                            innerList.Add(new ProcessGUIPresenter(process));
                        }
                    }
                    catch
                    {
                        //nothing here : we are just on a gui tsting project
                    }
                }
                innerList.Sort((a, b) => a.ProcessName.CompareTo(b.ProcessName));
                _processList.DataSource = innerList;
            }
            finally
            {
                _processList.ResumeBinding();
            }
        }
示例#21
0
        //Relleno de productos a los grid de las fichas
        public void RellenarProductos()
        {
            float totalPagar = 0;

            if (DatosEstaticos.fichaSeleccionada != null)
            {
                productoBindingSource.Clear();
                foreach (var item in DatosEstaticos.fichaSeleccionada.productos)
                {
                    totalPagar += item.precio;
                    productoBindingSource.Add(item);
                }
                productosClienteDg.DataSource = productoBindingSource;
                totalPagoLb.Text = totalPagar.ToString();
            }
        }
示例#22
0
        //private void FillRekapTotalTransactionByItemDataSource(string transStatus)
        //{
        //    bs = new BindingSource();
        //    bs.Clear();
        //    if (!transStatus.Equals(lbl_Param1.Name))
        //        bs.DataSource = DataMaster.GetListEq(typeof(VTotalTransactionByItem), VTotalTransactionByItem.ColumnNames.TransactionStatus, transStatus);
        //    else
        //        bs.DataSource = DataMaster.GetAll(typeof(VTotalTransactionByItem));

        //    reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Inventori_Data_VTotalTransactionByItem", bs));
        //}

        private void FillTransactionTotalSource(string transStatus, DateTime from, DateTime to)
        {
            bs = new BindingSource();
            bs.Clear();
            if (!transStatus.Equals(lbl_Param1.Name))
            {
                bs.DataSource = DataMaster.GetListBetweenEqValue(typeof(VTotalTransactionDetail), VTotalTransactionDetail.ColumnNames.TransactionDate, from, to, VTotalTransactionDetail.ColumnNames.TransactionStatus, transStatus);
            }
            else
            {
                bs.DataSource = DataMaster.GetListBetweenValue(typeof(VTotalTransactionDetail), VTotalTransactionDetail.ColumnNames.TransactionDate, from, to);
            }

            reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Inventori_Data_VTotalTransactionDetail", bs));

            ReportParameter[] parameters = new ReportParameter[3];
            parameters[0] = new ReportParameter("Report_Parameter_DateFrom", from.ToString("f"));
            parameters[1] = new ReportParameter("Report_Parameter_DateTo", to.ToString("f"));
            parameters[2] = new ReportParameter("Report_Parameter_Status", transStatus);
            reportViewer1.LocalReport.SetParameters(parameters);

            bs = new BindingSource();
            bs.Clear();
            if (transStatus.Equals(lbl_Param1.Name) || transStatus.Equals(ListOfTransaction.Sales.ToString()) || transStatus.Equals(ListOfTransaction.SalesVIP.ToString()))
            {
                bs.DataSource = DataMaster.GetListBetweenEqValue(typeof(TTransaction), TTransaction.ColumnNames.TransactionDate, from, to, TTransaction.ColumnNames.TransactionStatus, ListOfTransaction.Sales.ToString());
            }
            else
            {
                bs.DataSource = DataMaster.GetListBetweenEqValue(typeof(TTransaction), TTransaction.ColumnNames.TransactionDate, from, to, TTransaction.ColumnNames.TransactionStatus, transStatus);
            }

            reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("Inventori_Data_TTransaction", bs));
        }
示例#23
0
        private void payButton_Click(object sender, EventArgs e)
        {
            if (cartBindingSource.List.Count <= 0)
            {
                MessageBox.Show("Количката е празна.");
                return;
            }

            if (totalAmount > SessionHelper.CurrentLoggedClient.Balance)
            {
                MessageBox.Show("Нямате достатъчно пари. Моля, изберете по-малко продукти.");
                return;
            }

            foreach (var product in cartBindingSource.List as ICollection <Product> )
            {
                dbo.MakeSale(product.ID, product.QuantityInStock, SessionHelper.CurrentLoggedClient.ID);
            }

            cartBindingSource.Clear();
            this.RefreshTotalAmount();
            SessionHelper.RefreshCurrentLoggedClient();
            this.LoadClientInfo();
            this.RefreshProductsTable();
        }
示例#24
0
        private void ButtonStart_Click(object sender, EventArgs e)
        {
            resultBindingSource.Clear();
            crawler.StartURL = textStartURL.Text;
            int maxnumber;

            int.TryParse(textmax.Text, out maxnumber);
            crawler.MaxPage = maxnumber;

            Match match = Regex.Match(crawler.StartURL, Crawler.urlParseRegex);

            if (match.Length == 0)
            {
                return;
            }
            string host = match.Groups["host"].Value;

            crawler.HostFilter = "^" + host + "$";
            crawler.FileFilter = "((.html?|.aspx|.jsp|.php)$|^[^.]+$)";

            if (thread != null)
            {
                thread.Abort();
            }
            thread = new Thread(crawler.Excute);
            thread.Start();
            statelabel.Text = "爬虫已启动....";
        }
        public void initializationInvestProject()
        {
            BindingSource    bindingSource = new BindingSource();
            InvestProjectDAO dao           = new InvestProjectDAO();

            bindingSource.Clear();
            bindingSource.DataSource          = dao.getAll();
            dataGridInvestProject.DataSource  = bindingSource;
            bindingSource.CurrentItemChanged += BindingSource_CurrentItemChanged;

            if ((ScrollIndex >= 0) && (dataGridInvestProject.Rows.Count > 0))
            {
                dataGridInvestProject.FirstDisplayedScrollingRowIndex = ScrollIndex;
            }
            if (BookMarkInvestProject != 0)
            {
                dataGridInvestProject.Rows[BookMarkInvestProject].Selected = true;
                bindingSource.Position = BookMarkInvestProject;
            }
            else
            {
                if (bindingSource.Count > 0)
                {
                    bindingSource.MoveNext();
                    bindingSource.MoveFirst();
                }
                //dataGridInvestProject.Rows[1].Selected = true;
            }
        }
示例#26
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            NowIndex = 0;
            resultBindingSource.Clear();
            crawler.StartURL = txtUrl.Text;

            Match match = Regex.Match(crawler.StartURL, Crawler.urlParseRegex);

            if (match.Length == 0)
            {
                return;
            }
            string host = match.Groups["host"].Value;

            crawler.HostFilter = "^" + host + "$";
            crawler.FileFilter = "((.html?|.aspx|.jsp|.php)$|^[^.]+$)";
            //crawler.Start();
            if (thread != null)
            {
                thread.Abort();
            }
            thread = new Thread(crawler.Start);
            thread.Start();
            //Task.Run(() => crawler.Start());
            lblInfo.Text = "爬虫已启动....";
        }
        public void RefreshAll()
        {
            bs.Clear();
            customers     = new Customer().GetCustomers();
            bs.DataSource = customers;
            dgView_Customers.DataSource = bs;

            cbUpdateCustomer.DataSource    = bs;
            cbUpdateCustomer.DisplayMember = "Name";

            cbDeleteCustomer.DataSource    = bs;
            cbDeleteCustomer.DisplayMember = "Name";

            bsProductList.Clear();
            catalogue = new Product().GetProducts();
            bsProductList.DataSource = catalogue;

            lsBoxPurchaseProducts.DataSource    = bsProductList;
            lsBoxPurchaseProducts.DisplayMember = "ProductSuite";

            lsBoxClientNames.DataSource    = bs;
            lsBoxClientNames.DisplayMember = "Name";

            RefreshOwnedProducts();
            RefreshAllProducts();
            RefreshCustomers();
        }
示例#28
0
        private void FillDataSource()
        {
            if (bindSource.Count != 0)
            {
                bindSource.Clear();
            }

            //Sort by AverageSalary, then by LastName
            List <Employee> filteredEmployeeList = new List <Employee>(Employees);

            filteredEmployeeList.OrderBy(zx => zx.AverageSalary).ThenBy(xz => xz.LastName);

            if (checkBoxFirst5.Checked)
            {
                filteredEmployeeList = filteredEmployeeList.Take(5).ToList();
            }

            if (checkBoxLast3.Checked)
            {
                filteredEmployeeList = filteredEmployeeList.OrderByDescending(zx => zx.EmployeeId).Take(3).ToList();
            }

            foreach (var bindItem in filteredEmployeeList)
            {
                bindSource.Add(bindItem);
            }
        }
示例#29
0
 private void New_PhieuNhap()
 {
     lblIdlapphieu.Text   = PhieuNhapBUL.Instance.Get_NewId();
     lblNgaylapphieu.Text = DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt");
     tbxGhichu.Clear();
     source.Clear();
 }
示例#30
0
        private void OpenBones(string path)
        {
            data.Clear();
            if (File.Exists(path))
            {
                using (TextReader tr = new StreamReader(path))
                {
                    string line;
                    while ((line = tr.ReadLine()) != null)
                    {
                        if (line.StartsWith("//") ||
                            line.StartsWith(";") ||
                            line.StartsWith("#") ||
                            line.StartsWith("\""))
                        {
                            continue;
                        }

                        string[] row = line.Split(',');
                        try
                        {
                            var joint = new JointConfigure(row);
                            data.Add(joint);
                        }
                        catch (Exception e)
                        {
                            log.WriteLine("ボーン構造読み取りエラー: " + line);
                        }
                    }
                }
            }
        }