示例#1
0
 public static int DeleteT_WQX_REF_TAXA_ORG(string orgName, string charName)
 {
     try
     {
         TWqxRefTaxaOrg r = new TWqxRefTaxaOrg();
         r = (from c in _db.TWqxRefTaxaOrg
              where c.OrgId == orgName &&
              c.BioSubjectTaxonomy == charName
              select c).FirstOrDefault();
         _db.TWqxRefTaxaOrg.Remove(r);
         _db.SaveChanges();
         return(1);
     }
     catch
     {
         return(0);
     }
 }
示例#2
0
        public static int InsertOrUpdateT_WQX_REF_TAXA_ORG(global::System.String bIO_SUBJECT_TAXAONOMY, global::System.String oRG_NAME, global::System.String cREATE_USER_ID)
        {
            try
            {
                Boolean        insInd = true;
                TWqxRefTaxaOrg a      = new TWqxRefTaxaOrg();

                if (_db.TWqxRefTaxaOrg.Any(o => o.BioSubjectTaxonomy == bIO_SUBJECT_TAXAONOMY && o.OrgId == oRG_NAME))
                {
                    //update case
                    a = (from c in _db.TWqxRefTaxaOrg
                         where c.BioSubjectTaxonomy == bIO_SUBJECT_TAXAONOMY &&
                         c.OrgId == oRG_NAME
                         select c).FirstOrDefault();
                    insInd = false;
                }

                a.BioSubjectTaxonomy = bIO_SUBJECT_TAXAONOMY;
                a.OrgId = oRG_NAME;

                if (insInd) //insert case
                {
                    a.CreateDt     = System.DateTime.Now;
                    a.CreateUserid = cREATE_USER_ID;
                    _db.TWqxRefTaxaOrg.Add(a);
                }
                else
                {
                    _db.TWqxRefTaxaOrg.Update(a);
                }
                _db.SaveChanges();
                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }