コード例 #1
0
 public void CreatePending(PendingDeliveryItem pendingDeliveryItem)
 {
     CurrentSession.Save(pendingDeliveryItem);
 }
コード例 #2
0
 public void Delete(ClientOrganization Value)
 {
     Value.DeletionDate = DateTime.Now;
     CurrentSession.SaveOrUpdate(Value);
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 public WithdrawLimit GetWithdrawLimitByTierLevel(string tierLevel)
 {
     return(CurrentSession.QueryOver <WithdrawLimit>().Where(x => x.TierLevel == tierLevel).SingleOrDefault());
 }
コード例 #5
0
 public WithdrawLimit GetWithdrawLimitById(int id)
 {
     return(CurrentSession.QueryOver <WithdrawLimit>().Where(x => x.Id == id).SingleOrDefault());
 }
コード例 #6
0
 public IList <Kursleiter> Get()
 {
     return(CurrentSession.CreateCriteria(typeof(Kursleiter)).List <Kursleiter>());
 }
コード例 #7
0
 public IList <Valorado> loadValoradoByAgencia(Agencia agencia)
 {
     return(CurrentSession.QueryOver <Valorado>().JoinQueryOver <Almacen>(x => x.Almacenes).Where(x => x.Agencia == agencia).List <Valorado>());
 }
コード例 #8
0
 public void UpdatePendingDeliveryItem(PendingDeliveryItem pendingItem)
 {
     CurrentSession.Update(pendingItem);
 }
コード例 #9
0
 public IEnumerable <PendingDeliveryItem> GetPendingDeliveryItems()
 {
     return(CurrentSession.Query <PendingDeliveryItem>());
 }
コード例 #10
0
 public PendingDeliveryItem GetPendingDeliveryItemForJobItem(Guid jobItemId)
 {
     return(CurrentSession.Query <PendingDeliveryItem>().Where(p => p.JobItem.Id == jobItemId).SingleOrDefault());
 }
コード例 #11
0
 public PendingDeliveryItem GetPendingDeliveryItem(Guid pendingItemId)
 {
     return(CurrentSession.Query <PendingDeliveryItem>().SingleOrDefault());
 }
コード例 #12
0
 public DeliveryItem GetDeliveryItemForJobItem(Guid jobItemId)
 {
     return(CurrentSession.Query <DeliveryItem>().Where(di => di.JobItem.Id == jobItemId).SingleOrDefault());
 }
コード例 #13
0
 public bool JobItemHasPendingDeliveryItem(Guid jobItemId)
 {
     return(CurrentSession.Query <PendingDeliveryItem>().SingleOrDefault(di => di.JobItem.Id == jobItemId) != null);
 }
コード例 #14
0
 public void DeletePendingDeliveryItem(Guid id)
 {
     CurrentSession.Delete(CurrentSession.Get <PendingDeliveryItem>(id));
 }
コード例 #15
0
 public TModel GetById(TId id)
 {
     return(CurrentSession.Get <TModel>(id));
 }
コード例 #16
0
 public IEnumerable <DeliveryItem> GetDeliveryItems(Guid deliveryId)
 {
     return(CurrentSession.Query <DeliveryItem>().Where(di => di.Delivery.Id == deliveryId));
 }
コード例 #17
0
 public void Delete(Producer value)
 {
     CurrentSession.SaveOrUpdate(value);
 }
コード例 #18
0
        public virtual IAttributeUseState GetAttributeUse(string attributeSetId, string attributeId)
        {
            var entityId = new AttributeSetAttributeUseId(attributeSetId, attributeId);

            return(CurrentSession.Get <AttributeUseState>(entityId));
        }
コード例 #19
0
 public Kursleiter Get(int id)
 {
     return(CurrentSession.Get <Kursleiter>(id));
 }
コード例 #20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public BlogPostModel Get(int id)
 {
     return(CurrentSession.Get <BlogPostModel>(id));
 }
コード例 #21
0
ファイル: HomeController.cs プロジェクト: Furkanf/Kutuphane
 public HomeController()
 {
     currentUser = CurrentSession.getCurrentUser();
 }
コード例 #22
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Save(BlogPostModel entity)
 {
     return((int)CurrentSession.Save(entity));
 }
コード例 #23
0
 public WithdrawLimit GetLimitByTierLevelAndCurrency(string tierLevel, string currencyType)
 {
     return(CurrentSession.QueryOver <WithdrawLimit>().Where(x => x.TierLevel == tierLevel &&
                                                             x.LimitsCurrency == currencyType).SingleOrDefault());
 }
コード例 #24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 public void Update(BlogPostModel entity)
 {
     CurrentSession.Update(entity);
 }
コード例 #25
0
 public void Save(ClientOrganization Value)
 {
     CurrentSession.SaveOrUpdate(Value);
 }
コード例 #26
0
        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;
            }
        }
コード例 #27
0
 /// <summary>
 /// Получение всех сущностей из базы
 /// </summary>
 /// <returns>Список сущностей</returns>
 public IEnumerable <ClientOrganization> GetAll()
 {
     return(CurrentSession.Query <ClientOrganization>().ToList());
 }
コード例 #28
0
 public IList <TModel> GetAll()
 {
     return(CurrentSession.Query <TModel>().ToList());
 }
コード例 #29
0
        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);
        }
コード例 #30
0
 public void AddUpdate(Trade entity)
 {
     // Persist entity
     CurrentSession.SaveOrUpdate(entity);
 }