protected void lv_ThongTinSP_ItemInserting(object sender, ListViewInsertEventArgs e) { if (_objCheckPermision.Permission(_objCheckPermision.LayQuyen("strChiNhanh_Them"))) { var t0 = new DAO.Branch(); var txt = (e.Item.FindControl("txt_Name")) as TextBox; if (txt != null) { t0.Name = txt.Text; } txt = (e.Item.FindControl("txt_Name")) as TextBox; if (txt != null) { t0.Name = txt.Text; } ChiNhanhDAO.Insert(t0); lv_ThongTinSP.EditIndex = -1; BinList(); } else { iRightAccess.Visible = false; ObjControl.LoadMyControl(idNotPermissionAccess, NotPermissControl); } }
protected void lbtnUpdate_Click(object sender, EventArgs e) { if (_objCheckPermision.Permission(_objCheckPermision.LayQuyen("strChiNhanh_Sua"))) { try { foreach (ListViewDataItem lvit in lv_ThongTinSP.Items) { string chiNhanhID; if (((HiddenField)lvit.FindControl("hfID")).Value != "") { chiNhanhID = ((HiddenField)lvit.FindControl("hfID")).Value; } else { ltr_Notice.Text = ObjComm.ShowNotice( false, "Cập nhật thông tin thất bại.\nLỗi trong quá trình nhận dạng chi nhánh"); return; } DAO.Branch t0 = ChiNhanhDAO.Get(Int32.Parse(chiNhanhID)); t0.Name = ((TextBox)lvit.FindControl("txt_Name")).Text; t0.Name = ((TextBox)lvit.FindControl("txt_Name")).Text; ChiNhanhDAO.Update(); } ltr_Notice.Text = ObjComm.ShowNotice(true, "Cập nhật thông tin thành công!"); } catch (Exception ex) { ltr_Notice.Text = ObjComm.ShowNotice( false, "Cập nhật thông tin thất bại. Chi tiết lỗi: " + ex.Message); } } else { ObjComm.wr( "<script language='javascript'>alert('Bạn không có quyền thực hiện chức năng này.');location.href='tin-tuc';</script>"); } }