Ejemplo n.º 1
0
 /// <UpdatePackage>
 /// Update Package
 /// </summary>
 /// <param name="package">Set Values in a Package Class Property and Pass the Object of Package Class.(Domein.Package)</param>
 public void UpdatePackage(Package package)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action, to update data.
                 session.CreateQuery("Update Package set PackageName =:packagename , Pricing=:pricing, Status=:status where Id = :packageid")
                     .SetParameter("packagename", package.PackageName)
                     .SetParameter("pricing", package.Pricing)
                     .SetParameter("status",package.Status)
                     .SetParameter("packageid",package.Id)
                     .ExecuteUpdate();
                 transaction.Commit();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 // return 0;
             }
         }//End Transaction
     }//End Session
 }
Ejemplo n.º 2
0
 /// <AddPackage>
 /// Add Package
 /// </summary>
 /// <param name="package">Set Values in a Package Class Property and Pass the Object of Package Class.(Domein.Package)</param>
 public void AddPackage(Package package)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action, to save data.
             session.Save(package);
             transaction.Commit();
         }//End Transaction
     }//End Session
 }
Ejemplo n.º 3
0
 public string UpdatePackage(string ObjPackage)
 {
     try
     {
         Domain.Socioboard.Domain.Package objPackage = (Domain.Socioboard.Domain.Package)(new JavaScriptSerializer().Deserialize(ObjPackage, typeof(Domain.Socioboard.Domain.Package)));
         objPackagerepo.UpdatePackage(objPackage);
         return(new JavaScriptSerializer().Serialize("Package Updated Successfully"));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(null);
     }
 }
Ejemplo n.º 4
0
        public string GetPackageDetailsById(string PackageId)
        {
            Guid Packageid = Guid.Parse(PackageId);

            try
            {
                Domain.Socioboard.Domain.Package objPackage = objPackagerepo.getPackageDetailsbyId(Packageid);

                return(new JavaScriptSerializer().Serialize(objPackage));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(null);
            }
        }