コード例 #1
0
 private void RemoveFranqueado(int key)
 {
     using (FranqueadoSession s = new FranqueadoSession())
     {
         using (var das = s.CreateDataAccessScope(false))
         {
             IMapperFranqueado map = s.CreateMapperFranqueado();
             Franqueado        f   = map.Read(key);
             map.Delete(f);
             das.Commit();
         }
     }
 }
コード例 #2
0
        private void InsertFranqueado()
        {
            Franqueado f = PromptUserForFranchiseeInfo();

            using (FranqueadoSession s = new FranqueadoSession())
            {
                using (var das = s.CreateDataAccessScope(false))
                {
                    IMapperFranqueado map = s.CreateMapperFranqueado();
                    map.Create(f);
                    das.Commit();
                }
            }
        }
コード例 #3
0
        private Franqueado PromptUserForFranchiseeInfo()
        {
            Franqueado f = new Franqueado();

            Console.WriteLine("Insert info of the franchisee");
            Console.Write("Nif (9 digits) : ");
            f.Nif = (int)GetInput(typeof(int));

            Console.Write("Name of Franchisee : ");
            f.Nome = (String)GetInput(typeof(String));

            Console.Write("Address :");
            f.Morada = (String)GetInput(typeof(String));

            return(f);
        }
コード例 #4
0
        private void UpdateFranqueado()
        {
            Console.WriteLine("Insert id of franchisee to update");
            int key = (int)GetInput(typeof(int));

            Franqueado f = PromptUserForFranchiseeInfo();

            f.Id = key;

            using (FranqueadoSession s = new FranqueadoSession())
            {
                using (var das = s.CreateDataAccessScope(false))
                {
                    IMapperFranqueado map = s.CreateMapperFranqueado();
                    map.Update(f);
                    das.Commit();
                }
            }
        }