private void btnSave_Click(object sender, EventArgs e)
        {
            int er = 0;

            if (txtPrice.Text == "")
            {
                er++;
                ep.SetError(txtPrice, "");
            }
            if (er > 0)
            {
                return;
            }
            //Validation baki
            DAL.ProductPrice pp = new DAL.ProductPrice();
            pp.ProductId = Convert.ToInt32(cmbProduct.SelectedValue);
            pp.UnitId    = Convert.ToInt32(cmbUnit.SelectedValue);
            pp.Price     = Convert.ToDouble(txtPrice.Text);

            if (pp.Insert())
            {
                MessageBox.Show("Data Saved");
                MyControls.Helper.clear(this);
                cmbProduct.Focus();
            }
            else
            {
                MessageBox.Show(pp.Error);
            }
        }
예제 #2
0
        private void SavePrices(Guid productId, string priceType, string currencyCode, string price)
        {
            string sql = "ProductId = '" + productId.ToString() + "' AND PriceTypeId = '" + Common.ProductPriceType.GetTypeId(priceType).ToString() + "'";

            DAL.ProductPrice oPrice = DAL.ProductPrice.LoadWhere(sql);
            if (oPrice == null)
            {
                oPrice = new DAL.ProductPrice();

                oPrice.ProductId = productId;
            }
            oPrice.PriceTypeId  = Common.ProductPriceType.GetTypeId(priceType);
            oPrice.CurrencyCode = currencyCode;
            oPrice.Price        = Convert.ToDecimal((price == string.Empty) ? "0" : price);
            oPrice.Save();
        }
예제 #3
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     DAL.ProductPrice pp = new DAL.ProductPrice();
     dgvData.DataSource = pp.Select().Tables[0];
 }