Ejemplo n.º 1
0
        private void doCrud(conference c)
        {
            switch (currentCrudOp)
            {
            // create
            case CrudOpr.Create:
                if (crud.create(c) != null)
                {
                    MessageBox.Show("Conference was added!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Adding was denied");
                }
                break;

            case CrudOpr.Update:

                c.conferenceId = formDTO.obj.conferenceId;

                if (crud.updateWithCountry(c, newCountry))
                {
                    MessageBox.Show("Conference was updated!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Updating was denied");
                }
                break;
            }
        }
Ejemplo n.º 2
0
 public void Update(conference entity)
 {
     _iConnection.ExecuteScalar <conference>(
         "UPDATE conference SET author=@author, editor=@editor, booktitle=@booktitle, entrytype=@entrytype, bibtexkey=@bibtexkey," +
         "month=@month, note=@note, pages=@pages, series=@series, address=@address, organization=@organization," +
         "publisher=@publisher, title=@title, volume=@volume, year=@year where ID = @ID", new
     {
         entity.editor,
         entity.booktitle,
         entity.entrytype,
         entity.bibtexkey,
         entity.author,
         entity.month,
         entity.note,
         entity.pages,
         entity.title,
         entity.volume,
         entity.year,
         entity.ID,
         entity.series,
         entity.address,
         entity.organization,
         entity.publisher,
     });
 }
Ejemplo n.º 3
0
        private void Add_Button_Click(object sender, RoutedEventArgs e)
        {
            MainWindow main        = Application.Current.Windows.OfType <MainWindow>().First();
            conference _conference = new conference()
            {
                bibtexkey    = bibtexkey_Txt.Text,
                title        = title_Txt.Text,
                year         = year_Txt.Text != "" ? Convert.ToInt32(year_Txt.Text) : null as int?,
                series       = series_Txt.Text != "" ? Convert.ToInt32(series_Txt.Text) : null as int?,
                month        = month_Txt.Text != "" ? Convert.ToInt32(month_Txt.Text) : null as int?,
                volume       = volume_Txt.Text != "" ? Convert.ToInt32(volume_Txt.Text) : null as int?,
                author       = author_Txt.Text,
                address      = address_Txt.Text,
                pages        = pages_Txt.Text,
                note         = note_Txt.Text,
                booktitle    = bookTitle_Txt.Text,
                organization = organization_Txt.Text,
                publisher    = publisher_Txt.Text,
                editor       = editor_Txt.Text,
                entrytype    = GetEntryType.GetValueByEnum(GetEntryType.EntryType.Conference)
            };


            bool result = AllFieldEmpty();

            if (!result)
            {
                _iConferenceService.Add(_conference);
                SetFieldClear();
                UIElement parent = App.Current.MainWindow;
                parent.IsEnabled = true;
                main.DataGridMain.ItemsSource = GetEntryType.GetAllByTypes();
                this.Close();
            }
            else
            {
                if (MessageBox.Show("Are you Sure to create a empty .bib", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    //do no stuff
                    return;
                }
                else
                {
                    _iConferenceService.Add(_conference);
                    SetFieldClear();
                    main.DataGridMain.ItemsSource = GetEntryType.GetAllByTypes();
                    UIElement parent = App.Current.MainWindow;
                    parent.IsEnabled = true;
                    this.Close();
                    //do yes stuff
                }
            }
        }
Ejemplo n.º 4
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            conference c = new conference();

            if (checkData())
            {
                c.conferenceName = conferenceDTO.name;
                c.address        = conferenceDTO.address;
                c.date           = conferenceDTO.date;
                c.address        = conferenceDTO.address;

                doCrud(c);
            }
        }
        public ComboBox addConferences(ComboBox cb)
        {
            conference all = new conference();

            all.conferenceName = "all";
            all.conferenceId   = 0;
            List <conference> confs = new List <conference>();

            confs.Add(all);
            confs.AddRange(db.conferences.ToList());

            cb.DataSource = confs;

            return(cb);
        }
Ejemplo n.º 6
0
        private void initDataForUpdate(conference obj)
        {
            tbConferenceName.Text = obj.conferenceName;
            cbCountry.Text        = obj.address1.country1.code;
            cbAddress.Text        = obj.address1.address1;
            dateTimePicker.Value  = obj.date;

            if (!(formDTO.userData.userRole == UserRole.ADMIN ||
                  formDTO.userData.userRole == UserRole.CONFERENCE_MANAGER))
            {
            }
            else
            {
            }
        }
