public CrudOperations Update(int idToSearch, CrudOperations entity)
        {
            CrudOperations found = null;

            found = context.Find <CrudOperations>(idToSearch);
            if (entity.Age != 0)
            {
                found.Age = entity.Age;
            }
            if (!string.IsNullOrEmpty(entity.Name))
            {
                found.Name = entity.Name;
            }
            if (!string.IsNullOrEmpty(entity.FatherName))
            {
                found.FatherName = entity.FatherName;
            }
            if (!string.IsNullOrEmpty(entity.Location))
            {
                found.Location = entity.Location;
            }
            if (!string.IsNullOrEmpty(entity.CNIC))
            {
                found.CNIC = entity.CNIC;
            }
            context.SaveChanges();
            return(entity);
        }
Exemplo n.º 2
0
    public void delete()
    {
        CrudOperations crud = new CrudOperations();

        crud.deleteSchedule("scheduleDataBase", "nhiremat", Name.text);
        Destroy(gameObject);
    }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            int           i   = 0;
            SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-PFA0L7A\SQLEXPRESS;Initial Catalog=bookYourShowDB;Integrated Security=True");

            //con.Open();

            for (i = 0; i < 7; i++)
            {
                CrudOperations objCrud = new CrudOperations();
                objCrud.Test();

                SqlCommand cmdGetMovies = new SqlCommand("INSERT INTO MovieTheatreMapping VALUES (1,3,@date,(SELECT seatMatrix FROM TheatreScreenMapping WHERE TheatreScreenMappingID = 3))", con);
                cmdGetMovies.Parameters.AddWithValue("@date", 13 + i + "-2-2017:M");
                cmdGetMovies.ExecuteNonQuery();
                SqlCommand cmdGetMovies1 = new SqlCommand("INSERT INTO MovieTheatreMapping VALUES (1,3,@date,(SELECT seatMatrix FROM TheatreScreenMapping WHERE TheatreScreenMappingID = 3))", con);
                cmdGetMovies1.Parameters.AddWithValue("@date", 13 + i + "-2-2017:A");
                cmdGetMovies1.ExecuteNonQuery();
                SqlCommand cmdGetMovies2 = new SqlCommand("INSERT INTO MovieTheatreMapping VALUES (1,3,@date,(SELECT seatMatrix FROM TheatreScreenMapping WHERE TheatreScreenMappingID = 3))", con);
                cmdGetMovies2.Parameters.AddWithValue("@date", 13 + i + "-2-2017:N");
                cmdGetMovies2.ExecuteNonQuery();
            }

            con.Close();
        }
Exemplo n.º 4
0
        public void GetItemsFromDatabase()
        {
            UnitOfWork unitOfWork = new UnitOfWork(new Entities());

            CrudOperations <Births> .AddRange(_sicksObservableCollection, unitOfWork.Sicks.GetSicksByFemale(Female.code));

            SicksListView.ItemsSource = _sicksObservableCollection;
        }
Exemplo n.º 5
0
        public void GetItemsFromDatabase()
        {
            var unitOfWork = new UnitOfWork(new Entities());

            CrudOperations <DatabaseFirst.Sales> .AddRange(_salesObservableCollection, unitOfWork.Sales.GetAll());

            SalesListView.ItemsSource = _salesObservableCollection;
        }
Exemplo n.º 6
0
        private void GetBirthsFromDatabase()
        {
            UnitOfWork unitOfWork = new UnitOfWork(new Entities());

            CrudOperations <Births> .AddRange(_birthsObservableList, unitOfWork.Births.GetBirthsByFemale(Female.code).ToList());

            BirthsListView.ItemsSource = _birthsObservableList;
        }
