public void Process(string pipeline, string utility, DateTime gasDay, string cycle)
 {
     var results = new PegasysContext().Database.SqlQuery <object>(
         "storedProc @PipelineCd, @CompanyCd, @GasDay, @Cycle",
         new SqlParameter("@PipelineCd", pipeline),
         new SqlParameter("@CompanyCd", utility),
         new SqlParameter("@GasDay", gasDay),
         new SqlParameter("@Cycle", cycle)
         ).FirstOrDefault();
 }
Beispiel #2
0
        //public Nomination.Domain.RequestForConfirmation.RequestForConfirmation Get(int id)
        //{
        //    var obj = base.Get(p =>
        //            p.TransMasterId == id
        //        )
        //        .Select(new ModelFactory().MapRfc)
        //        .FirstOrDefault();

        //    return obj;
        //}
        //public int Create(Nomination.Domain.RequestForConfirmation.RequestForConfirmation obj, string userId)
        //{
        //    //map business to entity framework
        //    tb_naesb_transaction_master entity = new ModelFactory(userId).Map(obj);

        //    //insert to database
        //    base.Add(entity);

        //    return Convert.ToInt32(entity.TransMasterId);
        //}
        private static string GetXmlFromDb(string pipeline, string utility, DateTime gasDay, string cycle)
        {
            var xmlOutput = new SqlParameter
            {
                ParameterName = "@xml_out",
                DbType        = DbType.Xml,
                Direction     = ParameterDirection.Output
            };

            var xmlResults = new PegasysContext().Database.SqlQuery <object>(
                "storedproc @PipelineCd, @CompanyCd, @GasDay, @Cycle, @xml_out out",
                new System.Data.SqlClient.SqlParameter("@PipelineCd", pipeline),
                new System.Data.SqlClient.SqlParameter("@CompanyCd", utility),
                new System.Data.SqlClient.SqlParameter("@GasDay", gasDay),
                new System.Data.SqlClient.SqlParameter("@Cycle", cycle),
                xmlOutput
                );

            xmlResults.FirstOrDefault();
            var xml = xmlOutput.Value.ToString();

            return(xml);
        }
 public Repository()
 {
     _database = new PegasysContext();
 }