public virtual void Remove(PROFILE_TRADE b) { try { db.PROFILE_TRADEs.DeleteOnSubmit(b); db.SubmitChanges(); } catch (Exception e) { throw new Exception(e.Message); } }
public virtual void Remove(int id) { try { PROFILE_TRADE b = this.GetById(id); this.Remove(b); } catch (Exception e) { throw new Exception(e.Message); } }
public virtual void Create(PROFILE_TRADE cus) { try { this.db.PROFILE_TRADEs.InsertOnSubmit(cus); db.SubmitChanges(); } catch //(Exception e) { //throw new Exception(e.Message); } }
public virtual void Update(PROFILE_TRADE cus) { try { PROFILE_TRADE cusOld = this.GetById(cus.ID); cusOld = cus; db.SubmitChanges(); } catch //(Exception e) { //throw new Exception(e.Message); } }
private void Save(string strLink = "") { try { if (_id == 0) { PROFILE_TRADE i = new PROFILE_TRADE(); i.TRAD_NAME = txtTenNganhNghe.Text; i.TRAD_ORDER = Utils.CIntDef(txtThuTu.Text); i.TRAD_ACTIVE = Utils.CIntDef(rblActive.SelectedValue); _trades.Create(i); var getlink = db.PROFILE_TRADEs.OrderByDescending(n => n.ID).Take(1).ToList(); if (getlink.Count > 0) { strLink = string.IsNullOrEmpty(strLink) ? "danh-muc-nganh-nghe.aspx?id=" + getlink[0].ID : strLink; } } else { var list = db.PROFILE_TRADEs.Where(a => a.ID == _id).ToList(); foreach (var i in list) { i.TRAD_NAME = txtTenNganhNghe.Text; i.TRAD_ORDER = Utils.CIntDef(txtThuTu.Text); i.TRAD_ACTIVE = Utils.CIntDef(rblActive.SelectedValue); _trades.Update(i); } db.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "danh-muc-nganh-nghe.aspx?id=" + _id : strLink; } } catch (Exception) { throw; } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }