Exemple #1
0
        public List <OtherInvoiceList> GetFilteredOtherInvoiceList(DateTime FromDate, DateTime ToDate, int?AgentId, string UsersId, int?TypesId)
        {
            List <OtherInvoiceList> otherInvList = new List <OtherInvoiceList>();

            try
            {
                using (SqlConnection connection = DataAccess.CreateConnection())
                {
                    SqlCommand command = DataAccess.CreateCommand(connection);

                    DataAccess.CreateStoredprocedure(command, "GetFilteredOtherInvoiceList_SP");
                    DataAccess.AddInParameter(command, "@FromDate", SqlDbType.VarChar, FromDate.ToString("MM/dd/yyyy"));
                    DataAccess.AddInParameter(command, "@ToDate", SqlDbType.VarChar, ToDate.ToString("MM/dd/yyyy"));
                    DataAccess.AddInParameter(command, "@AgentId", SqlDbType.Int, AgentId);
                    DataAccess.AddInParameter(command, "@UsersId", SqlDbType.VarChar, UsersId);
                    DataAccess.AddInParameter(command, "@TypesId", SqlDbType.Int, TypesId);
                    SqlDataReader reader = DataAccess.ExecuteReader(command);
                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            OtherInvoiceList otherInv = new OtherInvoiceList();
                            otherInv.ACAmount    = reader["ACAmount"] is DBNull ? 0 : Convert.ToDouble(reader["ACAmount"]);
                            otherInv.Agent       = reader["Agent"] is DBNull ? string.Empty : (String)reader["Agent"];
                            otherInv.CreatedOn   = reader["CreatedOn"] is DBNull ? string.Empty : (Convert.ToString(reader["CreatedOn"]));
                            otherInv.Due         = reader["Due"] is DBNull ? 0 : Convert.ToDouble(reader["Due"]);
                            otherInv.InvoiceId   = reader["InvoiceId"] is DBNull ? 0 : Convert.ToInt32(reader["InvoiceId"]);
                            otherInv.InvoiceType = reader["InvoiceType"] is DBNull ? string.Empty : Convert.ToString(reader["InvoiceType"]);
                            otherInv.Paid        = reader["Paid"] is DBNull ? 0 : Convert.ToDouble(reader["Paid"]);
                            otherInv.VAmount     = reader["VAmount"] is DBNull ? 0 : Convert.ToDouble(reader["VAmount"]);
                            otherInv.VDue        = reader["VDue"] is DBNull ? 0 : Convert.ToDouble(reader["VDue"]);
                            otherInv.Vendor      = reader["Vendor"] is DBNull ? string.Empty : (String)reader["Vendor"];
                            otherInv.VPaid       = reader["VPaid"] is DBNull ? 0 : Convert.ToDouble(reader["VPaid"]);
                            otherInv.User        = reader["UserName"] is DBNull ? string.Empty : (String)reader["UserName"];
                            otherInvList.Add(otherInv);
                        }
                    }
                    reader.Close();
                    return(otherInvList);
                }
            }
            catch (Exception ex)
            {
                return(otherInvList);
            }
        }
Exemple #2
0
        public List <OtherInvoiceList> GetVendorOutstandingOtherInvoiceList(int VendorId)
        {
            List <OtherInvoiceList> otherInvList = new List <OtherInvoiceList>();

            try
            {
                using (SqlConnection connection = DataAccess.CreateConnection())
                {
                    SqlCommand command = DataAccess.CreateCommand(connection);

                    DataAccess.CreateStoredprocedure(command, "GetVendorOutstandingOtherInvoiceList_SP");
                    DataAccess.AddInParameter(command, "@VendorId", SqlDbType.Int, VendorId);
                    SqlDataReader reader = DataAccess.ExecuteReader(command);
                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            OtherInvoiceList otherInv = new OtherInvoiceList();
                            otherInv.ACAmount    = reader["ACAmount"] is DBNull ? 0 : Convert.ToDouble(reader["ACAmount"]);
                            otherInv.Agent       = reader["Agent"] is DBNull ? string.Empty : (String)reader["Agent"];
                            otherInv.CreatedOn   = reader["CreatedOn"] is DBNull ? string.Empty : (Convert.ToString(reader["CreatedOn"]));
                            otherInv.Due         = reader["Due"] is DBNull ? 0 : Convert.ToDouble(reader["Due"]);
                            otherInv.InvoiceId   = reader["InvoiceId"] is DBNull ? 0 : Convert.ToInt32(reader["InvoiceId"]);
                            otherInv.InvoiceType = reader["InvoiceType"] is DBNull ? string.Empty : Convert.ToString(reader["InvoiceType"]);
                            otherInv.Paid        = reader["Paid"] is DBNull ? 0 : Convert.ToDouble(reader["Paid"]);
                            otherInv.VAmount     = reader["VAmount"] is DBNull ? 0 : Convert.ToDouble(reader["VAmount"]);
                            otherInv.VDue        = reader["VDue"] is DBNull ? 0 : Convert.ToDouble(reader["VDue"]);
                            otherInv.Vendor      = reader["Vendor"] is DBNull ? string.Empty : (String)reader["Vendor"];
                            otherInv.VPaid       = reader["VPaid"] is DBNull ? 0 : Convert.ToDouble(reader["VPaid"]);
                            otherInv.User        = reader["UserName"] is DBNull ? string.Empty : (String)reader["UserName"];
                            otherInvList.Add(otherInv);
                        }
                    }
                    reader.Close();
                    return(otherInvList);
                }
            }
            catch (Exception ex)
            {
                return(otherInvList);
            }
        }