Пример #1
0
    protected void Btn_Add_Click(object sender, EventArgs e)
    {
        HuaJiaCartModel huaJiaCartModel = new HuaJiaCartModel();

        huaJiaCartModel.setUsername(Session["username"].ToString());
        int medicineId = Int32.Parse(this.MedicineId.SelectedValue);

        huaJiaCartModel.setMedicineId(medicineId);
        float price = MedicineLogic.getPriceById(medicineId);

        huaJiaCartModel.setPrice(price);
        int count = Int32.Parse(this.Count.Text);

        huaJiaCartModel.setCount(count);
        float totalPrice = price * count;

        huaJiaCartModel.setTotalPrice(totalPrice);
        HuaJiaCartLogic huaJiaCartLogic = new HuaJiaCartLogic();

        if (huaJiaCartLogic.AddHuaJiaCartInfo(huaJiaCartModel))
        {
            Response.Write("<script>alert('药品划价销售信息添加成功!');location.href='HuaJiaAdd.aspx';</script>");
        }
        else
        {
            Response.Write("<script>alert('" + huaJiaCartLogic.getErrMessage() + "');location.href='HuaJiaAdd.aspx';</script>");
        }
    }
Пример #2
0
    protected void InitMedicineCartInfo()
    {
        string  username       = Session["username"].ToString();
        DataSet huajia_cart_ds = HuaJiaCartLogic.GetHuaJiaCartInfo(username);

        this.GridView1.DataSource = huajia_cart_ds;
        this.GridView1.DataBind();
    }
Пример #3
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int             id = Int32.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
        HuaJiaCartLogic huaJiaCartLogic = new HuaJiaCartLogic();

        if (huaJiaCartLogic.DeleteHuaJiaCartInfo(id))
        {
            Response.Write("<script language=javascript>alert('成功删除药品划价销售信息!');</script>");
        }
        else
        {
            Response.Write("<script language=javascript>alert('" + huaJiaCartLogic.getErrMessage() + "');</script>");
        }
        GridView1.EditIndex = -1;
        InitMedicineCartInfo();
    }
Пример #4
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int             id              = Int32.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
        int             count           = Int32.Parse(((TextBox)GridView1.Rows[e.RowIndex].FindControl("Count")).Text);
        HuaJiaCartLogic huaJiaCartLogic = new HuaJiaCartLogic();

        if (huaJiaCartLogic.UpdateHuaJiaCartInfo(id, count))
        {
            Response.Write("<script language=javascript>alert('修改成功!');</script>");
        }
        else
        {
            Response.Write("<script language=javascript>alert('" + huaJiaCartLogic.getErrMessage() + "');</script>");
        }
        GridView1.EditIndex = -1;
        InitMedicineCartInfo();
    }