This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IF @TypeId = 0 | |
| BEGIN | |
| SELECT SuggestionId, [Message], [Type] | |
| FROM so_Suggestion main | |
| INNER JOIN so_Suggestion_Model joined ON main.SuggestionId = joined.SuggestionId | |
| WHERE main.[Type] = @TypeId | |
| END | |
| ELSE IF @TypeId = 1 | |
| BEGIN | |
| SELECT SuggestionId, [Message], [Type] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Koppling | |
| suggestion | |
| - id | |
| - message | |
| - submitted_by | |
| - submitted_date | |
| - approved_by | |
| - approved_date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SuggestionController<T> : ApiController, ISuggestionController<T> where T : ISuggestion { | |
| public ISuggestionSubmitter<T> Submitter { get; set; } | |
| public SuggestionController(ISuggestionSubmitter<T> submitter) { | |
| Submitter = submitter; | |
| } | |
| [HttpPost] | |
| public JsonResult Create(T suggestion) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // POST: /api/cars | |
| [HttpPost] | |
| public JsonResult Create(Car request) { | |
| if (!CurrentIdentity.Can(data.SpecialRights.ChangePrice)) { | |
| return Json(ApiResult(Result.RightsError("Du har inte rättighet att skapa objekt.")), JsonRequestBehavior.DenyGet); | |
| } | |
| if (!ModelState.IsValid) { | |
| Response.StatusCode = 422; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // POST: /api/transports | |
| [HttpPost] | |
| public JsonResult Create(Transport request) { | |
| if (!CurrentIdentity.Can(data.SpecialRights.ChangePrice)) { | |
| return Json(ApiResult(Result.RightsError("Du har inte rättighet att skapa objekt.")), JsonRequestBehavior.DenyGet); | |
| } | |
| if (!ModelState.IsValid) { | |
| Response.StatusCode = 422; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Transformer : ITransformer { | |
| public TransformResult Transform(data.Image original, ImageSpecification spec) { | |
| double load, resize, rotate, create, sharpen; | |
| byte[] imageBytes = null; | |
| using (Bitmap source = ActionTimer.Time(() => { return Load(original); }, out load)) { | |
| using (Bitmap resized = ActionTimer.Time(() => { return Resize(source, spec); }, out resize)) { | |
| ActionTimer.Time(() => { Rotate(resized, original); }, out rotate); | |
| ActionTimer.Time(() => { Sharpen(resized, spec.Sharpen); }, out sharpen); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public ImageCreationResult Create() { | |
| double load, resize, rotate, create, sharpen; | |
| byte[] imageBytes = null; | |
| using (Bitmap source = ActionTimer.Time(() => { return Load(); }, out load)) { | |
| using (Bitmap resized = ActionTimer.Time(() => { return Resize(source); }, out resize)) { | |
| ActionTimer.Time(() => { Rotate(resized); }, out rotate); | |
| ActionTimer.Time(() => { Sharpen(resized); }, out sharpen); | |
| ActionTimer.Time(() => { | |
| imageBytes = ImageTools.CreateJpeg(resized, Spec.Quality); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Web; | |
| using NovusDataLayer.Classes; | |
| using data = NovusDataLayer.DataClasses; | |
| using System.Drawing; | |
| using System.Diagnostics; | |
| using System.IO; | |
| using System.Drawing.Imaging; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ImageSpec { | |
| public static int DefaultQuality = 85; | |
| public int Sharpen { get; private set; } | |
| public int Quality { get; private set; } | |
| public int Height { get; private set; } | |
| public int Width { get; private set; } | |
| public ImageSpec(int quality, int sharpen, int height, int width) { | |
| Sharpen = sharpen; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static void GetSize(string size, out int width, out int height) { | |
| height = 0; | |
| switch (size.ToLower()) { | |
| case "largest": | |
| case "4": width = 1024; break; | |
| case "full2": | |
| case "8": width = 900; break; | |
| case "11": width = 640; break; | |
| case "full": | |
| case "1": width = 575; break; |