public void AddPlan(int QntPlans) { QoalaEntities qe = new QoalaEntities(); qe.Entry(this).State = EntityState.Modified; qe.SaveChanges(); Plan p = qe.PLANS.Find(ID_PLAN); p.LEFT = p.LEFT - QntPlans; qe.Entry(p).State = EntityState.Modified; qe.SaveChanges(); }
public decimal?Add(QoalaEntities context) { if (emailAlreadyExist(context, EMAIL)) { throw new UserEmailExistsException(); } var outParameter = new ObjectParameter("OUT_ID_USER", typeof(decimal)); if (!(PERMISSION > 0 && PERMISSION <= 4)) { PERMISSION = 1; } int ret = context.SP_INSERT_USER(NAME, PASSWORD, EMAIL, PERMISSION, ADDRESS, DISTRICT, CITY, STATE, ZIPCODE, outParameter); if (outParameter.Value == DBNull.Value) { ID_USER = 0m; } else { ID_USER = (Decimal)outParameter.Value; } context.Entry(this).State = EntityState.Unchanged; return(ID_USER); }
public decimal?Add(QoalaEntities context) { var outParameter = new ObjectParameter("OUT_ID_GEO", typeof(decimal)); context.SP_INSERT_DEVICE_GEO_LOCATION( ID_DEVICE, LATITUDE, LONGITUDE, outParameter ); if (outParameter.Value == DBNull.Value) { throw new CreateRecordException(); } ID_DEVICE_GEO_LOCATION = (Decimal)outParameter.Value; context.Entry(this).State = EntityState.Unchanged; Device device = DAO.Device.findById(context, ID_DEVICE); device.LAST_LATITUDE = LATITUDE; device.LAST_LONGITUDE = LONGITUDE; device.UpdateLastLocation(context); return(ID_DEVICE_GEO_LOCATION); }
public Decimal Delete(QoalaEntities context) { var outParameter = new ObjectParameter("ROWCOUNT", typeof(decimal)); int ret = context.SP_DELETE_USER(ID_USER, outParameter); context.Entry(this).State = EntityState.Unchanged; return((Decimal)outParameter.Value); }
public void Update() { using (QoalaEntities qe = new QoalaEntities()) { qe.Entry(this).State = System.Data.Entity.EntityState.Modified; qe.SaveChanges(); } }
public decimal?Delete(QoalaEntities context) { var outParameter = new ObjectParameter("ROWCOUNT", typeof(decimal)); context.SP_DELETE_DEVICE(ID_DEVICE, outParameter); context.Entry(this).State = EntityState.Unchanged; return(1); }
public decimal?Publish(QoalaEntities context) { var outParameter = new ObjectParameter("ROWCOUNT", typeof(decimal)); context.SP_PUBLISH_POST(ID_POST, outParameter); context.Entry(this).State = EntityState.Unchanged; return(1); }
public decimal?Approve(QoalaEntities context) { var outParameter = new ObjectParameter("ROWCOUNT", typeof(decimal)); context.SP_APPROVE_COMMENT(ID_COMMENT, outParameter); context.Entry(this).State = EntityState.Unchanged; return(1); }
public bool Delete(QoalaEntities context) { this.Logger().Debug("delete ACCESSCONTROL(" + TOKEN + ") for user: " + this.USER.ToString()); // Do not remove this entity, just update with expired now //context.ACCESSCONTROLs.Remove(this); this.EXPIRED_AT = DateTime.Now; context.Entry(this).State = EntityState.Modified; context.SaveChanges(); return(find(context, TOKEN) == null); }
public decimal?Add(QoalaEntities context) { var outParameter = new ObjectParameter("OUT_ID_DEVICE", typeof(decimal)); context.SP_INSERT_DEVICE(ALIAS, COLOR, FREQUENCY_UPDATE, ID_USER, outParameter); if (outParameter.Value == DBNull.Value) { throw new CreateRecordException(); } ID_DEVICE = (Decimal)outParameter.Value; context.Entry(this).State = EntityState.Unchanged; return(ID_DEVICE); }
public decimal?Add(QoalaEntities context) { var outParameter = new ObjectParameter("OUT_ID_POST", typeof(decimal)); int ret = context.SP_INSERT_POST(TITLE, CONTENT, ID_USER, outParameter); if (outParameter.Value == DBNull.Value) { throw new CreateRecordException(); } ID_POST = (Decimal)outParameter.Value; context.Entry(this).State = EntityState.Unchanged; return(ID_POST); }