예제 #1
0
        protected void btnSaveStars_OnClick(object sender, EventArgs e)
        {
            var pa    = ppPerson.PersonAliasId;
            var value = Decimal.Parse(tbValue.Text);

            StarsService starsService = new StarsService(starsProjectContext);

            org.newpointe.Stars.Model.Stars stars = new org.newpointe.Stars.Model.Stars();

            stars.PersonAliasId       = pa.GetValueOrDefault();
            stars.CampusId            = 1;
            stars.TransactionDateTime = DateTime.Now;
            stars.Value = value;

            starsService.Add(stars);

            starsProjectContext.SaveChanges();
        }
        public void SaveStars(DateTime dt, int paId, decimal starsValue, string note)
        {
            StarsProjectContext starsProjectContext = new StarsProjectContext();
            StarsService        starsService        = new StarsService(starsProjectContext);

            org.newpointe.Stars.Model.Stars stars = new org.newpointe.Stars.Model.Stars();

            PersonAliasService personAliasService = new PersonAliasService(new RockContext());
            int campusId = personAliasService.GetByAliasId(paId).Person.GetCampus().Id;


            stars.PersonAliasId       = paId;
            stars.CampusId            = campusId;
            stars.TransactionDateTime = DateTime.Now;
            stars.Value = starsValue;
            stars.Note  = note;

            starsService.Add(stars);

            starsProjectContext.SaveChanges();
        }
예제 #3
0
        protected void btnSaveStars_OnClick(object sender, EventArgs e)
        {
            // ddl
            var x = Convert.ToInt32(ddlStars.SelectedItem.Value);

            DefinedValueService definedValueService = new DefinedValueService(rockContext);

            var definedValue = definedValueService.Queryable().FirstOrDefault(a => a.Id == x);

            definedValue.LoadAttributes();
            var attributeValue = definedValue.GetAttributeValue("StarValue");
            var starsValue     = Convert.ToDecimal(attributeValue);

            var pa = Person.PrimaryAliasId;
            //var pa = ppPerson.PersonAliasId;
            //var value = Decimal.Parse(tbValue.Text);


            StarsService starsService = new StarsService(starsProjectContext);

            org.newpointe.Stars.Model.Stars stars = new org.newpointe.Stars.Model.Stars();

            stars.PersonAliasId       = pa.GetValueOrDefault();
            stars.CampusId            = 1;
            stars.TransactionDateTime = DateTime.Now;
            stars.Value = starsValue;
            stars.Note  = ddlStars.SelectedItem.Text + ". Manually added by " + CurrentPerson.FullName;

            starsService.Add(stars);

            starsProjectContext.SaveChanges();


            //Refresh Page to update grids
            Response.Redirect(Request.RawUrl);
        }
예제 #4
0
        public void SaveStars(DateTime dt, int paId, decimal starsValue, string note)
        {
            StarsProjectContext starsProjectContext = new StarsProjectContext();
            StarsService starsService = new StarsService(starsProjectContext);
            org.newpointe.Stars.Model.Stars stars = new org.newpointe.Stars.Model.Stars();

            PersonAliasService personAliasService = new PersonAliasService(new RockContext());
            int campusId = personAliasService.GetByAliasId(paId).Person.GetCampus().Id;

            stars.PersonAliasId = paId;
            stars.CampusId = campusId;
            stars.TransactionDateTime = DateTime.Now;
            stars.Value = starsValue;
            stars.Note = note;

            starsService.Add(stars);

            starsProjectContext.SaveChanges();
        }