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(); AuthorTBx author = AM.GetByID(Convert.ToInt32(Request["id"])); author.Status = -1; 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); }
partial void DeleteAuthorTBx(AuthorTBx instance);
partial void UpdateAuthorTBx(AuthorTBx instance);
partial void InsertAuthorTBx(AuthorTBx instance);
public void AddNew(AuthorTBx author) { db.AuthorTBxes.InsertOnSubmit(author); Save(); }
public void AddNew(AuthorTBx authorcategory) { DB.AuthorTBxes.InsertOnSubmit(authorcategory); DB.SubmitChanges(); }