public async Task <APIResult> CustomizedTaskCheck(CustomizedTaskDto param) { try { string spName = @"up_RMMT_TOU_CustomizedTaskCheck_C"; DynamicParameters dp = new DynamicParameters(); dp.Add("@ScoreId", param.ScoreId, DbType.Int64); dp.Add("@TPId", param.TPId, DbType.Int64); dp.Add("@Remarks", param.Remarks, DbType.String); dp.Add("@UserId", param.UserId, DbType.Int64); using (var conn = new SqlConnection(DapperContext.Current.SqlConnection)) { conn.Open(); using (var tran = conn.BeginTransaction(System.Data.IsolationLevel.ReadCommitted)) { await conn.ExecuteAsync(spName, dp, tran, null, CommandType.StoredProcedure); tran.Commit(); } } return(new APIResult { Body = "", ResultCode = ResultType.Success, Msg = "" }); } catch (Exception ex) { return(new APIResult { Body = "", ResultCode = ResultType.Failure, Msg = ex.Message }); } }
public int LocalCustomizedTaskCheck(CustomizedTaskDto dto) { var conn = Resolver.Resolve <ISQLite>().GetConnection(); List <string> parameters = new List <string>(); string sql = @"select * from score where TPId =? AND ItemId =?"; parameters.Add(dto.TPId.ToString()); parameters.Add(dto.TCId.ToString()); var list = _scoreRepository.QueryListForTask(sql, parameters.ToArray()); foreach (var item in list) { _scoreRepository.Delete(item); } Score score = new Score() { TPId = dto.TPId.ToString(), ItemId = "0", Remarks = dto.Remarks, InUserId = int.Parse(CommonContext.Account.UserId), InDateTime = DateTime.Now, Id = Guid.NewGuid().ToString(), GRUD = "I" }; return(conn.InsertOrReplace(score)); }
private async void SaveMethod() { try { if (CustomizedTask == null) { return; } else if (string.IsNullOrEmpty(CustomizedTask.Remarks)) { _commonFun.AlertLongText("请填写备注信息"); return; } CustomizedTaskDto dto = new CustomizedTaskDto() { ScoreId = CustomizedTask.ScoreId, TPId = CustomizedTask.TPId, UserId = int.Parse(CommonContext.Account.UserId), Remarks = CustomizedTask.Remarks }; _commonFun.ShowLoading("保存中..."); var result = await _tourService.CustomizedTaskCheck(dto); if (result != null) { if (result.ResultCode == ResultType.Success) { await Navigation.PopAsync(); _commonFun.AlertLongText("保存成功"); } else { _commonFun.AlertLongText(result.Msg); } } else { _commonFun.AlertLongText("保存时服务出现错误,,请重试"); } } catch (OperationCanceledException) { _commonFun.HideLoading(); _commonFun.AlertLongText("请求超时,请重试"); } catch (Exception) { _commonFun.HideLoading(); _commonFun.AlertLongText("保存异常,请重试"); } finally { _commonFun.HideLoading(); } }
private async void CheckCustomizedTask(string taskId, string operation, string tPStatus) { if (_commonHelper.IsNetWorkConnected() == true) { try { _commonFun.ShowLoading("查询中..."); var result = await _tourService.GetCustomizedTaskByTaskId(taskId, operation); if (result.ResultCode == Module.ResultType.Success) { List<CustomizedTaskDto> dtoList = CommonHelper.DecodeString<List<CustomizedTaskDto>>(result.Body); if (dtoList != null && dtoList.Count > 0) { if (operation != "E") { CustomizedTaskDto dto = dtoList.FirstOrDefault(); await Navigation.PushAsync<CustomizedTaskViewModel>((vm, v) => vm.Init(dto, tPStatus), true); } else { GetPlans(_disId, _startTime, _endTime, _statu); } } else { _commonFun.HideLoading(); _commonFun.ShowToast("没有数据"); } } else { _commonFun.HideLoading(); _commonFun.AlertLongText("查询失败,请重试。 " + result.Msg); } } catch (OperationCanceledException) { _commonFun.HideLoading(); _commonFun.AlertLongText("请求超时。"); } catch (Exception) { _commonFun.HideLoading(); _commonFun.AlertLongText("查询异常,请重试。"); } finally { _commonFun.HideLoading(); } } else { _commonFun.AlertLongText("网络连接异常。"); } }
private async void LocalSaveMethod() { try { if (CustomizedTask == null) { return; } else if (string.IsNullOrEmpty(CustomizedTask.Remarks)) { _commonFun.AlertLongText("请填写备注信息"); return; } CustomizedTaskDto dto = new CustomizedTaskDto() { ScoreId = CustomizedTask.ScoreId, TPId = CustomizedTask.TPId, UserId = int.Parse(CommonContext.Account.UserId), Remarks = CustomizedTask.Remarks }; _commonFun.ShowLoading("保存中..."); int result = _localScoreService.LocalCustomizedTaskCheck(dto); if (result > 0) { await Navigation.PopAsync(); _commonFun.AlertLongText("保存成功"); } else { _commonFun.AlertLongText("保存失败"); } } catch (OperationCanceledException) { _commonFun.HideLoading(); _commonFun.AlertLongText("请求超时,请重试"); } catch (Exception) { _commonFun.HideLoading(); _commonFun.AlertLongText("保存异常,请重试"); } finally { _commonFun.HideLoading(); } }
private async void LocalCheckCustomizedTask(string taskId, string operation, string tPStatus) { try { _commonFun.ShowLoading("查询中..."); List<CustomizedTaskDto> result = new List<CustomizedTaskDto>(); try { result = await _localScoreService.LocalGetCustomizedTaskByTaskId(taskId, operation); } catch (Exception ex) { _commonFun.HideLoading(); _commonFun.AlertLongText(ex.Message); } if (result != null && result.Count > 0) { if (operation != "E" && operation != "C") { CustomizedTaskDto dto = result.FirstOrDefault(); await Navigation.PushAsync<CustomizedTaskViewModel>((vm, v) => vm.Init(dto, tPStatus), true); } else { GetLocalPlans(_disId); } } else { _commonFun.HideLoading(); } } catch (OperationCanceledException) { _commonFun.HideLoading(); _commonFun.AlertLongText("请求超时。"); } catch (Exception) { _commonFun.HideLoading(); _commonFun.AlertLongText("查询异常,请重试。"); } finally { _commonFun.HideLoading(); } }
public void Init(CustomizedTaskDto dto, string tPStatus) { try { CustomizedTask = dto; if (tPStatus == "E" && fromSeachYN == "search")//结束 { VisibleYN = "N"; } else { VisibleYN = "Y"; } } catch (Exception) { _commonFun.AlertLongText("操作异常,请重试。-->CustomizedTaskViewModel"); return; } }
public Task <APIResult> CustomizedTaskCheck([FromBody] CustomizedTaskDto param) { return(_tourService.CustomizedTaskCheck(param)); }
public async Task <APIResult> CustomizedTaskCheck(CustomizedTaskDto dto) { var info = await _commonHelper.HttpPOST <APIResult>(baseUrl, _config.Get <string>($"{Config.Config.Endpoints_Paths}.CustomizedTaskCheck"), dto); return(info); }