public void CreatePending(PendingDeliveryItem pendingDeliveryItem) { CurrentSession.Save(pendingDeliveryItem); }
public void Delete(ClientOrganization Value) { Value.DeletionDate = DateTime.Now; CurrentSession.SaveOrUpdate(Value); }
public int Delete(ReceiveMaster master) { try { var salesdetails = serviceDetails.GetAll(a => a.ReceiveMasterId == master.Id).ToList(); foreach (var item in salesdetails) { try { var isdetails = new DBService <ReceiveDetail>().Delete(item.Id); } catch (Exception ex) { } } var isDeleted = service.Delete(master.Id); foreach (var item in master.ReceiveDetails) { var existingItem = inventory.GetAll(a => a.ProductId == item.ProductId && a.IsActive == true && a.WarehouseId == item.WarehouseId).ToList(); if (existingItem.Count > 0) { foreach (var inv in existingItem) { inv.UpdatedDate = DateTime.Now; inv.UpdatedBy = ""; inv.BalanceQty = inv.BalanceQty - item.Qty; inv.ReceiveQty = inv.ReceiveQty ?? 0 - item.Qty; inventory.Update(inv, inv.Id); } } } var supplier = supplierService.GetById(master.SupplierID); // Ledger Saves credit var ledgerObj = new LedgerPosting(); ledgerObj.VoucherTypeId = (int)VoucherType.PurchaseInvoice; ledgerObj.VoucherNo = master.InvoiceNoPaper; ledgerObj.PostingDate = master.InvoiceDate; ledgerObj.LedgerId = (int)DefaultLedger.PurchaseAccount; ledgerObj.InvoiceNo = master.InvoiceNo; ledgerObj.Debit = 0; ledgerObj.Credit = master.GrandTotal; ledgerObj.Extra1 = "Purchase Invoice Deleted: " + master.InvoiceNo; var save = ledgerService.Save(ledgerObj); //Ledger posting to customer ledger credit var detailsLedger = new LedgerPosting(); detailsLedger.VoucherTypeId = (int)VoucherType.PurchaseInvoice; detailsLedger.VoucherNo = master.InvoiceNoPaper; detailsLedger.PostingDate = master.InvoiceDate; detailsLedger.LedgerId = supplier.LedgerId; detailsLedger.InvoiceNo = master.InvoiceNo; detailsLedger.Debit = master.GrandTotal; detailsLedger.Credit = 0; detailsLedger.Extra1 = "Purchase Invoice Deleted: " + master.InvoiceNo; var detailsLedgerResult = ledgerService.Save(detailsLedger); var party = new PartyBalance(); party.InvoiceNo = master.InvoiceNo; party.LedgerId = supplier.LedgerId ?? 0; party.Debit = master.GrandTotal; party.CreditPeriod = 60; party.Credit = 0; party.FinancialYearId = CurrentSession.GetCurrentSession().FinancialYear; party.PostingDate = master.InvoiceDate; party.VoucherTypeId = (int)VoucherType.PurchaseInvoice; party.extra1 = "Purchase Invoice Deleted: " + master.InvoiceNo; partyBalanceService.Save(party); return(1); } catch (Exception ex) { return(0); } }
public WithdrawLimit GetWithdrawLimitByTierLevel(string tierLevel) { return(CurrentSession.QueryOver <WithdrawLimit>().Where(x => x.TierLevel == tierLevel).SingleOrDefault()); }
public WithdrawLimit GetWithdrawLimitById(int id) { return(CurrentSession.QueryOver <WithdrawLimit>().Where(x => x.Id == id).SingleOrDefault()); }
public IList <Kursleiter> Get() { return(CurrentSession.CreateCriteria(typeof(Kursleiter)).List <Kursleiter>()); }
public IList <Valorado> loadValoradoByAgencia(Agencia agencia) { return(CurrentSession.QueryOver <Valorado>().JoinQueryOver <Almacen>(x => x.Almacenes).Where(x => x.Agencia == agencia).List <Valorado>()); }
public void UpdatePendingDeliveryItem(PendingDeliveryItem pendingItem) { CurrentSession.Update(pendingItem); }
public IEnumerable <PendingDeliveryItem> GetPendingDeliveryItems() { return(CurrentSession.Query <PendingDeliveryItem>()); }
public PendingDeliveryItem GetPendingDeliveryItemForJobItem(Guid jobItemId) { return(CurrentSession.Query <PendingDeliveryItem>().Where(p => p.JobItem.Id == jobItemId).SingleOrDefault()); }
public PendingDeliveryItem GetPendingDeliveryItem(Guid pendingItemId) { return(CurrentSession.Query <PendingDeliveryItem>().SingleOrDefault()); }
public DeliveryItem GetDeliveryItemForJobItem(Guid jobItemId) { return(CurrentSession.Query <DeliveryItem>().Where(di => di.JobItem.Id == jobItemId).SingleOrDefault()); }
public bool JobItemHasPendingDeliveryItem(Guid jobItemId) { return(CurrentSession.Query <PendingDeliveryItem>().SingleOrDefault(di => di.JobItem.Id == jobItemId) != null); }
public void DeletePendingDeliveryItem(Guid id) { CurrentSession.Delete(CurrentSession.Get <PendingDeliveryItem>(id)); }
public TModel GetById(TId id) { return(CurrentSession.Get <TModel>(id)); }
public IEnumerable <DeliveryItem> GetDeliveryItems(Guid deliveryId) { return(CurrentSession.Query <DeliveryItem>().Where(di => di.Delivery.Id == deliveryId)); }
public void Delete(Producer value) { CurrentSession.SaveOrUpdate(value); }
public virtual IAttributeUseState GetAttributeUse(string attributeSetId, string attributeId) { var entityId = new AttributeSetAttributeUseId(attributeSetId, attributeId); return(CurrentSession.Get <AttributeUseState>(entityId)); }
public Kursleiter Get(int id) { return(CurrentSession.Get <Kursleiter>(id)); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public BlogPostModel Get(int id) { return(CurrentSession.Get <BlogPostModel>(id)); }
public HomeController() { currentUser = CurrentSession.getCurrentUser(); }
/// <summary> /// /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Save(BlogPostModel entity) { return((int)CurrentSession.Save(entity)); }
public WithdrawLimit GetLimitByTierLevelAndCurrency(string tierLevel, string currencyType) { return(CurrentSession.QueryOver <WithdrawLimit>().Where(x => x.TierLevel == tierLevel && x.LimitsCurrency == currencyType).SingleOrDefault()); }
/// <summary> /// /// </summary> /// <param name="entity"></param> public void Update(BlogPostModel entity) { CurrentSession.Update(entity); }
public void Save(ClientOrganization Value) { CurrentSession.SaveOrUpdate(Value); }
private void WorkerProcedure() { try { DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(_Status)); DataContractJsonSerializer serializer2 = new DataContractJsonSerializer(typeof(_FriendsObject)); DataContractJsonSerializer serializer3 = new DataContractJsonSerializer(typeof(_EventObject)); //_webRequest = WebRequest.Create("http://betastream.twitter.com/2b/user.json") as HttpWebRequest; //_webRequest.Credentials = new NetworkCredential(CurrentSession.Connections[0].UserInfo.UserName, // CurrentSession.Connections[0].UserInfo.Password); //_webRequest.PreAuthenticate = true; _webRequest = CurrentSession.TwitterService.OAuthClient.CreateRequest( new Uri("http://betastream.twitter.com/2b/user.json"), TwitterOAuth.HttpMethod.GET); _webRequest.ServicePoint.ConnectionLimit = 1000; _webRequest.Timeout = 30 * 1000; using (var response = _webRequest.GetResponse()) using (var stream = response.GetResponseStream()) { StreamReader sr = new StreamReader(stream, Encoding.UTF8); Boolean isFirstLine = true; while (!sr.EndOfStream && _isRunning) { var line = sr.ReadLine(); if (String.IsNullOrEmpty(line)) { continue; } _Status statusJson = null; try { // XXX: これはてぬき if (isFirstLine) { isFirstLine = false; _FriendsObject streamObject = serializer2.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(line))) as _FriendsObject; if (streamObject != null && streamObject.friends != null) { _friendIds.UnionWith(streamObject.friends); } } else if (line.IndexOf("\"event\":") > -1) { _EventObject eventObj = serializer3.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(line))) as _EventObject; if (eventObj.Event == "follow" && eventObj.source.id == CurrentSession.TwitterUser.Id) { _friendIds.Add(eventObj.target.id); } } else { statusJson = serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(line))) as _Status; } } catch { //CurrentSession.SendServerErrorMessage("UserStream(Deserialize): " + line); continue; } if (statusJson == null || statusJson.id == 0) { continue; } if (Config.IsThroughMyPostFromUserStream && (statusJson.user.id == CurrentSession.TwitterUser.Id)) { continue; } Status status = statusJson.ToStatus(); Boolean friendCheckRequired = false; if (Config.AllAtMode || (statusJson.in_reply_to_user_id.HasValue == false) || (statusJson.in_reply_to_user_id.HasValue && _friendIds.Contains(statusJson.in_reply_to_user_id.Value))) { CurrentSession.TwitterService.ProcessStatus(status, (s) => CurrentSession.ProcessTimelineStatus(s, ref friendCheckRequired, false, false)); } } } } catch (ThreadAbortException) {} catch (Exception e) { CurrentSession.SendServerErrorMessage("UserStream: " + e.ToString()); } finally { _isRunning = false; } }
/// <summary> /// Получение всех сущностей из базы /// </summary> /// <returns>Список сущностей</returns> public IEnumerable <ClientOrganization> GetAll() { return(CurrentSession.Query <ClientOrganization>().ToList()); }
public IList <TModel> GetAll() { return(CurrentSession.Query <TModel>().ToList()); }
public ReceiveMaster Save(ReceiveMaster cus, int wareHouseId, int goodsType) { var supplier = supplierService.GetById(cus.SupplierID); cus.YearId = financialYearId; var result = service.Save(cus); if (result != null || result.Id > 0) { foreach (var item in cus.ReceiveDetails) { var product = productService.GetById(item.ProductId); if (product != null) { goodsType = product.ProductTypeId ?? 1; } var existingItem = inventory.GetAll(a => a.ProductId == item.ProductId && a.IsActive == true && a.WarehouseId == wareHouseId).ToList(); if (existingItem.Count > 0) { foreach (var inv in existingItem) { inv.UpdatedDate = DateTime.Now; inv.UpdatedBy = ""; inv.BalanceQty = inv.BalanceQty + item.Qty; inv.ReceiveQty = inv.ReceiveQty ?? 0 + item.Qty; inventory.Update(inv, inv.Id); } } else { Inventory inv = new Inventory(); inv.IsActive = true; inv.ProductId = item.ProductId; inv.ReceiveQty = item.Qty; inv.QtyInBale = 0; inv.SupplierId = cus.SupplierID; inv.WarehouseId = wareHouseId; inv.OpeningQty = 0; inv.BalanceQty = item.Qty; inv.GoodsType = goodsType.ToString(); inventory.Save(inv); } } // Ledger posting debit to purchase account var ledgerObj = new LedgerPosting(); ledgerObj.VoucherTypeId = (int)VoucherType.PurchaseInvoice; ledgerObj.VoucherNo = result.InvoiceNoPaper; ledgerObj.PostingDate = cus.InvoiceDate; ledgerObj.LedgerId = (int)DefaultLedger.PurchaseAccount; ledgerObj.InvoiceNo = cus.InvoiceNo; ledgerObj.Credit = 0; ledgerObj.Debit = cus.GrandTotal; var save = ledgerService.Save(ledgerObj); //Ledger posting to customer ledger credit var detailsLedger = new LedgerPosting(); detailsLedger.VoucherTypeId = (int)VoucherType.PurchaseInvoice; detailsLedger.VoucherNo = result.InvoiceNoPaper; detailsLedger.PostingDate = cus.InvoiceDate; detailsLedger.LedgerId = supplier.LedgerId; detailsLedger.InvoiceNo = cus.InvoiceNo; detailsLedger.Credit = cus.GrandTotal; detailsLedger.Debit = 0; var detailsLedgerResult = ledgerService.Save(detailsLedger); var party = new PartyBalance(); party.InvoiceNo = result.InvoiceNo; party.LedgerId = supplier.LedgerId ?? 0; party.Credit = cus.GrandTotal; party.CreditPeriod = 60; party.Debit = 0; party.FinancialYearId = CurrentSession.GetCurrentSession().FinancialYear; party.PostingDate = cus.InvoiceDate; party.VoucherTypeId = (int)VoucherType.PurchaseInvoice; party.VoucherNo = result.InvoiceNo; party.extra1 = "Purchase Invoice: " + cus.InvoiceNo + " Coutha:" + cus.InvoiceNoPaper; partyBalanceService.Save(party); } return(cus); }
public void AddUpdate(Trade entity) { // Persist entity CurrentSession.SaveOrUpdate(entity); }