Пример #1
0
        public void Delete(string id)
        {
            var pp = (from oo in _basicInfor.Record
                      where oo.ID == id
                      select oo).ToList().FirstOrDefault();

            if (pp != null)
            {
                _basicInfor.Record.DeleteOnSubmit(pp);
                _basicInfor.SubmitChanges();
            }
        }
Пример #2
0
        public void SaveOpt(string name, string value)
        {
            var pp = (from oo in _basicInfor.ConFig
                      where oo.Key == name
                      select oo).ToList().FirstOrDefault();

            if (pp != null)
            {
                pp.Value = value;
            }
            else
            {
                ConFig posOpt = new ConFig();
                posOpt.Key   = name;
                posOpt.Value = value;
                posOpt.ID    = Guid.NewGuid().ToString();
                if (_basicInfor.Connection.State == ConnectionState.Closed)
                {
                    _basicInfor.Connection.Open();
                }
                _basicInfor.ConFig.InsertOnSubmit(posOpt);
            }
            if (_basicInfor.Connection.State == ConnectionState.Closed)
            {
                _basicInfor.Connection.Open();
            }
            _basicInfor.SubmitChanges();
        }