コード例 #1
0
        public bool IsChequeNoPresent(string cashChequeNo)
        {
            string str = Convert.ToString(Convert.ToByte(CashBankTransactionType.RefundFromSupplier));

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var po = entities.CashAndBankTransactions.Where(e => e.Cash_Cheque_No == cashChequeNo &&
                                                                    e.Type == str).ToList();
                    if (po.Count > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public List <SalesInvoiceEntity> GetSalesInvoiceDetails(int psID)
        {
            string pandsID = Convert.ToString(psID);

            try
            {
                List <SalesInvoiceEntity> lstCodes = new List <SalesInvoiceEntity>();
                using (SASEntitiesEDM objprodEntities = new SASEntitiesEDM())
                {
                    lstCodes = (from pi in objprodEntities.SalesInvoices
                                join pid in objprodEntities.SalesInvoiceDetails
                                on pi.ID equals pid.SI_ID
                                where pid.SI_No == pandsID
                                orderby pi.CreatedDate descending
                                select new SalesInvoiceEntity
                    {
                        ID = pi.ID,
                        //PSCode = pid.PandS_Code,
                        // PSName = pid.PandS_Name,
                        InvoiceDate = pi.SI_Date,
                        Amount = pid.SI_Amount,
                        Price = pid.SI_Price,
                        Quantity = pid.SI_Qty
                    }).ToList <SalesInvoiceEntity>();

                    return(lstCodes);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public void UpdateRefreshData(int psID)
        {
            try
            {
                using (SASEntitiesEDM objEntities = new SASEntitiesEDM())
                {
                    ProductsAndService pands = objEntities.ProductsAndServices.Where(p => p.ID == psID).SingleOrDefault();
                    if (pands != null)
                    {
                        pands.IsRefresh   = true;
                        pands.RefreshDate = DateTime.Now.Date;
                        objEntities.SaveChanges();
                    }

                    List <ProductsAndService> pandsOther = objEntities.ProductsAndServices.Where(e => e.ID != psID).ToList();
                    if (pandsOther != null)
                    {
                        foreach (var item in pandsOther)
                        {
                            item.IsRefresh   = false;
                            item.RefreshDate = null;
                            objEntities.SaveChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        public List <PandSDetailsModel> GetAllPandSNames()
        {
            List <PandSDetailsModel> lstCodes = new List <PandSDetailsModel>();

            using (SASEntitiesEDM objEntities = new SASEntitiesEDM())
            {
                try
                {
                    lstCodes = (from code in objEntities.ProductsAndServices
                                where code.IsDeleted == false
                                select new PandSDetailsModel
                    {
                        ID = code.ID,
                        PSCode = code.PandS_Code,
                        PSName = code.PandS_Description,
                    }).ToList <PandSDetailsModel>();

                    return(lstCodes);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// This method is used to get category content
        /// </summary>
        /// <returns></returns>
        public List <ContentModel> GetCategoryContent(string catType)
        {
            List <ContentModel> lstContents = new List <ContentModel>();

            using (SASEntitiesEDM objProdEntities = new SASEntitiesEDM())
            {
                try
                {
                    lstContents = (from content in objProdEntities.CategoriesContents
                                   join cat in objProdEntities.Categories on content.Cat_Id equals cat.ID
                                   where cat.Cat_Code == catType && content.IsDeleted == false
                                   select new ContentModel
                    {
                        CategoryID = cat.ID,
                        ContentID = content.ID,
                        ContentName = content.Cat_Contents,
                        IsSelected = content.Set_Default
                    }).ToList();

                    return(lstContents);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
コード例 #6
0
 public bool SaveSearchJson(string jsonSearch, int ScreenId, string ScreenName)
 {
     try
     {
         using (SASEntitiesEDM entities = new SASEntitiesEDM())
         {
             var result = entities.LastSelectionHistories.Where(x => x.Screen_Id == ScreenId).FirstOrDefault();
             if (result != null)
             {
                 result.Last_Selection = jsonSearch;
                 result.Last_Updated   = DateTime.Now;
                 entities.SaveChanges();
                 return(true);
             }
             else
             {
                 LastSelectionHistory lastSelection = new LastSelectionHistory()
                 {
                     Screen_Id      = ScreenId,
                     Screen_Name    = ScreenName,
                     Last_Selection = jsonSearch,
                     Last_Updated   = DateTime.Now
                 };
                 entities.LastSelectionHistories.Add(lastSelection);
                 entities.SaveChanges();
                 return(true);
             }
         }
     }
     catch
     {
         return(false);
     }
 }
コード例 #7
0
        /// <summary>
        /// This method is used to get category content
        /// </summary>
        /// <returns></returns>
        public string GetCategoryContent(string catType)
        {
            string tandCContent = string.Empty;

            using (SASEntitiesEDM entities = new SASEntitiesEDM())
            {
                try
                {
                    var tandC = (from content in entities.TermsAndConditions
                                 where content.Cat_Code == catType
                                 select new ContentModel
                    {
                        ContentName = content.Cat_Content,
                        ContentID = content.ID
                    });
                    if (tandC != null)
                    {
                        tandCContent = tandC.SingleOrDefault().ContentName;
                    }
                    return(tandCContent);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
コード例 #8
0
        //public TaxModel GetDefaultTaxes()
        //{
        //    try
        //    {
        //        using (SASEntitiesEDM objEntities = new SASEntitiesEDM())
        //        {

        //            var defaultTax = (from tax in objEntities.TaxCodesAndRates
        //                              where tax.IsDeleted == false
        //                              select new TaxModel()
        //                              {
        //                                  TaxID = tax.ID,
        //                                  TaxName = tax.Tax_Name,
        //                                  TaxDescription = tax.Tax_Description,
        //                                  TaxCode = tax.Tax_Code,
        //                                  TaxRate = tax.Tax_Rate,
        //                                  IsDefault = tax.Tax_Default,
        //                                  IsInActive = tax.Tax_Inactive,
        //                                  Predefined = tax.Predefined
        //                              }).Where(x => x.IsDefault == true && x.IsInActive != "Y").FirstOrDefault();

        //            return defaultTax as TaxModel;
        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}

        public TaxModel GetDefaultTaxes()
        {
            try
            {
                using (SASEntitiesEDM objEntities = new SASEntitiesEDM())
                {
                    var defaultTax = (from tax in objEntities.TaxCodesAndRates
                                      where tax.IsDeleted == false
                                      select new TaxModel()
                    {
                        TaxID = tax.ID,
                        TaxName = tax.Tax_Name,
                        TaxDescription = tax.Tax_Description,
                        TaxCode = tax.Tax_Code,
                        TaxRate = tax.Tax_Rate,
                        IsDefault = tax.Tax_Default,
                        IsInActive = tax.Tax_Inactive,
                        Predefined = tax.Predefined
                    }).FirstOrDefault();

                    return(defaultTax as TaxModel);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #9
0
        public string GetCountOfPOSuppliers()
        {
            string POCount = string.Empty;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var po = (from e in entities.PurchaseOrders
                              join p in entities.Suppliers
                              on e.Sup_Id equals p.ID
                              where e.IsDeleted == false
                              select new
                    {
                        e.Sup_Id,
                        p.Sup_Name
                    }
                              ).Distinct().ToList();

                    if (po != null)
                    {
                        POCount = Convert.ToString(po.Count);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(POCount);
        }
コード例 #10
0
 /// <summary>
 /// This method is used to retrieve single tax code and rates
 /// </summary>
 /// <param name="taxId"></param>
 /// <returns></returns>
 public List <TaxModel> GetTax(int taxId)
 {
     try
     {
         using (SASEntitiesEDM objEntities = new SASEntitiesEDM())
         {
             var lstTax = (from tax in objEntities.TaxCodesAndRates
                           where tax.IsDeleted == false &&
                           tax.ID == taxId
                           select new TaxModel
             {
                 TaxID = tax.ID,
                 TaxName = tax.Tax_Name,
                 TaxDescription = tax.Tax_Description,
                 TaxCode = tax.Tax_Code,
                 TaxRate = tax.Tax_Rate,
                 IsDefault = tax.Tax_Default,
                 IsInActive = tax.Tax_Inactive,
                 Predefined = tax.Predefined
             }).ToList();
             return(lstTax);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #11
0
        public bool IsCodeAndRateExists(TaxModel taxModel)
        {
            bool isExists = false;

            try
            {
                using (SASEntitiesEDM objEntities = new SASEntitiesEDM())
                {
                    var tax = objEntities.TaxCodesAndRates.Where(e => e.Tax_Code.Trim() == taxModel.TaxCode
                                                                 //&& e.Tax_Rate == taxModel.TaxRate ------removes after client MOM on 11 may 2017
                                                                 && e.IsDeleted == false && e.ID != taxModel.TaxID).ToList();
                    if (tax.Count > 0)
                    {
                        isExists = true;
                    }
                    else
                    {
                        isExists = false;
                    }
                }
                return(isExists);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #12
0
        /// <summary>
        /// This method is used to save category contents with associated category
        /// </summary>
        /// <param name="content"></param>
        public void SaveCategoryContent(ContentModel content)
        {
            using (SASEntitiesEDM objCategoryEntities = new SASEntitiesEDM())
            {
                var obj = objCategoryEntities.CategoriesContents.Where(x => x.Cat_Id == content.CategoryID && x.IsDeleted != true && x.Set_Default == true && content.IsSelected == true).FirstOrDefault();
                if (obj != null)
                {
                    obj.Set_Default = false;
                    objCategoryEntities.SaveChanges();
                }

                try
                {
                    CategoriesContent catContent = new CategoriesContent();
                    catContent.Cat_Contents  = content.ContentName.Trim();
                    catContent.Content_Limit = content.Limit;
                    catContent.Cat_Id        = content.CategoryID;
                    catContent.IsDeleted     = false;
                    catContent.Set_Default   = content.IsSelected;
                    catContent.CreatedDate   = DateTime.Now;
                    objCategoryEntities.CategoriesContents.Add(catContent);
                    objCategoryEntities.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
コード例 #13
0
        public bool IsContentExists(ContentModel content)
        {
            bool IsExists = false;

            using (SASEntitiesEDM objCategoryEntities = new SASEntitiesEDM())
            {
                try
                {
                    var catContent = objCategoryEntities.CategoriesContents.Where(e => e.Cat_Id == content.CategoryID &&
                                                                                  e.Cat_Contents == content.ContentName.Trim() && e.IsDeleted == false && e.ID != content.ContentID).ToList();
                    if (catContent.Count > 0)
                    {
                        IsExists = true;
                    }
                    else
                    {
                        IsExists = false;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return(IsExists);
            }
        }
コード例 #14
0
        public List <AdjustCreditNoteEntity> GetCreditNotes(string CustomerId)
        {
            using (SASEntitiesEDM entities = new SASEntitiesEDM())
            {
                int supid = 0;
                //List<CustomerEntity> suppliersource = entities.Customers.Where(x => x.IsDeleted != true).Select(x => new CustomerEntity
                //{
                //    ID = x.ID,
                //    CustomerName = x.Sup_Name,
                //    Createddate = x.CreatedDate,
                //}).ToList();
                if (CustomerId != null || CustomerId != "" || CustomerId != " ")
                {
                    supid = Convert.ToInt32(CustomerId);
                }
                List <AdjustCreditNoteEntity> debitnotelist = (from p in entities.SalesInvoices
                                                               join d in entities.CreditNotes on p.ID equals d.SI_Id
                                                               where d.IsDeleted != true && d.Cus_Id == supid && d.CN_Amount > 0
                                                               select new AdjustCreditNoteEntity
                {
                    Date = d.CN_Date,
                    Amount = p.SI_Tot_aft_Tax,
                    CreditNoteNo = d.CN_No
                }).ToList();

                return(debitnotelist);
            }
        }
コード例 #15
0
        /// <summary>
        /// This method is used to get latest quitation no
        /// </summary>
        /// <returns></returns>
        public int GetLastQuotationNo()
        {
            int qno = 0;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var pq = (from pqs in entities.SalesQuotations
                              orderby pqs.ID descending
                              select new
                    {
                        pqs.ID,
                        pqs.CreatedDate
                    }

                              );
                    int Count = Convert.ToInt32(pq.Count());
                    if (Count > 0)
                    {
                        qno = pq.Take(1).SingleOrDefault().ID;
                    }
                    else
                    {
                        qno = 0;
                    }
                }
                return(qno);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #16
0
        public List <AdjustDebitNoteEntity> GetDebitNotes(string SupplierId)
        {
            using (SASEntitiesEDM entities = new SASEntitiesEDM())
            {
                int supid = 0;
                //List<SupplierDetailEntity> suppliersource = entities.Suppliers.Where(x => x.IsDeleted != true).Select(x => new SupplierDetailEntity
                //{
                //    ID = x.ID,
                //    SupplierName = x.Sup_Name,
                //    Createddate = x.CreatedDate,
                //}).ToList();
                if (SupplierId != null || SupplierId != "" || SupplierId != " ")
                {
                    supid = Convert.ToInt32(SupplierId);
                }
                List <AdjustDebitNoteEntity> debitnotelist = (from p in entities.PurchaseInvoices
                                                              join d in entities.DebitNotes on p.ID equals d.PI_Id
                                                              where d.IsDeleted != true && d.Sup_Id == supid
                                                              select new AdjustDebitNoteEntity
                {
                    Date = d.DN_Date,
                    Amount = p.PI_Tot_aft_Tax,
                    DebitNoteNo = d.DN_No
                }).ToList();

                return(debitnotelist);
            }
        }
コード例 #17
0
        /// <summary>
        /// This method is used to get all purchase quotations
        /// </summary>
        /// <returns></returns>
        public List <SalesQuotationEntity> GetAllSalesQuotations()
        {
            // List<SalesQuotationModel> lstSQF = new List<SalesQuotationForm>();
            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var lstSQs = (from pq in entities.SalesQuotations
                                  where (pq.IsDeleted == false || pq.IsDeleted == null)

                                  select new SalesQuotationEntity
                    {
                        CustomerID = pq.Cus_Id,
                        QuotationNo = pq.SQ_No,
                        QuotationDate = pq.SQ_Date,
                        QuotationDateStr = Convert.ToString(pq.SQ_Date),
                        ValidForDays = pq.SQ_Valid_for,
                        TotalBeforeTax = pq.SQ_Tot_bef_Tax,
                        TotalTax = pq.SQ_GST_Amt,
                        TotalAfterTax = pq.SQ_Tot_aft_Tax,
                        TermsAndConditions = pq.SQ_TandC,
                        CreatedBy = pq.CreatedBy,
                        CreatedDate = pq.CreatedDate
                    }).ToList <SalesQuotationEntity>();

                    return(lstSQs);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #18
0
        public string GetCountOfPISuppliers()
        {
            string PICount = string.Empty;
            byte   status  = Convert.ToByte(PI_Status.UnPaid);

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var po = (from e in entities.PurchaseInvoices
                              join p in entities.Suppliers
                              on e.Sup_Id equals p.ID
                              where e.IsDeleted == false &&
                              e.PI_Status == status
                              select new
                    {
                        e.Sup_Id,
                        p.Sup_Name
                    }
                              ).Distinct().ToList();
                    if (po != null)
                    {
                        PICount = Convert.ToString(po.Count);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(PICount);
        }
コード例 #19
0
        public int GetLastInvoiceNo()
        {
            int qno = 0;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var pq = (from pqs in entities.SalesInvoices
                              orderby pqs.ID descending
                              select new
                    {
                        pqs.ID,
                        pqs.CreatedDate
                    }

                              );
                    if (pq != null)
                    {
                        qno = pq.Take(1).SingleOrDefault().ID;
                    }
                    else
                    {
                        qno = 0;
                    }
                }
                return(qno);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #20
0
        /// <summary>
        /// This method is used to get all purchase invoices
        /// </summary>
        /// <returns></returns>
        public List <SalesInvoiceEntity> GetAllSalesInvoices()
        {
            // List<SalesInvoiceModel> lstSIF = new List<SalesInvoiceForm>();
            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var lstSIs = (from pq in entities.SalesInvoices
                                  where (pq.IsDeleted == false || pq.IsDeleted == null)

                                  select new SalesInvoiceEntity
                    {
                        CustomerID = pq.Cus_Id,
                        InvoiceNo = pq.SI_No,
                        InvoiceDate = pq.SI_Date,
                        // PaymentDueDate = pq.SI_Pmt_Due_Date,
                        OurSONo = pq.Cus_PO_No,
                        CreditDays = pq.SI_Credit_Days,
                        SalesmanID = pq.Salesman,
                        TotalBeforeTax = pq.SI_Tot_bef_Tax,
                        TotalTax = pq.SI_GST_Amt,
                        TotalAfterTax = pq.SI_Tot_aft_Tax,
                        TermsAndConditions = pq.SI_TandC,
                        CreatedBy = pq.CreatedBy,
                        CreatedDate = pq.CreatedDate
                    }).ToList <SalesInvoiceEntity>();

                    return(lstSIs);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #21
0
        //public int GetLastOrderNo()
        //{
        //    int qno = 0;
        //    try
        //    {
        //        using (SASEntitiesEDM entities = new SASEntitiesEDM())
        //        {
        //            var pq = (from pqs in entities.SalesOrders
        //                      orderby pqs.ID descending
        //                      select new
        //                      {
        //                          pqs.ID,
        //                          pqs.SO_No,
        //                          pqs.CreatedDate
        //                      }

        //                     );
        //            int Count = Convert.ToInt32(pq.Count());
        //            if (Count>0)
        //            {
        //                qno = pq.Take(1).SingleOrDefault().ID;
        //            }
        //            else
        //            {
        //                qno = 0;
        //            }
        //        }
        //        return qno;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}

        ///// <summary>
        ///// This method is used to get latest quitation no
        ///// </summary>
        ///// <returns></returns>
        //public int GetLastOrderNo()
        //{
        //    int qno = 0;
        //    try
        //    {
        //        using (SDNSalesDBEntities entities = new SDNSalesDBEntities())
        //        {
        //            var pq = (from pqs in entities.SalesOrders
        //                      orderby pqs.ID descending
        //                      select new
        //                      {
        //                          pqs.ID,
        //                          pqs.CreatedDate
        //                      }

        //                     );
        //            if (pq != null)
        //            {
        //                qno = pq.Take(1).SingleOrDefault().ID;
        //            }
        //            else
        //            {
        //                qno = 0;
        //            }
        //        }
        //        return qno;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}
        /// <summary>
        /// This method is used to get all sales orders
        /// </summary>
        /// <returns></returns>
        public List <SalesOrderEntity> GetAllSalesOrders()
        {
            // List<SalesOrderModel> lstSOF = new List<SalesOrderForm>();
            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var lstSOs = (from pq in entities.SalesOrders
                                  where (pq.IsDeleted == false || pq.IsDeleted == null)

                                  select new SalesOrderEntity
                    {
                        CustomerID = pq.Cus_Id,
                        OrderNo = pq.SO_No,
                        OrderDate = pq.SO_Date,
                        //ValidForDays = pq.SO_Valid_for,,
                        DeliveryDate = pq.SO_Del_Date,
                        Cus_Po_No = pq.Cus_PO_No,
                        TotalBeforeTax = pq.SO_Tot_bef_Tax,
                        TotalTax = pq.SO_GST_Amt,
                        TotalAfterTax = pq.SO_Tot_aft_Tax,
                        TermsAndConditions = pq.SO_TandC,
                        CreatedBy = pq.CreatedBy,
                        CreatedDate = pq.CreatedDate
                    }).ToList <SalesOrderEntity>();

                    return(lstSOs);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #22
0
        public ReceiveMoneyEntity GetReceiveMoneyDetails(string cashChequeNo)
        {
            ReceiveMoneyEntity receiveMoney = new ReceiveMoneyEntity();

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    ReceiveMoney cbt = entities.ReceiveMoneys.SingleOrDefault(e => e.CashChequeNo == cashChequeNo);
                    if (cbt != null)
                    {
                        receiveMoney.ID = cbt.ID;
                        receiveMoney.SelectedLinkedAcntID   = cbt.LinkedAccountID;
                        receiveMoney.SelectedCashBankAcntID = cbt.CashBankAccountID;
                        receiveMoney.IsCheque       = cbt.IsCheque;
                        receiveMoney.CashChequeNo   = cbt.CashChequeNo;
                        receiveMoney.CashChequeDate = cbt.CashChequeDate;
                        receiveMoney.Remarks        = cbt.Remarks;
                        receiveMoney.SelectedTaxID  = cbt.TaxID;
                        receiveMoney.TotalBeforeTax = cbt.TotalBeforeTax;
                        receiveMoney.TotalTax       = cbt.TotalTax;
                        receiveMoney.TotalAfterTax  = cbt.TotalAfterTax;
                        receiveMoney.Remarks        = cbt.Remarks;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(receiveMoney);
        }
コード例 #23
0
        public List <PandSQtyAndStockModel> GetPandSList()
        {
            List <PandSQtyAndStockModel> lstCodes = new List <PandSQtyAndStockModel>();

            using (SASEntitiesEDM objEntities = new SASEntitiesEDM())
            {
                try
                {
                    lstCodes = (from code in objEntities.ProductsAndServices
                                where (code.IsDeleted == false || code.IsDeleted == null)
                                select new PandSQtyAndStockModel
                    {
                        PSID = code.ID,
                        PSCode = code.PandS_Code,
                        PSName = code.PandS_Name,
                        Category1 = code.PandS_Cat1,
                        Category2 = code.PandS_Cat2,
                        QtyInStock = code.PandS_Qty_in_stock,
                        PSType = code.PandS_Type,
                        IsInActive = code.PandS_Inactive,
                        AvgCostPriceAfterGSTd = code.PandS_Ave_Cost_Price_aft_GST,
                        AvgCostPriceBeforeGSTd = code.PandS_Ave_Cost_Price_bef_GST,
                        StdPriceAfterGSTd = code.PandS_Std_Cost_Price_aft_GST,
                        StdPriceBeforeGSTd = code.PandS_Std_Cost_Price_bef_GST
                    }).OrderBy(e => e.PSName).ToList <PandSQtyAndStockModel>();

                    return(lstCodes);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
コード例 #24
0
        public int SaveReceiveMoney(ReceiveMoneyEntity receiveMoney)
        {
            int autoId = 0;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    ReceiveMoney cbt = new ReceiveMoney();
                    cbt.LinkedAccountID   = receiveMoney.SelectedLinkedAcntID;
                    cbt.CashBankAccountID = receiveMoney.SelectedCashBankAcntID;
                    cbt.IsCheque          = receiveMoney.IsCheque;
                    cbt.CashChequeNo      = receiveMoney.CashChequeNo;
                    cbt.CashChequeDate    = receiveMoney.CashChequeDate;
                    cbt.Remarks           = receiveMoney.Remarks;
                    cbt.TaxID             = receiveMoney.SelectedTaxID;
                    cbt.TotalBeforeTax    = receiveMoney.TotalBeforeTax;
                    cbt.TotalTax          = receiveMoney.TotalTax;
                    cbt.TotalAfterTax     = receiveMoney.TotalAfterTax;
                    cbt.Remarks           = receiveMoney.Remarks;
                    cbt.CreatedBy         = 1;
                    cbt.CreatedDate       = DateTime.Now;
                    entities.ReceiveMoneys.Add(cbt);
                    entities.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(autoId);
        }
コード例 #25
0
        public List <PurchaseInvoiceEntity> GetPurchaseInvoiceDetails(int psID)
        {
            string pandsId = Convert.ToString(psID);

            try
            {
                List <PurchaseInvoiceEntity> lstCodes = new List <PurchaseInvoiceEntity>();
                using (SASEntitiesEDM objprodEntities = new SASEntitiesEDM())
                {
                    lstCodes = (from pi in objprodEntities.PurchaseInvoices
                                join pid in objprodEntities.PurchaseInvoiceDetails
                                on pi.ID equals pid.PI_ID
                                where pid.PI_No == pandsId
                                select new PurchaseInvoiceEntity
                    {
                        ID = pi.ID,

                        InvoiceDate = pi.PI_Date,
                        Amount = pi.PI_Tot_bef_Tax,
                        Price = pid.PI_Price,
                        Quantity = pid.PI_Qty == null ? 0 : pid.PI_Qty
                    }).ToList <PurchaseInvoiceEntity>();

                    return(lstCodes);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #26
0
        public bool DeleteQuotatoin(int pqID)
        {
            bool result = false;

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var obj = entities.SalesQuotations.Where(x => x.ID == pqID).FirstOrDefault();
                    //entities.SalesQuotations.Remove(obj);
                    if (obj != null)
                    {
                        obj.IsDeleted    = true;
                        obj.ModifiedDate = DateTime.Now;
                        entities.SaveChanges();
                    }
                }
                result = true;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
コード例 #27
0
        /// <summary>
        /// This method is used to get all the taxes which are not deleted and inactive
        /// </summary>
        /// <returns></returns>
        public List <TaxModel> GetTax()
        {
            List <TaxModel> lstContents = new List <TaxModel>();

            using (SASEntitiesEDM objProdEntities = new SASEntitiesEDM())
            {
                try
                {
                    lstContents = (from tax in objProdEntities.TaxCodesAndRates
                                   where tax.IsDeleted == false && tax.Tax_Inactive.Trim() == "N"
                                   // && tax.Tax_Default==true
                                   select new TaxModel
                    {
                        TaxID = tax.ID,
                        TaxDescription = tax.Tax_Description,
                        TaxCode = tax.Tax_Code,
                        TaxName = tax.Tax_Name,
                        TaxRate = tax.Tax_Rate,
                        IsDefault = tax.Tax_Default,
                        IsInActive = tax.Tax_Inactive
                    }).ToList();

                    return(lstContents);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
コード例 #28
0
        public List <ContentModel> GetAllSalesman(string catType)
        {
            List <ContentModel> lstsalesman = new List <ContentModel>();

            using (SASEntitiesEDM objProdEntities = new SASEntitiesEDM())
            {
                try
                {
                    lstsalesman = (from content in objProdEntities.Categories
                                   join catContent in objProdEntities.CategoriesContents
                                   on content.ID equals catContent.Cat_Id
                                   where content.Cat_Code == catType && catContent.IsDeleted == false
                                   select new ContentModel
                    {
                        ContentName = catContent.Cat_Contents,
                        ContentID = catContent.ID
                    }).ToList <ContentModel>();

                    return(lstsalesman);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
コード例 #29
0
        public SuppliersStatementEntity GetAllUnPaidInvoice(int supplierID, string statementDate)
        {
            SuppliersStatementEntity             entity      = new SuppliersStatementEntity();
            List <SuppliersBalanceEntity>        lstbalances = new List <SuppliersBalanceEntity>();
            List <SuppliersInvoiceDetailsEntity> lstInvoices = new List <SuppliersInvoiceDetailsEntity>();

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    lstInvoices = entities.Database.SqlQuery <SuppliersInvoiceDetailsEntity>("USP_SuppliersStatementUnPaidInvoice @ID,@SDate",
                                                                                             new SqlParameter("ID", supplierID),
                                                                                             new SqlParameter("SDate", statementDate)).ToList();

                    lstbalances = entities.Database.SqlQuery <SuppliersBalanceEntity>("USP_GetStatementUnpaidInvoice_Summary @ID,@SDate,@Type",
                                                                                      new SqlParameter("ID", supplierID),
                                                                                      new SqlParameter("SDate", statementDate),
                                                                                      new SqlParameter("Type", "S")).ToList();

                    entity.LstBalances = lstbalances;
                    entity.LstInvoices = lstInvoices;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(entity);
        }
コード例 #30
0
        public string GetCountOfDNSuppliers(out List <SupplierDetailEntity> lstSuppliers)
        {
            string DNCount    = string.Empty;
            byte   status     = Convert.ToByte(DN_Status.UnAdjusted);
            byte   unrefunded = Convert.ToByte(DN_Status.Refunded);

            lstSuppliers = new List <SupplierDetailEntity>();
            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var po = (from e in entities.DebitNotes
                              join p in entities.Suppliers
                              on e.Sup_Id equals p.ID
                              where e.IsDeleted == false && p.Sup_Inactive != "Y" &&
                              (e.DN_Status == status || e.DN_Status != unrefunded)
                              select new SupplierDetailEntity
                    {
                        ID = e.Sup_Id,
                        SupplierName = p.Sup_Name
                    }
                              ).Distinct().ToList();
                    if (po != null)
                    {
                        lstSuppliers = new List <SupplierDetailEntity>(po.ToList());
                        DNCount      = Convert.ToString(po.Count);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(DNCount);
        }