Ejemplo n.º 7
0
        public ActionResult SHOW_CONFERENCE_HALL(int id)
        {
            //DataTable dt = new DataTable();
            //using (SqlConnection con = new SqlConnection(connectionstring))
            //{
            //    con.Open();

            //    string query = "Select * from hotel where CityId = @id";
            //    SqlDataAdapter ada = new SqlDataAdapter(query, con);

            //    ada.Fill(dt);
            //    con.Close();

            //}


            conference conferencemodel = new conference();
            DataTable  dt = new DataTable();

            using (SqlConnection con = new SqlConnection(connectionstring))
            {
                con.Open();
                string         query = "Select * from conference where HotelId = @HotelId";
                SqlDataAdapter ada   = new SqlDataAdapter(query, con);
                ada.SelectCommand.Parameters.AddWithValue("@HotelId", id);
                ada.Fill(dt);
                con.Close();
            }
            if (dt.Rows.Count == 1)
            {
                conferencemodel.HallId = Convert.ToInt32(dt.Rows[0][0].ToString());
                //conferencemodel.CityName = dt.Rows[0][1].ToString();
                //conferencemodel.HallName = dt.Rows[0][2].ToString();
                //conferencemodel.facilities = dt.Rows[0][3].ToString();
                //conferencemodel.capacity = Convert.ToInt32(dt.Rows[0][6].ToString());
                //conferencemodel.budget = Convert.ToInt32(dt.Rows[0][9].ToString());
                //conferencemodel.address = dt.Rows[0][10].ToString();



                return(View(conferencemodel));
            }
            else
            {
                return(View());
            }
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            conference c = new conference();

            c.conferenceId = Convert.ToInt32(dataGridView1.CurrentRow.Cells["conferenceId"].Value);

            // updating
            if (e.ColumnIndex == 5)
            {
                formDTO.op = CrudOpr.Update;

                conference findConf = dataFormDTO.db.conferences.Find(c.conferenceId);
                formDTO.obj = findConf;

                CreateUpdateConferenceForm form = new CreateUpdateConferenceForm(this, formDTO);
                form.Show();
            }

            // deleting
            if (e.ColumnIndex == 6)
            {
                // Запрашиваем подтверждение
                string message = "Do you want to delete?";
                string caption = "Y/n";
                var    result  = MessageBox.Show(message, caption,
                                                 MessageBoxButtons.YesNo,
                                                 MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    // deleting
                    if (conferenceCrud.delete(c))
                    {
                        MessageBox.Show("Conference was deleted!");
                        resetData();
                    }
                    else
                    {
                        MessageBox.Show("Deleting was denied");
                    }
                }
            }
        }
Ejemplo n.º 9
0
 public void Add(conference entity)
 {
     _iConnection.ExecuteScalar <conference>(
         "INSERT INTO conference (editor, booktitle, author, month, note, pages, title, volume, year, address," +
         " bibtexkey, entrytype, series, organization, publisher) VALUES( @editor, @booktitle, @author, @month, @note, @pages, @title," +
         " @volume, @year, @address, @bibtexkey, @entrytype, @series, @organization, @publisher)", new
     {
         entity.entrytype,
         entity.bibtexkey,
         entity.editor,
         entity.booktitle,
         entity.author,
         entity.month,
         entity.note,
         entity.pages,
         entity.title,
         entity.volume,
         entity.year,
         entity.series,
         entity.address,
         entity.organization,
         entity.publisher,
     });
 }
        private void cbConference_SelectedIndexChanged(object sender, EventArgs e)
        {
            conference c = (conference)cbConference.SelectedItem;

            filter.conference = c.conferenceId;
        }
        private void cbConference_SelectedIndexChanged(object sender, EventArgs e)
        {
            conference c = (conference)cbConference.SelectedItem;

            participantDTO.conference = c.conferenceId;
        }
Ejemplo n.º 12
0
 public ConferenceView()
 {
     _iConferenceService = InstanceFactory.GetInstance <DapperConferenceDal>();
     InitializeComponent();
     DataContext = new conference();
 }