示例#1
0
        private void getType()
        {
            DataTable ausType = AusTypeInfoManager.GetList(strwhere);

            this.type.DataSource = ausType;
            this.type.DataBind();
        }
        private void getType()
        {
            IList <AusTypeInfo> austype = AusTypeInfoManager.GetAllList();

            this.type.DataSource = austype;
            this.type.DataBind();
        }
示例#3
0
        protected void ibtnAdd_Click(object sender, ImageClickEventArgs e)
        {
            AusTypeInfo ausTypeInfo = new AusTypeInfo();

            ausTypeInfo.typename = this.txtTypeName.Text.ToString();
            if (this.iscy.Checked)
            {
                ausTypeInfo.iscy = "y";
            }
            else
            {
                ausTypeInfo.iscy = "n";
            }

            AusTypeInfo ausTypeInfocount = AusTypeInfoManager.GetModelByTypename(this.txtTypeName.Text.ToString());

            if (ausTypeInfocount == null)
            {
                bool count = AusTypeInfoManager.Add(ausTypeInfo);
                if (count == true)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('添加成功');window.location='AusTypeList.aspx'</script>", false);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('添加失败')</script>", false);
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "alert('类型名称不能重复!');", true);
            }
        }
示例#4
0
        /// <summary>
        /// 是否常用(不常用)
        /// </summary>
        public bool isCy2(string id)
        {
            AusTypeInfo typeInfo = AusTypeInfoManager.getAusTypesById(Convert.ToInt32(id));

            if (typeInfo.iscy == "y")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        protected void ibtnAdd_Click(object sender, ImageClickEventArgs e)
        {
            AusTypeInfo ausTypeInfo = new AusTypeInfo();

            ausTypeInfo.id       = Convert.ToInt32(Request.QueryString["id"]);//得到当前更改类别的id
            ausTypeInfo.typename = this.txtTypeName.Text.ToString();
            if (this.iscy.Checked)
            {
                ausTypeInfo.iscy = "y";
            }
            else
            {
                ausTypeInfo.iscy = "n";
            }

            AusTypeInfo ausTypeInfocount = AusTypeInfoManager.GetModelByTypename(this.txtTypeName.Text.ToString());//得到该类别名称的实例  控制不会出现重复的类型名称

            if (ausTypeInfocount == null)
            {
                bool count = AusTypeInfoManager.Update(ausTypeInfo);
                if (count == true)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('更新成功');window.location='AusTypeList.aspx'</script>", false);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('更新失败')</script>", false);
                }
            }
            else
            {
                if (ausTypeInfocount.id == ausTypeInfo.id)//判断其与所需要更新的类别的ID是否一样,如果一样可以更新。如果不一样就不能更新
                {
                    bool count = AusTypeInfoManager.Update(ausTypeInfo);
                    if (count == true)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('更新成功');window.location='AusTypeList.aspx'</script>", false);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('更新失败')</script>", false);
                    }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "", "alert('类型名称不能重复!');", true);
                }
            }
        }
示例#6
0
        private void loadAusType()
        {
            int         id       = Convert.ToInt32(Request.QueryString["id"]);
            AusTypeInfo typeInfo = AusTypeInfoManager.getAusTypesById(id);

            txtTypeName.Text = typeInfo.typename;
            if (typeInfo.iscy == "y")
            {
                this.iscy.Checked = true;
            }
            else
            {
                this.iscy.Checked = false;
            }
        }
示例#7
0
        protected void cuslist_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string id = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "Delete":
                AusTypeInfo typeInfo = AusTypeInfoManager.getAusTypesById(Convert.ToInt32(id));
                string      typeName = typeInfo.typename;
                int         count    = AusDetialInfoManager.getAusDetialInfoByAusType(typeName);
                if (count > 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('费用类别正在使用中,无法删除!');", true);
                }
                else
                {
                    bool del = AusTypeInfoManager.Delete(Convert.ToInt32(id));
                    if (del == true)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('删除成功');window.location='AusTypeList.aspx'</script>", false);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('删除失败')</script>", true);
                    }
                }
                break;

            case "Update":
                Response.Redirect("UpdateAusType.aspx?id=" + id);
                break;

            case "Tick":
                AusTypeInfo typeInfo1 = AusTypeInfoManager.getAusTypesById(Convert.ToInt32(id));
                typeInfo1.iscy = "y";
                AusTypeInfoManager.Update(typeInfo1);
                break;

            case "TurnBack":
                AusTypeInfo typeInfo2 = AusTypeInfoManager.getAusTypesById(Convert.ToInt32(id));
                typeInfo2.iscy = "n";
                AusTypeInfoManager.Update(typeInfo2);
                break;
            }
            dataBind();
        }
        protected void type_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                string id = e.CommandArgument.ToString();

                IList <AusTypeInfo> cop = AusTypeInfoManager.getAusRottenInfo(Convert.ToInt32(id));

                if (cop.Count > 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('正在使用中的类型不能删除!');", true);
                }
                else
                {
                    AusTypeInfoManager.Delete(Convert.ToInt32(id));
                }
            }
            getType();
        }