public Blanket UpdateBlanket(int id, Blanket b) { try { ISession s = DataLayer.GetSession(); Blanket r = s.Load <Blanket>(id); r.Datum = b.Datum; r.Dodao = b.Dodao; r.Godina = b.Godina; r.Odobren = b.Odobren; r.Odobrio = b.Odobrio; r.Usmeni = b.Usmeni; r.Predmet = b.Predmet; r.Rok = b.Rok; r.ImageInBytes = b.ImageInBytes; r.ThumbnailInBytes = b.ThumbnailInBytes; //r.ImageInBytes = r.imageToByte(b.Image); s.Update(r); s.Flush(); s.Close(); return(GetBlanket(id)); } catch (Exception ex) { return(null); } }
private static void Compile(IEnumerable <ICompilerExtension> sequence) { object param = new Blanket(); var filebuffer = new FileBuffer(); var emptyParams = new object[] { filebuffer }; // ReSharper disable once LoopCanBeConvertedToQuery foreach (var item in sequence) { var itemType = item.GetType(); var isStage = itemType.FindInterfaces( (type, criteria) => type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IStage <,>), null).Length > 0; if (isStage) { itemType.GetMethod("Initialize").Invoke(item, emptyParams); param = itemType.GetMethod("Process").Invoke(item, new[] { param }); } else { param = itemType.GetMethod("Activate").Invoke(item, new[] { param }); } } }
public int OpretPersonoplysninger() { Medarbejder medarbejder = OpretMedarbejderPersonoplysninger(new Medarbejder()); Blanket blanket = OpretBlanket(medarbejder); OpretLog(blanket, "Afventer godkendelse"); try { db.SaveChanges(); } catch (DbEntityValidationException ex) { // Retrieve the error messages as a list of strings. var errorMessages = ex.EntityValidationErrors .SelectMany(x => x.ValidationErrors) .Select(x => x.ErrorMessage); // Join the list to a single string. var fullErrorMessage = string.Join("; ", errorMessages); // Combine the original exception message with the new one. var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage); // Throw a new DbEntityValidationException with the improved exception message. throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors); } return(medarbejder.id); }
private Blanket OpretBlanket(Medarbejder medarbejder) { Blanket blanket = new Blanket(); blanket.Medarbejder = medarbejder; blanket.type = "Oprettelse"; db.Blanket.Add(blanket); return(blanket); }
public IList <ConstructionInfo> Process(Blanket input) { var constructions = new List <ConstructionInfo>(); for (var i = 0; i < constructionFiles.Length; i++) { constructions.Add(ConstructionInfo.ParseFromFile(constructionFiles[i])); } return(constructions); }
private void OpretLog(Blanket blanket, string status) { Log log = new Log(); log.status = status; log.dato = DateTime.Today; log.initialer = Environment.UserName; log.Blanket = blanket; db.Log.Add(log); }
//POST api/blanket public Blanket Post([FromBody] Blanket g) { BlanketDataProvider provider = new BlanketDataProvider(); //Blanket b = Mapper.Map<BlanketDTO, Blanket>(g); //b.ImageInBytes = b.imageToByte(b.Image); g.Datum = DateTime.Now; return(provider.AddBlanket(g)); }
public BlanketDTO GetBlanketDTO(int id) { ISession s = DataLayer.GetSession(); Blanket d = s.Query <Blanket>().Where(r => r.IdBlanket == id).Select(p => p).FirstOrDefault(); if (d == null) { return(null); } return(Mapper.Map <Blanket, BlanketDTO>(d)); }
public void GodkendMedarbejder(int medarbejderId) { Log log = new Log(); Blanket blanket = db.Blanket.Where(b => b.medarbejder_id == medarbejderId).ToArray()[0]; log.status = "Godkendt af leder"; log.dato = DateTime.Today; log.Blanket = blanket; log.initialer = Environment.UserName; db.Log.Add(log); db.SaveChanges(); }
// GET api/BlanketSearch? predmet = {predmet}&rok={rok}&godina={godina}&pismeni={pismeni}&usmeni={usmeni} public BlanketDTO Get(int predmet, int rok, int godina, bool pismeni, bool usmeni) { BlanketSearch r = new BlanketSearch(); r.IdPredmet = predmet; r.IdRok = rok; r.Godina = godina; r.Pismeni = pismeni; r.Usmeni = usmeni; BlanketDataProvider provider = new BlanketDataProvider(); Blanket s = provider.NadjiBlanket(r); return(Mapper.Map <Blanket, BlanketDTO>(s)); }
// GET api/blanket/5 public Blanket Get(int id) { BlanketDataProvider provider = new BlanketDataProvider(); Blanket s = provider.GetBlanket(id); if (s == null) { return(null); } //s.Image=s.byteArrayToImage(s.ImageInBytes); return(s); //return Mapper.Map<Blanket, BlanketDTO>(s); }
public Blanket RemoveBlanket(int id) { try { ISession s = DataLayer.GetSession(); Blanket r = s.Load <Blanket>(id); s.Delete(r); s.Flush(); s.Close(); return(GetBlanket(id)); } catch (Exception ex) { return(new Blanket()); } }
public int Opret() { Medarbejder medarbejder = OpretMedarbejder(new Medarbejder()); Blanket blanket = OpretBlanket(medarbejder); db.Medarbejder.Add(medarbejder); OpretLog(blanket, "Afventer godkendelse"); db.SaveChanges(); return(medarbejder.id); }
public Blanket NadjiBlanket(BlanketSearch r) { try { ISession s = DataLayer.GetSession(); Blanket b = s.Query <Blanket>() .Where(c => c.Rok.IdRok == r.IdRok).Where(c => c.Predmet.IdPredmet == r.IdPredmet) .Where(c => c.Godina == r.Godina).Where(c => c.Pismeni == r.Pismeni) .Where(c => c.Usmeni == r.Usmeni).FirstOrDefault(); s.Close(); return(b); } catch (Exception ex) { return(null); } }
void Start() { mainBlanket = GameObject.FindGameObjectWithTag("Blanket").GetComponent<Blanket>(); StartCoroutine(rotatingCube()); StartCoroutine(phaseRoutine()); }
void Start() { currentPhase = PlayerPrefs.GetInt("Phase"); playerObject = GameObject.FindGameObjectWithTag("Player"); mainBlanket = GameObject.FindGameObjectWithTag("Blanket").GetComponent<Blanket>(); dialogueText = GameObject.FindGameObjectWithTag("DialogueText").GetComponent<Dialogue>(); dialogueBox = GameObject.FindGameObjectWithTag("DialogueBox"); // Make new player's heart invisible until function is called after heroine leaves int numOfHearts = playerObject.GetComponent<Player>().numOfHearts; Color heartInvisibleColor = playerObject.GetComponent<Player>().getHearts()[numOfHearts-1].transform.GetChild(1).GetComponent<Wireframe>().lineColor; heartInvisibleColor.a = 0; playerObject.GetComponent<Player>().getHearts()[numOfHearts-1].transform.GetChild(1).GetComponent<Wireframe>().lineColor = heartInvisibleColor; }
// PUT api/blanket/5 public Blanket Put(int id, [FromBody] Blanket v) { BlanketDataProvider provider = new BlanketDataProvider(); return(provider.UpdateBlanket(id, v)); }