public bool GetParamAsBool(string name) { return ConvertHelper.ToBool(GetParam(name)); }
public string AddOrderInfo(SHFY v) { string wramStr = ""; if (string.IsNullOrEmpty(v.VisitorName)) { wramStr = "访客姓名不能为空"; return(ConvertHelper.resultJson(0, wramStr)); } if (string.IsNullOrEmpty(v.VisitorSex)) { wramStr = "访客性别不能为空"; return(ConvertHelper.resultJson(0, wramStr)); } if (string.IsNullOrEmpty(v.VisitorPhone)) { wramStr = "访客电话不能为空"; return(ConvertHelper.resultJson(0, wramStr)); } if (string.IsNullOrEmpty(v.StaffNo)) { wramStr = "员工编号不能为空"; return(ConvertHelper.resultJson(0, wramStr)); } string sql = ""; SqlParameter[] pms = null; DateTime dt = DateTime.Now; int RandKey = 1000; bool is_ec_ok = false; while (!is_ec_ok) { Random ran = new Random(); RandKey = ran.Next(1000, 9999); int OrderCodeIsUse = 0; string sqlIsExistEC = "select count(*) from XXCLOUDALL.dbo.T_SHFYOrderInfo where OrderCode=@OrderCode and OrderCodeIsUse=@OrderCodeIsUse"; SqlParameter[] pms4EC = new SqlParameter[] { new SqlParameter("@OrderCode", SqlDbType.VarChar) { Value = RandKey.ToString() }, new SqlParameter("@OrderCodeIsUse", SqlDbType.VarChar) { Value = OrderCodeIsUse.ToString() } }; object obj = SQLHelper2.ExecuteScalar(sqlIsExistEC, System.Data.CommandType.Text, pms4EC); if (Convert.ToInt32(obj) == 0) { //说明此EnterCode可以使用 is_ec_ok = true; } } sql = "insert into XXCLOUDALL.dbo.T_SHFYOrderInfo(OrderNo, OrderCode, VisitorName, VisitorSex, VisitorPhone, VisitorIdNo, VisitorReason, VisitorNumber, CarNo, VisitorStartDT, VisitorEndDT, StaffNo, CreateTime)" + "values(@OrderNo, @OrderCode, @VisitorName, @VisitorSex, @VisitorPhone, @VisitorIdNo, @VisitorReason, @VisitorNumber, @CarNo, @VisitorStartDT, @VisitorEndDT, @StaffNo, @CreateTime)"; pms = new SqlParameter[] { new SqlParameter("@OrderNo", SqlDbType.VarChar) { Value = DataHelper.IsNullReturnLine(v.OrderNo) }, new SqlParameter("@OrderCode", SqlDbType.VarChar) { Value = DataHelper.IsNullReturnLine(RandKey.ToString()) }, new SqlParameter("@VisitorName", SqlDbType.NVarChar) { Value = DataHelper.IsNullReturnLine(v.VisitorName) }, new SqlParameter("@VisitorSex", SqlDbType.NVarChar) { Value = DataHelper.IsNullReturnLine(v.VisitorSex) }, new SqlParameter("@VisitorPhone", SqlDbType.VarChar) { Value = DataHelper.IsNullReturnLine(v.VisitorPhone) }, new SqlParameter("@VisitorIdNo", SqlDbType.VarChar) { Value = DataHelper.IsNullReturnLine(v.VisitorIdNo) }, new SqlParameter("@VisitorReason", SqlDbType.NVarChar) { Value = DataHelper.IsNullReturnLine(v.VisitorReason) }, new SqlParameter("@VisitorNumber", SqlDbType.NVarChar) { Value = DataHelper.IsNullReturnLine(v.VisitorNumber) }, new SqlParameter("@CarNo", SqlDbType.NVarChar) { Value = DataHelper.IsNullReturnLine(v.CarNo) }, new SqlParameter("@VisitorStartDT", SqlDbType.NVarChar) { Value = DataHelper.IsNullReturnLine(v.VisitorStartDT) }, new SqlParameter("@VisitorEndDT", SqlDbType.NVarChar) { Value = DataHelper.IsNullReturnLine(v.VisitorEndDT) }, new SqlParameter("@StaffNo", SqlDbType.NVarChar) { Value = DataHelper.IsNullReturnLine(v.StaffNo) }, new SqlParameter("@CreateTime", SqlDbType.VarChar) { Value = dt.ToString("yyyy-MM-dd hh:mm:ss") } }; try { int result = SQLHelper2.ExecuteNonQuery(sql, System.Data.CommandType.Text, pms); if (result == 1) { int code = 1; return("{\"code\":\"" + code + "\",\"ordercode\":\"" + RandKey.ToString() + "\"}"); //return "{\"code\":1,\"ordercode\":" + RandKey.ToString() + "}"; } else { return(ConvertHelper.resultJson(0, "操作数据库失败,请联系技术人员")); } } catch (Exception e) { //在webapi中要想抛出异常必须这样抛出,否则只抛出一个默认500的异常 var resp = new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(e.ToString()), ReasonPhrase = "error" }; throw new HttpResponseException(resp); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { Label1.Text = System.Threading.Thread.CurrentPrincipal.Identity.Name; Dictionary <string, object> dict = new Dictionary <string, object>(); if (!string.IsNullOrEmpty(this.Context.Request.QueryString["window"])) { string windowId = this.Context.Request.QueryString["window"]; WindowInfo windowInfo = ADInfoBll.Instance.GetWindowInfo(windowId); IList <WindowTabInfo> tabInfos = null; if (windowInfo != null) { this.Title = windowInfo.Text; tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Id); } if (tabInfos != null && tabInfos.Count > 0) { CreateColumns(0, tabInfos[0]); dict["winTab"] = tabInfos[0].Id; } } else if (!string.IsNullOrEmpty(this.Context.Request.QueryString["wintab"])) { string winTabId = this.Context.Request.QueryString["wintab"]; WindowTabInfo tabInfo = ADInfoBll.Instance.GetWindowTabInfo(winTabId); if (tabInfo != null) { this.Title = tabInfo.Text; CreateColumns(0, tabInfo); dict["winTab"] = tabInfo.Id.ToString(); } } else { return; } if (!string.IsNullOrEmpty(this.Context.Request.QueryString["se"])) { //this.Grid1.Filter = this.Context.Request.QueryString["se"]; dict["se"] = this.Context.Request.QueryString["se"]; } if (!string.IsNullOrEmpty(this.Context.Request.QueryString["so"])) { this.Grid1.Sort = this.Context.Request.QueryString["so"]; } if (!string.IsNullOrEmpty(this.Context.Request.QueryString["ro"])) { this.Grid1.RecordOffset = ConvertHelper.ToInt(this.Context.Request.QueryString["ro"]).Value; } if (!string.IsNullOrEmpty(this.Context.Request.QueryString["ps"])) { this.Grid1.PageSize = ConvertHelper.ToInt(this.Context.Request.QueryString["ps"]).Value; } this.Grid1.WebServiceCustomParameter = Helper.DictionaryToString(dict); } }
void UpdateDiStates(UserGame game) { // Get all mapped user instances. var instanceGuids = SettingsManager.Settings.Items .Where(x => x.MapTo > (int)MapTo.None) .Select(x => x.InstanceGuid).ToArray(); // Get all connected devices. var userDevices = SettingsManager.UserDevices.Items .Where(x => instanceGuids.Contains(x.InstanceGuid) && x.IsOnline) .ToArray(); // Acquire copy of feedbacks for processing. var feedbacks = CopyAndClearFeedbacks(); for (int i = 0; i < userDevices.Count(); i++) { // Update direct input form and return actions (pressed Buttons/DPads, turned Axis/Sliders). var ud = userDevices[i]; JoystickState state = null; // Allow if not testing or testing with option enabled. var o = SettingsManager.Options; var allow = !o.TestEnabled || o.TestGetDInputStates; var isOnline = ud != null && ud.IsOnline; if (isOnline && allow) { var device = ud.Device; if (device != null) { var exceptionData = new System.Text.StringBuilder(); try { var isVirtual = ((EmulationType)game.EmulationType).HasFlag(EmulationType.Virtual); var hasForceFeedback = device.Capabilities.Flags.HasFlag(DeviceFlags.ForceFeedback); // Exclusive mode required only if force feedback is available and device is virtual there are no info about effects. var exclusiveRequired = hasForceFeedback && (isVirtual || ud.DeviceEffects == null); // If exclusive mode is required and mode is unknown or not exclusive then... if (exclusiveRequired && (!ud.IsExclusiveMode.HasValue || !ud.IsExclusiveMode.Value)) { var flags = CooperativeLevel.Background | CooperativeLevel.Exclusive; // Reacquire device in exclusive mode. exceptionData.AppendLine("Unacquire (Exclusive)..."); device.Unacquire(); exceptionData.AppendLine("SetCooperativeLevel (Exclusive)..."); device.SetCooperativeLevel(detector.DetectorForm.Handle, flags); exceptionData.AppendLine("Acquire (Exclusive)..."); device.Acquire(); ud.IsExclusiveMode = true; } // If current mode must be non exclusive and mode is unknown or exclusive then... else if (!exclusiveRequired && (!ud.IsExclusiveMode.HasValue || ud.IsExclusiveMode.Value)) { var flags = CooperativeLevel.Background | CooperativeLevel.NonExclusive; // Reacquire device in non exclusive mode so that xinput.dll can control force feedback. exceptionData.AppendLine("Unacquire (NonExclusive)..."); device.Unacquire(); exceptionData.AppendLine("SetCooperativeLevel (Exclusive)..."); device.SetCooperativeLevel(detector.DetectorForm.Handle, flags); exceptionData.AppendLine("Acquire (Acquire)..."); device.Acquire(); ud.IsExclusiveMode = false; } exceptionData.AppendFormat("device.GetCurrentState() // ud.IsExclusiveMode = {0}", ud.IsExclusiveMode).AppendLine(); state = device.GetCurrentState(); // Fill device objects. if (ud.DeviceObjects == null) { exceptionData.AppendFormat("AppHelper.GetDeviceObjects(device) // ud.IsExclusiveMode = {0}", ud.IsExclusiveMode).AppendLine(); var dos = AppHelper.GetDeviceObjects(device); ud.DeviceObjects = dos; // Update masks. ud.DiAxeMask = CustomDiState.GetJoystickAxisMask(dos, device); ud.DiSliderMask = CustomDiState.GetJoystickSlidersMask(dos, device); } if (ud.DeviceEffects == null) { exceptionData.AppendFormat("AppHelper.GetDeviceEffects(device) // ud.IsExclusiveMode = {0}", ud.IsExclusiveMode).AppendLine(); ud.DeviceEffects = AppHelper.GetDeviceEffects(device); } // Get PAD index this device is mapped to. var userIndex = SettingsManager.Settings.Items .Where(x => x.MapTo > (int)MapTo.None) .Where(x => x.InstanceGuid == ud.InstanceGuid) .Select(x => x.MapTo).First(); // If device support force feedback then... if (hasForceFeedback) { // Get setting related to user device. var setting = SettingsManager.Settings.Items .FirstOrDefault(x => x.MapTo == userIndex && x.InstanceGuid == ud.InstanceGuid); if (setting != null) { // Get pad setting attached to device. var ps = SettingsManager.GetPadSetting(setting.PadSettingChecksum); if (ps != null) { // If force is enabled then... if (ps.ForceEnable == "1") { if (ud.FFState == null) { ud.FFState = new Engine.ForceFeedbackState(); } // If force update supplied then... var force = feedbacks[userIndex - 1]; if (force != null || ud.FFState.Changed(ps)) { var v = new Vibration(); if (force == null) { v.LeftMotorSpeed = short.MinValue; v.RightMotorSpeed = short.MinValue; } else { v.LeftMotorSpeed = (short)ConvertHelper.ConvertRange(byte.MinValue, byte.MaxValue, short.MinValue, short.MaxValue, force.LargeMotor); v.RightMotorSpeed = (short)ConvertHelper.ConvertRange(byte.MinValue, byte.MaxValue, short.MinValue, short.MaxValue, force.SmallMotor); } // For the future: Investigate device states if force feedback is not working. // var st = ud.Device.GetForceFeedbackState(); //st == SharpDX.DirectInput.ForceFeedbackState // ud.Device.SendForceFeedbackCommand(ForceFeedbackCommand.SetActuatorsOn); exceptionData.AppendFormat("ud.FFState.SetDeviceForces(device) // ud.IsExclusiveMode = {0}", ud.IsExclusiveMode).AppendLine(); ud.FFState.SetDeviceForces(ud, device, ps, v); } } // If force state was created then... else if (ud.FFState != null) { // Stop device forces. exceptionData.AppendFormat("ud.FFState.StopDeviceForces(device) // ud.IsExclusiveMode = {0}", ud.IsExclusiveMode).AppendLine(); ud.FFState.StopDeviceForces(device); ud.FFState = null; } } } } } catch (Exception ex) { ex.Data.Add("FFInfo", exceptionData.ToString()); JocysCom.ClassLibrary.Runtime.LogHelper.Current.WriteException(ex); ud.IsExclusiveMode = null; } } // If this is test device then... else if (TestDeviceHelper.ProductGuid.Equals(ud.ProductGuid)) { // Fill device objects. if (ud.DeviceObjects == null) { var dos = TestDeviceHelper.GetDeviceObjects(); ud.DeviceObjects = dos; // Update masks. ud.DiAxeMask = 0x1 | 0x2 | 0x4 | 0x8; ud.DiSliderMask = 0; } if (ud.DeviceEffects == null) { ud.DeviceEffects = new DeviceEffectItem[0]; } state = TestDeviceHelper.GetCurrentState(ud); } } ud.JoState = state ?? new JoystickState(); var newState = new CustomDiState(ud.JoState); var newTime = watch.ElapsedTicks; // Mouse needs special update. if (ud.Device != null && ud.Device.Information.Type == SharpDX.DirectInput.DeviceType.Mouse) { var mouseState = new CustomDiState(ud.JoState); if (ud.OldDiState == null) { // Make sure new state have zero values. for (int a = 0; a < newState.Axis.Length; a++) { mouseState.Axis[a] = -short.MinValue; } // Update sliders with delta. for (int s = 0; s < newState.Sliders.Length; s++) { mouseState.Sliders[s] = -short.MinValue; } } else { // This parts needs to be worked on. var ticks = (int)(newTime - ud.DiStateTime); // Update axis with delta. for (int a = 0; a < newState.Axis.Length; a++) { mouseState.Axis[a] = ticks * (newState.Axis[a] - ud.OldDiState.Axis[a]) - short.MinValue; } // Update sliders with delta. for (int s = 0; s < newState.Sliders.Length; s++) { mouseState.Sliders[s] = ticks * (newState.Sliders[s] - ud.OldDiState.Sliders[s]) - short.MinValue; } } // Assign unmodified state. ud.OldDiState = newState; ud.OldDiStateTime = ud.DiStateTime; ud.DiState = mouseState; } else { // Update state. ud.DiState = newState; } ud.DiStateTime = newTime; } }
/// <summary> /// 给实体赋值 /// </summary> /// <param name="model">实体</param> /// <param name="colName">列名</param> /// <param name="value">值</param> public void SetModelValue(DataAccess.Model.CONTRACT00 model, string colName, object value) { if (model == null || string.IsNullOrEmpty(colName)) { return; } //返回指定条件的实体 switch (colName) { case "Id": model.Id = (int)value; break; case "CONTRACT_ID": model.CONTRACT_ID = (string)value; break; case "CONTRACT_TITLE": model.CONTRACT_TITLE = (string)value; break; case "CONTRACTP_SIGN": model.CONTRACTP_SIGN = (DateTime)value; break; case "CONTRACTP_STARTTIME": model.CONTRACTP_STARTTIME = (DateTime)value; break; case "CONTRACTP_ENDTIME": model.CONTRACTP_ENDTIME = (DateTime)value; break; case "USABLE": model.USABLE = ConvertHelper.Ctinyint(value); break; case "LOCK": model.LOCK = ConvertHelper.Ctinyint(value); break; case "FIRST_PARTY": model.FIRST_PARTY = (string)value; break; case "SECEND_PARTY": model.SECEND_PARTY = (string)value; break; case "Meno": model.Meno = (string)value; break; case "CRT_DATETIME": model.CRT_DATETIME = (DateTime)value; break; case "CRT_USER_ID": model.CRT_USER_ID = (string)value; break; case "MOD_DATETIME": model.MOD_DATETIME = (DateTime)value; break; case "MOD_USER_ID": model.MOD_USER_ID = (string)value; break; case "LAST_UPDATE": model.LAST_UPDATE = (DateTime)value; break; case "STATUS": model.STATUS = ConvertHelper.Ctinyint(value); break; } }
public static long GetFormInt64(string strName, long defValue) { return(ConvertHelper.StrToInt64(HttpContext.Current.Request.Form[strName], defValue)); }
/// <summary> /// 获得默认地址 /// </summary> /// <param name="userId">用户id</param> /// <returns></returns> public async Task <AddressDto> GetDefaultAsync(int userId) { var model = await this.MailingAddressRepository.FindAsync(ma => ma.UserId == userId.ToString() && ma.IsDefault.GetValueOrDefault(true)); return(ConvertHelper.ChangeType <AddressDto>(model)); }
public static JoystickState GetCurrentState(UserDevice ud) { if (watch == null) { watch = new Stopwatch(); watch.Start(); } var elapsed = watch.Elapsed; // Restart timer if out of limits. if (elapsed.TotalMilliseconds > int.MaxValue) { watch.Restart(); elapsed = watch.Elapsed; } // Acquire values. var ts = (int)elapsed.TotalSeconds; var tm = (int)elapsed.TotalMilliseconds; var state = new JoystickState(); // Set Buttons. for (int i = 0; i < ud.CapButtonCount; i++) { var currentLocation = ts % ud.CapButtonCount; // Enable button during its index. state.Buttons[i] = currentLocation == i; } // Do action for 4 seconds [0-3999] ms. var busy = 4000; var half = busy / 2; // then stay for 2 seconds idle [4000-5999] ms. var idle = 2000; // 6 = 4 + 2. var time = tm % (busy + idle); var invert = tm % ((busy + idle) * 2) > (busy + idle); // Set POVs. for (int i = 0; i < ud.CapPovCount; i++) { // Rotate POVs 360 degrees in 4 seconds forward and back. var degree = -1; if (time < busy) { // Shift busy value by half so movement starts from the centre. var value = (time + busy / 2) % busy; if (time <= half) { // Convert [ 0-1999] to [0-35999]. degree = ConvertHelper.ConvertRange(0, half - 1, 0, 35999, value); } else { // Convert [2000-3999] to [35999-0]. degree = ConvertHelper.ConvertRange(half, busy - 1, 35999, 0, value); } } state.PointOfViewControllers[i] = degree; } // Set Axis. var axis = CustomDiState.GetAxisFromState(state); // Get information about axis. var axisObjects = ud.DeviceObjects .Where(x => x.Flags.HasFlag(DeviceObjectTypeFlags.AbsoluteAxis) || x.Flags.HasFlag(DeviceObjectTypeFlags.RelativeAxis)).ToArray(); for (int i = 0; i < axisObjects.Count(); i++) { var ao = axisObjects[i]; // If axis index is even. var isEven = i % 2 == 0; var position = isEven // Default position is in the center. ? ushort.MaxValue - short.MaxValue // Default position is at the bottom. : 0; // Move axis in 4 seconds, then stay for 2 seconds idle. if (time < busy) { if (isEven) { // Convert [0-3999] to [0-2Pi]. var angle = time * 2 * Math.PI / busy; var sine = Math.Sin(angle); if (invert && isEven) { sine *= -1f; } var range = ConvertHelper.ConvertToShort((float)sine); position = ConvertHelper.ConvertRange(short.MinValue, short.MaxValue, ushort.MinValue, ushort.MaxValue, range); } else { position = time < half // Move up [0-1999]. ? ConvertHelper.ConvertRange(0, half - 1, ushort.MinValue, ushort.MaxValue, time) // Move down [2000-3999]. : ConvertHelper.ConvertRange(half, busy - 1, ushort.MaxValue, ushort.MinValue, time); } } axis[i] = position; } CustomDiState.SetStateFromAxis(state, axis); // Get sliders array. var sliders = CustomDiState.GetSlidersFromState(state); // Set sliders. for (int i = 0; i < sliders.Length; i++) { var isEven = i % 2 == 0; var position = isEven // Default position is in the center. ? ushort.MaxValue - short.MaxValue // Default position is at the bottom. : 0; // Move slider in 4 seconds, then stay for 2 seconds idle. if (time < busy) { if (isEven) { // Convert [0-3999] to [0-2Pi]. var angle = time * 2 * Math.PI / busy; var sine = Math.Sin(angle); if (invert && isEven) { sine *= -1f; } var range = ConvertHelper.ConvertToShort((float)sine); position = ConvertHelper.ConvertRange(short.MinValue, short.MaxValue, ushort.MinValue, ushort.MaxValue, range); } else { position = time < half // Move up. ? ConvertHelper.ConvertRange(0, half - 1, ushort.MinValue, ushort.MaxValue, time) // Move down. : ConvertHelper.ConvertRange(half, busy - 1, ushort.MaxValue, ushort.MinValue, time); } } sliders[i] = position; } CustomDiState.SetStateFromSliders(state, sliders); // Return state. return(state); }
/// <summary>自动排序</summary> /// <param name="fieldId">id字段名:"Id"</param> /// <param name="tableName">表名:"NewsClass"</param> /// <param name="strWhere">附加Where : " sid=1 "</param> /// <param name="isExistsMoreLv">是否存在多级分类,一级时,请使用false,多级使用true,(一级不包括ParentId字段)</param> /// <param name="pid">父级分类的ParentId</param> /// <param name="fieldName">字段名:"OrderId"</param> /// <param name="fieldParentId">字段名:"ParentId"</param> public static bool AutoSort(string fieldId, string tableName, string strWhere = "", bool isExistsMoreLv = false, int pid = 0, string fieldName = "Sort", string fieldParentId = "ParentId") { try { string sw = ""; var select = new SelectHelper(); var update = new UpdateHelper(); if (string.IsNullOrEmpty(strWhere) == false) { sw = " where " + strWhere; } if (isExistsMoreLv) { pid = ConvertHelper.Cint0(pid); if (string.IsNullOrEmpty(sw)) { sw = " where " + fieldParentId + "=" + pid; } else { sw += " and " + fieldParentId + "=" + pid; } } var dt = select.ExcuSQLDataTable("select " + fieldId + " from " + tableName + " " + sw + " order by " + fieldName + " asc," + fieldId); string[] pRs = DataTableHelper.GetArrayString(dt, fieldId); if (pRs.Length > 0) { int ti = pRs.Length; for (int i = 0; i < ti; i++) { if (pRs[i].Length > 0) { update.Update("update " + tableName + " set " + fieldName + "=" + (i + 1).ToString() + " where " + fieldId + "=" + pRs[i]); if (isExistsMoreLv) { AutoSort(fieldId, tableName, strWhere, isExistsMoreLv, ConvertHelper.Cint0(pRs[i]), fieldName, fieldParentId); } } } } pRs = null; return(true); } catch { return(false); } }
protected override int EncodePayload(byte[] bytes, int offset) { offset = ConvertHelper.EncodeUInt((uint)Gpo, bytes, offset); offset = ConvertHelper.EncodeUInt(Convert.ToUInt32(Active), bytes, offset); return(offset); }
public static void InitializeCK5() { Mapper.CreateMap <CK5MaterialOutput, CK5UploadViewModel>().IgnoreAllNonExisting(); Mapper.CreateMap <CK5Dto, CK5Item>().IgnoreAllNonExisting() .ForMember(dest => dest.Ck5Id, opt => opt.MapFrom(src => src.CK5_ID)) .ForMember(dest => dest.DocumentNumber, opt => opt.MapFrom(src => src.SUBMISSION_NUMBER)) .ForMember(dest => dest.Qty, opt => opt.ResolveUsing <CK5ListIndexQtyResolver>().FromMember(src => src)) .ForMember(dest => dest.QtyPackaging, opt => opt.ResolveUsing <CK5ListIndexQtyPackagingResolver>().FromMember(src => src)) .ForMember(dest => dest.POA, opt => opt.ResolveUsing <CK5ListIndexPOAResolver>().FromMember(src => src)) .ForMember(dest => dest.SourcePlant, opt => opt.MapFrom(src => src.SOURCE_PLANT_ID + " - " + src.SOURCE_PLANT_NAME)) .ForMember(dest => dest.DestinationPlant, opt => opt.ResolveUsing <CK5ListIndexDestinationPlantResolver>().FromMember(src => src)) .ForMember(dest => dest.Status, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.STATUS_ID))) .ForMember(dest => dest.StoNumber, opt => opt.MapFrom(src => src.STOB_NUMBER)) .ForMember(dest => dest.InvoiceNumber, opt => opt.MapFrom(src => src.INVOICE_NUMBER)) .ForMember(dest => dest.DocumentCreatedDate, opt => opt.MapFrom(src => src.CREATED_DATE.ToString("dd MMM yyyy"))) .ForMember(dest => dest.SubmissionDate, opt => opt.MapFrom(src => src.SUBMISSION_DATE.HasValue ? src.SUBMISSION_DATE.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.GrDate, opt => opt.MapFrom(src => src.GR_DATE.HasValue ? src.GR_DATE.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.RegDate, opt => opt.MapFrom(src => src.REGISTRATION_DATE.HasValue ? src.REGISTRATION_DATE.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.DestinationPlantId, opt => opt.MapFrom(src => src.DEST_PLANT_ID)) .ForMember(dest => dest.DestinationPlantDesc, opt => opt.MapFrom(src => src.DEST_PLANT_NAME)) ; Mapper.CreateMap <CK5SearchViewModel, CK5GetByParamInput>().IgnoreAllNonExisting() .ForMember(dest => dest.Month, opt => opt.ResolveUsing <StringToIntResolver>().FromMember(src => src.Month)) .ForMember(dest => dest.Year, opt => opt.ResolveUsing <StringToIntResolver>().FromMember(src => src.Year)) ; Mapper.CreateMap <T001WDto, CK5PlantModel>().IgnoreAllNonExisting() .ForMember(dest => dest.PlantId, opt => opt.MapFrom(src => src.WERKS)) .ForMember(dest => dest.PlantName, opt => opt.MapFrom(src => src.NAME1)) .ForMember(dest => dest.PlantNpwp, opt => opt.MapFrom(src => src.Npwp)) .ForMember(dest => dest.NPPBCK_ID, opt => opt.MapFrom(src => src.NPPBKC_ID)) .ForMember(dest => dest.CompanyCode, opt => opt.MapFrom(src => src.CompanyCode)) .ForMember(dest => dest.CompanyName, opt => opt.MapFrom(src => src.CompanyName)) .ForMember(dest => dest.CompanyAddress, opt => opt.MapFrom(src => src.ADDRESS)) .ForMember(dest => dest.KppBcName, opt => opt.MapFrom(src => src.KppbcCity + "-" + src.KppbcNo)) .ForMember(dest => dest.KppbcCity, opt => opt.MapFrom(src => src.KppbcCity)) .ForMember(dest => dest.KppbcNo, opt => opt.MapFrom(src => src.KppbcNo)) ; Mapper.CreateMap <CK5FormViewModel, CK5Dto>().IgnoreAllNonExisting() .ForMember(dest => dest.CK5_ID, opt => opt.MapFrom(src => src.Ck5Id)) .ForMember(dest => dest.CK5_TYPE, opt => opt.MapFrom(src => src.Ck5Type)) .ForMember(dest => dest.STATUS_ID, opt => opt.MapFrom(src => src.DocumentStatus)) .ForMember(dest => dest.CREATED_BY, opt => opt.MapFrom(src => src.CreatedBy)) .ForMember(dest => dest.CREATED_DATE, opt => opt.MapFrom(src => src.CreatedDate)) .ForMember(dest => dest.KPPBC_CITY, opt => opt.MapFrom(src => src.KppBcCity)) .ForMember(dest => dest.CE_OFFICE_CODE, opt => opt.MapFrom(src => src.CeOfficeCode)) .ForMember(dest => dest.SUBMISSION_NUMBER, opt => opt.MapFrom(src => src.SubmissionNumber)) .ForMember(dest => dest.SUBMISSION_DATE, opt => opt.MapFrom(src => src.SubmissionDate)) .ForMember(dest => dest.REGISTRATION_NUMBER, opt => opt.MapFrom(src => src.RegistrationNumber)) .ForMember(dest => dest.REGISTRATION_DATE, opt => opt.MapFrom(src => src.RegistrationDate)) .ForMember(dest => dest.EX_GOODS_TYPE_DESC, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.GoodType))) .ForMember(dest => dest.EX_GOODS_TYPE, opt => opt.MapFrom(src => src.GoodType)) .ForMember(dest => dest.EX_SETTLEMENT_ID, opt => opt.MapFrom(src => src.ExciseSettlement)) .ForMember(dest => dest.EX_STATUS_ID, opt => opt.MapFrom(src => src.ExciseStatus)) .ForMember(dest => dest.REQUEST_TYPE_ID, opt => opt.MapFrom(src => src.RequestType)) .ForMember(dest => dest.SOURCE_PLANT_ID, opt => opt.MapFrom(src => src.SourcePlantId)) .ForMember(dest => dest.SOURCE_PLANT_NPWP, opt => opt.MapFrom(src => src.SourceNpwp)) .ForMember(dest => dest.SOURCE_PLANT_NPPBKC_ID, opt => opt.MapFrom(src => src.SourceNppbkcId)) .ForMember(dest => dest.SOURCE_PLANT_COMPANY_CODE, opt => opt.MapFrom(src => src.SourceCompanyCode)) .ForMember(dest => dest.SOURCE_PLANT_COMPANY_NAME, opt => opt.MapFrom(src => src.SourceCompanyName)) .ForMember(dest => dest.SOURCE_PLANT_ADDRESS, opt => opt.MapFrom(src => src.SourceAddress)) .ForMember(dest => dest.SOURCE_PLANT_KPPBC_NAME_OFFICE, opt => opt.MapFrom(src => src.SourceKppbcName)) .ForMember(dest => dest.SOURCE_PLANT_NAME, opt => opt.MapFrom(src => src.SourcePlantName)) .ForMember(dest => dest.DEST_PLANT_ID, opt => opt.MapFrom(src => src.DestPlantId)) .ForMember(dest => dest.DEST_PLANT_NPWP, opt => opt.MapFrom(src => src.DestNpwp)) .ForMember(dest => dest.DEST_PLANT_NPPBKC_ID, opt => opt.MapFrom(src => src.DestNppbkcId)) .ForMember(dest => dest.DEST_PLANT_COMPANY_CODE, opt => opt.MapFrom(src => src.DestCompanyCode)) .ForMember(dest => dest.DEST_PLANT_COMPANY_NAME, opt => opt.MapFrom(src => src.DestCompanyName)) .ForMember(dest => dest.DEST_PLANT_ADDRESS, opt => opt.MapFrom(src => src.DestAddress)) .ForMember(dest => dest.DEST_PLANT_KPPBC_NAME_OFFICE, opt => opt.MapFrom(src => src.DestKppbcName)) .ForMember(dest => dest.DEST_PLANT_NAME, opt => opt.MapFrom(src => src.DestPlantName)) .ForMember(dest => dest.LOADING_PORT, opt => opt.MapFrom(src => src.LoadingPort)) .ForMember(dest => dest.LOADING_PORT_NAME, opt => opt.MapFrom(src => src.LoadingPortName)) .ForMember(dest => dest.LOADING_PORT_ID, opt => opt.MapFrom(src => src.LoadingPortId)) .ForMember(dest => dest.FINAL_PORT, opt => opt.MapFrom(src => src.FinalPort)) .ForMember(dest => dest.FINAL_PORT_NAME, opt => opt.MapFrom(src => src.FinalPortName)) .ForMember(dest => dest.FINAL_PORT_ID, opt => opt.MapFrom(src => src.FinalPortId)) .ForMember(dest => dest.INVOICE_NUMBER, opt => opt.MapFrom(src => src.InvoiceNumber)) .ForMember(dest => dest.INVOICE_DATE, opt => opt.MapFrom(src => src.InvoiceDate)) .ForMember(dest => dest.PBCK1_DECREE_ID, opt => opt.MapFrom(src => src.PbckDecreeId)) .ForMember(dest => dest.PbckNumber, opt => opt.MapFrom(src => src.PbckDecreeNumber)) .ForMember(dest => dest.CARRIAGE_METHOD_ID, opt => opt.MapFrom(src => src.CarriageMethod)) .ForMember(dest => dest.GRAND_TOTAL_EX, opt => opt.MapFrom(src => src.GrandTotalEx)) .ForMember(dest => dest.PACKAGE_UOM_ID, opt => opt.MapFrom(src => src.PackageUomName)) .ForMember(dest => dest.DEST_COUNTRY_CODE, opt => opt.MapFrom(src => src.CountryCode)) .ForMember(dest => dest.DEST_COUNTRY_NAME, opt => opt.MapFrom(src => src.CountryName)) .ForMember(dest => dest.RemainQuota, opt => opt.MapFrom(src => src.RemainQuota)) .ForMember(dest => dest.CK5_MANUAL_TYPE, opt => opt.MapFrom(src => src.Ck5ManualType)) .ForMember(dest => dest.CK5_REF_ID, opt => opt.MapFrom(src => src.Ck5RefId)) .ForMember(dest => dest.REDUCE_TRIAL, opt => opt.MapFrom(src => src.IsReducePbck1Ck5Trial)) .ForMember(dest => dest.STO_SENDER_NUMBER, opt => opt.MapFrom(src => src.StoSenderNumber)) .ForMember(dest => dest.STO_RECEIVER_NUMBER, opt => opt.MapFrom(src => src.StoReceiverNumber)) .ForMember(dest => dest.STOB_NUMBER, opt => opt.MapFrom(src => src.StobNumber)) .ForMember(dest => dest.FLAG_FOR_LACK1_LAB, opt => opt.MapFrom(src => src.IsLack1Lab)) ; Mapper.CreateMap <CK5Dto, CK5FormViewModel>().IgnoreAllNonExisting() .ForMember(dest => dest.Ck5Id, opt => opt.MapFrom(src => src.CK5_ID)) .ForMember(dest => dest.Ck5Type, opt => opt.MapFrom(src => src.CK5_TYPE)) .ForMember(dest => dest.Ck5TypeString, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.CK5_TYPE))) .ForMember(dest => dest.CreatedBy, opt => opt.MapFrom(src => src.CREATED_BY)) .ForMember(dest => dest.CreatedDate, opt => opt.MapFrom(src => src.CREATED_DATE)) .ForMember(dest => dest.DocumentStatus, opt => opt.MapFrom(src => src.STATUS_ID)) .ForMember(dest => dest.DocumentStatusDescription, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.STATUS_ID))) .ForMember(dest => dest.KppBcCity, opt => opt.MapFrom(src => src.KPPBC_CITY)) .ForMember(dest => dest.CeOfficeCode, opt => opt.MapFrom(src => src.CE_OFFICE_CODE)) .ForMember(dest => dest.SubmissionNumber, opt => opt.MapFrom(src => src.SUBMISSION_NUMBER)) .ForMember(dest => dest.SubmissionDate, opt => opt.MapFrom(src => src.SUBMISSION_DATE)) .ForMember(dest => dest.RegistrationNumber, opt => opt.MapFrom(src => src.REGISTRATION_NUMBER)) .ForMember(dest => dest.RegistrationDate, opt => opt.MapFrom(src => src.REGISTRATION_DATE)) .ForMember(dest => dest.GoodType, opt => opt.MapFrom(src => src.EX_GOODS_TYPE)) .ForMember(dest => dest.GoodTypeName, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.EX_GOODS_TYPE))) .ForMember(dest => dest.ExciseSettlement, opt => opt.MapFrom(src => src.EX_SETTLEMENT_ID)) .ForMember(dest => dest.ExciseSettlementDesc, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.EX_SETTLEMENT_ID))) .ForMember(dest => dest.ExciseStatus, opt => opt.MapFrom(src => src.EX_STATUS_ID)) .ForMember(dest => dest.ExciseStatusDesc, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.EX_STATUS_ID))) .ForMember(dest => dest.RequestType, opt => opt.MapFrom(src => src.REQUEST_TYPE_ID)) .ForMember(dest => dest.RequestTypeDesc, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.REQUEST_TYPE_ID))) .ForMember(dest => dest.SourcePlantId, opt => opt.MapFrom(src => src.SOURCE_PLANT_ID)) .ForMember(dest => dest.SourceNpwp, opt => opt.MapFrom(src => src.SOURCE_PLANT_NPWP)) .ForMember(dest => dest.SourceNppbkcId, opt => opt.MapFrom(src => src.SOURCE_PLANT_NPPBKC_ID)) .ForMember(dest => dest.SourceCompanyCode, opt => opt.MapFrom(src => src.SOURCE_PLANT_COMPANY_CODE)) .ForMember(dest => dest.SourceCompanyName, opt => opt.MapFrom(src => src.SOURCE_PLANT_COMPANY_NAME)) .ForMember(dest => dest.SourceAddress, opt => opt.MapFrom(src => src.SOURCE_PLANT_ADDRESS)) .ForMember(dest => dest.SourceKppbcName, opt => opt.MapFrom(src => src.SOURCE_PLANT_KPPBC_NAME_OFFICE)) .ForMember(dest => dest.SourcePlantName, opt => opt.MapFrom(src => src.SOURCE_PLANT_NAME)) .ForMember(dest => dest.DestPlantId, opt => opt.MapFrom(src => src.DEST_PLANT_ID)) .ForMember(dest => dest.DestNpwp, opt => opt.MapFrom(src => src.DEST_PLANT_NPWP)) .ForMember(dest => dest.DestNppbkcId, opt => opt.MapFrom(src => src.DEST_PLANT_NPPBKC_ID)) .ForMember(dest => dest.DestCompanyName, opt => opt.MapFrom(src => src.DEST_PLANT_COMPANY_NAME)) .ForMember(dest => dest.DestCompanyCode, opt => opt.MapFrom(src => src.DEST_PLANT_COMPANY_CODE)) .ForMember(dest => dest.DestAddress, opt => opt.MapFrom(src => src.DEST_PLANT_ADDRESS)) .ForMember(dest => dest.DestKppbcName, opt => opt.MapFrom(src => src.DEST_PLANT_KPPBC_NAME_OFFICE)) .ForMember(dest => dest.DestPlantName, opt => opt.MapFrom(src => src.DEST_PLANT_NAME)) .ForMember(dest => dest.LoadingPort, opt => opt.MapFrom(src => src.LOADING_PORT)) .ForMember(dest => dest.LoadingPortName, opt => opt.MapFrom(src => src.LOADING_PORT_NAME)) .ForMember(dest => dest.LoadingPortId, opt => opt.MapFrom(src => src.LOADING_PORT_ID)) .ForMember(dest => dest.FinalPort, opt => opt.MapFrom(src => src.FINAL_PORT)) .ForMember(dest => dest.FinalPortName, opt => opt.MapFrom(src => src.FINAL_PORT_NAME)) .ForMember(dest => dest.FinalPortId, opt => opt.MapFrom(src => src.FINAL_PORT_ID)) .ForMember(dest => dest.InvoiceNumber, opt => opt.MapFrom(src => src.INVOICE_NUMBER)) .ForMember(dest => dest.InvoiceDate, opt => opt.MapFrom(src => src.INVOICE_DATE)) .ForMember(dest => dest.PbckDecreeId, opt => opt.MapFrom(src => src.PBCK1_DECREE_ID)) .ForMember(dest => dest.PbckDecreeNumber, opt => opt.MapFrom(src => src.PbckNumber)) .ForMember(dest => dest.CarriageMethod, opt => opt.MapFrom(src => src.CARRIAGE_METHOD_ID)) .ForMember(dest => dest.CarriageMethodDesc, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.CARRIAGE_METHOD_ID))) .ForMember(dest => dest.GrandTotalEx, opt => opt.MapFrom(src => src.GRAND_TOTAL_EX)) .ForMember(dest => dest.GrandTotalExDisplay, opt => opt.MapFrom(src => ConvertHelper.ConvertDecimalToStringMoneyFormat(src.GRAND_TOTAL_EX))) .ForMember(dest => dest.PackageUomName, opt => opt.MapFrom(src => src.PACKAGE_UOM_ID)) .ForMember(dest => dest.DnNumber, opt => opt.MapFrom(src => src.DN_NUMBER)) .ForMember(dest => dest.DnDate, opt => opt.MapFrom(src => src.DN_DATE)) .ForMember(dest => dest.StoSenderNumber, opt => opt.MapFrom(src => src.STO_SENDER_NUMBER)) .ForMember(dest => dest.StoReceiverNumber, opt => opt.MapFrom(src => src.STO_RECEIVER_NUMBER)) .ForMember(dest => dest.StobNumber, opt => opt.MapFrom(src => src.STOB_NUMBER)) .ForMember(dest => dest.GiDate, opt => opt.MapFrom(src => src.GI_DATE)) .ForMember(dest => dest.GrDate, opt => opt.MapFrom(src => src.GR_DATE)) .ForMember(dest => dest.SealingNotifNumber, opt => opt.MapFrom(src => src.SEALING_NOTIF_NUMBER)) .ForMember(dest => dest.SealingNotifDate, opt => opt.MapFrom(src => src.SEALING_NOTIF_DATE)) .ForMember(dest => dest.UnSealingNotifNumber, opt => opt.MapFrom(src => src.UNSEALING_NOTIF_NUMBER)) .ForMember(dest => dest.UnsealingNotifDate, opt => opt.MapFrom(src => src.UNSEALING_NOTIF_DATE)) .ForMember(dest => dest.CountryCode, opt => opt.MapFrom(src => src.DEST_COUNTRY_CODE)) .ForMember(dest => dest.CountryName, opt => opt.MapFrom(src => src.DEST_COUNTRY_NAME)) .ForMember(dest => dest.DisplayDetailsDestinationCountry, opt => opt.MapFrom(src => src.DEST_COUNTRY_CODE + " - " + src.DEST_COUNTRY_NAME)) .ForMember(dest => dest.Ck5ManualType, opt => opt.MapFrom(src => src.CK5_MANUAL_TYPE)) .ForMember(dest => dest.Ck5ManualTypeString, opt => opt.MapFrom(src => Utils.EnumHelper.GetDescription(src.CK5_MANUAL_TYPE))) .ForMember(dest => dest.Ck5FileUploadModelList, opt => opt.MapFrom(src => Mapper.Map <List <CK5_FILE_UPLOADDto> >(src.Ck5FileUploadDtos))) .ForMember(dest => dest.Ck5RefId, opt => opt.MapFrom(src => src.CK5_REF_ID)) .ForMember(dest => dest.IsCompleted, opt => opt.MapFrom(src => src.STATUS_ID == Enums.DocumentStatus.Completed ? true:false)) .ForMember(dest => dest.IsReducePbck1Ck5Trial, opt => opt.MapFrom(src => src.REDUCE_TRIAL.HasValue ? src.REDUCE_TRIAL : false)) .ForMember(dest => dest.IsCk5Manual, opt => opt.MapFrom(src => src.CK5_TYPE == Enums.CK5Type.Manual)) .ForMember(dest => dest.IsTriggerSto, opt => opt.MapFrom(src => src.CK5_TYPE == Enums.CK5Type.Return)) .ForMember(dest => dest.IsLack1Lab, opt => opt.MapFrom(src => src.FLAG_FOR_LACK1_LAB)) ; Mapper.CreateMap <CK5_FILE_UPLOADDto, CK5FileUploadViewModel>().IgnoreAllNonExisting(); Mapper.CreateMap <CK5UploadViewModel, CK5MaterialInput>().IgnoreAllNonExisting(); Mapper.CreateMap <CK5UploadViewModel, CK5MaterialDto>().IgnoreAllNonExisting() .ForMember(dest => dest.PLANT_ID, opt => opt.MapFrom(src => src.Plant)) .ForMember(dest => dest.QTY, opt => opt.ResolveUsing <StringToDecimalResolver>().FromMember(src => src.Qty)) .ForMember(dest => dest.CONVERTED_QTY, opt => opt.ResolveUsing <StringToDecimalResolver>().FromMember(src => src.ConvertedQty)) .ForMember(dest => dest.EXCISE_VALUE, opt => opt.ResolveUsing <StringToDecimalResolver>().FromMember(src => src.ExciseValue)) .ForMember(dest => dest.CONVERTION, opt => opt.ResolveUsing <StringToDecimalResolver>().FromMember(src => src.Convertion)) .ForMember(dest => dest.USD_VALUE, opt => opt.ResolveUsing <StringToDecimalResolver>().FromMember(src => src.UsdValue)) .ForMember(dest => dest.CONVERTED_UOM, opt => opt.MapFrom(src => src.ConvertedUom)) .ForMember(dest => dest.MATERIAL_DESC, opt => opt.MapFrom(src => src.MaterialDesc)) .ForMember(dest => dest.MATDOC, opt => opt.MapFrom(src => src.MatDoc)) .ForMember(dest => dest.STICKER_CODE, opt => opt.MapFrom(src => src.StickerCode)); Mapper.CreateMap <CK5MaterialDto, CK5UploadViewModel>().IgnoreAllNonExisting() .ForMember(dest => dest.Plant, opt => opt.MapFrom(src => src.PLANT_ID)) .ForMember(dest => dest.Qty, opt => opt.ResolveUsing <DecimalToStringMoneyResolver>().FromMember(src => src.QTY)) .ForMember(dest => dest.ConvertedQty, opt => opt.ResolveUsing <DecimalToStringMoneyResolver>().FromMember(src => src.CONVERTED_QTY)) .ForMember(dest => dest.Convertion, opt => opt.ResolveUsing <DecimalToStringMoneyResolver>().FromMember(src => src.CONVERTION)) .ForMember(dest => dest.ExciseValue, opt => opt.ResolveUsing <DecimalToStringMoneyResolver>().FromMember(src => src.EXCISE_VALUE)) .ForMember(dest => dest.UsdValue, opt => opt.ResolveUsing <DecimalToStringMoneyResolver>().FromMember(src => src.USD_VALUE)) .ForMember(dest => dest.ConvertedUom, opt => opt.MapFrom(src => src.CONVERTED_UOM)) .ForMember(dest => dest.MaterialDesc, opt => opt.MapFrom(src => src.MATERIAL_DESC)) .ForMember(dest => dest.MatDoc, opt => opt.MapFrom(src => src.MATDOC)) .ForMember(dest => dest.StickerCode, opt => opt.MapFrom(src => src.STICKER_CODE)); Mapper.CreateMap <CK5Dto, CK5SummaryReportsItem>().IgnoreAllNonExisting() .ForMember(dest => dest.Ck5Id, opt => opt.MapFrom(src => src.CK5_ID)) //added .ForMember(dest => dest.Ck5TypeDescription, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.CK5_TYPE))) .ForMember(dest => dest.KppbcCityName, opt => opt.MapFrom(src => src.KPPBC_CITY)) //.ForMember(dest => dest.SourcePlant, opt => opt.MapFrom(src => src.SOURCE_PLANT_ID)) .ForMember(dest => dest.SubmissionNumber, opt => opt.MapFrom(src => src.SUBMISSION_NUMBER)) .ForMember(dest => dest.SubmissionDate, opt => opt.MapFrom(src => src.SUBMISSION_DATE.HasValue ? src.SUBMISSION_DATE.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.ExGoodTypeDesc, opt => opt.MapFrom(src => src.EX_GOODS_TYPE_DESC)) .ForMember(dest => dest.ExciseSettlement, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.EX_SETTLEMENT_ID))) .ForMember(dest => dest.ExciseStatus, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.EX_STATUS_ID))) .ForMember(dest => dest.RequestType, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.REQUEST_TYPE_ID))) .ForMember(dest => dest.SourcePlant, opt => opt.MapFrom(src => src.SOURCE_PLANT_ID)) .ForMember(dest => dest.DestinationPlant, opt => opt.MapFrom(src => src.DEST_PLANT_ID)) .ForMember(dest => dest.UnpaidExciseFacilityNumber, opt => opt.MapFrom(src => src.PbckNumber)) .ForMember(dest => dest.UnpaidExciseFacilityDate, opt => opt.MapFrom(src => src.PbckDecreeDate.HasValue ? src.PbckDecreeDate.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.SealingNotificationDate, opt => opt.MapFrom(src => src.SEALING_NOTIF_DATE.HasValue ? src.SEALING_NOTIF_DATE.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.SealingNotificationNumber, opt => opt.MapFrom(src => src.SEALING_NOTIF_NUMBER)) .ForMember(dest => dest.UnSealingNotificationDate, opt => opt.MapFrom(src => src.UNSEALING_NOTIF_DATE.HasValue ? src.UNSEALING_NOTIF_DATE.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.UnSealingNotificationNumber, opt => opt.MapFrom(src => src.UNSEALING_NOTIF_NUMBER)) //.ForMember(dest => dest.Lack1, opt => opt.MapFrom(src => src.PbckNumber)) //.ForMember(dest => dest.Lack2, opt => opt.MapFrom(src => src.PbckNumber)) .ForMember(dest => dest.TanggalAju, opt => opt.MapFrom(src => src.SUBMISSION_DATE.HasValue ? src.SUBMISSION_DATE.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.NomerAju, opt => opt.MapFrom(src => src.SUBMISSION_NUMBER)) .ForMember(dest => dest.TanggalPendaftaran, opt => opt.MapFrom(src => src.REGISTRATION_DATE.HasValue ? src.REGISTRATION_DATE.Value.ToString("dd MMM yyyy") : string.Empty)) .ForMember(dest => dest.NomerPendaftaran, opt => opt.MapFrom(src => src.REGISTRATION_NUMBER)) .ForMember(dest => dest.OriginCeOffice, opt => opt.MapFrom(src => src.KPPBC_CITY)) .ForMember(dest => dest.OriginCompany, opt => opt.MapFrom(src => src.SOURCE_PLANT_COMPANY_NAME)) .ForMember(dest => dest.OriginCompanyNppbkc, opt => opt.MapFrom(src => src.SOURCE_PLANT_NPPBKC_ID)) .ForMember(dest => dest.OriginCompanyAddress, opt => opt.MapFrom(src => src.SOURCE_PLANT_ADDRESS)) .ForMember(dest => dest.DestinationCountry, opt => opt.MapFrom(src => src.DEST_COUNTRY_NAME)) .ForMember(dest => dest.NumberBox, opt => opt.MapFrom(src => src.GRAND_TOTAL_EX.ToString())) //.ForMember(dest => dest.ContainPerBox, opt => opt.MapFrom(src => src.PbckNumber)) //.ForMember(dest => dest.TotalOfExcisableGoods, opt => opt.MapFrom(src => src.PbckNumber)) //.ForMember(dest => dest.BanderolPrice, opt => opt.MapFrom(src => src.)) //.ForMember(dest => dest.ExciseTariff, opt => opt.MapFrom(src => src.PbckNumber)) //.ForMember(dest => dest.ExciseValue, opt => opt.MapFrom(src => src.PbckNumber)) .ForMember(dest => dest.DestinationCeOffice, opt => opt.MapFrom(src => src.DEST_PLANT_KPPBC_NAME_OFFICE)) .ForMember(dest => dest.DestCompanyAddress, opt => opt.MapFrom(src => src.DEST_PLANT_ADDRESS)) .ForMember(dest => dest.DestCompanyNppbkc, opt => opt.MapFrom(src => src.DEST_PLANT_NPPBKC_ID)) .ForMember(dest => dest.DestCompanyName, opt => opt.MapFrom(src => src.DEST_PLANT_NAME)) .ForMember(dest => dest.LoadingPort, opt => opt.MapFrom(src => src.LOADING_PORT)) .ForMember(dest => dest.LoadingPortName, opt => opt.MapFrom(src => src.LOADING_PORT_NAME)) .ForMember(dest => dest.StoNumberSender, opt => opt.MapFrom(src => src.STO_SENDER_NUMBER)) .ForMember(dest => dest.StoNumberReciever, opt => opt.MapFrom(src => src.STO_RECEIVER_NUMBER)) .ForMember(dest => dest.StoBNumber, opt => opt.MapFrom(src => src.STOB_NUMBER)) .ForMember(dest => dest.DnNumber, opt => opt.MapFrom(src => src.DN_NUMBER)) .ForMember(dest => dest.GiDate, opt => opt.MapFrom(src => src.GI_DATE)) .ForMember(dest => dest.GrDate, opt => opt.MapFrom(src => src.GR_DATE)) .ForMember(dest => dest.Status, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.STATUS_ID))) ; Mapper.CreateMap <CK5SearchSummaryReportsViewModel, CK5SummaryReportsItem>().IgnoreAllNonExisting(); //.ForMember(dest => dest.NPPBKCOrigin, opt => opt.MapFrom(src => src.NppbkcId)); Mapper.CreateMap <CK5FileUploadViewModel, CK5_FILE_UPLOADDto>().IgnoreAllNonExisting(); Mapper.CreateMap <CK5SearchSummaryReportsViewModel, CK5GetSummaryReportByParamInput>().IgnoreAllNonExisting() .ForMember(dest => dest.Month, opt => opt.ResolveUsing <StringToIntResolver>().FromMember(src => src.Month)) .ForMember(dest => dest.Year, opt => opt.ResolveUsing <StringToIntResolver>().FromMember(src => src.Year)) ; Mapper.CreateMap <CK5FileDocumentItems, CK5UploadFileDocumentsInput>().IgnoreAllNonExisting() .ForMember(dest => dest.PackageUomName, opt => opt.MapFrom(src => src.Uom)) .ForMember(dest => dest.SUBMISSION_DATE, opt => opt.MapFrom(src => src.SUBMISSION_DATE)) ; Mapper.CreateMap <CK5FileUploadDocumentsOutput, CK5FileDocumentItems>().IgnoreAllNonExisting() .ForMember(dest => dest.Ck5Type, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.CK5_TYPE))) .ForMember(dest => dest.ExGoodType, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.EX_GOODS_TYPE))) .ForMember(dest => dest.ExciseSettlement, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.EX_SETTLEMENT_ID))) .ForMember(dest => dest.ExciseStatus, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.EX_STATUS_ID))) .ForMember(dest => dest.RequestType, opt => opt.MapFrom(src => EnumHelper.GetDescription(src.REQUEST_TYPE_ID))) .ForMember(dest => dest.Uom, opt => opt.MapFrom(src => src.PackageUomName)) .ForMember(dest => dest.InvoiceDateDisplay, opt => opt.MapFrom(src => src.INVOICE_DATE != null ? src.INVOICE_DATE.Value.ToString("dd MMMM yyyy") : string.Empty)) //.ForMember(dest => dest.InvoiceDate, opt => opt.MapFrom(src => src.InvoiceDate)) .ForMember(dest => dest.MesssageUploadFileDocuments, opt => opt.MapFrom(src => src.Message)) ; Mapper.CreateMap <CK5FileDocumentItems, CK5Dto>().IgnoreAllNonExisting() .ForMember(dest => dest.CK5_TYPE, opt => opt.MapFrom(src => src.CK5_TYPE)) .ForMember(dest => dest.KPPBC_CITY, opt => opt.MapFrom(src => src.KppBcCityName)) .ForMember(dest => dest.EX_GOODS_TYPE_DESC, opt => opt.MapFrom(src => src.ExGoodType)) .ForMember(dest => dest.INVOICE_NUMBER, opt => opt.MapFrom(src => src.InvoiceNumber)) //.ForMember(dest => dest.INVOICE_DATE, opt => opt.MapFrom(src => src.InvoiceDate)) .ForMember(dest => dest.PbckNumber, opt => opt.MapFrom(src => src.PbckDecreeNumber)) // .ForMember(dest => dest.GRAND_TOTAL_EX, opt => opt.MapFrom(src => src.GrandTotalEx)) //.ForMember(dest => dest.PACKAGE_UOM_ID, opt => opt.MapFrom(src => src.PackageUomName) // .ForMember(dest => dest.INVOICE_NUMBER, opt => opt.MapFrom(src => src.InvoiceNumber)) //// .ForMember(dest => dest.INVOICE_DATE, opt => opt.MapFrom(src => src.InvoiceDate)) // .ForMember(dest => dest.PBCK1_DECREE_ID, opt => opt.MapFrom(src => src.PbckDecreeId)) // .ForMember(dest => dest.PbckNumber, opt => opt.MapFrom(src => src.PbckDecreeNumber)) // .ForMember(dest => dest.CARRIAGE_METHOD_ID, opt => opt.MapFrom(src => src.CarriageMethod)) // .ForMember(dest => dest.GRAND_TOTAL_EX, opt => opt.MapFrom(src => src.GrandTotalEx)) //.ForMember(dest => dest.PACKAGE_UOM_ID, opt => opt.MapFrom(src => src.PackageUomName)) //.ForMember(dest => dest.DEST_COUNTRY_CODE, opt => opt.MapFrom(src => src.CountryCode)) //.ForMember(dest => dest.DEST_COUNTRY_NAME, opt => opt.MapFrom(src => src.CountryName)) ; Mapper.CreateMap <CK5FileDocumentItems, CK5FileDocumentDto>().IgnoreAllNonExisting(); Mapper.CreateMap <Pbck1Dto, Ck5ListPbck1Completed>().IgnoreAllNonExisting() .ForMember(dest => dest.PbckId, opt => opt.MapFrom(src => src.Pbck1Id)) .ForMember(dest => dest.PbckNumber, opt => opt.MapFrom(src => src.Pbck1Number)) ; Mapper.CreateMap <MaterialDto, CK5InputManualViewModel>().IgnoreAllNonExisting() .ForMember(dest => dest.MaterialNumber, opt => opt.MapFrom(src => src.STICKER_CODE)) .ForMember(dest => dest.MaterialDesc, opt => opt.MapFrom(src => src.GoodTypeDescription)) .ForMember(dest => dest.Hje, opt => opt.MapFrom(src => src.HJE)) .ForMember(dest => dest.Tariff, opt => opt.MapFrom(src => src.TARIFF)) .ForMember(dest => dest.Convertion, opt => opt.MapFrom(src => 0)) ; Mapper.CreateMap <CK5ExternalSupplierDto, CK5ExternalSupplierModel>().IgnoreAllNonExisting() .ForMember(dest => dest.SupplierPlant, opt => opt.MapFrom(src => src.SUPPLIER_PLANT)) .ForMember(dest => dest.SupplierCompany, opt => opt.MapFrom(src => src.SUPPLIER_COMPANY)) .ForMember(dest => dest.SupplierAddress, opt => opt.MapFrom(src => src.SUPPLIER_ADDRESS)) .ForMember(dest => dest.SupplierNppbkcId, opt => opt.MapFrom(src => src.SUPPLIER_NPPBKC_ID)) .ForMember(dest => dest.SupplierKppbcId, opt => opt.MapFrom(src => src.SUPPLIER_KPPBC_ID)) .ForMember(dest => dest.SupplierKppbcName, opt => opt.MapFrom(src => src.SUPPLIER_KPPBC_NAME)) .ForMember(dest => dest.SupplierPhone, opt => opt.MapFrom(src => src.SUPPLIER_PHONE)) .ForMember(dest => dest.SupplierPortId, opt => opt.MapFrom(src => src.SUPPLIER_PORT_ID)) .ForMember(dest => dest.SupplierPortName, opt => opt.MapFrom(src => src.SUPPLIER_PORT_NAME)); Mapper.CreateMap <CK5ExternalSupplierDto, CK5PlantModel>().IgnoreAllNonExisting() //.ForMember(dest => dest.PlantId, opt => opt.MapFrom(src => src.SUPPLIER_PLANT)) .ForMember(dest => dest.PlantName, opt => opt.MapFrom(src => src.SUPPLIER_PLANT)) //.ForMember(dest => dest.PlantNpwp, opt => opt.MapFrom(src => src.supp)) .ForMember(dest => dest.NPPBCK_ID, opt => opt.MapFrom(src => src.SUPPLIER_NPPBKC_ID)) //.ForMember(dest => dest.CompanyCode, opt => opt.MapFrom(src => src.s)) .ForMember(dest => dest.CompanyName, opt => opt.MapFrom(src => src.SUPPLIER_COMPANY)) .ForMember(dest => dest.CompanyAddress, opt => opt.MapFrom(src => src.SUPPLIER_ADDRESS)) .ForMember(dest => dest.KppBcName, opt => opt.MapFrom(src => src.SUPPLIER_KPPBC_NAME)); //.ForMember(dest => dest.KppbcCity, opt => opt.MapFrom(src => src.supp)) //.ForMember(dest => dest.KppbcNo, opt => opt.MapFrom(src => src.SUPPLIER_KPPBC_ID)); ; Mapper.CreateMap <Ck5SummaryReportDto, CK5SummaryReportsItem>().IgnoreAllNonExisting(); Mapper.CreateMap <GetBrandByPlantAndMaterialNumberOutput, CK5InputManualViewModel>().IgnoreAllNonExisting() ; Mapper.CreateMap <Ck5MarketReturnSummaryReportDto, CK5MarketReturnSummaryReportsItem>().IgnoreAllNonExisting() ; Mapper.CreateMap <CK5MarketReturnSearchSummaryReportsViewModel, CK5MarketReturnSummaryReportsItem>().IgnoreAllNonExisting(); Mapper.CreateMap <CK5MarketReturnSearchSummaryReportsViewModel, CK5MarketReturnGetSummaryReportByParamInput>().IgnoreAllNonExisting(); Mapper.CreateMap <Ck5MatdocDto, SelectItemModel>().IgnoreAllNonExisting() .ForMember(dest => dest.TextField, opt => opt.MapFrom(src => string.Format("{0} - {1} - {2}", src.MatDoc, src.Qty, src.PostingDate))) .ForMember(dest => dest.ValueField, opt => opt.MapFrom(src => src.MatDoc)); }
public ActionResult GetList() { int Status = WebUtil.GetFormValue <int>("Status", 0); string OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); string BadType = WebUtil.GetFormValue <string>("BadType", string.Empty); string ProductType = WebUtil.GetFormValue <string>("ProductType", string.Empty); string beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty); string endTime = WebUtil.GetFormValue <string>("endTime", string.Empty); int pageSize = WebUtil.GetFormValue <int>("PageSize", 10); int pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; BadReportEntity entity = new BadReportEntity(); if (Status > 0) { entity.Where(a => a.Status == Status); } if (!OrderNum.IsEmpty()) { entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%"); } if (!ProductType.IsEmpty()) { entity.Where("ProductType", ECondition.Eth, ProductType); } if (!BadType.IsEmpty()) { entity.Where("BadType", ECondition.Eth, BadType); } if (!beginTime.IsEmpty() && !endTime.IsEmpty()) { entity.Where("CreateTime", ECondition.Between, ConvertHelper.ToType <DateTime>(beginTime), ConvertHelper.ToType <DateTime>(endTime)); } entity.And(a => a.StorageNum == this.DefaultStore); Bill <BadReportEntity, BadReportDetailEntity> bill = new BadOrder(); List <BadReportEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult == null ? new List <BadReportEntity>() : listResult; string json = ConvertJson.ListToJson <BadReportEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", json); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return(Content(this.ReturnJson.ToString())); }
public ActionResult ToExcel() { int Status = WebUtil.GetFormValue <int>("Status", 0); string OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); string BadType = WebUtil.GetFormValue <string>("BadType", string.Empty); string ProductType = WebUtil.GetFormValue <string>("ProductType", string.Empty); string beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty); string endTime = WebUtil.GetFormValue <string>("endTime", string.Empty); int pageSize = WebUtil.GetFormValue <int>("PageSize", 10); int pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; BadReportEntity entity = new BadReportEntity(); if (Status > 0) { entity.Where(a => a.Status == Status); } if (!OrderNum.IsEmpty()) { entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%"); } if (!ProductType.IsEmpty()) { entity.Where("ProductType", ECondition.Eth, ProductType); } if (!BadType.IsEmpty()) { entity.Where("BadType", ECondition.Eth, BadType); } if (!beginTime.IsEmpty() && !endTime.IsEmpty()) { entity.Where("CreateTime", ECondition.Between, ConvertHelper.ToType <DateTime>(beginTime), ConvertHelper.ToType <DateTime>(endTime)); } entity.And(a => a.StorageNum == this.DefaultStore); Bill <BadReportEntity, BadReportDetailEntity> bill = new BadOrder(); List <BadReportEntity> listResult = bill.GetList(entity, ref pageInfo); if (!listResult.IsNullOrEmpty()) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("序号 ")); dt.Columns.Add(new DataColumn("单据编号")); dt.Columns.Add(new DataColumn("报损类型")); dt.Columns.Add(new DataColumn("关联单号")); dt.Columns.Add(new DataColumn("报损数量")); dt.Columns.Add(new DataColumn("状态")); dt.Columns.Add(new DataColumn("操作方式")); dt.Columns.Add(new DataColumn("创建人")); dt.Columns.Add(new DataColumn("创建时间")); int count = 1; foreach (BadReportEntity t in listResult) { DataRow row = dt.NewRow(); row[0] = count; row[1] = t.OrderNum; row[2] = EnumHelper.GetEnumDesc <EBadType>(t.BadType); row[3] = t.ContractOrder; row[4] = t.Num; row[5] = EnumHelper.GetEnumDesc <EAudite>(t.Status); row[6] = EnumHelper.GetEnumDesc <EOpType>(t.OperateType); row[7] = t.CreateUser; row[8] = t.CreateTime.ToString("yyyy-MM-dd"); dt.Rows.Add(row); count++; } string filePath = Server.MapPath("~/UploadFiles/"); if (!System.IO.Directory.Exists(filePath)) { System.IO.Directory.CreateDirectory(filePath); } string filename = string.Format("报损管理{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")); NPOIExcel excel = new NPOIExcel("报损管理", "报损单", System.IO.Path.Combine(filePath, filename)); excel.ToExcel(dt); this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape()); } else { this.ReturnJson.AddProperty("d", "无数据导出!"); } return(Content(this.ReturnJson.ToString())); }
public void BuildMap(EyeableBorderObjInfo[] objInfos, Rectanglef mapBorder, float spaceForTank) { #region 对每一个BorderObj生成逻辑坐标上的凸包点集,并向外扩展 borderLines = new List <Segment>(); convexs = new List <GuardConvex>(); foreach (EyeableBorderObjInfo obj in objInfos) { if (obj.ConvexHall == null || obj.IsDisappeared || obj.ConvexHall.Points == null) { continue; } Matrix matrix = obj.EyeableInfo.CurTransMatrix; GraphPoint <NaviPoint>[] convexHall; List <BordPoint> bordPoints = obj.ConvexHall.Points; if (bordPoints.Count > 2) { List <GraphPoint <NaviPoint> > list = new List <GraphPoint <NaviPoint> >(); for (int i = 0; i < bordPoints.Count; i++) { Vector2 lastPos = Vector2.Transform(ConvertHelper.PointToVector2(bordPoints[i - 1 < 0 ? bordPoints.Count - 1 : i - 1].p), matrix); Vector2 curPos = Vector2.Transform(ConvertHelper.PointToVector2(bordPoints[i].p), matrix); Vector2 nextPos = Vector2.Transform(ConvertHelper.PointToVector2(bordPoints[(i + 1) % bordPoints.Count].p), matrix); Vector2 v1 = curPos - lastPos; Vector2 v2 = curPos - nextPos; float ang = MathTools.AngBetweenVectors(v1, v2); if (ang >= MathHelper.PiOver2) { float halfDes = (float)(spaceForTank / Math.Sin(ang)); Vector2 delta = halfDes * Vector2.Normalize(v1) + halfDes * Vector2.Normalize(v2); list.Add(new GraphPoint <NaviPoint>( new NaviPoint(obj, bordPoints[i].index, curPos + delta), new List <GraphPath <NaviPoint> >())); } else { v1.Normalize(); v2.Normalize(); Vector2 cenV = Vector2.Normalize(v1 + v2); Vector2 vertiV = new Vector2(cenV.Y, -cenV.X); float ang2 = MathHelper.PiOver4 - 0.25f * ang; float vertiL = (float)(spaceForTank * Math.Tan(ang2)); list.Add(new GraphPoint <NaviPoint>( new NaviPoint(obj, bordPoints[i].index, curPos + spaceForTank * cenV + vertiL * vertiV), new List <GraphPath <NaviPoint> >())); list.Add(new GraphPoint <NaviPoint>( new NaviPoint(obj, bordPoints[i].index, curPos + spaceForTank * cenV - vertiL * vertiV), new List <GraphPath <NaviPoint> >())); } // 添加borderLine borderLines.Add(new Segment(curPos, nextPos)); } convexHall = list.ToArray(); convexs.Add(new GuardConvex(convexHall)); } else if (bordPoints.Count == 2) { convexHall = new GraphPoint <NaviPoint> [4]; Vector2 startPos = Vector2.Transform(ConvertHelper.PointToVector2(bordPoints[0].p), matrix); Vector2 endPos = Vector2.Transform(ConvertHelper.PointToVector2(bordPoints[1].p), matrix); Vector2 dir = endPos - startPos; dir.Normalize(); Vector2 normal = new Vector2(dir.Y, -dir.X); convexHall[0] = new GraphPoint <NaviPoint>( new NaviPoint(obj, bordPoints[0].index, startPos - dir * spaceForTank), new List <GraphPath <NaviPoint> >()); convexHall[1] = new GraphPoint <NaviPoint>( new NaviPoint(obj, bordPoints[0].index, startPos + spaceForTank * normal), new List <GraphPath <NaviPoint> >()); convexHall[2] = new GraphPoint <NaviPoint>( new NaviPoint(obj, bordPoints[1].index, endPos + spaceForTank * normal), new List <GraphPath <NaviPoint> >()); convexHall[3] = new GraphPoint <NaviPoint>( new NaviPoint(obj, bordPoints[1].index, endPos + dir * spaceForTank), new List <GraphPath <NaviPoint> >()); //if (float.IsNaN( convexHall[0].value.Pos.X ) || float.IsNaN( convexHall[1].value.Pos.X )) //{ //} // 添加borderLine borderLines.Add(new Segment(startPos, endPos)); convexs.Add(new GuardConvex(convexHall)); } } #endregion #region 得到警戒线 guardLines = new List <Segment>(); foreach (GuardConvex convex in convexs) { for (int i = 0; i < convex.points.Length; i++) { guardLines.Add(new Segment(convex[i].value.Pos, convex[(i + 1) % convex.Length].value.Pos)); //if (float.IsNaN( convex[i].value.Pos.X )) //{ //} } } mapBorder = new Rectanglef(mapBorder.X + spaceForTank, mapBorder.Y + spaceForTank, mapBorder.Width - 2 * spaceForTank, mapBorder.Height - 2 * spaceForTank); guardLines.Add(new Segment(mapBorder.UpLeft, mapBorder.UpRight)); guardLines.Add(new Segment(mapBorder.UpRight, mapBorder.DownRight)); guardLines.Add(new Segment(mapBorder.DownRight, mapBorder.DownLeft)); guardLines.Add(new Segment(mapBorder.DownLeft, mapBorder.UpLeft)); #endregion #region 检查凸包内部连线是否和警戒线相交,如不相交则连接该连线并计算权值 foreach (GuardConvex convex in convexs) { for (int i = 0; i < convex.Length; i++) { // 检查连线是否超出边界 if (!mapBorder.Contains(convex[i].value.Pos)) { continue; } Segment link = new Segment(convex[i].value.Pos, convex[(i + 1) % convex.Length].value.Pos); bool isCross = false; foreach (Segment guardLine in guardLines) { if (link.Equals(guardLine)) { continue; } if (Segment.IsCross(link, guardLine)) { isCross = true; break; } } if (!isCross) { float weight = Vector2.Distance(convex[i].value.Pos, convex[(i + 1) % convex.Length].value.Pos); //if (float.IsNaN( weight )) //{ //} GraphPoint <NaviPoint> .Link(convex[i], convex[(i + 1) % convex.Length], weight); } } } #endregion #region 检查凸包之间连线是否与警戒线以及边界线相交,如不相交则连接并计算权值 for (int i = 0; i < convexs.Count - 1; i++) { for (int j = i + 1; j < convexs.Count; j++) { foreach (GraphPoint <NaviPoint> p1 in convexs[i].points) { // 检查连线是否超出边界 if (!mapBorder.Contains(p1.value.Pos)) { continue; } foreach (GraphPoint <NaviPoint> p2 in convexs[j].points) { Segment link = new Segment(p1.value.Pos, p2.value.Pos); bool isCross = false; foreach (Segment guardLine in guardLines) { if (Segment.IsCross(link, guardLine)) { isCross = true; break; } } if (!isCross) { foreach (Segment borderLine in borderLines) { if (Segment.IsCross(link, borderLine)) { isCross = true; break; } } } if (!isCross) { float weight = Vector2.Distance(p1.value.Pos, p2.value.Pos); //if (float.IsNaN( weight )) //{ //} GraphPoint <NaviPoint> .Link(p1, p2, weight); } } } } } #endregion #region 整理导航图 List <GraphPoint <NaviPoint> > points = new List <GraphPoint <NaviPoint> >(); foreach (GuardConvex convex in convexs) { foreach (GraphPoint <NaviPoint> p in convex.points) { points.Add(p); } } naviGraph = points.ToArray(); #endregion }
/// <summary> /// 获得指定Url参数的int类型值 /// </summary> /// <param name="strName">Url参数</param> /// <returns>Url参数的int类型值</returns> public static int GetQueryInt(string strName) { return(ConvertHelper.StrToInt(HttpContext.Current.Request.QueryString[strName], 0)); }
protected override void FillItemToControls() { base.FillItemToControls(); sourceLanguageComboBox.SelectedIndex = Math.Min( ConvertHelper.ToInt32( PersistanceHelper.RestoreValue( @"QuickTranslationForm.sourceLanguageComboBox.SelectedIndex", sourceLanguageComboBox.SelectedIndex)), sourceLanguageComboBox.Properties.Items.Count - 1); destinationLanguageComboBox.SelectedIndex = Math.Min( ConvertHelper.ToInt32( PersistanceHelper.RestoreValue( @"QuickTranslationForm.destinationLanguageComboBox.SelectedIndex", destinationLanguageComboBox.SelectedIndex)), destinationLanguageComboBox.Properties.Items.Count - 1); sourceTextTextBox.Text = ConvertHelper.ToString( PersistanceHelper.RestoreValue( @"QuickTranslationForm.sourceTextTextBox.Text", sourceTextTextBox.Text)); copyDestinationTextToClipboardCheckBox.Checked = ConvertHelper.ToBoolean( PersistanceHelper.RestoreValue( @"QuickTranslationForm.copyDestinationTextToClipboardCheckBox.Checked", copyDestinationTextToClipboardCheckBox.Checked)); // -- // Select defaults. if (sourceLanguageComboBox.SelectedIndex < 0 && sourceLanguageComboBox.Properties.Items.Count > 0) { sourceLanguageComboBox.SelectedIndex = 0; } if (destinationLanguageComboBox.SelectedIndex < 0 && destinationLanguageComboBox.Properties.Items.Count > 0) { foreach (TranslationLanguageInfo pair in destinationLanguageComboBox.Properties.Items) { if (pair.LanguageCode.ToLowerInvariant() == @"en") { destinationLanguageComboBox.SelectedItem = pair; break; } } if (destinationLanguageComboBox.SelectedIndex < 0) { destinationLanguageComboBox.SelectedIndex = 0; } } var ti = TranslationHelper.GetTranslationEngine( MainForm.Current.ProjectFilesControl.Project ?? Project.Empty); labelControl4.Text = ti.UserReadableName; }
/// <summary> /// 获得指定表单参数的int类型值 /// </summary> /// <param name="strName">表单参数</param> /// <param name="defValue">缺省值</param> /// <returns>表单参数的int类型值</returns> public static int GetFormInt(string strName, int defValue) { return(ConvertHelper.StrToInt(HttpContext.Current.Request.Form[strName], defValue)); }
public MessageViewModel(string loggedMail, List <Message> messages) { LoggedMail = loggedMail; ViewMessages = ConvertHelper.ConvertMessagesToShowInView(messages, loggedMail); }
/// <summary> /// 获得指定表单参数的float类型值 /// </summary> /// <param name="strName">表单参数</param> /// <param name="defValue">缺省值</param> /// <returns>表单参数的float类型值</returns> public static float GetFormFloat(string strName, float defValue) { return(ConvertHelper.StrToFloat(HttpContext.Current.Request.Form[strName], defValue)); }
/// <summary> /// 给实体赋值 /// </summary> /// <param name="model">实体</param> /// <param name="colName">列名</param> /// <param name="value">值</param> public void SetModelValue(DataAccess.Model.IN_BACK00 model, string colName, object value) { if (model == null || string.IsNullOrEmpty(colName)) { return; } //返回指定条件的实体 switch (colName) { case "Id": model.Id = (int)value; break; case "SHOP_ID": model.SHOP_ID = (string)value; break; case "IB_ID": model.IB_ID = (string)value; break; case "STATUS": model.STATUS = (int)value; break; case "INPUT_DATE": model.INPUT_DATE = (DateTime)value; break; case "OUT_SHOP": model.OUT_SHOP = (string)value; break; case "STOCK_ID": model.STOCK_ID = (string)value; break; case "USER_ID": model.USER_ID = (string)value; break; case "APP_USER": model.APP_USER = (string)value; break; case "APP_DATETIME": model.APP_DATETIME = (DateTime)value; break; case "RELATE_ID": model.RELATE_ID = (string)value; break; case "Memo": model.Memo = (string)value; break; case "LOCKED": model.LOCKED = ConvertHelper.Ctinyint(value); break; case "CRT_DATETIME": model.CRT_DATETIME = (DateTime)value; break; case "CRT_USER_ID": model.CRT_USER_ID = (string)value; break; case "MOD_DATETIME": model.MOD_DATETIME = (DateTime)value; break; case "MOD_USER_ID": model.MOD_USER_ID = (string)value; break; case "LAST_UPDATE": model.LAST_UPDATE = (DateTime)value; break; case "Trans_STATUS": model.Trans_STATUS = ConvertHelper.Ctinyint(value); break; } }
/// <summary> /// 查询台账记录 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <InventoryBookEntity> GetList(InventoryBookEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); entity.OrderBy(a => a.ID, EOrderBy.DESC); entity.Where(a => a.CompanyID == this.CompanyID); if (entity.BarCode.IsNotEmpty()) { entity.And("BarCode", ECondition.Like, "%" + entity.BarCode + "%"); } if (entity.ProductName.IsNotEmpty()) { entity.And("ProductName", ECondition.Like, "%" + entity.ProductName + "%"); } if (entity.BatchNum.IsNotEmpty()) { entity.And("BatchNum", ECondition.Like, "%" + entity.BatchNum + "%"); } if (entity.Type > 0) { entity.And(a => a.Type == entity.Type); } if (entity.OrderNum.IsNotEmpty()) { entity.And("OrderNum", ECondition.Like, "%" + entity.OrderNum + "%"); } if (entity.ContactOrder.IsNotEmpty()) { entity.And(item => item.ContactOrder == entity.ContactOrder); } if (entity.FromStorageNum.IsNotEmpty()) { entity.And(item => item.FromStorageNum == entity.FromStorageNum); } if (entity.BeginTime.IsNotEmpty()) { DateTime begin = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddDays(-30)).Date; entity.And(a => a.CreateTime >= begin); } if (entity.EndTime.IsNotEmpty()) { DateTime end = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).AddDays(1).Date; entity.And(a => a.CreateTime < end); } int rowCount = 0; List <InventoryBookEntity> listResult = this.InventoryBook.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; if (!listResult.IsNullOrEmpty()) { List <LocationEntity> listLocation = new LocationProvider(this.CompanyID).GetList(); listLocation = listLocation == null ? new List <LocationEntity>() : listLocation; ProductProvider provider = new ProductProvider(this.CompanyID); foreach (InventoryBookEntity item in listResult) { if (item.FromLocalNum.IsNotEmpty()) { LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.FromLocalNum); item.FromLocalName = location != null ? location.LocalName : string.Empty; item.FromStorageName = location != null ? location.StorageName : string.Empty; } if (item.ToLocalNum.IsNotEmpty()) { LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.ToLocalNum); item.ToLocalName = location != null ? location.LocalName : string.Empty; item.ToStorageName = location != null ? location.StorageName : string.Empty; } ProductEntity product = provider.GetProduct(item.ProductNum); if (product != null) { item.Size = product.Size; item.UnitName = product.UnitName; } } } return(listResult); }
/// <summary> /// 查询队伍信息与队伍比赛结果信息 - WEB页面使用 /// - 合并队伍基础信息与队伍结果信息 /// - 合并各玩法SP数据 /// </summary> /// <param name="service">HttpServerUtilityBase对象</param> /// <param name="matchDate">查询日期</param> /// <param name="isLeftJoin">是否查询没有结果的队伍比赛信息</param> /// <returns>队伍信息及比赛结果信息</returns> public static List <JCZQ_MatchInfo_WEB> MatchList_WEB(string gameType, string newVerType, string matchDate = null, bool isLeftJoin = true) { BettingHelper bizHelper = new BettingHelper(); var match = bizHelper.GetMatchInfoList <JCZQ_MatchInfo>(MatchFile(newVerType, matchDate)); var matchresult = bizHelper.GetMatchInfoList <JCZQ_MatchResultInfo>(MatchResultFile(matchDate)); //var sp_spf = bizHelper.GetMatchInfoList<JCZQ_SPF_SPInfo>(SPFile("SPF",matchDate)); //让球胜平负sp数据 //var sp_brqspf = bizHelper.GetMatchInfoList<JCZQ_SPF_SPInfo>(SPFile("BRQSPF", matchDate)); //胜平负sp数据 //var sp_zjq = bizHelper.GetMatchInfoList<JCZQ_ZJQ_SPInfo>(SPFile("ZJQ", matchDate)); //总进球sp数据 //var sp_bf = bizHelper.GetMatchInfoList<JCZQ_BF_SPInfo>(SPFile("BF", matchDate)); //比分sp数据 //var sp_bqc = bizHelper.GetMatchInfoList<JCZQ_BQC_SPInfo>(SPFile("BQC", matchDate)); //半全场sp数据 var sp_spf = bizHelper.GetMatchInfoList <JCZQ_SPF_SPInfo>(SPFile(gameType, matchDate)); //让球胜平负sp数据 var sp_brqspf = bizHelper.GetMatchInfoList <JCZQ_SPF_SPInfo>(SPFile(gameType, matchDate)); //胜平负sp数据 var sp_zjq = bizHelper.GetMatchInfoList <JCZQ_ZJQ_SPInfo>(SPFile(gameType, matchDate)); //总进球sp数据 var sp_bf = bizHelper.GetMatchInfoList <JCZQ_BF_SPInfo>(SPFile(gameType, matchDate)); //比分sp数据 var sp_bqc = bizHelper.GetMatchInfoList <JCZQ_BQC_SPInfo>(SPFile(gameType, matchDate)); //半全场sp数据 var list = new List <JCZQ_MatchInfo_WEB>(); match = match.Where(t => long.Parse(Convert.ToDateTime(t.FSStopBettingTime).ToString("yyyyMMddHHmmss")) > long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss")) && t.MatchStopDesc != "2").ToList(); foreach (var item in match) { #region 队伍基础信息 //var startTime=Convert.ToDateTime(item.StartDateTime); //if (startTime.Date == DateTime.Now.AddDays(1).Date) // startTime = startTime.AddHours(-9); var matchDataTime = ConvertHelper.ConvertStrToDateTime("20" + item.MatchData); //var matchDataTime = bizHelper.ConvertDateTimeInt(bizHelper.ConvertStrToDateTime("20150623")); var info = new JCZQ_MatchInfo_WEB() { //CreateTime = item.CreateTime.ToString("yyyyMMddHHmmss"), //DSStopBettingTime = item.DSStopBettingTime.ToString("yyyyMMddHHmmss"), MatcheDateTime = matchDataTime, //FSStopBettingTime = bizHelper.ConvertDateTimeInt(Convert.ToDateTime(item.FSStopBettingTime)).ToString(), FSStopBettingTime = item.FSStopBettingTime, //FSStopBettingTime = item.FSStopBettingTime.ToString("yyyyMMddHHmmss"), //GuestTeamId = item.GuestTeamId, GuestTeamName = BettingHelper.GetTeamName(item.GuestTeamName), //HomeTeamId = item.HomeTeamId, HomeTeamName = BettingHelper.GetTeamName(item.HomeTeamName), LeagueColor = item.LeagueColor, //LeagueId = item.LeagueId, LeagueName = item.LeagueName, LetBall = item.LetBall, //LoseOdds = item.LoseOdds, MatchIdName = item.MatchIdName, StartDateTime = Convert.ToDateTime(item.StartDateTime), //StartDateTime = item.StartDateTime.ToString("yyyyMMddHHmmss"), //WinOdds = item.WinOdds, //FlatOdds = item.FlatOdds, MatchData = item.MatchData, MatchId = item.MatchId, MatchNumber = item.MatchNumber, //Mid = item.Mid, FXId = item.FXId, State = item.State, PrivilegesType = item.PrivilegesType == null ? string.Empty : item.PrivilegesType, }; #endregion #region 附加队伍结果信息 var res = matchresult.FirstOrDefault(p => p.MatchId == item.MatchId); if (res != null) { //info.ZJQ_Result = res.ZJQ_Result; //info.ZJQ_SP = res.ZJQ_SP; //info.SPF_SP = res.SPF_SP; //info.SPF_Result = res.SPF_Result; //info.BQC_SP = res.BQC_SP; //info.BQC_Result = res.BQC_Result; //info.BF_SP = res.BF_SP; //info.BF_Result = res.BF_Result; //info.FullGuestTeamScore = res.FullGuestTeamScore; //info.FullHomeTeamScore = res.FullHomeTeamScore; //info.HalfGuestTeamScore = res.HalfGuestTeamScore; //info.HalfHomeTeamScore = res.HalfHomeTeamScore; //info.MatchState = res.MatchState; } else if (!isLeftJoin) { continue; } #endregion #region 附加让球胜平负sp数据 var sp_spf_item = sp_spf.FirstOrDefault(p => p.MatchId == item.MatchId); if (gameType.ToLower() == "hh") { if (sp_spf_item != null && sp_spf_item.SPF != null) { var json = JsonHelper.Deserialize <JCZQ_SPF_SPInfo>(sp_spf_item.SPF); info.SP_Win_Odds = json.WinOdds; info.SP_Lose_Odds = json.LoseOdds; info.SP_Flat_Odds = json.FlatOdds; //info.PrivilegesType = json.PrivilegesType==null?string.Empty:json.PrivilegesType; } } else if (sp_spf_item != null) { info.SP_Win_Odds = sp_spf_item.WinOdds; info.SP_Lose_Odds = sp_spf_item.LoseOdds; info.SP_Flat_Odds = sp_spf_item.FlatOdds; //info.PrivilegesType = sp_spf_item.PrivilegesType; } #endregion #region 附加胜平负sp数据 var sp_brqspf_item = sp_brqspf.FirstOrDefault(p => p.MatchId == item.MatchId); if (gameType.ToLower() == "hh") { if (sp_brqspf_item != null && sp_brqspf_item.BRQSPF != null) { var json = JsonHelper.Deserialize <JCZQ_SPF_SPInfo>(sp_brqspf_item.BRQSPF); info.SP_Win_Odds_BRQ = json.WinOdds; info.SP_Lose_Odds_BRQ = json.LoseOdds; info.SP_Flat_Odds_BRQ = json.FlatOdds; //info.PrivilegesType = json.PrivilegesType==null?string.Empty:json.PrivilegesType; } } else if (sp_brqspf_item != null) { info.SP_Win_Odds_BRQ = sp_brqspf_item.WinOdds; info.SP_Lose_Odds_BRQ = sp_brqspf_item.LoseOdds; info.SP_Flat_Odds_BRQ = sp_brqspf_item.FlatOdds; //info.PrivilegesType = sp_brqspf_item.PrivilegesType==null?string.Empty:sp_brqspf_item.PrivilegesType; } #endregion #region 附加总进球sp数据 var sp_zjq_item = sp_zjq.FirstOrDefault(p => p.MatchId == item.MatchId); if (gameType.ToLower() == "hh") { if (sp_zjq_item != null && sp_zjq_item.ZJQ != null) { var json = JsonHelper.Deserialize <JCZQ_ZJQ_SPInfo>(sp_zjq_item.ZJQ); info.JinQiu_0_Odds = json.JinQiu_0_Odds; info.JinQiu_1_Odds = json.JinQiu_1_Odds; info.JinQiu_2_Odds = json.JinQiu_2_Odds; info.JinQiu_3_Odds = json.JinQiu_3_Odds; info.JinQiu_4_Odds = json.JinQiu_4_Odds; info.JinQiu_5_Odds = json.JinQiu_5_Odds; info.JinQiu_6_Odds = json.JinQiu_6_Odds; info.JinQiu_7_Odds = json.JinQiu_7_Odds; //info.PrivilegesType = json.PrivilegesType==null?string.Empty:json.PrivilegesType; } } else if (sp_zjq_item != null) { info.JinQiu_0_Odds = sp_zjq_item.JinQiu_0_Odds; info.JinQiu_1_Odds = sp_zjq_item.JinQiu_1_Odds; info.JinQiu_2_Odds = sp_zjq_item.JinQiu_2_Odds; info.JinQiu_3_Odds = sp_zjq_item.JinQiu_3_Odds; info.JinQiu_4_Odds = sp_zjq_item.JinQiu_4_Odds; info.JinQiu_5_Odds = sp_zjq_item.JinQiu_5_Odds; info.JinQiu_6_Odds = sp_zjq_item.JinQiu_6_Odds; info.JinQiu_7_Odds = sp_zjq_item.JinQiu_7_Odds; //info.PrivilegesType = sp_zjq_item.PrivilegesType==null?string.Empty:sp_zjq_item.PrivilegesType; } #endregion #region 附加比分sp数据 var sp_bf_item = sp_bf.FirstOrDefault(p => p.MatchId == item.MatchId); if (gameType.ToLower() == "hh") { if (sp_bf_item != null && sp_bf_item.BF != null) { var json = JsonHelper.Deserialize <JCZQ_BF_SPInfo>(sp_bf_item.BF); info.F_01 = json.F_01; info.F_02 = json.F_02; info.F_03 = json.F_03; info.F_04 = json.F_04; info.F_05 = json.F_05; info.F_12 = json.F_12; info.F_13 = json.F_13; info.F_14 = json.F_14; info.F_15 = json.F_15; info.F_23 = json.F_23; info.F_24 = json.F_24; info.F_25 = json.F_25; info.F_QT = json.F_QT; info.P_00 = json.P_00; info.P_11 = json.P_11; info.P_22 = json.P_22; info.P_33 = json.P_33; info.P_QT = json.P_QT; info.S_10 = json.S_10; info.S_20 = json.S_20; info.S_21 = json.S_21; info.S_30 = json.S_30; info.S_31 = json.S_31; info.S_32 = json.S_32; info.S_40 = json.S_40; info.S_41 = json.S_41; info.S_42 = json.S_42; info.S_50 = json.S_50; info.S_51 = json.S_51; info.S_52 = json.S_52; info.S_QT = json.S_QT; //info.PrivilegesType = json.PrivilegesType==null?string.Empty:json.PrivilegesType; } } else if (sp_bf_item != null) { info.F_01 = sp_bf_item.F_01; info.F_02 = sp_bf_item.F_02; info.F_03 = sp_bf_item.F_03; info.F_04 = sp_bf_item.F_04; info.F_05 = sp_bf_item.F_05; info.F_12 = sp_bf_item.F_12; info.F_13 = sp_bf_item.F_13; info.F_14 = sp_bf_item.F_14; info.F_15 = sp_bf_item.F_15; info.F_23 = sp_bf_item.F_23; info.F_24 = sp_bf_item.F_24; info.F_25 = sp_bf_item.F_25; info.F_QT = sp_bf_item.F_QT; info.P_00 = sp_bf_item.P_00; info.P_11 = sp_bf_item.P_11; info.P_22 = sp_bf_item.P_22; info.P_33 = sp_bf_item.P_33; info.P_QT = sp_bf_item.P_QT; info.S_10 = sp_bf_item.S_10; info.S_20 = sp_bf_item.S_20; info.S_21 = sp_bf_item.S_21; info.S_30 = sp_bf_item.S_30; info.S_31 = sp_bf_item.S_31; info.S_32 = sp_bf_item.S_32; info.S_40 = sp_bf_item.S_40; info.S_41 = sp_bf_item.S_41; info.S_42 = sp_bf_item.S_42; info.S_50 = sp_bf_item.S_50; info.S_51 = sp_bf_item.S_51; info.S_52 = sp_bf_item.S_52; info.S_QT = sp_bf_item.S_QT; //info.PrivilegesType = sp_bf_item.PrivilegesType==null?string.Empty:sp_bf_item.PrivilegesType; } #endregion #region 附加半全场sp数据 var sp_bqc_item = sp_bqc.FirstOrDefault(p => p.MatchId == item.MatchId); if (gameType.ToLower() == "hh") { if (sp_bqc_item != null && sp_bqc_item.BQC != null) { var json = JsonHelper.Deserialize <JCZQ_BQC_SPInfo>(sp_bqc_item.BQC); info.F_F_Odds = json.F_F_Odds; info.F_P_Odds = json.F_P_Odds; info.F_SH_Odds = json.F_SH_Odds; info.P_F_Odds = json.P_F_Odds; info.P_P_Odds = json.P_P_Odds; info.P_SH_Odds = json.P_SH_Odds; info.SH_F_Odds = json.SH_F_Odds; info.SH_P_Odds = json.SH_P_Odds; info.SH_SH_Odds = json.SH_SH_Odds; //info.PrivilegesType = json.PrivilegesType==null?string.Empty:json.PrivilegesType; } } else if (sp_bqc_item != null) { info.F_F_Odds = sp_bqc_item.F_F_Odds; info.F_P_Odds = sp_bqc_item.F_P_Odds; info.F_SH_Odds = sp_bqc_item.F_SH_Odds; info.P_F_Odds = sp_bqc_item.P_F_Odds; info.P_P_Odds = sp_bqc_item.P_P_Odds; info.P_SH_Odds = sp_bqc_item.P_SH_Odds; info.SH_F_Odds = sp_bqc_item.SH_F_Odds; info.SH_P_Odds = sp_bqc_item.SH_P_Odds; info.SH_SH_Odds = sp_bqc_item.SH_SH_Odds; //info.PrivilegesType = sp_bqc_item.PrivilegesType==null?string.Empty:sp_bqc_item.PrivilegesType; } #endregion list.Add(info); } return(list); }
public static bool HasAuth(int?userID, string operateCode) { string auth = RelationWidget.GetUserAuth(userID); return(ConvertHelper.StrIn(auth, operateCode)); }
public static List <JCZQ_MatchInfo_WEB> GetJCZQHHDGList() { List <JCZQ_MatchInfo_WEB> jczqMatchList = new List <JCZQ_MatchInfo_WEB>(); BettingHelper bizHelper = new BettingHelper(); var matchList = bizHelper.GetMatchInfoList <JCZQHHDGBase>(GetFilePath("Match_List_HH")); matchList = matchList.Where(s => long.Parse(Convert.ToDateTime(s.FSStopBettingTime).ToString("yyyyMMddHHmmss")) > long.Parse(DateTime.Now.ToString("yyyyMMddHHmmss")) && s.MatchStopDesc != "2").ToList(); if (matchList != null && matchList.Count > 0) { foreach (var item in matchList) { JCZQ_MatchInfo_WEB info = new JCZQ_MatchInfo_WEB(); info.MatcheDateTime = ConvertHelper.ConvertStrToDateTime("20" + item.MatchData); //info.FSStopBettingTime = bizHelper.ConvertDateTimeInt(Convert.ToDateTime(item.FSStopBettingTime)).ToString(); info.FSStopBettingTime = item.FSStopBettingTime; //info.//FSStopBettingTime = item.FSStopBettingTime.ToString("yyyyMMddHHmmss"), //info.//GuestTeamId = item.GuestTeamId, info.GuestTeamName = BettingHelper.GetTeamName(item.GuestTeamName); //info.//HomeTeamId = item.HomeTeamId, info.HomeTeamName = BettingHelper.GetTeamName(item.HomeTeamName); info.LeagueColor = item.LeagueColor; //info.//LeagueId = item.LeagueId, info.LeagueName = item.LeagueName; info.LetBall = item.LetBall; //info.//LoseOdds = item.LoseOdds, info.MatchIdName = item.MatchIdName; //info.StartDateTime = bizHelper.ConvertDateTimeInt(Convert.ToDateTime(item.StartDateTime)).ToString(); info.StartDateTime = Convert.ToDateTime(item.StartDateTime); //info.//StartDateTime = item.StartDateTime.ToString("yyyyMMddHHmmss"), //info.//WinOdds = item.WinOdds, //info.//FlatOdds = item.FlatOdds, info.MatchData = item.MatchData; info.MatchId = item.MatchId; info.MatchNumber = item.MatchNumber; //info.//Mid = item.Mid, info.FXId = item.FXId; info.State_HHDG = item.State; info.PrivilegesType = item.PrivilegesType == null ? string.Empty : item.PrivilegesType; //info.State = item.State; #region 附加让球胜平负sp数据 if (item.SPF != null) { var json_spf = JsonHelper.Deserialize <JCZQ_SPF_SPInfo>(item.SPF); info.SP_Win_Odds = json_spf.WinOdds; info.SP_Lose_Odds = json_spf.LoseOdds; info.SP_Flat_Odds = json_spf.FlatOdds; info.NoSaleState_SPF = json_spf.NoSaleState; //info.PrivilegesType = json_spf.PrivilegesType==null?string.Empty:json_spf.PrivilegesType; } else { info.SP_Win_Odds = 0; info.SP_Lose_Odds = 0; info.SP_Flat_Odds = 0; info.NoSaleState_SPF = "0"; //info.PrivilegesType = string.Empty; } #endregion #region 附加胜平负sp数据 if (item.BRQSPF != null) { var json_brqspf = JsonHelper.Deserialize <JCZQ_SPF_SPInfo>(item.BRQSPF); info.SP_Win_Odds_BRQ = json_brqspf.WinOdds; info.SP_Lose_Odds_BRQ = json_brqspf.LoseOdds; info.SP_Flat_Odds_BRQ = json_brqspf.FlatOdds; info.NoSaleState_BRQSPF = json_brqspf.NoSaleState; //info.PrivilegesType = json_brqspf.PrivilegesType==null?string.Empty:json_brqspf.PrivilegesType; } else { info.SP_Win_Odds_BRQ = 0; info.SP_Lose_Odds_BRQ = 0; info.SP_Flat_Odds_BRQ = 0; info.NoSaleState_BRQSPF = "0"; //info.PrivilegesType = string.Empty; } #endregion #region 附加总进球sp数据 if (item.ZJQ != null) { var json_zjq = JsonHelper.Deserialize <JCZQ_ZJQ_SPInfo>(item.ZJQ); info.JinQiu_0_Odds = json_zjq.JinQiu_0_Odds; info.JinQiu_1_Odds = json_zjq.JinQiu_1_Odds; info.JinQiu_2_Odds = json_zjq.JinQiu_2_Odds; info.JinQiu_3_Odds = json_zjq.JinQiu_3_Odds; info.JinQiu_4_Odds = json_zjq.JinQiu_4_Odds; info.JinQiu_5_Odds = json_zjq.JinQiu_5_Odds; info.JinQiu_6_Odds = json_zjq.JinQiu_6_Odds; info.JinQiu_7_Odds = json_zjq.JinQiu_7_Odds; info.NoSaleState_ZJQ = json_zjq.NoSaleState; //info.PrivilegesType = json_zjq.PrivilegesType==null?string.Empty:json_zjq.PrivilegesType; } else { info.JinQiu_0_Odds = 0; info.JinQiu_1_Odds = 0; info.JinQiu_2_Odds = 0; info.JinQiu_3_Odds = 0; info.JinQiu_4_Odds = 0; info.JinQiu_5_Odds = 0; info.JinQiu_6_Odds = 0; info.JinQiu_7_Odds = 0; info.NoSaleState_ZJQ = "0"; //info.PrivilegesType = string.Empty; } #endregion #region 附加比分sp数据 if (item.BF != null) { var json_bf = JsonHelper.Deserialize <JCZQ_BF_SPInfo>(item.BF); info.F_01 = json_bf.F_01; info.F_02 = json_bf.F_02; info.F_03 = json_bf.F_03; info.F_04 = json_bf.F_04; info.F_05 = json_bf.F_05; info.F_12 = json_bf.F_12; info.F_13 = json_bf.F_13; info.F_14 = json_bf.F_14; info.F_15 = json_bf.F_15; info.F_23 = json_bf.F_23; info.F_24 = json_bf.F_24; info.F_25 = json_bf.F_25; info.F_QT = json_bf.F_QT; info.P_00 = json_bf.P_00; info.P_11 = json_bf.P_11; info.P_22 = json_bf.P_22; info.P_33 = json_bf.P_33; info.P_QT = json_bf.P_QT; info.S_10 = json_bf.S_10; info.S_20 = json_bf.S_20; info.S_21 = json_bf.S_21; info.S_30 = json_bf.S_30; info.S_31 = json_bf.S_31; info.S_32 = json_bf.S_32; info.S_40 = json_bf.S_40; info.S_41 = json_bf.S_41; info.S_42 = json_bf.S_42; info.S_50 = json_bf.S_50; info.S_51 = json_bf.S_51; info.S_52 = json_bf.S_52; info.S_QT = json_bf.S_QT; info.NoSaleState_BF = json_bf.NoSaleState; //info.PrivilegesType = json_bf.PrivilegesType==null?string.Empty:json_bf.PrivilegesType; } else { info.F_01 = 0; info.F_02 = 0; info.F_03 = 0; info.F_04 = 0; info.F_05 = 0; info.F_12 = 0; info.F_13 = 0; info.F_14 = 0; info.F_15 = 0; info.F_23 = 0; info.F_24 = 0; info.F_25 = 0; info.F_QT = 0; info.P_00 = 0; info.P_11 = 0; info.P_22 = 0; info.P_33 = 0; info.P_QT = 0; info.S_10 = 0; info.S_20 = 0; info.S_21 = 0; info.S_30 = 0; info.S_31 = 0; info.S_32 = 0; info.S_40 = 0; info.S_41 = 0; info.S_42 = 0; info.S_50 = 0; info.S_51 = 0; info.S_52 = 0; info.S_QT = 0; info.NoSaleState_BF = "0"; //info.PrivilegesType = string.Empty; } #endregion #region 附加半全场sp数据 if (item.BQC != null) { var json_bqc = JsonHelper.Deserialize <JCZQ_BQC_SPInfo>(item.BQC); info.F_F_Odds = json_bqc.F_F_Odds; info.F_P_Odds = json_bqc.F_P_Odds; info.F_SH_Odds = json_bqc.F_SH_Odds; info.P_F_Odds = json_bqc.P_F_Odds; info.P_P_Odds = json_bqc.P_P_Odds; info.P_SH_Odds = json_bqc.P_SH_Odds; info.SH_F_Odds = json_bqc.SH_F_Odds; info.SH_P_Odds = json_bqc.SH_P_Odds; info.SH_SH_Odds = json_bqc.SH_SH_Odds; info.NoSaleState_BQC = json_bqc.NoSaleState; //info.PrivilegesType = json_bqc.PrivilegesType==null?string.Empty:json_bqc.PrivilegesType; } else { info.F_F_Odds = 0; info.F_P_Odds = 0; info.F_SH_Odds = 0; info.P_F_Odds = 0; info.P_P_Odds = 0; info.P_SH_Odds = 0; info.SH_F_Odds = 0; info.SH_P_Odds = 0; info.SH_SH_Odds = 0; info.NoSaleState_BQC = "0"; //info.PrivilegesType = string.Empty; } #endregion jczqMatchList.Add(info); } } return(jczqMatchList); }
public string CheckOrderCode(SHFY v) { SqlParameter[] pms = null; string sql = ""; int OrderCodeIsUse0 = 0; string sqlIsExistEC = "select count(*) from XXCLOUDALL.dbo.T_SHFYOrderInfo where OrderCode=@OrderCode and OrderCodeIsUse=@OrderCodeIsUse0"; SqlParameter[] pms4EC = new SqlParameter[] { new SqlParameter("@OrderCode", SqlDbType.NVarChar) { Value = v.OrderCode }, new SqlParameter("@OrderCodeIsUse0", SqlDbType.VarChar) { Value = (OrderCodeIsUse0.ToString()) } }; object obj = SQLHelper2.ExecuteScalar(sqlIsExistEC, System.Data.CommandType.Text, pms4EC); if (Convert.ToInt32(obj) == 1) { int OrderCodeIsUse = 1; pms = new SqlParameter[] { new SqlParameter("@OrderCode", SqlDbType.VarChar) { Value = (v.OrderCode) }, new SqlParameter("@OrderCodeIsUse", SqlDbType.VarChar) { Value = (OrderCodeIsUse.ToString()) } }; sql = "update XXCLOUDALL.dbo.T_SHFYOrderInfo set OrderCodeIsUse=@OrderCodeIsUse where OrderCode=@OrderCode"; try { int result = SQLHelper2.ExecuteNonQuery(sql, System.Data.CommandType.Text, pms); if (result == 1) { return(ConvertHelper.resultJson(1, "此预约码有效,允许进入")); } else { return(ConvertHelper.resultJson(0, "操作数据库失败,请联系技术人员")); } } catch (Exception e) { //在webapi中要想抛出异常必须这样抛出,否则只抛出一个默认500的异常 var resp = new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent(e.ToString()), ReasonPhrase = "error" }; throw new HttpResponseException(resp); } } else { return(ConvertHelper.resultJson(0, "此预约码无效,需人工审核")); } }
protected override int EncodePayload(byte[] bytes, int offset) { offset = ConvertHelper.EncodeUInt((uint)Input, bytes, offset); offset = ConvertHelper.EncodeUInt(Convert.ToUInt32(Enabled), bytes, offset); return(offset); }
/// <summary> /// 初始加载页 /// </summary> public void InitPage() { //获取所有题目,根据SID //long SID = ConvertHelper.ConvertLong(Request.QueryString["SID"]); long SID = 96; string SurveryName = ""; DataTable dtChoosedOption = new WebChart_Layer().GetChoosedOption(ConvertHelper.ConvertString(SID), ""); long nowRentCount = 0; DataTable SurveyTable = new WebChart_Layer().GetSurveyTableName(ConvertHelper.ConvertString(SID)); if (SurveyTable.Rows.Count == 1) { SurveryName = ConvertHelper.ConvertString(SurveyTable.Rows[0]["SurveyName"]); } DataTable SurveyItems = new WebChart_Layer().GetAllSurveyTtem(ConvertHelper.ConvertString(SID)); //获取问卷的所有题目 if (SurveyItems.Rows.Count > 0) { foreach (DataRow drSurveyItem in SurveyItems.Rows) { Chart chart = new Chart(); chart.Titles.Add(ConvertHelper.ConvertString(drSurveyItem["ItemName"])); Series series0 = new Series(); //series0.Type =SeriesChartType.Pie; chart.Series.Add(series0); ChartArea ChartArea0 = new ChartArea(); ChartArea0.Name = "a"; chart.ChartAreas.Add(ChartArea0); Legend Legends0 = new Legend(); Legends0.Name = "Default"; chart.Legends.Add(Legends0); CalloutAnnotation CalloutAnnotation0 = new CalloutAnnotation(); CalloutAnnotation0.Name = "Callout1"; chart.Annotations.Add(CalloutAnnotation0); SetChartProperty(chart); DataRow[] dataItemRows = dtChoosedOption.Select(string.Format("IID={0}", ConvertHelper.ConvertString(drSurveyItem["IID"]))); if (dataItemRows != null) { for (int i = 0; i < dataItemRows.Length; i++) { nowRentCount = nowRentCount + ConvertHelper.ConvertLong(dataItemRows[i]["CountItemValue"]); } } DataTable dtTtemOption = new WebChart_Layer().GetTtemOption(ConvertHelper.ConvertString(SID), ConvertHelper.ConvertString(drSurveyItem["IID"])); //获取题目的所有选项 if (dtTtemOption != null) { int j = 0; foreach (DataRow dtItemOption in dtTtemOption.Rows) { if (dtChoosedOption != null) { DataRow[] dataRows = dtChoosedOption.Select(string.Format("IID={0} and ItemValue={1}", ConvertHelper.ConvertString(drSurveyItem["IID"]), ConvertHelper.ConvertString(dtItemOption["OID"]))); if (dataRows.Length > 0) { chart.Series[0].Points.AddY(Convert.ToInt64(dataRows[0]["CountItemValue"]) * 100 / nowRentCount); chart.Series[0].Points[j].Label = Convert.ToString(Math.Round(Convert.ToDouble(dataRows[0]["CountItemValue"]) * 100 / nowRentCount, 2)) + "%"; chart.Series[0].Points[j].LegendText = ConvertHelper.ConvertString(dtItemOption["OptionName"]) + "(" + dataRows[0]["CountItemValue"].ToString() + "个)"; j++; } else { //chart.Series[0].Points.AddY(0); //chart.Series[0].Points[j].Label = "100%"; //chart.Series[0].Points[j].LegendText = ConvertHelper.ConvertString(dtItemOption["OptionName"]) + "(" + 0 + "个)"; //chart.Series[0].Enabled = false; //j++; } } } j = 0; } Page.Controls.Add(chart); nowRentCount = 0; } } }
private CardDB() { CardList.Clear(); cardidToCardList.Clear(); //placeholdercard Card plchldr = new Card { name = CardName.unknown, cost = 1000 }; namelist.Add("unknown"); CardList.Add(plchldr); unknownCard = CardList[0]; string name = ""; var cards = Cards.All; foreach (var item in cards.Keys) { var card = new Card(); allCardIDS.Add(item); card.cardIDenum = ConvertHelper.cardIdstringToEnum(item); var dbCard = cards[item]; card.EnglishName = dbCard.GetLocName(Locale.enUS); card.ChineseName = dbCard.GetLocName(Locale.zhCN); card.Health = dbCard.Health; card.Class = (int)dbCard.Class; card.Attack.Value = dbCard.Attack; card.race = (int)dbCard.Race; card.rarity = (int)dbCard.Rarity; card.cost = dbCard.Cost; card.type = (CardType)dbCard.Type; card.DbfId = dbCard.DbfId; if (card.type == CardType.Token) { card.isToken = true; } if (card.type == CardType.ENCHANTMENT) { continue; } var trimmedCardName = TrimHelper.TrimEnglishName(dbCard.Name); if (!string.IsNullOrWhiteSpace(name)) { namelist.Add(trimmedCardName); } card.name = ConvertHelper.cardNamestringToEnum(trimmedCardName); card.poisonous = dbCard.Entity.GetTag(GameTag.POISONOUS) == 1; card.Enrage = dbCard.Entity.GetTag(GameTag.ENRAGED) == 1; card.Aura = dbCard.Entity.GetTag(GameTag.AURA) == 1; card.tank = dbCard.Entity.GetTag(GameTag.TAUNT) == 1; card.battlecry = dbCard.Entity.GetTag(GameTag.BATTLECRY) == 1; card.discover = dbCard.Entity.GetTag(GameTag.DISCOVER) == 1; card.windfury = dbCard.Entity.GetTag(GameTag.WINDFURY) == 1; card.deathrattle = dbCard.Entity.GetTag(GameTag.DEATHRATTLE) == 1; card.Reborn = dbCard.Entity.GetTag(GameTag.REBORN) == 1; card.Inspire = dbCard.Entity.GetTag(GameTag.INSPIRE) == 1; card.Durability = dbCard.Entity.GetTag(GameTag.DURABILITY); card.Elite = dbCard.Entity.GetTag(GameTag.ELITE) == 1; card.Combo = dbCard.Entity.GetTag(GameTag.COMBO) == 1; card.oneTurnEffect = dbCard.Entity.GetTag(GameTag.TAG_ONE_TURN_EFFECT) == 1; card.overload = dbCard.Entity.GetTag(GameTag.OVERLOAD); card.lifesteal = dbCard.Entity.GetTag(GameTag.LIFESTEAL) == 1; card.untouchable = dbCard.Entity.GetTag(GameTag.UNTOUCHABLE) == 1; card.Stealth = dbCard.Entity.GetTag(GameTag.STEALTH) == 1; card.Secret = dbCard.Entity.GetTag(GameTag.SECRET) == 1; card.Quest = dbCard.Entity.GetTag(GameTag.QUEST) == 1; card.Freeze = dbCard.Entity.GetTag(GameTag.FREEZE) == 1; card.AdjacentBuff = dbCard.Entity.GetTag(GameTag.ADJACENT_BUFF) == 1; card.DivineShield = dbCard.Entity.GetTag(GameTag.DIVINE_SHIELD) == 1; card.Charge = dbCard.Entity.GetTag(GameTag.CHARGE) == 1; card.Rush.Value = dbCard.Entity.GetTag(GameTag.RUSH) == 1; card.Silence = dbCard.Entity.GetTag(GameTag.SILENCE) == 1; card.Morph = dbCard.Entity.GetTag(GameTag.MORPH) == 1; card.Spellpower = dbCard.Entity.GetTag(GameTag.SPELLPOWER) > 0; card.spellpowervalue = dbCard.Entity.GetTag(GameTag.SPELLPOWER); card.TwinSpell = dbCard.Entity.GetTag(GameTag.TWINSPELL) == 1; card.TwinSpellCopyDbfId = dbCard.Entity.GetTag(GameTag.TWINSPELL); if (!string.IsNullOrEmpty(dbCard.Text)) { if (dbCard.Text.ToLower().Contains("choose one")) { card.choice = true; } } var playRequirements = dbCard.Entity.GetPlayRequirements(); if (playRequirements != null) { foreach (var playRequirement in playRequirements) { var reqId = Convert.ToInt32(playRequirement.ReqId); var errorType = (ErrorType)Enum.ToObject(typeof(ErrorType), reqId); card.playrequires.Add(errorType); } } if (card.name != CardName.unknown) { CardList.Add(card); if (!cardidToCardList.ContainsKey(card.cardIDenum)) { cardidToCardList.Add(card.cardIDenum, card); } else { Logger.GetLoggerInstanceForType() .ErrorFormat("[c.cardIDenum:" + card.cardIDenum + "] already exists in cardidToCardList"); } } } teacherminion = getCardDataFromID(CardIdEnum.NEW1_026t); illidanminion = getCardDataFromID(CardIdEnum.EX1_614t); lepergnome = getCardDataFromID(CardIdEnum.EX1_029); burlyrockjaw = getCardDataFromID(CardIdEnum.GVG_068); Helpfunctions.Instance.InfoLog("CardList:" + cardidToCardList.Count); }
// TODO: rollback changes when exception! private void ParseSource() { int srcYear; if (!int.TryParse(edSourceYear.Text, out srcYear)) { ShowError(fLangMan.LS(FLS.LSID_SourceYearInvalid)); return; } string srcName = cbSource.Text; string srcPage = edPage.Text; string place = edPlace.Text; GDMSourceRecord srcRec = null; if (!string.IsNullOrEmpty(srcName)) { srcRec = fBase.Context.FindSource(srcName); if (srcRec == null) { srcRec = fBase.Context.Tree.CreateSource(); srcRec.ShortTitle = srcName; } } GDMIndividualRecord iMain = null; int num = dataGridView1.Rows.Count; for (int r = 0; r < num; r++) { DataGridViewRow row = dataGridView1.Rows[r]; string lnk = CheckStr((string)row.Cells[0].Value); string nm = CheckStr((string)row.Cells[1].Value); string pt = CheckStr((string)row.Cells[2].Value); string fm = CheckStr((string)row.Cells[3].Value); string age = CheckStr((string)row.Cells[4].Value); string comment = CheckStr((string)row.Cells[5].Value); if (!string.IsNullOrEmpty(lnk)) { PersonLink link = GetLinkByName(lnk); if (link == PersonLink.plNone) { continue; } GDMSex sx = fBase.Context.DefineSex(nm, pt); GDMIndividualRecord iRec = fBase.Context.CreatePersonEx(nm, pt, fm, sx, false); if (!string.IsNullOrEmpty(age) && ConvertHelper.IsDigits(age)) { int birthYear = srcYear - int.Parse(age); fBase.Context.CreateEventEx(iRec, GEDCOMTagName.BIRT, "ABT " + birthYear.ToString(), ""); } if (!string.IsNullOrEmpty(place)) { GDMCustomEvent evt = fBase.Context.CreateEventEx(iRec, GEDCOMTagName.RESI, "", ""); evt.Place.StringValue = place; } if (!string.IsNullOrEmpty(comment)) { GDMNoteRecord noteRec = fBase.Context.Tree.CreateNote(); noteRec.SetNoteText(comment); iRec.AddNote(noteRec); } if (srcRec != null) { iRec.AddSource(srcRec, srcPage, 0); } fBase.NotifyRecord(iRec, RecordAction.raAdd); GDMFamilyRecord family = null; if (link == PersonLink.plPerson) { iMain = iRec; string evName = ""; if (rbSK_Met.Checked) { switch (cbEventType.SelectedIndex) { case 0: evName = GEDCOMTagName.BIRT; break; case 1: evName = GEDCOMTagName.DEAT; break; case 2: evName = GEDCOMTagName.MARR; break; } } if (evName == GEDCOMTagName.BIRT || evName == GEDCOMTagName.DEAT) { GDMCustomEvent evt = fBase.Context.CreateEventEx(iRec, evName, GDMDate.CreateByFormattedStr(edEventDate.Text, false), ""); evt.Place.StringValue = place; } else if (evName == GEDCOMTagName.MARR) { family = iRec.GetMarriageFamily(true); GDMCustomEvent evt = fBase.Context.CreateEventEx(family, evName, GDMDate.CreateByFormattedStr(edEventDate.Text, false), ""); evt.Place.StringValue = place; } } else { if (iMain == null) { throw new PersonScanException(fLangMan.LS(FLS.LSID_BasePersonInvalid)); } else { switch (link) { case PersonLink.plFather: case PersonLink.plMother: family = iMain.GetParentsFamily(true); family.AddSpouse(iRec); break; case PersonLink.plGodparent: iMain.AddAssociation(fLangMan.LS(FLS.LSID_PLGodparent), iRec); break; case PersonLink.plSpouse: family = iMain.GetMarriageFamily(true); family.AddSpouse(iRec); break; case PersonLink.plChild: family = iMain.GetMarriageFamily(true); family.AddChild(iRec); break; } } } } } InitSourceControls(); }
public int GetParamAsInt(string name) { return ConvertHelper.ToInt(GetParam(name)); }