Esempio n. 1
0
        public static int CreateActivation(ActivationParams p)
        {
            //get data context (license manager database)
            using (var dc = new LicenseManagerClassesDataContext())
            {
                //create activation data object
                Activation act = new Activation();
                Mapper.Map(p, act);

                //add new activation object to new changes
                dc.Activations.InsertOnSubmit(act);

                //submit changes to database
                dc.SubmitChanges();

                if (p.IsActivated)
                {
                    act.License.LicenseFeatures[0].ExtendedExpirationDate     = p.ExtendedExpirationDate;
                    act.License.LicenseFeatures[0].ExpirationWarningStartDate = p.ExpirationWarningsBeginDate;
                    dc.SubmitChanges();
                }

                return(act.ID);
            }
        }
Esempio n. 2
0
        public static int SaveActivation(ActivationParams p)
        {
            using (var dc = new LicenseManagerClassesDataContext())
            {
                Activation a = dc.Activations.SingleOrDefault(x => x.ID == p.ID);
                Mapper.Map(p, a);

                a.License.LicenseFeatures[0].ExtendedExpirationDate     = p.ExtendedExpirationDate;
                a.License.LicenseFeatures[0].ExpirationWarningStartDate = p.ExpirationWarningsBeginDate;

                dc.SubmitChanges();

                return(a.ID);
            }
        }