Exemplo n.º 1
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (ddl_cost_item.SelectedValue != "")
            {
                Model.manager     manager = GetAdminInfo();
                Model.U_User_Info model   = new BLL.U_User_Info().GetModel(int.Parse(Request.QueryString["id"]));
                Model.P_Cost_Item item    = new BLL.P_Cost_Item().GetModel(int.Parse(ddl_cost_item.SelectedValue));
                if (model.account_amount >= item.item_amount)
                {
                    model.account_amount -= item.item_amount;
                    new BLL.U_User_Info().Update(model);

                    Model.U_User_Recharge record = new Model.U_User_Recharge();
                    record.FK_user_id         = model.user_id;
                    record.recharge_user_name = model.user_name;
                    record.recharge_type      = 1;
                    record.payment_type       = null;
                    record.recharge_amount    = item.item_amount;
                    record.balance            = model.account_amount;
                    record.real_amount        = null;
                    record.rechage_time       = DateTime.Now;
                    record.create_by          = manager.id;
                    record.create_name        = manager.real_name;
                    record.recharge_remark    = null;
                    new BLL.U_User_Recharge().Add(record);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "1", "alert('消费完成!');ok();", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "1", "alert('余额不够,请确认!');", true);
                }
            }
        }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txtName.Text.Trim() == "")
     {
         JscriptMsg("请填写名称!", "");
         return;
     }
     else if (txtAmount.Text.Trim() == "")
     {
         JscriptMsg("请填写金额!", "");
         return;
     }
     if (!string.IsNullOrEmpty(Request.QueryString["id"]))//修改
     {
         Model.P_Cost_Item model = new BLL.P_Cost_Item().GetModel(int.Parse(Request.QueryString["id"]));
         model.item_name   = txtName.Text;
         model.item_amount = Convert.ToDecimal(txtAmount.Text);
         model.item_remark = txtRemark.Text;
         new BLL.P_Cost_Item().Update(model);
         JscriptMsg("修改成功", "pay_item_list.aspx");
     }
     else//新增
     {
         Model.P_Cost_Item model = new Model.P_Cost_Item();
         model.item_name   = txtName.Text;
         model.item_amount = Convert.ToDecimal(txtAmount.Text);
         model.item_remark = txtRemark.Text;
         new BLL.P_Cost_Item().Add(model);
         JscriptMsg("添加成功", "pay_item_list.aspx");
     }
 }
        private void BindData()
        {
            DataTable dt = new BLL.P_Cost_Item().GetAllList().Tables[0];

            rptList1.DataSource = dt;
            rptList1.DataBind();
        }
Exemplo n.º 4
0
        private void BindDDL()
        {
            DataTable dt = new BLL.P_Cost_Item().GetAllList().Tables[0];

            ddl_cost_item.DataSource     = dt;
            ddl_cost_item.DataTextField  = "item_name";
            ddl_cost_item.DataValueField = "item_id";
            ddl_cost_item.DataBind();
            ddl_cost_item.Items.Insert(0, new ListItem("请选择", ""));
        }
Exemplo n.º 5
0
 protected void ddl_cost_item_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddl_cost_item.SelectedValue != "")
     {
         Model.P_Cost_Item item = new BLL.P_Cost_Item().GetModel(int.Parse(ddl_cost_item.SelectedValue));
         if (item != null)
         {
             lblCostMoney.Text = item.item_amount.ToString();
         }
     }
 }
 private void GetData()
 {
     if (!string.IsNullOrEmpty(Request.QueryString["id"]))
     {
         Model.P_Cost_Item model = new BLL.P_Cost_Item().GetModel(int.Parse(Request.QueryString["id"]));
         if (model != null)
         {
             txtName.Text   = model.item_name;
             txtAmount.Text = model.item_amount.ToString();
             txtRemark.Text = model.item_remark;
         }
     }
 }