Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            CCSpecialEntities context = new CCSpecialEntities();

            int count = context.Ecolabpos.Count();

            var ctx = new CCSpecialEntities();

            var griddata = ctx.Ecolabpos.AsEnumerable().OrderBy(n => n.SHIPTO).ThenBy(n => n.DUEDATE);

            // Insert Code to convert griddata to DataTable


            //dataGridView1.DataSource = griddata;

            List <Ecolabpo> EPO = new List <Ecolabpo>();



            foreach (Ecolabpo row in griddata)
            {
                Ecolabpo Object = new Ecolabpo();

                Object.PART = row.PART;
                EPO.Add(Object);
            }


            dataGridView1.DataSource = EPO;
        }
Esempio n. 2
0
        private void btnGenerateList_Click(object sender, EventArgs e)
        {
            List <EmailData> datalist = new List <EmailData>();

            datalist.Add(new EmailData {
                FirstName = "John", LastName = "Smith"
            });
            datalist.Add(new EmailData {
                FirstName = "Mark", LastName = "Robin"
            });
            datalist.Add(new EmailData {
                FirstName = "Don", LastName = "Adems"
            });


            CCSpecialEntities context = new CCSpecialEntities();

            int count = context.Ecolabpos.Count();

            var       ctx       = new CCSpecialEntities();
            var       griddata  = ctx.Ecolabpos.ToList().OrderBy(n => n.SHIPTO).ThenBy(n => n.DUEDATE);
            DataTable dbdataset = new DataTable();

            dbdataset = (DataTable)griddata;

            BindingSource bSource = new BindingSource();


            dataGridView1.DataSource = dbdataset;
        }
Esempio n. 3
0
        public void openPartBase()
        {
            using (var context = new CCSpecialEntities())
            {
                DataTable dt = ParseDBF.ReadDBF(partbasepath);
                //grdDBF.DataSource = dt;
                JobNumber    = dt.Rows.OfType <DataRow>().Select(k => k[0].ToString()).ToArray();
                Unit         = dt.Rows.OfType <DataRow>().Select(k => k[1].ToString()).ToArray();
                PartNumber   = dt.Rows.OfType <DataRow>().Select(k => k[2].ToString().Trim()).ToArray();
                Desc         = dt.Rows.OfType <DataRow>().Select(k => k[3].ToString()).ToArray();
                Price        = dt.Rows.OfType <DataRow>().Select(k => k[4].ToString()).ToArray();
                PartsOnShelf = dt.Rows.OfType <DataRow>().Select(k => k[5].ToString()).ToArray();
                PartBin      = dt.Rows.OfType <DataRow>().Select(k => k[6].ToString()).ToArray();

                int Max = JobNumber.Length;

                int   OnShelf_ = 0;
                float Float_   = 0;

                var partbaserecords = context.PARTBASEs.ToList();

                //List<PARTBASE> NewRecordList = new List<PARTBASE>();
                PARTBASE row = new PARTBASE();

                for (int i = 1; i < Max; i++)
                {
                    row = partbaserecords.FirstOrDefault(x => PartNumber[i] == x.PartNumber.Trim());
                    if (row != null)
                    {
                        Int32.TryParse(PartsOnShelf[i], out OnShelf_);
                        row.OnShelf   = OnShelf_;
                        row.BoxNumber = PartBin[i];
                    }
                    else
                    {
                        PARTBASE NewRow = new PARTBASE();

                        float.TryParse(JobNumber[i], out Float_);
                        NewRow.JobNumber = (decimal)Float_;

                        NewRow.Unit = Unit[i];

                        NewRow.PartNumber  = PartNumber[i];
                        NewRow.Description = Desc[i];

                        float.TryParse(Price[i], out Float_);
                        NewRow.Price = (decimal)Float_;

                        Int32.TryParse(PartsOnShelf[i], out OnShelf_);
                        NewRow.OnShelf = OnShelf_;

                        NewRow.PartBaseID = Guid.NewGuid();

                        NewRow.BoxNumber = PartBin[i];

                        context.AddToPARTBASEs(NewRow);
                    }
                }
                // Update changes to PARTBASE SQL Table
                context.SaveChanges();
            }
        }