public void Check_Management_save()
        {
            //arrange
            Kustia_Trading_Agency_Management_Entity information = new Kustia_Trading_Agency_Management_Entity();
            Kustia_Trading_Agency_Management_BL     kta_bl      = new Kustia_Trading_Agency_Management_BL();

            //act
            information.truck_number  = "KST-11-1392";
            information.ship_name     = "Pirireis";
            information.loading_point = "RVJ";
            information.customer      = "Arpon";
            information.destination   = "Nilphamari";
            string price = "21.5";

            information.price = float.Parse(price);
            information.sacks = 50;
            string mton = "5.0";

            information.m_ton = float.Parse(mton);
            float amnt = 800;
            float n    = (amnt - information.amt);

            information.avamt = n.ToString();

            Boolean t = kta_bl.setManagementData(information);

            //assert
            Assert.AreEqual(true, t);
        }
        public bool set_management_data(Kustia_Trading_Agency_Management_Entity information)
        {
            try
            {
                cmd2.Connection = cn;
                cn.Open();
                cmd2.CommandText = "SELECT id FROM tbl_customer WHERE name = '" + information.customer + "'";
                sdr = cmd2.ExecuteReader();
                sdr.Read();
                string id = sdr["id"].ToString();

                cn.Close();
                amt_update_ship(information);
                //MessageBox.Show(id);

                int customer_id = int.Parse(id);


                SqlCommand cmd = new SqlCommand("INSERT INTO tbl_shifting(truck_number , ship_name,date , loading_point ,destination , price ,sacks , m_ton ,customerId  ) VALUES('" + information.truck_number + "','" + information.ship_name + "','" + DateTime.Now.ToString("dd-MM-yyyy") + "','" + information.loading_point + "' , '" + information.destination + "' , '" + information.price + "', '" + information.sacks + "' , '" + information.m_ton + "', '" + customer_id + "')", cn);

                cmd.Connection = cn;
                cn.Open();

                cmd.ExecuteNonQuery();
                cn.Close();
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
        private void fill_grid_view()
        {
            Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
            Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
            DataSet n = kta_bl.dailyReport(information1);

            dataGridView1.DataSource = n;
            dataGridView1.DataMember = "ship_name";
        }
        private void fill_grid_view()
        {
            Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
            Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
            DataSet n = kta_bl.available_truck(information1);

            truck_dataGridView.DataSource = n;
            truck_dataGridView.DataMember = "truck_number";
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Kustia_Trading_Agency_Management_Entity information = new Kustia_Trading_Agency_Management_Entity();
            Kustia_Trading_Agency_Management_BL     kta_bl      = new Kustia_Trading_Agency_Management_BL();

            information.amt = float.Parse(textBox2.Text);
            if (information.amt < amnt)
            {
                if (comboBox1.Text == "" || comboBox2.Text == "" || comboBox3.Text == "" || comboBox4.Text == "" || textBox2.Text == "")
                {
                    MessageBox.Show("All text Box have to be filled!!!");
                }

                else
                {
                    //float txbamt = float.Parse(textBox2.Text);

                    information.truck_number  = comboBox3.Text;
                    information.ship_name     = comboBox1.Text;
                    information.loading_point = comboBox2.Text;
                    information.customer      = comboBox4.Text;
                    information.destination   = textBox5.Text;
                    string price = textBox3.Text;
                    information.price = float.Parse(price);
                    information.sacks = int.Parse(textBox1.Text);
                    information.m_ton = float.Parse(textBox2.Text);
                    float n = (amnt - information.amt);
                    information.avamt = n.ToString();
                    //Kustia_Trading_Agency_Management_BL kta_bl = new Kustia_Trading_Agency_Management_BL();
                    if (kta_bl.setManagementData(information))
                    {
                        MessageBox.Show("Data Saved Successfully!!");
                        comboBox1.Text = "";
                        comboBox2.Text = "";
                        comboBox3.Text = "";
                        comboBox4.Text = "";
                        textBox1.Text  = "";
                        textBox2.Text  = "";
                        textBox3.Text  = "";
                        textBox5.Text  = "";
                        label12.Text   = "";
                        label13.Text   = "";
                        label5.Text    = "";
                    }
                    else
                    {
                        MessageBox.Show("Wrong Entry!!");
                    }
                    // MessageBox.Show("Your Carring amount is greater than available amount!!");
                }
            }
            else
            {
                MessageBox.Show("Your entered amount is larger than available product!!");
            }
        }
        public DataSet available_truck(Kustia_Trading_Agency_Management_Entity information)
        {
            cmd.Connection = cn;
            cn.Open();
            string         sql         = "SELECT truck_number,driver_name FROM tbl_truck WHERE  truck_number not in (SELECT truck_number  FROM tbl_shifting WHERE date = '" + DateTime.Now.ToString("dd-MM-yyyy") + "')";
            SqlDataAdapter dataadapter = new SqlDataAdapter(sql, cn);
            DataSet        ds          = new DataSet();

            dataadapter.Fill(ds, "truck_number");
            cn.Close();
            return(ds);
        }
        public DataSet dailyReport(Kustia_Trading_Agency_Management_Entity information)
        {
            cmd.Connection = cn;
            cn.Open();
            string         sql         = "SELECT ship_name,truck_number,loading_point,destination,price,sacks,m_ton,date FROM tbl_shifting WHERE  date  = '" + DateTime.Now.ToString("dd-MM-yyyy") + "'";
            SqlDataAdapter dataadapter = new SqlDataAdapter(sql, cn);
            DataSet        ds          = new DataSet();

            dataadapter.Fill(ds, "ship_name");
            cn.Close();
            return(ds);
        }
        public DataSet accodingDate(Kustia_Trading_Agency_Management_Entity information)
        {
            cmd.Connection = cn;
            cn.Open();
            string         sql         = "SELECT * FROM tbl_shifting WHERE  date  = '" + DateTime.Now.ToString("dd-MM-yyyy") + "'";
            SqlDataAdapter dataadapter = new SqlDataAdapter(sql, cn);
            DataSet        ds          = new DataSet();

            dataadapter.Fill(ds, "ship_name");
            cn.Close();
            return(ds);
        }
        public void Check_Add_Truck()
        {
            //arrange
            Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
            Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();

            information1.truck_number = "KST-11-1392";
            information1.driver_name  = "Mr. x";
            //act
            bool t = kta_bl.addTruck(information1);

            //assert
            Assert.AreEqual(true, t);
        }
        public void Check_Customer_Place()
        {
            //arrange
            Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
            Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();

            information1.cus_name = "Arpon";

            //act
            string n = kta_bl.destination(information1);

            //assertS
            Assert.AreEqual("Khulna", n);
        }
Ejemplo n.º 11
0
 void destination()
 {
     try
     {
         Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
         Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
         information1.cus_name = comboBox4.Text;
         string n = kta_bl.destination(information1);
         textBox5.Text = n;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
        public void Check_Add_Ship()
        {
            //arrange
            Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
            Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();

            //act
            information1.ship_name = "Sundorbon";
            information1.amount    = "500";

            bool t = kta_bl.addShip(information1);

            //assert
            Assert.AreEqual(true, t);
        }
        public void Check_Add_Driver()
        {
            //arrange
            Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
            Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();

            information1.driver_name   = "Mr. x";
            information1.mobile_number = "12345678912";
            information1.address       = "Dhaka";
            //act
            bool t = kta_bl.addDriver(information1);

            //assert
            Assert.AreEqual(true, t);
        }
        public void  Check_Add_Customer()
        {
            Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
            Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();

            information1.cus_name    = "aaa";
            information1.cus_mob_no  = "xxx";
            information1.cus_address = "zzz";

            //act
            bool t = (kta_bl.addCustomer(information1));


            //assert
            Assert.AreEqual(true, t);
        }
 public void update_customer(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "UPDATE tbl_customer SET mobile ='" + information.cus_mob_no + "', address ='" + information.cus_address + "' WHERE name = '" + information.cus_name + "'";
         SqlDataReader rd = cmd.ExecuteReader();
         MessageBox.Show("Update Successfull !!");
         cn.Close();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         MessageBox.Show("bal");
     }
 }
Ejemplo n.º 16
0
 void amount()
 {
     try
     {
         Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
         Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
         information1.ship_name = comboBox1.Text;
         string n = kta_bl.amount(information1);
         amnt        = float.Parse(n);
         label5.Text = "Available : " + amnt;
         // label5.Text = n;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
 void truck_number()
 {
     try
     {
         Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
         Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
         information1.driver_name = comboBox2.Text;
         string n = kta_bl.truck_number(information1);
         // amnt = float.Parse(n);
         // label5.Text = "Available : " + amnt;
         // label5.Text = n;
         comboBox3.Text = n;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
 public bool addTruck(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "INSERT INTO tbl_truck(truck_number, driver_name) VALUES('" + information.truck_number + "','" + information.driver_name + "')";
         cmd.ExecuteNonQuery();
         cn.Close();
         MessageBox.Show("Data Saved Successfully!!");
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("" + ex);
         return(false);
     }
 }
 private void Update_button_Click(object sender, EventArgs e)
 {
     try
     {
         Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
         Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
         information1.truck_number = comboBox3.Text;
         information1.driver_name  = comboBox2.Text;
         kta_bl.update_truck(information1);
         // amnt = float.Parse(n);
         //label5.Text = "Available : "+amnt;
         // label5.Text = n;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
 public bool addCustomer(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "INSERT INTO tbl_customer(name,mobile,address) VALUES('" + information.cus_name + "','" + information.cus_mob_no + "','" + information.cus_address + "')";
         cmd.ExecuteNonQuery();
         cn.Close();
         MessageBox.Show("Data Saved Successfully!!");
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("" + ex);
         return(false);
     }
 }
 public void update_ship(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "UPDATE tbl_ship SET amount ='" + information.amount + "' WHERE name = '" + information.ship_name + "'";
         SqlDataReader rd = cmd.ExecuteReader();
         MessageBox.Show("Update Successfull !!");
         cn.Close();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         MessageBox.Show("bal");
         // return information;
     }
 }
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
         Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
         information1.ship_name = comboBox1.Text;
         information1.amount    = textBox3.Text;
         kta_bl.update_ship(information1);
         comboBox1.Text = "";
         textBox3.Text  = "";
         // textBox6.Text = "";
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
 public void update_driver(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "UPDATE tbl_profile SET mobile_number ='" + information.mobile_number + "', address ='" + information.address + "' WHERE name = '" + information.driver_name + "'";
         SqlDataReader rd = cmd.ExecuteReader();
         MessageBox.Show("Update Successfull !!");
         cn.Close();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         MessageBox.Show("bal");
         // return information;
     }
 }
Ejemplo n.º 24
0
 void fill_combobox2()
 {
     try
     {
         Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
         Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
         Kustia_Trading_Agency_Management_Entity information2 = new Kustia_Trading_Agency_Management_Entity();
         information2 = kta_bl.load_truck_in_combobox(information1);
         int len = information2.truckNumber.Length;
         for (int i = 0; i < len; i++)
         {
             comboBox3.Items.Add(information2.truckNumber[i]);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
 public string truck_number(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "SELECT truck_number FROM tbl_truck WHERE  driver_name = '" + information.driver_name + "'";
         sdr             = cmd.ExecuteReader();
         sdr.Read();
         string n = sdr["truck_number"].ToString();
         cn.Close();
         return(n);
     }
     catch (Exception ex)
     {
         MessageBox.Show("" + ex);
         return(n);
     }
 }
 public Kustia_Trading_Agency_Management_Entity product(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "SELECT amount FROM tbl_ship WHERE  name = '" + information.ship_name + "'";
         sdr             = cmd.ExecuteReader();
         sdr.Read();
         information.amount = sdr["amount"].ToString();
         cn.Close();
         return(information);
     }
     catch (Exception ex)
     {
         MessageBox.Show("" + ex);
         return(information);
     }
 }
 public string destination(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "SELECT address FROM tbl_customer WHERE name = '" + information.cus_name + "'";
         sdr             = cmd.ExecuteReader();
         sdr.Read();
         string des = sdr["address"].ToString();
         cn.Close();
         return(des);
     }
     catch (Exception ex)
     {
         MessageBox.Show("" + ex);
         return(n);
     }
 }
        public void delete_customer(Kustia_Trading_Agency_Management_Entity information)
        {
            try
            {
                cmd.Connection = cn;
                cn.Open();
                cmd.CommandText = "DELETE FROM tbl_customer WHERE  name ='" + information.cus_name + "' ";
                SqlDataReader rd = cmd.ExecuteReader();

                MessageBox.Show("Delete Successfull !!");
                cn.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                MessageBox.Show("bal");
                // return information;
            }
        }
Ejemplo n.º 29
0
 void fill_combobox4()
 {
     try
     {
         Kustia_Trading_Agency_Management_BL     kta_bl       = new Kustia_Trading_Agency_Management_BL();
         Kustia_Trading_Agency_Management_Entity information1 = new Kustia_Trading_Agency_Management_Entity();
         Kustia_Trading_Agency_Management_Entity information2 = new Kustia_Trading_Agency_Management_Entity();
         information2 = kta_bl.customer_in_combobox(information1);
         int len = information2.customerName.Length;
         for (int i = 0; i < len; i++)
         {
             comboBox4.Items.Add(information2.customerName[i]);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
 public Kustia_Trading_Agency_Management_Entity cus_details(Kustia_Trading_Agency_Management_Entity information)
 {
     try
     {
         cmd.Connection = cn;
         cn.Open();
         cmd.CommandText = "SELECT mobile, address FROM [tbl_customer] WHERE  name = '" + information.cus_name + "'";
         sdr             = cmd.ExecuteReader();
         sdr.Read();
         information.cus_mob_no  = sdr["mobile"].ToString();
         information.cus_address = sdr["address"].ToString();
         cn.Close();
         return(information);
     }
     catch (Exception ex)
     {
         MessageBox.Show("" + ex);
         return(information);
     }
 }