public T AddItem(T model) { T resultModel = baseDal.Add(model); DBContent.SaveChanges(); return(resultModel); }
public async Task <IResult> Add(TEntity entity) { IResult result; try { if (typeof(ILogEntity).IsAssignableFrom(typeof(ILogEntity))) { foreach (var item in typeof(TEntity).GetFields().Where(x => typeof(ILogEntity).GetFields().Select(x => x.Name).Contains(x.Name))) { if (item.Name == "CreatedTime") { item.SetValue(null, DateTime.Now); } if (item.Name == "UserId") { item.SetValue(null, 0); } } } await _baseDal.Add(entity); _identityId = _baseDal.SCOPE_IDENTY_ID; result = new SuccessResult("Adding was succesed"); } catch (Exception ex) { result = new ErrorResult(ex.Message); } return(result); }
/// <summary> /// 同步-新增 /// </summary> /// <param name="entity"></param> /// <returns></returns> public T Add(T entity) { var result = _baseDal.Add(entity); unitOfWork.SaveChanges(); return(result); }
public T Add(T entity) { var myEntity = CurrentDal.Add(entity); DbSession.SaveChanges(); return(myEntity); }
public T Add(T entity) { T entityData = CurrentDal.Add(entity); Db.SaveChanges(); return(entityData); }
/// <summary> /// BaseService的插入 /// </summary> /// <param name="Enity">要插入的Enity实体</param> /// <returns>返回插入的Enity实体</returns> public TModel Add(TModel Enity) { TModel tmp = CurrentDal.Add(Enity); dbSession.SaveChanges(); return(Enity); }
public T Add(T entity) { CurrentDal.Add(entity); dbSession.SaveChanges(); return(entity); //return dbSession.UserInfoDal.Add(entity); }
public T Add(T entity) { ////假设是UserInfoBll继承了这个类,那么这里就应该是 //return UserInnfoDal.Add(entity); ////如果是OrderInfoBll继承了这个类,那么这里就应该是 //return OrderInfoDal.Add(entity); ////所以这里就应该是用当前的Dal——CurrentDal //return CurrentDal.Add(entity); CurrentDal.Add(entity); DbSession.SaveChanges(); return(entity); }
/// <summary> /// 用户提交 意向单业务 /// </summary> /// <param name="orderId">关联的 流程订单id</param> /// <param name="userId">提交意向的 用户id</param> /// <param name="remarks">意向备注</param> /// <param name="bProductDetailModel">意向产品 集合</param> /// <returns></returns> public string AddIntentionOrder(Guid orderId, Guid userId, string remarks, IList <BProductDetailModel> bProductDetailModel) { var isHave = baseDal.GetListQuery(item => item.OrderId == orderId).Count(); if (isHave > 0) { return("该流程订单已经存在 对应的意向订单 请勿重复提交"); } IntentionOrder intentionOrder = new IntentionOrder() { Id = Guid.NewGuid(), CreateTime = DateTime.Now, Flag = (int)BusinessOrderFlag.Undetermined, OrderId = orderId, IntentionUserId = userId, Remarks = remarks }; baseDal.Add(intentionOrder); foreach (var item in bProductDetailModel) { IntentionProduct intentionProduct = new IntentionProduct() { Id = Guid.NewGuid(), Count = item.Count, Specifications = item.Specifications, Manufactor = item.Manufactor, Name = item.ProductName, Price = item.Price, IntentionOrderId = intentionOrder.Id, Remarks = item.Remarks }; intentionProductDal.Add(intentionProduct); } UserOrder userOrder = new UserOrder() { Id = intentionOrder.OrderId, Flag = (int)OrderStateFlag.Intention, //OrderId = "1", CurrentStateTime = DateTime.Now }; userOrderDal.UpdateItemSelect(userOrder, new string[] { UserOrderPropertiesConfig.Flag, UserOrderPropertiesConfig.CurrentStateTime }); int count = DBContent.SaveChanges(); if (count > 0) { return(BReturnModel.IsOk); } return(BReturnModel.Error); }
/// <summary> /// 用户 提交询价单业务 /// </summary> /// <param name="userId">用户id</param> /// <param name="productName">产品名称</param> /// <param name="remarks">备注</param> /// <param name="price">用户提交的参考价格</param> /// <param name="productImgList">用户提交的 图片路径数组</param> /// <param name="orderFlag">订单状态 此处提交(询价单 状态码)</param> /// <param name="price">支付状态 此处提交(未支付)</param> /// <returns></returns> public bool AddUserInquiryOrder(Guid userId, string remarks, decimal price, List <string> productImgList, OrderStateFlag orderFlag = OrderStateFlag.Inquiry, OrderPayStateFlag payFlag = OrderPayStateFlag.Unpaid) { UserOrder userOrder = new UserOrder() { Id = Guid.NewGuid(), UserId = userId, OriginalPrice = price, RealisticPrice = price, Flag = (int)orderFlag, PayFlag = (int)payFlag, CreateTime = DateTime.Now, BusinessOrderId = OrderHelp.GetOrderIdOne(4), Description = remarks }; userOrderDal.Add(userOrder); InquiryOrder inquiryOrder = new InquiryOrder() { Id = Guid.NewGuid(), CreateTime = DateTime.Now, Price = price, OrderId = userOrder.Id, Remarks = remarks, Flag = (int)BusinessOrderFlag.Undetermined, UserId = userId }; baseDal.Add(inquiryOrder); foreach (var urlItem in productImgList) { InquiryProductImg inquiryProductImg = new InquiryProductImg() { Id = Guid.NewGuid(), ImgUrl = urlItem, OrderId = userOrder.Id, Remarks = remarks, InquiryOrdertId = inquiryOrder.Id }; inquiryProductImgDal.Add(inquiryProductImg); } int count = DBContent.SaveChanges(); if (count > 0) { return(true); } return(false); }
internal void Add(Kategori newKategori) { try { ReturnValue = kategoriDal.Add(newKategori); } catch (Exception exception) { Helper.Message.Error(exception.Message); } if (ReturnValue > 0) { Helper.Message.Information("Kayıt ekleme işlemi başarılı"); } }
internal void Add(AltKategori newAltKategori) { ReturnValue = 0; try { ReturnValue = _altKategoriDal.Add(newAltKategori); if (ReturnValue > 0) { Helper.Message.Information("Kaydınız eklendi."); } } catch (Exception exception) { Helper.Message.Error(exception.Message); } }
internal void Add(string kategori, string altKategori, DateTime tarih, decimal tutar, string aciklama) { Gelir gelir = new Gelir(); gelir.Aciklama = aciklama; gelir.AltKategoriAdi = altKategori; gelir.KategoriAdi = kategori; gelir.KayitTarihi = tarih; gelir.Tutar = tutar; ReturnValue = gelirDal.Add(gelir); if (ReturnValue > 0) { Helper.Message.Information("Kayıt Ekleme İşleminiz başarılı."); } else { Helper.Message.Error("Kayıt işleminiz başarısız."); } }
private SUBJEKTU_ASMENYS CreateNaudotojas(ADUser adUser, int domainId) { var subjektas = new SUBJEKTAI { SBJ_PAV = string.Format("{0} {1}", adUser.Name, adUser.Surname), SBJ_EMAIL = adUser.Email, SBJ_SBJT_ID = (int)SubjektuTipai.Darbuotojas, SBJ_TELEFONAS = adUser.Telephone, SBJ_REG_DATA = adUser.WhenCreated, SBJ_DATA_NUO = DateTime.Now }; _subjektaiDal.Add(subjektas); var subjektuAsmenys = new SUBJEKTU_ASMENYS { ASM_LOCAL = true, // jei ne 0 - slaptazodis tikrinamas Active directory, ASM_LOGIN = adUser.UserName, ASM_GUID = adUser.ObjectGuid.ToString(), ASM_VARDAS = adUser.Name, ASM_PAVARDE = adUser.Surname, ASM_DATA_NUO = DateTime.Now, ASM_NTIP_ID = (short?)NaudotojoTipas.Darbuotojas, // 0 - single user, 4 - admin ASM_DOMAIN_ID = domainId }; _subjektuAsmenysDal.Add(subjektuAsmenys); var istorija = new SUBJEKTU_ASMENU_ISTORIJA { Subjektas = subjektas, SubjektuAsmenys = subjektuAsmenys, SBJA_DATA_NUO = DateTime.Now }; _subjektuAsmenuIstorijaDal.Add(istorija); _transactionProvider.SaveChangesWithoutLogging(); return(subjektuAsmenys); }
public virtual JsonModel Add(T entity) { JsonModel jsonModel = null; try { int result = CurrentDal.Add(entity); if (result > 0) { jsonModel = new JsonModel() { errNum = 0, errMsg = "success", retData = result }; } else { jsonModel = new JsonModel() { errNum = 5, errMsg = "名称重复", retData = result }; } return(jsonModel); } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; return(jsonModel); } }
public virtual bool Add(T model) { return(dal.Add(model)); }
public virtual T Add(T model) { CurrentDal.Add(model); dbSession.SaveChanges(); return(model); }
public TEntity Add(TEntity entity) { _baseDal.Add(entity); return(entity); }
public virtual void Add(T model) { basedal.Add(model); }
public void Add(Car car) => _carDal.Add(car);
/// <summary> /// 添加/制作 合同单 /// </summary> /// <param name="orderId"></param> /// <param name="makeUserId"></param> /// <param name="expireTime"></param> /// <param name="bProductDetailModel"></param> /// <returns></returns> public BReturnModel AddContractOrder(Guid orderId, Guid makeUserId, DateTime expireTime, IList <BProductDetailModel> bProductDetailModel) { var isHave = baseDal.GetListQuery(item => item.OrderId == orderId).Count(); if (isHave > 0) { return(BReturnModel.ReturnError("当前流程单 已经存在对应的合同订单 不可重复提交")); } var userOrderModel = userOrderDal.GetItemById(orderId); if (userOrderModel == null) { return(BReturnModel.ReturnError("未找到 对应的流程订单")); } ContractOrder contractOrder = new ContractOrder() { Id = Guid.NewGuid(), CreateTime = DateTime.Now, Flag = (int)BusinessOrderFlag.Undetermined, ExpireTime = expireTime, OrderId = orderId, ContractMakeUserId = makeUserId, UserId = userOrderModel.UserId }; baseDal.Add(contractOrder); decimal totalPrice = 0; foreach (var item in bProductDetailModel) { ContractProduct contractProduct = new ContractProduct() { Id = Guid.NewGuid(), ContractOrderId = contractOrder.Id, Count = item.Count, Price = item.Price, ProductName = item.ProductName, Remarks = item.Remarks, Specifications = item.Specifications, Manufactor = item.Manufactor }; totalPrice += (decimal)contractProduct.Price * (int)contractProduct.Count; contractProductDal.Add(contractProduct); } UserOrder userOrder = new UserOrder() { Id = orderId, CurrentStateTime = DateTime.Now, Flag = (int)OrderStateFlag.Contract, OriginalPrice = totalPrice, RealisticPrice = totalPrice //现价 需要减去用户红包金额 }; userOrderDal.UpdateItemSelect(userOrder, new string[] { UserOrderPropertiesConfig.Flag, UserOrderPropertiesConfig.CurrentStateTime, UserOrderPropertiesConfig.OriginalPrice, UserOrderPropertiesConfig.RealisticPrice }); int count = DBContent.SaveChanges(); if (count > 0) { return(BReturnModel.ReturnOk()); } else { return(BReturnModel.ReturnError()); } }
public void Add(T entity) { dal.Add(entity); DbSession.SaveChange(); }
public int Add(T entity) { return(_dao.Add(entity)); }
//增加 public bool Add(T u) { curDal.Add(u); return(dbSession.SaveChanges() > 0); }
public void Add(Brand brand) => _brandDal.Add(brand);
/// <summary> /// 添加 报价订单 /// </summary> /// <param name="userId">操作员id</param> /// <param name="orderId">关联的流程订单id</param> /// <param name="remarks">备注</param> /// <param name="QuotationUserId">操作员id</param> /// <param name="expireTime">过期时间</param> /// <param name="bProductDetailModel">关联的产品模型</param> /// <returns>响应消息</returns> public BReturnModel AddQuotationOrder(Guid orderId, string remarks, Guid QuotationUserId, DateTime expireTime, IList <BProductDetailModel> bProductDetailModel) { var isHave = baseDal.GetListQuery(item => item.OrderId == orderId).Count(); if (isHave > 0) { return(BReturnModel.ReturnError("orderId流程订单已经存在 对应的报价订单 请勿重复提交")); } var userOrderModel = userOrderDal.GetItemById(orderId); if (userOrderModel == null) { return(BReturnModel.ReturnError("未查询到 对应的流程订单")); } QuotationOrder quotationOrder = new QuotationOrder() { Id = Guid.NewGuid(), CreateTime = DateTime.Now, ExpireTime = expireTime, Remarks = remarks, OrderId = orderId, QuotationUserId = QuotationUserId, Flag = (int)BusinessOrderFlag.Undetermined, UserId = userOrderModel.UserId }; baseDal.Add(quotationOrder); foreach (var item in bProductDetailModel) { QuotationProduct quotationProduct = new QuotationProduct() { Id = Guid.NewGuid(), Manufactor = item.Manufactor, Specifications = item.Specifications, QuotationOrderId = quotationOrder.Id, Price = item.Price, Remarks = item.Remarks, ProductName = item.ProductName, }; quotationProductDal.Add(quotationProduct); foreach (var itemImg in item.ImgUrl) { QuotationProductImg quotationProductImg = new QuotationProductImg() { Id = Guid.NewGuid(), ImgUrl = itemImg, QuotationProductId = quotationProduct.Id }; quotationProductImgDal.Add(quotationProductImg); } } UserOrder userOrder = new UserOrder() { Id = orderId, Flag = (int)OrderStateFlag.Offer, CurrentStateTime = DateTime.Now }; userOrderDal.UpdateItemSelect(userOrder, new string[] { UserOrderPropertiesConfig.Flag, UserOrderPropertiesConfig.CurrentStateTime }); int count = DBContent.SaveChanges(); if (count > 0) { return(BReturnModel.ReturnOk()); } return(BReturnModel.ReturnError()); }
/// <summary> /// 添加 /// </summary> /// <param name="Entity"></param> /// <returns></returns> public T Add(T Entity) { currentDal.Add(Entity); DBSession.SaveChanges(); return(Entity); }
public void Add(TEntity model) { basedal.Add(model); }
public void Add(Color color) => _colorDal.Add(color);