示例#1
0
        public List <CustomerPayments> GetAllCustomerPayments(CustomerPaymentsSearch CustomerPaymentsSearch)
        {
            List <CustomerPayments> custPayObj = null;

            custPayObj = _customerPaymentsRepository.GetAllCustomerPayments(CustomerPaymentsSearch);
            return(custPayObj);
        }
        public string GetAllCustomerPayments(string customerPaymentsSearchObject)
        {
            CustomerPaymentsSearch CustomerPaymentsAdvancedSearchObj = customerPaymentsSearchObject != null?JsonConvert.DeserializeObject <CustomerPaymentsSearch>(customerPaymentsSearchObject) : new CustomerPaymentsSearch();

            List <CustomerPaymentsViewModel> CustPayList = Mapper.Map <List <CustomerPayments>, List <CustomerPaymentsViewModel> >(_CustPaymentBusiness.GetAllCustomerPayments(CustomerPaymentsAdvancedSearchObj));

            return(JsonConvert.SerializeObject(new { Result = "OK", Records = CustPayList }));
        }
示例#3
0
        public List <CustomerPayments> GetAllCustomerPayments(CustomerPaymentsSearch customerPaymentsSearch)
        {
            List <CustomerPayments> ExpenseTypelist = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[Accounts].[GetAllCustomerPayments]";
                        //DateTime? FromDate = string.IsNullOrEmpty(customerPaymentsSearch.FromDate) ? (DateTime?)null : DateTime.Parse();
                        //DateTime? ToDate = string.IsNullOrEmpty(customerPaymentsSearch.ToDate) ? (DateTime?)null : DateTime.Parse();
                        cmd.Parameters.Add("@FromDate", SqlDbType.DateTime).Value         = customerPaymentsSearch.FromDate;
                        cmd.Parameters.Add("@ToDate", SqlDbType.DateTime).Value           = customerPaymentsSearch.ToDate;
                        cmd.Parameters.Add("@CustomerCode", SqlDbType.NVarChar, 50).Value = customerPaymentsSearch.Customer;
                        cmd.Parameters.Add("@PaymentMode", SqlDbType.NVarChar, 50).Value  = customerPaymentsSearch.PaymentMode;
                        cmd.Parameters.Add("@CompanyCode", SqlDbType.NVarChar, 50).Value  = customerPaymentsSearch.Company;
                        cmd.Parameters.Add("@search", SqlDbType.NVarChar, 250).Value      = customerPaymentsSearch.Search;
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                ExpenseTypelist = new List <CustomerPayments>();
                                while (sdr.Read())
                                {
                                    CustomerPayments CustPaymentsObj = new CustomerPayments();

                                    {
                                        CustPaymentsObj.ID = (sdr["ID"].ToString() != "" ? Guid.Parse(sdr["ID"].ToString()) : CustPaymentsObj.ID);
                                        CustPaymentsObj.PaymentDateFormatted = (sdr["PaymentDate"].ToString() != "" ? DateTime.Parse(sdr["PaymentDate"].ToString()).ToString("dd-MMM-yyyy").ToString() : CustPaymentsObj.PaymentDateFormatted);
                                        CustPaymentsObj.ChequeDate           = (sdr["ChequeDate"].ToString() != "" ? DateTime.Parse(sdr["ChequeDate"].ToString()).ToString("dd-MMM-yyyy").ToString() : CustPaymentsObj.ChequeDate);
                                        CustPaymentsObj.PaymentRef           = (sdr["PaymentRef"].ToString() != "" ? sdr["PaymentRef"].ToString() : CustPaymentsObj.PaymentRef);
                                        CustPaymentsObj.EntryNo                   = (sdr["EntryNo"].ToString() != "" ? sdr["EntryNo"].ToString() : CustPaymentsObj.EntryNo);
                                        CustPaymentsObj.PaymentMode               = (sdr["PaymentMode"].ToString() != "" ? sdr["PaymentMode"].ToString() : CustPaymentsObj.PaymentMode);
                                        CustPaymentsObj.TotalRecdAmt              = (sdr["AmountReceived"].ToString() != "" ? Decimal.Parse(sdr["AmountReceived"].ToString()): CustPaymentsObj.TotalRecdAmt);
                                        CustPaymentsObj.AdvanceAmount             = (sdr["AdvanceAmount"].ToString() != "" ? Decimal.Parse(sdr["AdvanceAmount"].ToString()) : CustPaymentsObj.AdvanceAmount);
                                        CustPaymentsObj.CompanyObj                = new Companies();
                                        CustPaymentsObj.CompanyObj.Name           = sdr["ReceivedTo"].ToString();
                                        CustPaymentsObj.Type                      = (sdr["Type"].ToString() != "" ? sdr["Type"].ToString() : CustPaymentsObj.Type);
                                        CustPaymentsObj.CreditNo                  = (sdr["CRNRefNo"].ToString() != "" ? sdr["CRNRefNo"].ToString() : CustPaymentsObj.CreditNo);
                                        CustPaymentsObj.customerObj               = new Customer();
                                        CustPaymentsObj.customerObj.CompanyName   = (sdr["Customer"].ToString() != "" ? sdr["Customer"].ToString() : CustPaymentsObj.customerObj.CompanyName);
                                        CustPaymentsObj.customerObj.ID            = (sdr["CustomerID"].ToString() != "" ? Guid.Parse(sdr["CustomerID"].ToString()) : CustPaymentsObj.customerObj.ID);
                                        CustPaymentsObj.customerObj.ContactPerson = (sdr["ContactPerson"].ToString() != "" ? sdr["ContactPerson"].ToString() : CustPaymentsObj.customerObj.ContactPerson);
                                    };

                                    ExpenseTypelist.Add(CustPaymentsObj);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ExpenseTypelist);
        }