public bool ifExistConfig(ConfiguracionesJSON item) { int tn = clsCommon.getIdentity().tenatId; genConfig ifexistconfig = (from c in db.genConfig where c.genConfigNameId == item.configNameid && c.tenantId == tn select c).FirstOrDefault(); if (ifexistconfig != null) { ifexistconfig.parameter = item.parameter; ifexistconfig.updatedById = clsCommon.getIdentity().Id; ifexistconfig.modifyDateTime = new DateTime(1900, 1, 1, 0, 0, 0);//por defecto o null db.Entry(ifexistconfig).State = EntityState.Modified; db.SaveChanges(); return(true); } return(false); }
public genConfig BulkConfigs(ConfiguracionesJSON item) { genConfig config = new genConfig(); config.parameter = item.parameter; config.active = true; config.genConfigNameId = item.configNameid; /****** Valores quemados de campos auditoria*****/ config.tenantId = clsCommon.getIdentity().tenatId; config.updatedById = 0; //por defecto o null config.createdById = clsCommon.getIdentity().Id; config.modifyDateTime = new DateTime(1900, 1, 1, 0, 0, 0); //por defecto o null config.insertDateTime = DateTime.Now; ///****** Valores quemados de campos auditoria*****/ return(config); }
public static string getSetting(string code) { TestProjectEntities db = new TestProjectEntities(); try { int currenttenant = getIdentity().tenatId; genConfigName config = db.genConfigName.Where(x => x.code.ToLower() == code.ToLower()).FirstOrDefault(); genConfig configvalue = db.genConfig.Where(c => c.tenantId == currenttenant && c.genConfigNameId == config.genConfigNameId).FirstOrDefault(); //tenant tenant = db.tenant.Find(user.tenantId); //billingRefNumber = tenant.billingRefNumber; if (config != null) { return(configvalue.parameter); } } catch (Exception e) { } return(null); }