예제 #1
0
        public List <SparReconReport> GetSparReconReport(DateTimeFromToQuery query)
        {
            SparReconRepository reconrepo = new SparReconRepository();

            //...Create New Instance of Object...
            List <SparReconReport> list = new List <SparReconReport>();
            SparReconReport        ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection      con    = dbConn.SqlConn();
            SqlCommand         cmdI   = new SqlCommand();

            cmdI.CommandTimeout = 540;
            cmdI.Connection     = con;
            cmdI.CommandText    = "f_Admin_Report_SparRecon";
            cmdI.CommandType    = System.Data.CommandType.StoredProcedure;
            cmdI.Parameters.AddWithValue("@SelectedDate", query.From);
            cmdI.Parameters.AddWithValue("@SupplierType", query.IntergerSelect);

            cmdI.Connection.Open();

            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins                   = new SparReconReport();
                    ins.StateDate         = Convert.ToDateTime(drI["StateDate"]).ToShortDateString();
                    ins.GRVExVAT          = drI["GRVExVAT"].ToString();
                    ins.GRVInVAT          = drI["GRVInVAT"].ToString();
                    ins.GRVInvoiceNumber  = drI["GRVInvoiceNumber"].ToString();
                    ins.GRVPayDate        = Convert.ToDateTime(drI["GRVPayDate"]).ToShortDateString();
                    ins.GRVPinkSlipNumber = drI["GRVPinkSlipNumber"].ToString();
                    ins.GRVType           = drI["GRVType"].ToString();

                    ins.ReconAmount        = drI["ReconAmount"].ToString();
                    ins.ReconDate          = Convert.ToDateTime(drI["ReconDate"]).ToShortDateString();
                    ins.ReconInvoiceNumber = drI["ReconInvoiceNumber"].ToString();
                    ins.ReconType          = drI["ReconType"].ToString();

                    ins.Supplier = drI["Supplier"].ToString();
                    ins.Status   = reconrepo.GetReconStatus(Convert.ToDecimal(ins.ReconAmount), Convert.ToInt32(ins.ReconType), ins.ReconInvoiceNumber
                                                            , Convert.ToDecimal(ins.GRVInVAT), Convert.ToInt32(ins.GRVType), ins.GRVInvoiceNumber);
                    list.Add(ins);
                }
            }

            //...Close Connections...
            cmdI.Connection.Close();
            con.Dispose();

            //...Return...
            return(list);
        }
        public List<SparReconReport> GetSparReconReport(DateTimeFromToQuery query)
        {
            SparReconRepository reconrepo = new SparReconRepository();

            //...Create New Instance of Object...
            List<SparReconReport> list = new List<SparReconReport>();
            SparReconReport ins;

            //...Database Connection...
            DataBaseConnection dbConn = new DataBaseConnection();
            SqlConnection con = dbConn.SqlConn();
            SqlCommand cmdI = new SqlCommand();
            cmdI.CommandTimeout = 540;
            cmdI.Connection = con;
            cmdI.CommandText = "f_Admin_Report_SparRecon";
            cmdI.CommandType = System.Data.CommandType.StoredProcedure;
            cmdI.Parameters.AddWithValue("@SelectedDate", query.From);
            cmdI.Parameters.AddWithValue("@SupplierType", query.IntergerSelect);

            cmdI.Connection.Open();

            SqlDataReader drI = cmdI.ExecuteReader();

            //...Retrieve Data...
            if (drI.HasRows)
            {
                while (drI.Read())
                {
                    ins = new SparReconReport();
                    ins.StateDate = Convert.ToDateTime(drI["StateDate"]).ToShortDateString();
                    ins.GRVExVAT = drI["GRVExVAT"].ToString();
                    ins.GRVInVAT = drI["GRVInVAT"].ToString();
                    ins.GRVInvoiceNumber = drI["GRVInvoiceNumber"].ToString();
                    ins.GRVPayDate = Convert.ToDateTime(drI["GRVPayDate"]).ToShortDateString();
                    ins.GRVPinkSlipNumber = drI["GRVPinkSlipNumber"].ToString();
                    ins.GRVType = drI["GRVType"].ToString();

                    ins.ReconAmount = drI["ReconAmount"].ToString();
                    ins.ReconDate = Convert.ToDateTime(drI["ReconDate"]).ToShortDateString();
                    ins.ReconInvoiceNumber = drI["ReconInvoiceNumber"].ToString();
                    ins.ReconType = drI["ReconType"].ToString();

                    ins.Supplier = drI["Supplier"].ToString();
                    ins.Status = reconrepo.GetReconStatus(Convert.ToDecimal(ins.ReconAmount), Convert.ToInt32(ins.ReconType), ins.ReconInvoiceNumber
                            , Convert.ToDecimal(ins.GRVInVAT), Convert.ToInt32(ins.GRVType), ins.GRVInvoiceNumber);
                    list.Add(ins);
                }
            }

            //...Close Connections...
            cmdI.Connection.Close();
            con.Dispose();

            //...Return...
            return list;
        }