public void getConfigSuccess (TCConfigHelper helper, SystemDTO sysConfig)
		{
			MApplication.getInstance ().systemConfig = sysConfig;
			TCGlobals.getInstance.isNoGetConfiged = false;

			string strStartDate = "";
			string strEndDate = "";

			if (MApplication.getInstance ().isConsultant && this.bookingInfo.Status == (int)CoreSystem.Constants.STATUS.Requested && bookingInfo.Type == (int)CoreSystem.Constants.TALKNOWTYPE.ASAP) {
				strStartDate = MUtils.dateTimeToString (CoreSystem.Utils.getDateTimeNow(MApplication.getInstance().timezoneName).AddSeconds(sysConfig.minimumLeadTime * 60), MUtils.kFormatDateTimeDefaultPlatform);
				strEndDate = MUtils.dateTimeToString (CoreSystem.Utils.getDateTimeNow(MApplication.getInstance().timezoneName).AddSeconds((sysConfig.minimumLeadTime + sysConfig.minimumBooking) * 60), MUtils.kFormatDateTimeDefaultPlatform);
			} else {
				strStartDate = MUtils.stringDateToString (bookingInfo.StartTime, MUtils.kFormatDateTimeDefaultPlatform);
				strEndDate = MUtils.stringDateToString (bookingInfo.EndTime, MUtils.kFormatDateTimeDefaultPlatform);
			}
				
			this.lbStartTime.Text = strStartDate;
			this.lbEndTime.Text = strEndDate;
		}
Ejemplo n.º 2
0
		public static SystemDTO parseResponseSystemConfig (string response)
		{
			SystemDTO systemDTO = null;

			try {
				DataContractJsonSerializer js = new DataContractJsonSerializer (typeof(List<ConfigDTO>));
				MemoryStream ms = new MemoryStream (System.Text.UTF8Encoding.UTF8.GetBytes (response.ToString ()));
				List<ConfigDTO> configDTOs = (List<ConfigDTO>)js.ReadObject (ms);
				systemDTO = new SystemDTO ();
				foreach (ConfigDTO configDTO in configDTOs) {
					if (configDTO.Name.Equals (CoreSystem.Constants.ParamatricBusinessRules.MINIMUM_BOOKING.ToString ())) {
						systemDTO.minimumBooking = int.Parse (double.Parse (configDTO.Value, new CultureInfo ("en-us")).ToString ());
					} else if (configDTO.Name.Equals (CoreSystem.Constants.ParamatricBusinessRules.MAXIMUM_BOOKING.ToString ())) {
						systemDTO.maximumBooking = int.Parse (double.Parse (configDTO.Value, new CultureInfo ("en-us")).ToString ());
					} else if (configDTO.Name.Equals (CoreSystem.Constants.ParamatricBusinessRules.MINIMUM_LEAD_TIME.ToString ())) {
						systemDTO.minimumLeadTime = int.Parse (double.Parse (configDTO.Value, new CultureInfo ("en-us")).ToString ());
					} else if (configDTO.Name.Equals (CoreSystem.Constants.ParamatricBusinessRules.MAXIMUM_LEAD_TIME.ToString ())) {
						systemDTO.maximumLeadTime = int.Parse (double.Parse (configDTO.Value, new CultureInfo ("en-us")).ToString ());
					}
				}

				ms.Close ();
			} catch (Exception ex) {
				#if DEBUG
				Console.Write(ex.Message);
				#endif
				return null;
			} 

			return systemDTO;
		}