예제 #1
0
        private void tbtnAddCargoData_Click(object sender, EventArgs e)
        {
            string cargoId = "";

            if (lstCargoId.SelectedItem != null)
            {
                cargoId = (lstCargoId.SelectedItem as string);
            }

            string cargoType = "";

            if (cmbCargoType.Text.Length == 3)
            {
                cargoType = cmbCargoType.Text;
            }

            string addedCargoId = EditDialog.ExecuteDialog_Insert(_IDatabase, SelectedTable, cargoId, cargoType);

            if (addedCargoId != "")
            {
                if (addedCargoId == cargoId)
                {
                    RefreshListCargoData();
                }
                else
                {
                    RefreshListCargoId();
                }
            }
        }
예제 #2
0
        private static string ExecuteDialog(TheAltisProjectDatabase.IDatabaseCargoGui iDatabase, string table, Int64 id, string cargoId, string cargoType, string cargoData, bool insert)
        {
            using (EditDialog dlg = new EditDialog())
            {
                dlg.txtCargoId.Text   = cargoId;
                dlg.cmbCargoType.Text = cargoType;
                dlg.txtCargoData.Text = cargoData;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    if (insert)
                    {
                        iDatabase.Insert(table, dlg.txtCargoId.Text, dlg.cmbCargoType.Text, dlg.txtCargoData.Text);
                    }
                    else
                    {
                        iDatabase.Update(table, id, dlg.txtCargoId.Text, dlg.cmbCargoType.Text, dlg.txtCargoData.Text);
                    }

                    return(dlg.txtCargoId.Text);
                }

                return("");
            }
        }
예제 #3
0
        private void tbtnEditCargoData_Click(object sender, EventArgs e)
        {
            string cargoId = "";

            if (lstCargoId.SelectedItem != null)
            {
                cargoId = (lstCargoId.SelectedItem as string);
            }

            string cargoType = "";

            if (cmbCargoType.Text.Length == 3)
            {
                cargoType = cmbCargoType.Text;
            }

            Int64  id        = -1;
            string cargoData = "";

            if (lstCargoData.SelectedItem != null)
            {
                id        = (lstCargoData.SelectedItem as TheAltisProjectDatabase.IdStringPair).Id;
                cargoData = (lstCargoData.SelectedItem as TheAltisProjectDatabase.IdStringPair).Text;
            }

            if (EditDialog.ExecuteDialog_Update(_IDatabase, SelectedTable, id, cargoId, cargoType, cargoData) != "")
            {
                RefreshListCargoData();
            }
        }