コード例 #1
0
ファイル: PIBController.cs プロジェクト: lcahuec/FinalPX
        public ActionResult DeleteConfirmed(int id)
        {
            PIB pIB = db.PIB.Find(id);

            db.PIB.Remove(pIB);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
ファイル: PIBController.cs プロジェクト: lcahuec/FinalPX
 public ActionResult Edit([Bind(Include = "Id,PIB1")] PIB pIB)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pIB).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pIB));
 }
コード例 #3
0
ファイル: PIBController.cs プロジェクト: lcahuec/FinalPX
        public ActionResult Create([Bind(Include = "Id,PIB1")] PIB pIB)
        {
            if (ModelState.IsValid)
            {
                db.PIB.Add(pIB);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pIB));
        }
コード例 #4
0
        private void OK_Click(object sender, EventArgs e)
        {
            if (PIB.Text.Length == 0 || Passport.Text.Length == 0 || Summ.Text.Length == 0)
            {
                MessageBox.Show("Всі поля мають бути заповнені!");
            }
            else
            {
                string pib       = PIB.Text;
                int    passport  = int.Parse(Passport.Text);
                string operation = Operation.SelectedItem.ToString();
                string valuta    = Currency.SelectedItem.ToString();
                float  summ      = float.Parse(Summ.Text);

                DB db = new DB();

                DataTable table  = new DataTable();
                DataTable table2 = new DataTable();

                MySqlDataAdapter adapter = new MySqlDataAdapter();

                MySqlCommand query  = new MySqlCommand("INSERT INTO `clients`(`id`, `PIB`, `passport`, `operation`, `valuta`, `summ`) VALUES ('','" + pib + "','" + passport + "','" + operation + "','" + valuta + "','" + summ + "')", db.GetConnection());
                MySqlCommand query2 = new MySqlCommand("SELECT `Buy`,`Sell` FROM `exchangerate` WHERE `title` = '" + valuta + "'", db.GetConnection());

                adapter.SelectCommand = query;
                adapter.Fill(table);
                adapter.SelectCommand = query2;
                adapter.Fill(table2);

                SummUAH.Visible = true;
                label3.Visible  = true;

                float[,] values = new float[table2.Rows.Count, table2.Columns.Count];
                for (int i = 0; i < table2.Rows.Count; i++)
                {
                    DataRow row = table2.Rows[i];
                    for (int j = 0; j < table2.Columns.Count; j++)
                    {
                        values[i, j] = (float)row[j];
                    }
                }

                float result = values[0, 0] * summ;

                SummUAH.Text = result.ToString();

                PIB.Clear();
                Passport.Clear();
                Summ.Clear();
                Operation.SelectedItem = "Купівля";
                Currency.SelectedItem  = 0;
            }
        }
コード例 #5
0
ファイル: PIBController.cs プロジェクト: lcahuec/FinalPX
        // GET: PIB/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PIB pIB = db.PIB.Find(id);

            if (pIB == null)
            {
                return(HttpNotFound());
            }
            return(View(pIB));
        }