Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AuthorTBx     author = new AuthorTBx();
        AuthorManager am     = new AuthorManager();

        author       = am.GetByID(Convert.ToInt32(Request["id"]));
        author.Name  = Request["name"];
        author.Phone = Request["phone"];
        author.Desc  = Request["desc"];
        author.Email = Request["email"];

        string listcat = Request["listcat"];

        Author_CategoryManager    acm = new Author_CategoryManager();
        List <Author_CategoryTBx> listauthorcatnew = new List <Author_CategoryTBx>();

        for (int i = 0; i < listcat.Split('@').Length - 1; i++)
        {
            Author_CategoryTBx authorcat = new Author_CategoryTBx();
            authorcat.CategoryID = Convert.ToInt32(listcat.Split('@')[i]);
            authorcat.AuthorID   = author.ID;
            listauthorcatnew.Add(authorcat);
        }
        List <Author_CategoryTBx> listauthorcat = new List <Author_CategoryTBx>();

        listauthorcat = acm.GetListID(author.ID);
        acm.DeleteCat(listauthorcat);
        acm.AddNew(listauthorcatnew);

        am.Save();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        AuthorManager am = new AuthorManager();

        author = am.GetByID(Convert.ToInt32(Request["id"]));
        CategoryManager cm = new CategoryManager();

        listCategory = cm.GetList();
        Author_CategoryManager acm = new Author_CategoryManager();

        listauthorcat = acm.GetListID(author.ID);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        AuthorTBx     author = new AuthorTBx();
        AuthorManager am     = new AuthorManager();

        author.Name   = Request["name"];
        author.Phone  = Request["phone"];
        author.Desc   = Request["desc"];
        author.Email  = Request["email"];
        author.Status = 1;
        am.AddNew(author);
        string listcat = Request["listcat"];
        List <Author_CategoryTBx> listauthorcat = new List <Author_CategoryTBx>();
        Author_CategoryManager    acm           = new Author_CategoryManager();

        for (int i = 0; i < listcat.Split('@').Length - 1; i++)
        {
            Author_CategoryTBx authorcat = new Author_CategoryTBx();
            authorcat.AuthorID   = author.ID;
            authorcat.CategoryID = Convert.ToInt32(listcat.Split('@')[i]);
            listauthorcat.Add(authorcat);
        }
        acm.AddNew(listauthorcat);
    }