private void UpdatePriceText() { if (rddKota.SelectedValue != null && rddProduct.SelectedValue != null) { decimal price_ = 0; //get price according to kota and if (bool.Parse(rddProduct.Tag.ToString())) { txtPrice.Value = 0; txtPrice.Enabled = true; } else { //get price using (sinarekDataSetTableAdapters.productpriceTableAdapter tbl = new sinarekDataSetTableAdapters.productpriceTableAdapter()) { price_ = decimal.Parse(tbl.GetPrice(int.Parse(rddProduct.SelectedValue.ToString()) , int.Parse(rddKota.SelectedValue.ToString())).ToString()); } txtPrice.Value = price_; txtPrice.Enabled = false; } } }
private void UpdatePriceText() { try { if (rddKota.SelectedValue != null && rddProduct.SelectedValue != null) { decimal price_ = 0; //get price according to kota and if (bool.Parse(rddProduct.Tag.ToString())) { txtPrice.Value = 0; txtPrice.Enabled = true; chkTukar.Enabled = false; } else { chkTukar.Enabled = true; //get price try { using (sinarekDataSetTableAdapters.productpriceTableAdapter tbl = new sinarekDataSetTableAdapters.productpriceTableAdapter()) { price_ = decimal.Parse(tbl.GetPrice(int.Parse(rddProduct.SelectedValue.ToString()) , int.Parse(rddKota.SelectedValue.ToString())).ToString()); } } catch (Exception ex) { helper.SysLog(this.GetType().Name, "ERROR :" + this.Text, ex.Message + ":" + ex.StackTrace); } if (price_ == 0) { txtPrice.Value = 0; txtPrice.Enabled = true; } else { txtPrice.Value = price_; txtPrice.Enabled = false; } } } } catch (Exception ex) { helper.SysLog(this.GetType().Name, this.Text, "ERROR :" + ex.Message + ":" + ex.StackTrace); txtPrice.Value = 0; txtPrice.Enabled = true; } }