Exemplo n.º 1
0
    /*****************************************************
    * - Function name : submit
    * - Description : 提交并操作
    * - Variables : void
    *****************************************************/
    public void submit()
    {
        IncomeExpenseService IES = new IncomeExpenseService();

        IES.saveIncomeExpenseRecord(this.IE);
    }
Exemplo n.º 2
0
    /*****************************************************
    * - Function name : submit_Click
    * - Description : 提交响应
    * - Variables : object sender, EventArgs e
    *****************************************************/
    protected void submit_Click(object sender, EventArgs e)
    {
        // 获取输入值
        double money     = double.Parse(TextBoxMoney.Text.ToString());
        string y         = DropDownListYear.Text.ToString();
        string m         = DropDownListMonth.Text.ToString();
        string d         = DropDownListDay.Text.ToString();
        string h         = System.DateTime.Now.Hour.ToString();
        string min       = System.DateTime.Now.Minute.ToString();
        string sec       = System.DateTime.Now.Second.ToString();
        string date      = y + "/" + m + "/" + d + " " + h + ":" + min + ":" + sec;
        string deal_kind = "";

        if (RadioButton1.Checked == true)
        {
            deal_kind = "收入";
        }
        else if (RadioButton2.Checked == true)
        {
            deal_kind = "支出";
        }
        string receive_name       = TextBoxReceiveMan.Text.ToString();
        string receive_card       = TextBoxReceiveCard.Text.ToString();
        string allocate_name      = TextBoxAllocateMan.Text.ToString();
        string allocate_card      = TextBoxAllocateCard.Text.ToString();
        string deal_way           = DropDownListDealway.Text.ToString();
        FinanceDatabaseHelper FDH = new FinanceDatabaseHelper();
        string deal_man           = TextBoxDealMan.Text.ToString();
        string assure_id          = FDH.getEmployeeID(deal_man);
        string note = TextBoxNote.Text.ToString();

        // 检验办理人是否合理
        if (deal_man != "匿名")
        {
            if (deal_man == "")
            {
                Response.Write("<script>alert('办理人不合法!');</script>");
                return;
            }
        }

        // 创建控制类
        IncomeExpenseAction IEA = new IncomeExpenseAction();

        // 新建收支对象
        IEA.addIncomeExpense();

        // 设置属性值
        IEA.setIEDeal(money, receive_name, receive_card, allocate_name, allocate_card);
        IEA.setIEDealMan(date, deal_kind, deal_way, assure_id);
        IEA.setIENote(note);

        // 保存
        IncomeExpenseService IES = new IncomeExpenseService();

        if (IES.saveIncomeExpenseRecord(IEA.getIncomeExpense()))
        {
            Response.Write("<script type='text/javascript'>alert('添加成功!');window.location='financeHome.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('添加失败!');</script>");
        }
    }