Пример #1
0
        public static void SaveClientCorporate(ClientsModel model, int clientId)
        {
            DataContext  db  = new DataContext();
            TblCorporate tbl = new TblCorporate();

            tbl.UpdatedBy       = model.UpdatedById;
            tbl.FilePathNew     = model.FilePathNew;
            tbl.FilePathOld     = model.FilePathOld;
            tbl.ClientId        = clientId;
            tbl.UserId          = model.UserId;
            tbl.YearId          = model.YearId;
            tbl.LastChangesInfo = model.LastChanges;
            db.TblCorporates.InsertOnSubmit(tbl);
            db.SubmitChanges();
            db.Dispose();
        }
Пример #2
0
        public static int ReturnLastCorporateId()
        {
            DataContext  db     = new DataContext();
            TblCorporate obj    = new TblCorporate();
            var          result = (from e in db.TblCorporates
                                   orderby e.Id descending
                                   select e).FirstOrDefault();

            obj = result;
            if (result != null)
            {
                return(obj.Id);
            }
            else
            {
                return(0);
            }
        }
Пример #3
0
        public static void UpdateClientCorporate(ClientsModel model, int clientId)
        {
            DataContext  db     = new DataContext();
            TblCorporate result = (from a in db.TblCorporates
                                   join c in db.TblClients on a.ClientId equals c.Id
                                   join u in db.TblUsers on a.UserId equals u.Id
                                   join y in db.TblYears on a.YearId equals y.Id
                                   where a.ClientId == clientId && y.Year == model.Year
                                   select a).SingleOrDefault();

            result.LastChangesInfo = model.LastChanges;
            result.FilePathNew     = model.FilePathNew;
            result.FilePathOld     = model.FilePathOld;
            result.UpdatedBy       = model.UpdatedById;
            result.UserId          = model.UserId;
            InsertForUniqueId();
            db.SubmitChanges();
        }