/// <summary>
 /// Insert một bản ghi vào bảng Danh mục dùng chung
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public void InsertList(DmucKieudmuc obj, ref string ActResult)
 {
     try
     {
         ActionResult _act = isExistedRecord(obj.MaLoai);
         if (_act == ActionResult.ExistedRecord || _act == ActionResult.Exception)
         {
             ActResult = _act.ToString();
             return;
         }
         obj.IsNew = true;
         obj.Save();
         obj.Id    = Utility.Int32Dbnull(DmucKieudmuc.CreateQuery().GetMax(DmucKieudmuc.IdColumn.ColumnName), 0);
         ActResult = ActionResult.Success.ToString();
     }
     catch
     {
         ActResult = ActionResult.Exception.ToString();
     }
 }
 public ActionResult isExistedRecord4Update(string MaMoi, string MaCu)
 {
     try
     {
         DmucKieudmucCollection v_obj = new DmucKieudmucController().FetchByQuery(DmucKieudmuc.CreateQuery().AddWhere(DmucKieudmuc.Columns.MaLoai, Comparison.NotEquals, MaCu));
         List <DmucKieudmuc>    q     = (from p in v_obj
                                         where p.MaLoai == MaMoi
                                         select p).ToList <DmucKieudmuc>();
         if (q.Count() > 0)
         {
             return(ActionResult.ExistedRecord);
         }
         return(ActionResult.Success);
     }
     catch
     {
         return(ActionResult.Exception);
     }
 }