Exemplo n.º 1
0
        private void LoadType()
        {
            int        id    = Convert.ToInt32(Request.QueryString["id"]);
            IncomeType model = IncomeTypeManager.GetModel(id);

            txtTypeName.Text = model.TypeName;
        }
Exemplo n.º 2
0
        private void Load_Type()
        {
            ddlsktype.Items.Add(new ListItem("——请选择——", "0"));
            DataTable dt = IncomeTypeManager.GetList("");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ListItem adItem = new ListItem();
                adItem.Text  = dt.Rows[i]["typename"].ToString();
                adItem.Value = dt.Rows[i]["id"].ToString();
                ddlsktype.Items.Add(adItem);
            }
        }
Exemplo n.º 3
0
        protected void typeList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string id = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "Update":
                Response.Redirect("UpdateIncomeType.aspx?id=" + id);
                break;

            case "Delete":
                bool del = IncomeTypeManager.Delete(Convert.ToInt32(id));
                break;
            }
            dataBind();
        }
Exemplo n.º 4
0
        protected void ibtnAdd_Click(object sender, ImageClickEventArgs e)
        {
            IncomeType model = IncomeTypeManager.GetModel(Convert.ToInt32(Request.QueryString["id"]));

            model.TypeName = this.txtTypeName.Text.Trim();

            IncomeType modellast = IncomeTypeManager.GetModelByName(this.txtTypeName.Text.Trim());

            if (modellast == null)
            {
                bool result = IncomeTypeManager.Update(model);
                if (result)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('更新成功');window.location='InComeTypeList.aspx'</script>", false);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('更新失败')</script>", false);
                }
            }
            else
            {
                if (model.id == modellast.id)
                {
                    bool result = IncomeTypeManager.Update(model);
                    if (result)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('更新成功');window.location='InComeTypeList.aspx'</script>", false);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('更新失败')</script>", false);
                    }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "alert('类型名称不能重复!');", true);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 新增类别
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ibtnAdd_Click(object sender, ImageClickEventArgs e)
        {
            IncomeType type = IncomeTypeManager.GetModelByName(this.txtTypeName.Text.Trim());

            if (type == null)
            {
                type          = new IncomeType();
                type.TypeName = this.txtTypeName.Text.Trim();
                bool result = IncomeTypeManager.Add(type);
                if (result)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "success", "<script>alert('添加成功');window.location='InComeTypeList.aspx'</script>", false);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "defaul", "<script>alert('添加失败')</script>", false);
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "alert('类型名称不能重复!');", true);
            }
        }