Exemplo n.º 1
0
        private String Konek()
        {
            String   konek = "";
            MainMenu frm   = new MainMenu();

            konek = frm.Konek();
            return(konek);
        }
Exemplo n.º 2
0
        public String Konek()
        {
            MainMenu frm = new MainMenu();

            return(frm.Konek());
        }
Exemplo n.º 3
0
        public String get_number_sequence_packinglist()
        {
            List <object[]> data       = new List <object[]>();
            MainMenu        frm        = new MainMenu();
            String          connString = frm.Konek();
            MySqlConnection conn3      = null;

            conn3 = new MySqlConnection(connString);
            conn3.Open();
            MySqlCommand cmd = new MySqlCommand("", conn3);

            cmd.CommandText = "select * from shipping_unit where year(shipdate)=@tahun order by id desc";
            DateTime myDateTime = DateTime.Now;
            Int32    tahun      = myDateTime.Year;

            cmd.Parameters.AddWithValue("@tahun", tahun);

            MySqlDataReader rdr = cmd.ExecuteReader();
            int             a;

            int     temp;
            String  pl     = "";
            String  seq    = "";
            Boolean status = false;

            while (rdr.Read())
            {
                if (rdr.IsDBNull(0))
                {
                    a = 0;
                }
                else
                {
                    a = 1;
                }

                pl     = rdr.GetString("shipping_unit_number");
                seq    = Right(pl, 3);
                status = int.TryParse(seq, out temp);

                if (status == true)
                {
                    object[] tempRow = new object[rdr.FieldCount];
                    for (int i = 0; i < rdr.FieldCount; i++)
                    {
                        tempRow[i] = rdr[i];
                    }
                    data.Add(tempRow);
                }
            }



            String plno      = "";
            String urut      = "";
            Int32  urutint   = 0;
            String uruthasil = "";

            if (data.Count > 0)
            {
                plno    = data[0][1].ToString();
                urut    = Right(plno, 3);
                urutint = Int32.Parse(urut) + 1;


                if (urutint.ToString().Length == 3)
                {
                    uruthasil = urutint.ToString();
                }
                else if (urutint.ToString().Length == 2)
                {
                    uruthasil = "0" + urutint.ToString();
                }
                else if (urutint.ToString().Length == 1)
                {
                    uruthasil = "00" + urutint.ToString();
                }
            }
            else
            {
                uruthasil = "001";
            }

            conn3.Close();
            return(uruthasil);
        }
Exemplo n.º 4
0
        private String Konek()
        {
            MainMenu frm = new MainMenu();

            return(frm.Konek());
        }