public OrderTransCostInfo GetDataById(int otc_id) { OrderTransCostInfo info = new OrderTransCostInfo(); IDataReader reader = db.GetDataById(otc_id).CreateDataReader(); if (reader.Read()) { info = OrderTransCostInfo.Populate(reader); } return(info); }
protected void btnSubmit_Click(object sender, EventArgs e) { OrderTransCostInfo info = otcBLL.GetDataById(Tools.TryParseMethod(Request.QueryString["id"].ToString())); info.otc_name = txtName.Text; info.otc_cost = Tools.TryParseMethod(txtPrice.Text); info.otc_detail = Ckeditorl1.Text; info.otc_show = bool.Parse(rbShow.SelectedValue); if (otcBLL.Update(info) > 0) { Response.Redirect("List.aspx?header=" + Getmessage("30014")); } }
protected void btnSubmit_Click(object sender, EventArgs e) { OrderTransCostInfo info = new OrderTransCostInfo(); info.otc_name = txtName.Text; info.otc_cost = Tools.TryParseMethod(txtPrice.Text); info.otc_detail = Ckeditorl1.Text; info.otc_show = bool.Parse(rbShow.SelectedValue); if (otcBLL.Insert(info) > 0) { Response.Redirect("List.aspx?header=" + Getmessage("30009")); } }
protected void Bind() { if (Request.QueryString["id"] != null) { if (Tools.TryParseMethod(id.ToString()) != 0) { OrderTransCostInfo info = otcBLL.GetDataById(Tools.TryParseMethod(Request.QueryString["id"].ToString())); txtName.Text = info.otc_name; txtPrice.Text = info.otc_cost.ToString(); Ckeditorl1.Text = info.otc_detail; rbShow.SelectedValue = info.otc_show.ToString(); } } }
public static OrderTransCostInfo Populate(IDataReader reader) { OrderTransCostInfo info = new OrderTransCostInfo(); for (int i = 0; i < reader.FieldCount; i++) { PropertyInfo property = info.GetType().GetProperty(reader.GetName(i)); Type propType = property.PropertyType; TypeConverters.ITypeConverter typeConverter = TypeConverters.TypeConverterFactory.GetConvertType(propType); property.SetValue(info, Convert.ChangeType(typeConverter.Convert(reader.GetValue(i)), propType), null); } return(info); }
public int Update(OrderTransCostInfo info) { return(db.Update(info.otc_name, info.otc_cost, info.otc_show, info.otc_detail, info.otc_id)); }
public int Insert(OrderTransCostInfo info) { return(db.Insert(info.otc_name, info.otc_cost, info.otc_show, info.otc_detail)); }