예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (context == null)
            {
                context = new SaalutDataClasses1DataContext();
            }

            Int32.TryParse(Request.QueryString["ID"], out jourID);

            if (jourID == 0)
            {
                Response.Redirect("~/SkladTSD/Default.aspx");
            }

            JourNumLabel1.Text = "Журнал N " + jourID.ToString();
            Page.Title         = "Журнал N " + jourID.ToString();

            JourLinesLinqDataSource1.WhereParameters[0].DefaultValue = jourID.ToString();

            BarcodeTextBox1.Focus();
            if (!IsPostBack)
            {
                BarcodeTextBox2.Text = "1";
            }
        }
예제 #2
0
 protected void DeleteBCImageButton1_Click(object sender, ImageClickEventArgs e)
 {
     PriceLabel1.Text     = "";
     BarcodeTextBox1.Text = "";
     BarcodeTextBox1.Focus();
 }
예제 #3
0
        protected void BarcodeTextBox1_TextChanged(object sender, EventArgs e)
        {
            string barcodeText = BarcodeTextBox1.Text.Trim();

            var store = (from s in context.StoreInfos
                         where s.Active == true
                         select s).FirstOrDefault();

            var barcode = (from p in context.Barcodes
                           where p.Barcode1 == barcodeText &&
                           p.Active == true    // bug fix barkode
                           select p).FirstOrDefault();

            if (barcode == null)
            {
                PriceLabel1.Text            = "Ш/К не найден.";
                AddToJournalButton1.Enabled = false;
                PrintRightNow.Enabled       = false;
                BarcodeTextBox1.Text        = "";
                BarcodeTextBox1.Focus();
                return;
            }


            // цены укм
            // Create a connection object and data adapter
            DataTable       prices;
            decimal         price = 0;
            MySqlConnection cnx   = null;

            try
            {
                cnx = new MySqlConnection(connStr);
                MySqlDataAdapter adapter = new MySqlDataAdapter();

                // Prices
                string       cmdText = "select item, price, version, deleted	from ukmserver.trm_in_pricelist_items where item = '"+ barcode.Good.Articul + "' and pricelist_id = '" + store.PriceList_ID_UKM.ToString() + "'  and deleted = 0 ";
                MySqlCommand cmd     = new MySqlCommand(cmdText, cnx);
                cmd.CommandTimeout = 30000;

                // Create a fill a Dataset
                DataSet ds5 = new DataSet();
                adapter.SelectCommand = cmd;
                adapter.Fill(ds5);

                prices = ds5.Tables[0];

                if (prices != null)
                {
                    foreach (DataRow row in prices.Rows)
                    {
                        price = (decimal)row[1];
                    }
                }
            }
            catch (MySqlException ex)
            {
                PriceLabel1.Text            = "Нет цены.";
                AddToJournalButton1.Enabled = false;
                PrintRightNow.Enabled       = false;
                BarcodeTextBox1.Focus();
                return;
            }
            finally
            {
                if (cnx != null)
                {
                    cnx.Close();
                }
            }


            //var price = (from p in context.Prices
            //             where p.GoodID == barcode.GoodID
            //             && p.Active == true
            //             select p).FirstOrDefault();
            //if (price == null)
            //{
            //    PriceLabel1.Text = "Нет цены.";
            //    AddToJournalButton1.Enabled = false;
            //    BarcodeTextBox1.Focus();
            //    return;
            //}

            if (price == 0)
            {
                PriceLabel1.Text            = "Нет цены.";
                AddToJournalButton1.Enabled = false;
                PrintRightNow.Enabled       = false;
                BarcodeTextBox1.Focus();
                return;
            }

            PriceLabel1.Text            = "Текущая цена: " + price.ToString();
            AddToJournalButton1.Enabled = true;
            PrintRightNow.Enabled       = true;
            AddToJournalButton1.Focus();
        }