Exemplo n.º 7
0
        private void GetInseminationsFromDatabase()
        {
            UnitOfWork unitOfWork = new UnitOfWork(new Entities());

            CrudOperations <Inseminations> .AddRange(_inseminationsObservableList, unitOfWork.Inseminations.GetInseminationsByFemale(Female.code));

            InseminationsListView.ItemsSource = _inseminationsObservableList;
        }
 //Contractor that loads initialies all the private fileds above
 public CasesController(ApplicationDbContext _context)
 {
     context  = _context;
     caseOps  = new CaseOps(context);
     offender = new OffenderOps(context);
     offence  = new CrudOperations <Offence>(context);
     officer  = new OfficerOps(context);
     caseof   = new CaseOffenderOps(context);
 }
        public CrudOperations Delete(int idToSearch)
        {
            CrudOperations found = null;

            found = context.Find <CrudOperations>(idToSearch);
            context.Remove(found);
            context.SaveChanges();
            return(found);
        }
Exemplo n.º 10
0
 private static IEnumerable <T> GetCrudItems <T>(IEnumerable <T> items, CrudOperations type) where T : SObject
 {
     // TODO: Need to find a better way to have the operationtype
     //       available during xml serialization of the objects, this is not the best
     return(items.Select(x =>
     {
         x.OperationType = type;
         return x;
     }).ToArray());
 }
 public FinePaymentController(ApplicationDbContext _context, IAmortizationCalculate _amortizationCalculate)
 {
     context = _context;
     fineOps = new FineOps(context);
     caseOps = new CaseOps(context);
     amortizationCalculate = _amortizationCalculate;
     amortization          = new CrudOperations <Amortization>(context);
     finepay     = new CrudOperations <FinePayment>(context);
     offenderOps = new OffenderOps(context);
     offence     = new CrudOperations <Offence>(context);
 }
    public void delete()

    {
        Singleton singleton = Singleton.Instance();
        String    user      = singleton.getUserName();

        CrudOperations crud = new CrudOperations();

        crud.deleteSchedule("scheduleDataBase", user, Name.text);
        Destroy(gameObject);
    }
Exemplo n.º 13
0
        public ModelCrudOperations MapToModelCrudOperations(CrudOperations crudOperations)
        {
            switch (crudOperations)
            {
            case CrudOperations.Delete:
                return(ModelCrudOperations.Delete);

            case CrudOperations.Update:
                return(ModelCrudOperations.Update);

            default:
                return(ModelCrudOperations.Create);
            }
        }
Exemplo n.º 14
0
    void Start()
    {
        locationsData       = new Dictionary <string, string>();
        sharedLocationsData = new Dictionary <string, JObject>();
        dbDetails           = new DB_Details();
        crud = new CrudOperations();
        // Set up the Editor before calling into the realtime database.
        FirebaseApp.DefaultInstance.SetEditorDatabaseUrl(dbDetails.getDBUrl());

        // Get the root reference location of the database.
        reference = FirebaseDatabase.DefaultInstance.RootReference;

        singleton             = Singleton.Instance();
        ScheduleName          = singleton.getScheduleName();
        UserName              = singleton.getUserName();
        ScheduleNameText.text = ScheduleName;

        getScheduleData();

        locationsDisplayed = false;
    }
Exemplo n.º 15
0
 public PayOnLineLogic()
 {
     PaymentBoxesManage = new CrudOperations <CAJAS_Pago>();
 }
Exemplo n.º 16
0
 public PayOnLineLogic(BDCatastroTulancingoEntities context)
 {
     PaymentBoxesManage = new CrudOperations <CAJAS_Pago>(context);
 }
Exemplo n.º 17
0
 public static CrudViewModel ToModel(this CrudOperations entity)
 {
     return(new CrudViewModel {
         Id = entity.Id, Name = entity.Name, FatherName = entity.FatherName, CNIC = entity.CNIC, Age = entity.Age, Location = entity.Location
     });
 }
Exemplo n.º 18
0
 public CrudOperations Add(CrudOperations entity)
 {
     context.Add(entity);
     context.SaveChanges();
     return(entity);
 }
Exemplo n.º 19
0
 public OffendersController(ApplicationDbContext _context)
 {
     context     = _context;
     offenderOps = new OffenderOps(context);
     status      = new CrudOperations <OffenderStatus>(context);
 }