////////////////// // Constructors // ////////////////// public Job(TYPE jobType, EXTENSION extension, TIME_DEMAND timeDemand, DURATION duration, CityPart.PLACE cityPlace) { int quantity = Global.Values.jobsQuantity[(int)extension, (int)jobType]; int salary = Global.Values.jobsSalary[(int)jobType]; int contractedDays = Global.Values.jobsContractedDays[(int)duration, (int)jobType]; float requieredEffortValue = Global.Values.jobsRequieredEffort[(int)timeDemand, (int)jobType]; JobSchedule newSchedule = new JobSchedule(Global.Values.jobsStart[(int)jobType], Global.Values.jobsWorkingHours[(int)timeDemand, (int)jobType]); SetInitialValues(jobType, quantity, salary, contractedDays, newSchedule, requieredEffortValue, extension, timeDemand, duration, cityPlace); }
////////////////////// // Auxiliar Methods // ////////////////////// void SetInitialValues(TYPE jobType, int quantity, int salary, int contractedDays, JobSchedule schedule, float requieredEffortValue, EXTENSION extension, TIME_DEMAND timeDemand, DURATION duration, CityPart.PLACE cityPlace) { CityPlace = cityPlace; JobType = jobType; this.extension = extension; this.timeDemand = timeDemand; this.duration = duration; Salary = salary; Quantity = quantity; ContractedDays = contractedDays; Schedule = schedule; RequieredEffort = new ConditionableIndex("Esfuerzo Requerido", "Representacuanto esfuerzo ers necesario para ser " + Global.Names.jobs[(int)jobType] + " en el barrio " + Global.Names.cityPart[(int)cityPlace], requieredEffortValue); }
private void GetWebImageBase64() { //get the base 64 for display if (ImageFilePath != null) { //byte[] imageArray = System.IO.File.ReadAllBytes(ImageFilePath); //ImageBase64 = Convert.ToBase64String(imageArray); ImageBase64 = FileHelper.FileToBase64(ImageFilePath); WebImageBase64 = EXTENSION.Equals("tif", StringComparison.CurrentCultureIgnoreCase) ? ConvertImageToPng() : ImageBase64; WebImageBase64Src = "data:" + SrcImageType + ";base64," + WebImageBase64; if (IncludeThumbnail) { WebImageThumbBase64 = ResizeImage(ThumbWidth); WebImageThumbBase64Src = "data:image/png;base64," + WebImageThumbBase64; } } }
private string GetTeamLabResponse(string url, EXTENSION ext, METHOD method, Dictionary<string, string> headers, Dictionary<string, string> bodyParams) { try { return GetResponse(url + "." + ext.ToString(), method, headers, bodyParams); } catch (WebException ex) { if (ex.Message == "The remote server returned an error: (401) Unauthorized.") { throw new UnauthorizedException(); } string msgFromServer = null; try { var resp = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd(); dynamic obj = Newtonsoft.Json.JsonConvert.DeserializeObject(resp); msgFromServer = obj.error.message; } catch (NullReferenceException) { throw new ConnectionFailedException(); } switch (msgFromServer) { case "Invalid username or password.": throw new WrongCredentialsException(); case "Could not resolve current tenant :-(.": throw new WrongPortalException(); case "Not found": //Task was not found on the server throw new TaskNotFoundException(); case "Object reference not set to an instance of an object.": throw new ObjectReferenceException(); default: throw ex; } } }
//////////////////// // Public Methods // //////////////////// public void SetExtension(EXTENSION extension) { this.extension = extension; Quantity = Global.Values.jobsQuantity[(int)extension, (int)JobType]; }