예제 #1
0
        private void combo_selection()
        {
            string pck = package.SelectedItem.ToString();

            try
            {
                string querry = "Select Package_price,Package_DeliveryDays from CMS_Package where Package_Description=@pck ";

                SqlCommand cmd = new SqlCommand(querry);
                cmd.Parameters.AddWithValue("@pck", pck);
                SqlConnection con = Conn.Connection();

                cmd.Connection = con;

                try
                {
                    con.Open();



                    SqlDataReader rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        float initial_price = Convert.ToInt16(rdr[0]);
                        int   package_days  = Convert.ToInt16(rdr[1]);


                        double finalprice = Convert.ToDouble(txt_send_add_pckg_w.Text) * initial_price;
                        txt_price.Text = "" + finalprice;
                        DateTime td = DateTime.Now.AddDays(package_days);
                        txt_receive_add_date.Text = "" + td.Date.ToString("MM/dd/yyyy");
                    }
                }
                catch (Exception c)
                {
                }
                finally
                {
                    con.Close();
                }
            }
            catch (Exception cc)
            {
            }
        }
예제 #2
0
        private void package_combo()
        {
            if (package.Items.Count == 0)
            {
                try
                {
                    string querry = "Select Package_Description from CMS_Package ";

                    SqlCommand cmd = new SqlCommand(querry);

                    SqlConnection con = Conn.Connection();

                    cmd.Connection = con;

                    try
                    {
                        con.Open();



                        SqlDataReader rdr = cmd.ExecuteReader();

                        while (rdr.Read())
                        {
                            package.Items.Add(rdr[0].ToString());
                        }
                    }
                    catch (Exception c)
                    {
                    }
                    finally
                    {
                        con.Close();
                    }
                }
                catch (Exception)
                {
                }
            }
        }