public bool RealizaTransferencia(TransferEntity transfer) { const string proc = "sp_Lancamento_Transfer"; var transferContas = VerificaContas(transfer); if (transferContas != null) { LancamentoEntity lancto = new LancamentoEntity() { ContaCorrenteOriId = transferContas.ContaCorrenteOriId, ContaCorrenteDesId = transferContas.ContaCorrenteDesId, Valor = transfer.Valor }; var paramContaOrigem = DataHelperParameters.CreateParameter("@FromContaCorrenteId", lancto.ContaCorrenteOriId); var paramContaDestino = DataHelperParameters.CreateParameter("@ToContaCorrenteId", lancto.ContaCorrenteDesId); var paramContaOrigemSaldoAtual = DataHelperParameters.CreateParameter("@Valor", lancto.Valor); return(_unitOfWork.Get <bool>(proc, paramContaOrigem, paramContaDestino)); } else { return(false); } }
public bool RealizarPost() { using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:44343/api/SuperDigital"); var obj = new TransferEntity() { BancoOri = 1, AgenciaOri = 12, ContaOri = 3123, DigitoOri = 32, BancoDes = 2, AgenciaDes = 47, ContaDes = 8334, DigitoDes = 6, Valor = 500 }; string jsonLancamento = JsonConvert.SerializeObject(obj); StringContent paramTransfer = new StringContent(jsonLancamento); paramTransfer.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage retorno = client.PostAsync("", paramTransfer).Result; return(retorno.IsSuccessStatusCode); } }
public void BzWc(TransferEntity entity) { WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; try { BxwcTransfer bt = new BxwcTransfer(); bt.RoleDutyId = entity.InPostId; bt.RoleDutyName = entity.InPostName; bt.id = entity.TID; bt.quarters = entity.OutJobName; bt.quartersid = entity.OutJobId; BzBase bs = new BzBase(); bs.data = bt; bs.userId = OperatorProvider.Provider.Current().UserId; //如果是待审批状态 则同步到班组那边 System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(); nc.Add("json", Newtonsoft.Json.JsonConvert.SerializeObject(bs)); wc.UploadValuesCompleted += wc_UploadValuesCompleted; wc.UploadValuesAsync(new Uri(new DataItemDetailBLL().GetItemValue("yjbzUrl") + "/UserWorkAllocation/updatetoerchtms"), nc); } catch (Exception e) { } }
public object Transfer() { try { string res = ctx.Request["json"]; dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string data = JsonConvert.SerializeObject(dy.data); TransferEntity entity = JsonConvert.DeserializeObject <TransferEntity>(data); string uid = entity.UserId;//获取到需要转岗的用户id //是否是新增 0是新增 1是修改 string isNew = dy.isNew; UserEntity ue = userBll.GetEntity(uid); entity.InDeptId = ue.DepartmentId; entity.InDeptName = deptBll.GetEntity(ue.DepartmentId).FullName; entity.InDeptCode = ue.DepartmentCode; entity.InJobId = ue.PostId; entity.InJobName = ue.PostName; entity.InPostId = ue.DutyId; entity.InPostName = ue.DutyName; transferbll.AppSaveForm(isNew, entity, dy.userId); return(new { Code = 0, Info = "操作成功" }); } catch (Exception ex) { return(new { Code = -1, Info = ex.Message }); } }
private TransferADTO ToDTO(TransferEntity entity) { TransferADTO dto = new TransferADTO(); dto.CreateTime = entity.CreateTime; dto.Id = entity.Id; dto.Amount = entity.Amount; dto.ChangeTypeName = entity.ChangeType.ToString() == "1" ? "A积分转换B积分": ""; return(dto); }
/// <summary> /// 转岗确认操作 /// </summary> /// <param name="keyValue"></param> /// <param name="entity"></param> public void Update(string keyValue, TransferEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void AppSaveForm(string keyValue, TransferEntity entity, string Userid) { try { service.AppSaveForm(keyValue, entity, Userid); } catch (Exception) { throw; } }
public IActionResult Post([FromBody] TransferEntity data) { var transfer = new TransferApp(data); if (transfer.errors.Any()) { return(NoContent()); } else { return(Ok()); } }
/// <summary> /// 转岗同步 /// </summary> private void SyZg(TransferEntity entity, bool i) { WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; try { BzAppTransfer tr = new BzAppTransfer(); tr.Id = entity.TID; tr.RoleDutyId = entity.OutPostId; tr.RoleDutyName = entity.OutPostName; tr.allocationtime = Convert.ToDateTime(entity.TransferTime).ToString("yyyy-MM-dd"); tr.department = entity.OutDeptName; tr.departmentid = entity.OutDeptId; tr.iscomplete = i; tr.leaveremark = ""; tr.leavetime = ""; tr.oldRoleDutyName = entity.InPostName; tr.olddepartment = entity.InDeptName; tr.olddepartmentid = entity.InDeptId; tr.oldquarters = entity.InJobName; tr.quarters = entity.OutJobName; tr.quartersid = entity.OutJobId; tr.userId = entity.UserId; tr.username = entity.UserName; BzBase bs = new BzBase(); bs.data = tr; bs.userId = OperatorProvider.Provider.Current().UserId; string Json = "json=" + bs.ToJson(); string massge = HttpMethods.HttpPost(new DataItemDetailBLL().GetItemValue("yjbzUrl") + "/UserWorkAllocation/OperationEntity", Json); AppInTransfer appreturn = JsonConvert.DeserializeObject <AppInTransfer>(massge); if (appreturn.code == "0") { if (i) { BzWc(entity); } } ////如果是待审批状态 则同步到班组那边 //System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(); //nc.Add("json", Newtonsoft.Json.JsonConvert.SerializeObject(bs)); //wc.UploadValuesCompleted += wc_UploadValuesCompleted; //wc.UploadValuesAsync(new Uri(new DataItemDetailBLL().GetItemValue("yjbzUrl") + "/UserWorkAllocation/OperationEntity"), nc); } catch (Exception e) { } }
public static PostTransfersResponse Parse(TransferEntity entity) { if (entity == null) { return(new PostTransfersResponse()); } return(new PostTransfersResponse() { AccountIDFrom = entity.AccountIDfrom, AccountIDTo = entity.AccountIDto, Value = entity.value, DateTransfer = entity.CreatedDate }); }
public async Task <long> AddAsync(long userId, decimal amount) { using (MyDbContext dbc = new MyDbContext()) { UserEntity user = await dbc.GetAll <UserEntity>().SingleOrDefaultAsync(u => u.Id == userId); if (user == null) { return(-1); } if (user.BonusAmount < amount) { return(-2); } TransferEntity entity = new TransferEntity(); entity.UserId = userId; entity.ChangeType = 1; entity.Amount = amount; dbc.Transfer.Add(entity); user.BonusAmount -= amount; user.Amount += amount; int JournalTypeId = 1; JournalEntity journal = new JournalEntity(); journal.OutAmount = amount; journal.InAmount = 0; journal.JournalTypeId = JournalTypeId; journal.Remark = "A积分转换B积分"; journal.UserId = userId; journal.CurrencyType = 1; journal.BalanceAmount = user.BonusAmount; dbc.Journals.Add(journal); JournalEntity journalInfo = new JournalEntity(); journalInfo.OutAmount = 0; journalInfo.InAmount = amount; journalInfo.JournalTypeId = JournalTypeId; journalInfo.Remark = "A积分转换B积分"; journalInfo.UserId = userId; journalInfo.CurrencyType = 2; journalInfo.BalanceAmount = user.Amount; dbc.Journals.Add(journalInfo); await dbc.SaveChangesAsync(); return(entity.Id); } }
public async Task AddAsync(ITransfer transfer) { using (var context = _contextFactory.CreateDataContext()) { var transferEntity = TransferEntity.Create(transfer); var historyForSender = TransactionHistoryEntity.CreateForSender(transfer); var historyForReceiver = TransactionHistoryEntity.CreateForReceiver(transfer); context.Transfers.Add(transferEntity); context.TransactionHistories.Add(historyForSender); context.TransactionHistories.Add(historyForReceiver); await context.SaveChangesAsync(); } }
private TransferContasEntity VerificaContas(TransferEntity transfer) { const string proc = "sp_ContaCorrente_Transfer"; var paramBancoOri = DataHelperParameters.CreateParameter("@BancoOri", transfer.BancoOri); var paramAgenciaOri = DataHelperParameters.CreateParameter("@AgenciaOri", transfer.AgenciaOri); var paramContaOri = DataHelperParameters.CreateParameter("@ContaOri", transfer.ContaOri); var paramDigitoOri = DataHelperParameters.CreateParameter("@DigitoOri", transfer.DigitoOri); var paramBancoDes = DataHelperParameters.CreateParameter("@BancoDes", transfer.BancoDes); var paramAgenciaDes = DataHelperParameters.CreateParameter("@AgenciaDes", transfer.AgenciaDes); var paramContaDes = DataHelperParameters.CreateParameter("@ContaDes", transfer.ContaDes); var paramDigitoDes = DataHelperParameters.CreateParameter("@DigitoDes", transfer.DigitoDes); return(_unitOfWork.Get <TransferContasEntity>(proc, paramBancoOri, paramAgenciaOri, paramContaOri, paramDigitoOri, paramBancoDes, paramAgenciaDes, paramContaDes, paramDigitoDes)); }
public TransferApp(TransferEntity transfer) { errors = IsValid(transfer); if (errors.Count == 0) { TransferRepository _dados = new TransferRepository(); var retorno = _dados.RealizaTransferencia(transfer); if (!retorno) { errors.Add("Ocorreu um erro ao gravar as informações"); } } }
public static TransferHistory ParseHistory(TransferEntity entity) { if (entity == null) { return(new TransferHistory()); } return(new TransferHistory() { AccountIDFrom = entity.AccountIDfrom, AccountIDTo = entity.AccountIDto, Value = (entity.TypeTransaction == Enums.ETypeTransaction.Debit ? entity.value * -1 : entity.value), DateTransfer = entity.CreatedDate, TypeTransaction = entity.TypeTransaction.ToString(), TypePay = entity.TypePay.ToString() }); }
public static List <string> ValidationRules(TransferEntity transfer) { List <string> errors = new List <string>(); if (transfer.BancoOri <= 0) { errors.Add(ReturnMessage.BancoOrigem_Obrigatorio); } if (transfer.AgenciaOri <= 0) { errors.Add(ReturnMessage.ContaOrigem_Obrigatorio); } if (transfer.ContaOri <= 0) { errors.Add(ReturnMessage.AgenciaOrigem_Obrigatorio); } if (transfer.DigitoOri <= 0) { errors.Add(ReturnMessage.DigitoOrigem_Obrigatorio); } if (transfer.BancoDes <= 0) { errors.Add(ReturnMessage.BancoDestino_Obrigatorio); } if (transfer.AgenciaDes <= 0) { errors.Add(ReturnMessage.ContaDestino_Obrigatorio); } if (transfer.ContaDes <= 0) { errors.Add(ReturnMessage.AgenciaDestino_Obrigatorio); } if (transfer.DigitoDes <= 0) { errors.Add(ReturnMessage.DigitoDestino_Obrigatorio); } if (transfer.Valor <= 0) { errors.Add(ReturnMessage.Valor_Obrigatorio); } return(errors); }
// SubmitTransfer public async Task <Transfer> SubmitTransfer(string currency, string username, double amount) { using (var client = new HttpClient()) { // create the URL string. string endpoint = "api/private/submittransfer"; // JSON POST parameters JObject jObject = new JObject(); jObject["currency"] = currency; // Hmmmm, we switched to lowercase? jObject["username"] = username; jObject["Amount"] = amount; string postParams = jObject.ToString(Formatting.None, null); // Http Client params SetHttpClientPropertiesPrivate(client, endpoint, postParams); // make the request var content = new StringContent(postParams, Encoding.UTF8, "application/json"); var response = await client.PostAsync(endpoint, content); // parse the response and return the data. var jsonResponseString = await response.Content.ReadAsStringAsync(); TransferEntity transferEntity = new TransferEntity(); try { transferEntity = JsonConvert.DeserializeObject <TransferEntity>(jsonResponseString); } catch (Exception e) { throw new Exception(_ParseError, e); } // Check success message from server if (transferEntity.Success == false) { throw new Exception(_SuccessError); } return(transferEntity.Result); } }
/// <summary> /// Podrobný zoznam všetkých surovin jedla ako prenosová entita /// </summary> /// <param name="id_jazyk"></param> /// <returns>zoznám surovin jedla</returns> public IList <TSurovina> PE_suroviny_jedla(String id_jazyk) { List <TSurovina> result = new List <TSurovina>(); foreach (var surovinaJedla in suroviny_jedla) { TransferEntity konkretnaSurovina = surovinaJedla.surovina.toTransferObject(id_jazyk); if (konkretnaSurovina != null) { TSurovina pridavana = (TSurovina)konkretnaSurovina; if (surovinaJedla.mnozstvo != null) { pridavana.Mnozstvo = surovinaJedla.mnozstvo; } result.Add(pridavana); } } return(result); }
/// <summary> /// 同步修改海康安防平台人员组织信息 /// </summary> public void HikUpdateUserInfo(TransferEntity entity) { try { DataItemDetailBLL itemBll = new DataItemDetailBLL(); string KMIndex = itemBll.GetItemValue("KMIndexUrl"); string HikHttps = itemBll.GetItemValue("HikHttps"); List <UserEntity> list = new List <UserEntity>(); if (!string.IsNullOrEmpty(KMIndex) || !string.IsNullOrEmpty(HikHttps)) {//只允许执行该操作(可门电厂、黄金埠) if (entity != null && entity.IsConfirm == 0) { UserEntity ue = userBLL.GetEntity(entity.UserId); ue.DepartmentId = entity.OutDeptId; HikUpdateUserInfo(ue); } } } catch (Exception) { throw; } }
public void updatefromTransferObject(TransferEntity transferEntity, risTabulky risContext) { if (transferEntity.GetType() == typeof(TJedlo)) { TJedlo jedlo = (TJedlo)transferEntity; if (jedlo.Id.HasValue) { if (!jedlo.DlzkaPripravy.Equals(dlzka_pripravy)) { entity.dlzka_pripravy = jedlo.DlzkaPripravy; } if (!jedlo.IdTypu.Equals(typ_jedla.id_typu)) { entity.id_typu = jedlo.IdTypu; } if (!jedlo.MnozstvoKalorii.Equals(mnozstvo_kalorii)) { entity.mnozstvo_kalorii = jedlo.MnozstvoKalorii; } foreach (var surovina in suroviny_jedla) { TSurovina tempSurovina = jedlo.ZoznamSurovin.First(p => p.Id == surovina.id_surovina); if (tempSurovina != null) { if (!surovina.mnozstvo.Equals(tempSurovina.Mnozstvo)) { surovina.mnozstvo = tempSurovina.Mnozstvo; } } else { entity.jedlo_surovina.Remove(surovina.entityJedloSurovina); } } foreach (var surovina in jedlo.ZoznamSurovin) { jedlo_surovina temp_bsurovina = entity.jedlo_surovina.First(p => p.id_surovina == surovina.Id); if (temp_bsurovina == null) { entity.jedlo_surovina.Add(risContext.jedlo_surovina.First(p => p.id_surovina == surovina.Id)); } } foreach (var preklad in jedlo.Preklady) { preklad temp_preklad = entity.text.preklad.First(p => p.kod_jazyka.Equals(preklad.Key)); if (temp_preklad == null) { preklad prkl = new preklad(); prkl.kod_jazyka = preklad.Key; prkl.preklad1 = preklad.Value; prkl.text = nazov.entityText; risContext.preklad.Add(prkl); entity.text.preklad.Add(prkl); } else { temp_preklad.preklad1 = preklad.Value; } } foreach (var preklad in nazov.preklad) { String temp_preklad = jedlo.Preklady.Keys.First(p => p.Equals(preklad.kod_jazyka)); if (temp_preklad == null) { nazov.preklad.Remove(preklad); } } risContext.SaveChanges(); } else { this.Reset(); entity = new jedlo(); entity.mnozstvo_kalorii = jedlo.MnozstvoKalorii; entity.dlzka_pripravy = jedlo.DlzkaPripravy; foreach (var suroviny in jedlo.ZoznamSurovin) { surovina surovinaTemp = risContext.surovina.First(p => p.id_surovina == suroviny.Id); if (surovinaTemp != null) { jedlo_surovina tempJedloSurovina = new jedlo_surovina(); tempJedloSurovina.jedlo = entity; tempJedloSurovina.surovina = surovinaTemp; tempJedloSurovina.mnozstvo = suroviny.Mnozstvo; entity.jedlo_surovina.Add(tempJedloSurovina); } } } } }
public ActionResult Update(string keyValue, TransferEntity entity) { Operator curuser = ERCHTMS.Code.OperatorProvider.Provider.Current(); transferbll.Update(keyValue, entity); SyZg(entity, true); HikUpdateUserInfo(entity); string uid = entity.UserId;//获取到需要转岗的用户id UserEntity ue = userBLL.GetEntity(uid); string GdhcUrl = new DataItemDetailBLL().GetItemValue("GdhcUrl"); string pcrul = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/" + Request.ApplicationPath; string LogUrl = Server.MapPath("~/logs/RYZG"); try { DesktopBLL deskBll = new DesktopBLL(); string[] receiverList = userBLL.GetList().Where(t => ((t.RoleName.Contains("负责人") || t.RoleName.Contains("公司领导") || t.RoleName.Contains("厂级部门用户")) && entity.OutDeptCode.StartsWith(t.DepartmentCode)) || (entity.OutDeptCode.StartsWith(t.DepartmentCode) && entity.OutDeptCode != t.DepartmentCode) && t.Account != "System" && !string.IsNullOrWhiteSpace(t.EnCode)).Select(t => t.EnCode).ToArray(); if (!string.IsNullOrWhiteSpace(GdhcUrl)) { Task.Factory.StartNew(() => { GdhcDbsxEntity DbEntity = new GdhcDbsxEntity(); DbEntity.syscode = "GSI"; DbEntity.flowid = entity.TID; DbEntity.requestname = ue.RealName + "转岗申请"; DbEntity.workflowname = "RYZG"; DbEntity.nodename = "人员转岗审批完成"; DbEntity.receiver = string.Join(",", receiverList); DbEntity.requestlevel = "0"; DbEntity.GdhcUrl = GdhcUrl; DbEntity.LogUrl = LogUrl; deskBll.GdhcDbsxSyncYB(DbEntity); DbEntity.receiver = string.Join(",", receiverList); DbEntity.nodename = "人员转岗审批完成"; deskBll.GdhcDbsxSyncBJ(DbEntity); }); } } catch (Exception ex) { if (!string.IsNullOrWhiteSpace(LogUrl)) { if (!System.IO.Directory.Exists(LogUrl)) { System.IO.Directory.CreateDirectory(LogUrl); } } System.IO.File.AppendAllText(LogUrl + "/" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "异常信息:" + ex.ToString()); } DataItemDetailBLL di = new DataItemDetailBLL(); string way = di.GetItemValue("WhatWay"); DepartmentBLL departmentBLL = new DepartmentBLL(); DepartmentEntity org = departmentBLL.GetEntity(ue.OrganizeId); if (org.IsTrain == 1) { //对接.net培训平台 if (way == "0") { } //对接java培训平台 if (way == "1") { var user = ERCHTMS.Code.OperatorProvider.Provider.Current(); DepartmentEntity dept = departmentBLL.GetEntity(entity.OutDeptId); if (dept != null) { string deptId = dept.DepartmentId; string enCode = dept.EnCode; if (!string.IsNullOrWhiteSpace(dept.DeptKey)) { string[] arr = dept.DeptKey.Split('|'); deptId = arr[0]; if (arr.Length > 1) { enCode = arr[1]; } } Task.Factory.StartNew(() => { object obj = new { action = "edit", time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), userId = ue.UserId, userName = ue.RealName, account = ue.Account, deptId = deptId, deptCode = enCode, password = "", //为null时不要修改密码! sex = ue.Gender, idCard = ue.IdentifyID, email = ue.Email, mobile = ue.Mobile, birth = ue.Birthday == null ? "" : ue.Birthday.Value.ToString("yyyy-MM-dd"), //生日 postId = entity.OutPostId, postName = entity.OutPostName, //岗位 age = ue.Age, //年龄 native = ue.Native, //籍贯 nation = ue.Nation, //民族 encode = ue.EnCode, //工号 jobTitle = entity.OutJobName, techLevel = ue.TechnicalGrade, workType = ue.Craft, companyId = org.InnerPhone, trainRoles = ue.TrainRoleId, role = ue.IsTrainAdmin == null ? 0 : ue.IsTrainAdmin //角色(0:学员,1:培训管理员) }; List <object> list = new List <object>(); list.Add(obj); Busines.JPush.JPushApi.PushMessage(list, 1); LogEntity logEntity = new LogEntity(); logEntity.CategoryId = 5; logEntity.OperateTypeId = ((int)OperationType.Update).ToString(); logEntity.OperateType = "人员转岗"; logEntity.OperateAccount = user.Account + "(" + user.UserName + ")"; logEntity.OperateUserId = user.UserId; logEntity.ExecuteResult = 1; logEntity.ExecuteResultJson = string.Format("同步人员(转岗)到java培训平台,同步信息:\r\n{0}", list.ToJson()); logEntity.Module = "人员档案"; logEntity.ModuleId = "ea93dc6b-83fc-4ac2-a1b7-56ef6909445c"; logEntity.WriteLog(); }); } } } return(Success("操作成功。")); }
public List <string> IsValid(TransferEntity transfer) { return(TransferValidation.ValidationRules(transfer)); }
public void updatefromTransferObject(TransferEntity transferEntity, risTabulky risContext) { throw new NotImplementedException(); }
public void Delete(TransferEntity entity) { throw new NotImplementedException(); }
public void Insert(TransferEntity entity) { _context.Set <TransferEntity>().Add(entity); _context.SaveChanges(); }