示例#1
0
        public int DeleteIndustryByIndID(int indID)
        {
            int count = 0;
            industryDataContext db = new industryDataContext();
            var user = from c in db.industry where c.IndID == indID select c;

            if (user.Count() > 0)
            {
                db.industry.DeleteAllOnSubmit(user);
                count = db.industry.Where(c => c.IndID == indID).Count();
            }
            return(count);
        }
示例#2
0
        public industry GetIndustry(int indID)
        {
            industryDataContext db = new industryDataContext();

            if (db.industry.Count() > 0)
            {
                var user = db.industry.Single(c => c.IndID == indID);
                return(user);
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        public IList <industry> GetIndustry()
        {
            industryDataContext    db     = new industryDataContext();
            IEnumerable <industry> attInd = from c in db.industry select c;

            if (attInd != null)
            {
                return(attInd.ToList <industry>());
            }
            else
            {
                return(new List <industry>());
            }
        }
示例#4
0
        public int InsertIndustry(industry ind)
        {
            industryDataContext db = new industryDataContext();

            try
            {
                db.industry.InsertOnSubmit(ind);
                db.SubmitChanges();
                return(int.Parse(ind.IndID.ToString()));
            }
            catch
            {
                return(0);
            }
        }
示例#5
0
        public int UpdateIndustryfoByIndID(industry ind)
        {
            industryDataContext db = new industryDataContext();

            try
            {
                var result = (from item in db.industry where item.IndID == ind.IndID select item).Single();
                result.IndName      = ind.IndName;
                result.IndChildID   = ind.IndChildID;
                result.IndChildName = ind.IndChildName;
                db.SubmitChanges();
                return(int.Parse(result.IndID.ToString()));
            }
            catch
            {
                return(0);
            }
        }