コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Edit.aspx.cs プロジェクト: nieo7/chienyehtsai
    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"));
        }
    }
コード例 #3
0
ファイル: Add.aspx.cs プロジェクト: nieo7/chienyehtsai
    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"));
        }
    }
コード例 #4
0
ファイル: Edit.aspx.cs プロジェクト: nieo7/chienyehtsai
 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();
         }
     }
 }
コード例 #5
0
    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);
    }
コード例 #6
0
 public int Update(OrderTransCostInfo info)
 {
     return(db.Update(info.otc_name, info.otc_cost, info.otc_show, info.otc_detail, info.otc_id));
 }
コード例 #7
0
 public int Insert(OrderTransCostInfo info)
 {
     return(db.Insert(info.otc_name, info.otc_cost, info.otc_show, info.otc_detail));
 }