示例#1
0
        private void updateStoringJob()
        {
            StoringJob sj = new StoringJob();

            sj.Id          = sj1.Id;
            sj.Description = textBox1.Text;
            string idStr = cbHarvest.Text.Split('.')[0];

            sj.Harvest_id = int.Parse(idStr);
            string idStr1 = cbCrop.Text.Split('.')[0];

            sj.Crop_id = int.Parse(idStr1);
            string idStr2 = cbBox.Text.Split('.')[0];

            sj.Box_id   = int.Parse(idStr2);
            sj.Quantity = int.Parse(textBox5.Text);
            string idStr3 = cbVehicle.Text.Split('.')[0];

            sj.Vehicle_id = int.Parse(idStr3);
            string idStr4 = cbEmployee.Text.Split('.')[0];

            sj.Employee_id = int.Parse(idStr4);
            sj.Date_start  = Convert.ToDateTime(dtpStart.Text);
            sj.Date_end    = Convert.ToDateTime(dtpEnd.Text);

            UpdateSQL update = new UpdateSQL();

            update.updateStoringJob(sj);
            MessageBox.Show(" Your record is added");
            this.Close();
        }
示例#2
0
        public static List <string> getStoringJobList()
        {
            StoringJob      storing = new StoringJob();
            List <string>   flist   = new List <string>();
            MySqlDataReader rdr     = null;

            try
            {
                string tableName = "storingjob";
                string query     = "SELECT * FROM " + tableName;

                MySqlCommand cmd = new MySqlCommand(query, MysqlDbc.Instance.getConn());
                rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    storing.Description = rdr.GetString("description");
                    flist.Add(storing.Description);
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());
            }
            finally
            {
                if (rdr != null)
                {
                    rdr.Close();
                }
            }

            return(flist);
        }
示例#3
0
        public StoringJob GetStoringJobFromID(int itemId)
        {
            StoringJob ss1 = new StoringJob();

            MySqlDataReader rdr = null;

            try
            {
                string tableName = "storingjob";
                string query     = "SELECT * FROM " + tableName + " WHERE id = " + itemId;

                MySqlCommand cmd = new MySqlCommand(query, MysqlDbc.Instance.getConn());
                rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    ss1.Id          = itemId;
                    ss1.Description = rdr.GetString("description");
                    ss1.Harvest_id  = rdr.GetInt32("harvest_id");
                    ss1.Crop_id     = rdr.GetInt32("crop_id");
                    ss1.Box_id      = rdr.GetInt32("box_id");
                    ss1.Quantity    = rdr.GetInt32("quantity");
                    ss1.Vehicle_id  = rdr.GetInt32("vehicle_id");
                    ss1.Employee_id = rdr.GetInt32("employee_id");
                    ss1.Date_start  = rdr.GetDateTime("date_start");
                    ss1.Date_end    = rdr.GetDateTime("date_end");
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());
            }
            finally
            {
                if (rdr != null)
                {
                    rdr.Close();
                }
            }

            return(ss1);
        }