private void buttonTambahBarang_Click(object sender, EventArgs e) { Spk a = listspk[comboBoxNomorSPK.SelectedIndex]; PemesananBahanBaku k = new PemesananBahanBaku(textBoxKode.Text, a, DateTime.Now, int.Parse(labelHarga.Text)); string code = ""; if (textBoxharga.Text != "" && textBoxKode.Text != "" && textBoxjenis.Text != "" && textBoxsub.Text != "" && textBoxjumlah.Text != "" && comboBoxID.Text != "" && richTextBoxkete.Text != "") { code = DetailPemesananBahanBaku.GenerateCode(out code); BahanBaku b = listHasilData[comboBoxID.SelectedIndex]; DetailPemesananBahanBaku s = new DetailPemesananBahanBaku(int.Parse(code), k, b, textBoxjenis.Text, int.Parse(textBoxjumlah.Text) , int.Parse(textBoxharga.Text), subharga, "", richTextBoxkete.Text); dataGridViewBarang.Rows.Add(listHasilData[comboBoxID.SelectedIndex].Nama, textBoxjenis.Text, textBoxharga.Text, textBoxjumlah.Text, textBoxsub.Text, richTextBoxkete.Text); int sub = int.Parse(textBoxsub.Text); hrg += sub; labelHarga.Text = hrg.ToString(); subharga = 0; harga = 0; jumlah = 0; textBoxsub.Text = ""; textBoxharga.Text = ""; textBoxjenis.Text = ""; textBoxjumlah.Text = ""; comboBoxID.Text = ""; richTextBoxkete.Text = ""; textBoxsub.Enabled = false; textBoxharga.Enabled = false; textBoxjenis.Enabled = false; textBoxjumlah.Enabled = false; richTextBoxkete.Enabled = false; } }
private void buttonSimpan_Click(object sender, EventArgs e) { try { int selectindexspk = comboBoxSPK.SelectedIndex; int selectindexmesin = comboBoxMesin.SelectedIndex; int selectindexpekerja = comboBoxPekerja.SelectedIndex; Pekerja p = listdaftarpekerja[selectindexpekerja]; Mesin m = listaftarmesin[selectindexmesin]; Spk s = listaftarspk[selectindexspk]; ProgresProduksi pk = new ProgresProduksi(textBoxNoDokumen.Text, s, m, p, dateTimePickerTglMulai.Value, dateTimePickerTglSelesai.Value, comboBoxStatus.Text, textBoxKeterengan.Text); //ProgresProduksi pk = new ProgresProduksi(textBoxNoDokumen.Text, comboBoxStatus.Text); string hasil = ProgresProduksi.TambahData(pk); if (hasil == "1") { MessageBox.Show("Data Telah ditambahkan"); frmDaftar.FormDaftarProgress_Load(sender, e); buttonKosongi_Click(sender, e); } else { MessageBox.Show("Error tidak bisa menambahkan data :" + hasil); } } catch (Exception ex) { MessageBox.Show("Error : " + ex); } }
private void FormTambahJadwal_Load(object sender, EventArgs e) { string codebaru; string hasilgen = Jadwal.GenerateCode(out codebaru); if (hasilgen == "1") { textBoXid.Text = codebaru; textBoXid.Enabled = false; } else { MessageBox.Show("Gagal melakukan generate code. Pesan kesalahan: " + hasilgen); } listhasildata.Clear(); string hasilBaca1 = Spk.BacaData("", "", listhasildata); if (hasilBaca1 == "1") { comboBoxSPK.Items.Clear(); for (int i = 0; i < listhasildata.Count; i++) { comboBoxSPK.Items.Add(listhasildata[i].NoSPK); } } else { MessageBox.Show("Data SPK gagal ditampilkan. Pesan kesalahan: " + hasilBaca1); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { listBahanBaku.Clear(); listSpk.Clear(); listBom.Clear(); Barang b = listBarang[comboBox1.SelectedIndex]; comboBoxBahanBaku.Items.Clear(); string hasilBom = BOM.BacaData("kode_barang", b.Kode, listBom); if (hasilBom == "1") { for (int i = 0; i < listBom.Count; i++) { List <BahanBaku> lbb = new List <BahanBaku>(); string hasilBahan = BahanBaku.BacaData("BB.Id", listBom[i].IdbahanBaku, lbb); comboBoxBahanBaku.Items.Add(lbb[0].Id + " - " + lbb[0].Nama); listBahanBaku.Add(lbb[0]); } } comboBoxSpk.Items.Clear(); string hasil = Spk.BacaData("kode_barang", b.Kode, listSpk); if (hasil == "1") { for (int i = 0; i < listSpk.Count; i++) { comboBoxSpk.Items.Add(listSpk[i].NoSPK + " - " + listSpk[i].IdPekerja.Nama); } comboBoxSpk.Enabled = true; comboBoxBahanBaku.Text = ""; comboBoxBahanBaku.Enabled = false; } }
private void buttonBuat_Click(object sender, EventArgs e) { try { int indexDipilihUser = comboBoxSPK.SelectedIndex; Spk spk = hasildataspk[indexDipilihUser]; Jadwal J = new Jadwal(textBoXid.Text, spk, dateTimePickerTanggalMulai.Value, dateTimePickerTanggalSelesai.Value, textBoxkET.Text); string hasilUbah = Jadwal.UbahData(J); if (hasilUbah == "1") { MessageBox.Show("Data Jadwal telah terubah", "Informasi"); frmdaftar.FormDaftarJadwal_Load(sender, e); } else { MessageBox.Show("Gagal mengubah data Jadwal. Pesan kesalahan: " + hasilUbah); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void buttonHapus_Click(object sender, EventArgs e) { // Pastikan dulu kepada user apakah akan menghapus data DialogResult konfirmasi = MessageBox.Show("Data Pengiriman akan terhapus. Apakah Anda yakin ? ", "Konfirmasi", MessageBoxButtons.YesNo); if (konfirmasi == System.Windows.Forms.DialogResult.Yes) // Jika user yakin menghapus data { Spk s = new Spk(); s.NoSPK = textBoxSPK.Text; Pengiriman P = new Pengiriman(textBoxNomerDokumen.Text, s, DateTime.Now); // Panggil static method HapusData di class kategori string hasilHapus = Pengiriman.HapusData(P); if (hasilHapus == "1") { MessageBox.Show("Data Pengiriman telah dihapus.", "Informasi"); buttonKosongi_Click(sender, e); frmDaftar.FormDaftarPengiriman_Load(sender, e); } else { MessageBox.Show("Gagal menghapus pelanggan. Pesan kesalahan : " + hasilHapus); } } }
private void textBoxCari_TextChanged(object sender, EventArgs e) { string kriteria = ""; if (comboBoxCari.Text == "No SPK") { kriteria = "S.nomor"; } else if (comboBoxCari.Text == "Barang") { kriteria = "B.nama"; } // Kosongi isi list listHasilData.Clear(); // Tampilkan data kategori sesuai kriteria string hasilBaca = Spk.BacaData(kriteria, textBoxCari.Text, listHasilData); if (hasilBaca == "1") { dataGridViewJabatan.DataSource = null; dataGridViewJabatan.DataSource = listHasilData; } }
private void buttonBuat_Click(object sender, EventArgs e) { try { int indexSPK = comboBoxSPK.SelectedIndex; Spk op = listhasildata[indexSPK]; Jadwal J = new Jadwal(textBoXid.Text, op, dateTimePickerTanggalMulai.Value, dateTimePickerTanggalSelesai.Value, textBoxkET.Text); string hasilTambah = Jadwal.TambahData(J); if (hasilTambah == "1") { MessageBox.Show("Jadwal telah tersimpan.", "Informasi"); buttonKosongi_Click(sender, e); frmDaftar.FormDaftarJadwal_Load(sender, e); } else { MessageBox.Show("Gagal menambah Jadwal. Pesan kesalahan: " + hasilTambah); } } catch (Exception exc) { MessageBox.Show("Data telah tersimpan silahkan Refresh"); } }
private void buttonBuat_Click(object sender, EventArgs e) { try { Spk k = listspk[comboBoxNomorSPK.SelectedIndex]; PemesananBahanBaku p = new PemesananBahanBaku(textBoxKode.Text, k, DateTime.Now, hrg); string has = DetailPemesananBahanBaku.BacaData("", "", dc); if (dataGridViewBarang.Rows.Count != 0) { int id = dc.Count + 1; // data barang diperoleh dari dataGridView for (int i = 0; i < dataGridViewBarang.Rows.Count; i++) { DetailPemesananBahanBaku brg = new DetailPemesananBahanBaku(); string code = DetailPemesananBahanBaku.GenerateCode(out code); brg.Id = id; brg.IDbahan = listHasilData[comboBoxID.SelectedIndex]; brg.KodePBB = p; brg.TanggalTerima = DateTime.Now; brg.Jenis = dataGridViewBarang.Rows[i].Cells["Jenis"].Value.ToString(); brg.HargaSatuan = int.Parse(dataGridViewBarang.Rows[i].Cells["HargaSatuan"].Value.ToString()); brg.Jumlah = int.Parse(dataGridViewBarang.Rows[i].Cells["Jumlah"].Value.ToString()); brg.SubTotalHarga = int.Parse(dataGridViewBarang.Rows[i].Cells["SubTotal"].Value.ToString()); brg.Keterangan = dataGridViewBarang.Rows[i].Cells["Keterangan"].Value.ToString(); // simpan detil barang ke nota p.TambahPemesanan(brg); id++; } string hasilTambah = PemesananBahanBaku.TambahData(p); if (hasilTambah == "1") { MessageBox.Show("Data Pemesanan Bahan Baku telah tersimpan", "Info"); FormPemesananBahanBaku_Load(sender, e); } else { MessageBox.Show("Data Pemesanan Bahan Baku gagal tersimpan. Pesan kesalahan: " + hasilTambah, "Kesalahan"); } } else { MessageBox.Show("Anda belum menambahkan bahan baku apa pun pada", "Kesalahan"); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void FormTambahSPK_Load(object sender, EventArgs e) { frmDaftar = (FormDaftarSPK)this.Owner; try { string codebaru; string hasilgen = Spk.GenerateCode(out codebaru); if (hasilgen == "1") { textBoxNoSPK.Text = codebaru; textBoxNoSPK.Enabled = false; } else { MessageBox.Show("Gagal melakukan generate code. Pesan kesalahan: " + hasilgen); } ListDatapeg.Clear(); listdatabarang.Clear(); string hasilbaca2 = OrderPenjualan.BacaData("", "", listorderpenjualan); if (hasilbaca2 == "1") { comboBox1.Items.Clear(); for (int i = 0; i < listorderpenjualan.Count; i++) { comboBox1.Items.Add(listorderpenjualan[i].NoOrder); } } string hasilBaca3 = Pekerja.BacaData("", "", ListDatapeg); if (hasilBaca3 == "1") { comboBoxPekerja.Items.Clear(); for (int i = 0; i < ListDatapeg.Count; i++) { comboBoxPekerja.Items.Add(ListDatapeg[i].IdPekerja + " . " + ListDatapeg[i].Nama); } } else { MessageBox.Show("Data Pekerja gagal ditampilkan. Pesan kesalahan: " + hasilBaca3); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
public ActionResult Spk(int id) { Context.Workshop dbitem2 = RepoWorkshop.FindByPK(id); Context.Spk dbitem = new Context.Spk(); dbitem.Workshop_id = dbitem2.Id; dbitem.Workshop = dbitem2; Workshop model2 = new Workshop(dbitem2); Spk model = new Spk(dbitem); model.Workshop = model2; ViewBag.name = model.Workshop.NoPPK; return(View("Spk", model)); }
public ActionResult UpdateSpk(Spk model) { int w_id = 0; if (ModelState.IsValid) { w_id = model.Workshop_id ?? default(int); Context.Spk dbitem = new Context.Spk(); model.setDb(dbitem); RepoSpk.save(dbitem, UserPrincipal.id); } Context.Workshop dbitem2 = RepoWorkshop.FindByPK(w_id); Workshop model2 = new Workshop(dbitem2); return(RedirectToAction("Spk", new { Id = w_id, idnya = w_id })); }
private void FormPengiriman_Load(object sender, EventArgs e) { listDataSPK.Clear(); string hasilBaca = Spk.BacaData("", "", listDataSPK); if (hasilBaca == "1") { comboBoxSPK.Items.Clear(); for (int i = 0; i < listDataSPK.Count; i++) { comboBoxSPK.Items.Add(listDataSPK[i].NoSPK); } } else { MessageBox.Show("Data Jabatan gagal ditampilkan. Pesan kesalahan: " + hasilBaca); } }
private void FormUbahJadwal_Load(object sender, EventArgs e) { hasildataspk.Clear(); string hasilBaca1 = Spk.BacaData("", "", hasildataspk); if (hasilBaca1 == "1") { comboBoxSPK.Items.Clear(); for (int i = 0; i < hasildataspk.Count; i++) { comboBoxSPK.Items.Add(hasildataspk[i].NoSPK); } } else { MessageBox.Show("Data SPK gagal ditampilkan. Pesan kesalahan: " + hasilBaca1); } }
private void buttonBuat_Click(object sender, EventArgs e) { int indexDipilihUser = comboBoxSPK.SelectedIndex; Spk s = listDataSPK[indexDipilihUser]; Pengiriman p = new Pengiriman(textBoxNomerDokumen.Text, s, dateTimePickerTanggal.Value); string hasilTambah = Pengiriman.TambahData(p); if (hasilTambah == "1") { MessageBox.Show("Pengiriman telah tersimpan.", "Informasi"); buttonKosongi_Click(sender, e); } else { MessageBox.Show("Gagal menambah jabatan. Pesan kesalahan: " + hasilTambah); } }
public void FormDaftarSPK_Load(object sender, EventArgs e) { listHasilData.Clear(); FormatDataGrid(); listHasilData.Clear(); string hasilBaca = Spk.BacaData("", "", listHasilData); if (hasilBaca == "1") { dataGridViewJabatan.Rows.Clear(); for (int i = 0; i < listHasilData.Count; i++) { dataGridViewJabatan.Rows.Add(listHasilData[i].NoSPK, listHasilData[i].Tanggal.ToShortDateString(), listHasilData[i].Brg.Nama , listHasilData[i].IdPekerja.Nama, listHasilData[i].Pekerjaan, listHasilData[i].Lokasi, listHasilData[i].LamaPengerjaan + " Hari", listHasilData[i].Biaya, listHasilData[i].Syarat, listHasilData[i].Metode); } } }
private void FormTambahProgress_Load(object sender, EventArgs e) { frmDaftar = (FormDaftarProgress)this.Owner; listaftarmesin.Clear(); listaftarspk.Clear(); listdaftarpekerja.Clear(); string bacamesin = Mesin.BacaData("", "", listaftarmesin); if (bacamesin == "1") { comboBoxMesin.Items.Clear(); for (int i = 0; i < listaftarmesin.Count; i++) { comboBoxMesin.Items.Add(listaftarmesin[i].IdMesin + " - " + listaftarmesin[i].Nama); } } string bacaspk = Spk.BacaData("", "", listaftarspk); if (bacaspk == "1") { comboBoxSPK.Items.Clear(); for (int i = 0; i < listaftarspk.Count; i++) { comboBoxSPK.Items.Add(listaftarspk[i].NoSPK); } } string bacapekerja = Pekerja.BacaData("", "", listdaftarpekerja); if (bacapekerja == "1") { comboBoxPekerja.Items.Clear(); for (int i = 0; i < listdaftarpekerja.Count; i++) { comboBoxPekerja.Items.Add(listdaftarpekerja[i].IdPekerja + " - " + listdaftarpekerja[i].Nama); } } }
public void FormPemesananBahanBaku_Load(object sender, EventArgs e) { hrg = 0; labelHarga.Text = hrg.ToString(); dataGridViewBarang.Rows.Clear(); FormatDataGrid(); listHasilData.Clear(); comboBoxID.Items.Clear(); comboBoxNomorSPK.Items.Clear(); textBoxsub.Text = ""; textBoxharga.Text = ""; textBoxjenis.Text = ""; textBoxjumlah.Text = ""; comboBoxID.Text = ""; richTextBoxkete.Text = ""; textBoxsub.Enabled = false; textBoxharga.Enabled = false; textBoxjenis.Enabled = false; textBoxjumlah.Enabled = false; richTextBoxkete.Enabled = false; string hasil = BahanBaku.BacaData("", "", listHasilData); if (hasil == "1") { for (int i = 0; i < listHasilData.Count; i++) { comboBoxID.Items.Add(listHasilData[i].Id + " - " + listHasilData[i].Nama); } } string spk = Spk.BacaData("", "", listspk); if (spk == "1") { for (int i = 0; i < listspk.Count; i++) { comboBoxNomorSPK.Items.Add(listspk[i].NoSPK); } } }
public void save(Spk spk_dbitem, int id) { if (spk_dbitem.Id == 0) //create { context.Spk.Add(spk_dbitem); var query = "INSERT INTO dbo.\"Spk\" (\"Jenis\", \"Permintaan\", \"Keterangan\", \"Mekanik1\", \"Mekanik2\", \"Workshop_id\", \"Status\", \"ServiceIn\", \"Estimasi\", \"ServiceOut\", " + "\"RevEstimasi\", \"KeteranganSPK\") VALUES ( " + spk_dbitem.Jenis + ", " + spk_dbitem.Permintaan + ", " + spk_dbitem.Keterangan + ", " + spk_dbitem.Mekanik1 + ", " + spk_dbitem.Mekanik2 + ", " + spk_dbitem.Workshop_id + ", " + spk_dbitem.Status + ", " + spk_dbitem.ServiceIn + ", " + spk_dbitem.Estimasi + ", " + spk_dbitem.ServiceOut + ", " + spk_dbitem.RevEstimasi + ", " + spk_dbitem.KeteranganSPK + ");"; var auditrail = new Auditrail { Actionnya = "Spk", EventDate = DateTime.Now, Modulenya = "Workshop", QueryDetail = query, RemoteAddress = AppHelper.GetIPAddress(), IdUser = id }; context.Auditrail.Add(auditrail); } else //edit { context.Spk.Attach(spk_dbitem); var spk_history = new SpkHistory { Tanggal = DateTime.Now, Jenis = spk_dbitem.Jenis, Estimasi = spk_dbitem.Estimasi ?? DateTime.Now, Status = spk_dbitem.Status, RevEstimasi = spk_dbitem.RevEstimasi ?? 0, WorkshopId = spk_dbitem.Workshop_id }; context.SpkHistory.Add(spk_history); var query = "UPDATE dbo.\"Spk\" SET \"Jenis\" = " + spk_dbitem.Jenis + ", \"Permintaan\" = " + spk_dbitem.Permintaan + ", \"Keterangan\" = " + spk_dbitem.Keterangan + ", \"Mekanik1\" \" = " + spk_dbitem.Mekanik1 + ", \"Mekanik2\" = \" = " + spk_dbitem.Mekanik2 + ", \"Workshop_id\" = \" = " + spk_dbitem.Workshop_id + ", \"Status\" = \" = " + spk_dbitem.Status + ", \"ServiceIn\" = \" = " + spk_dbitem.ServiceIn + ", \"Estimasi\" = \" = " + spk_dbitem.Estimasi + ", \"ServiceOut\" = \" = " + spk_dbitem.ServiceOut + ", \"RevEstimasi\" = \" = " + spk_dbitem.RevEstimasi + ", \"KeteranganSPK\" = \" = " + spk_dbitem.KeteranganSPK + " WHERE \"Id\" = " + spk_dbitem.Id + ";" + "INSERT INTO dbo.\"SpkHistory\" (\"Jenis\", \"Status\", \"Estimasi\", \"Tanggal\", \"RevEstimasi\", \"WorkshopId\") VALUES (" + spk_history.Jenis + ", " + spk_history.Status + ", " + spk_history.Estimasi + ", " + spk_history.Tanggal + ", " + spk_history.RevEstimasi + ", " + spk_history.WorkshopId + ");"; var auditrail = new Auditrail { Actionnya = "Spk", EventDate = DateTime.Now, Modulenya = "Workshop", QueryDetail = query, RemoteAddress = AppHelper.GetIPAddress(), IdUser = id }; context.Auditrail.Add(auditrail); var entry = context.Entry(spk_dbitem); entry.State = EntityState.Modified; } context.SaveChanges(); }
private void buttonSimpan_Click(object sender, EventArgs e) { try { int indexpeg = comboBoxPekerja.SelectedIndex; //int indexDipilihUser = comboBoxNoPo.SelectedIndex; for (int i = 0; i < listdatabarang.Count; i++) { if (comboBoxNoPo.Text == (listdatabarang[i].Kode + " - " + listdatabarang[i].Nama)) { op = listdatabarang[i]; } } Pekerja p = ListDatapeg[indexpeg]; Spk s = new Spk(textBoxNoSPK.Text, dateTimePickerdt.Value, op, p, textBoxPekerjaan.Text, textBoxLokasi.Text, int.Parse(textBoxBiaya.Text), textBoxLamaKerja.Text, textBoxSyarat.Text, comboBoxMetode.Text); string hasilTambah = Spk.TambahData(s); if (hasilTambah == "1") { MessageBox.Show("SPK telah tersimpan.", "Informasi"); frmDaftar.FormDaftarSPK_Load(sender, e); buttonKosongi_Click(sender, e); } else { MessageBox.Show("Gagal menambah SPK. Pesan kesalahan: " + hasilTambah); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
public ActionResult PpkIn(Workshop model) { if (ModelState.IsValid) { Context.Workshop dbitem = RepoWorkshop.FindByPK(model.id); model.setDbPpkIn(dbitem); RepoWorkshop.save(dbitem, UserPrincipal.id); dbitem.Spk.Clear(); RepoAuditrail.saveDelAllSpkQuery(dbitem, UserPrincipal.id); if (model.IsAc == true) { Context.Spk spk_dbitem = RepoSpk.FindByWorkshopAndType(dbitem.Id, "AC"); if (spk_dbitem == null) { spk_dbitem = new Context.Spk(); spk_dbitem.Id = spk_dbitem.Id; Spk model2 = new Spk(); model2.Jenis = "AC"; model2.Permintaan = model.KetAc; model2.Keterangan = model.KetKerjaAc; model2.Workshop_id = model.id; model2.RevEstimasi = 0; model2.setDb(spk_dbitem); RepoSpk.save(spk_dbitem, UserPrincipal.id); } else { spk_dbitem.Permintaan = model.KetAc; spk_dbitem.Keterangan = model.KetKerjaAc; RepoSpk.save(spk_dbitem, UserPrincipal.id); } } if (model.IsBan == true) { Context.Spk spk_dbitem = RepoSpk.FindByWorkshopAndType(dbitem.Id, "Ban"); if (spk_dbitem == null) { spk_dbitem = new Context.Spk(); spk_dbitem.Id = spk_dbitem.Id; Spk model2 = new Spk(); model2.Jenis = "Ban"; model2.Permintaan = model.KetBan; model2.Keterangan = model.KetKerjaBan; model2.Workshop_id = model.id; model2.RevEstimasi = 0; model2.setDb(spk_dbitem); RepoSpk.save(spk_dbitem, UserPrincipal.id); } else { spk_dbitem.Permintaan = model.KetBan; spk_dbitem.Keterangan = model.KetKerjaBan; RepoSpk.save(spk_dbitem, UserPrincipal.id); } } if (model.IsBox == true) { Context.Spk spk_dbitem = RepoSpk.FindByWorkshopAndType(dbitem.Id, "Box"); if (spk_dbitem == null) { spk_dbitem = new Context.Spk(); spk_dbitem.Id = spk_dbitem.Id; Spk model2 = new Spk(); model2.Jenis = "Box"; model2.Permintaan = model.KetBox; model2.Keterangan = model.KetKerjaBox; model2.Workshop_id = model.id; model2.RevEstimasi = 0; model2.setDb(spk_dbitem); RepoSpk.save(spk_dbitem, UserPrincipal.id); } else { spk_dbitem.Permintaan = model.KetBox; spk_dbitem.Keterangan = model.KetKerjaBox; RepoSpk.save(spk_dbitem, UserPrincipal.id); } } if (model.IsGps == true) { Context.Spk spk_dbitem = RepoSpk.FindByWorkshopAndType(dbitem.Id, "GPS"); if (spk_dbitem == null) { spk_dbitem = new Context.Spk(); spk_dbitem.Id = spk_dbitem.Id; Spk model2 = new Spk(); model2.Jenis = "GPS"; model2.Permintaan = model.KetGps; model2.Keterangan = model.KetKerjaGps; model2.Workshop_id = model.id; model2.RevEstimasi = 0; model2.setDb(spk_dbitem); RepoSpk.save(spk_dbitem, UserPrincipal.id); } else { spk_dbitem.Permintaan = model.KetGps; spk_dbitem.Keterangan = model.KetKerjaGps; RepoSpk.save(spk_dbitem, UserPrincipal.id); } } if (model.IsTruck == true) { Context.Spk spk_dbitem = RepoSpk.FindByWorkshopAndType(dbitem.Id, "Truck"); if (spk_dbitem == null) { spk_dbitem = new Context.Spk(); spk_dbitem.Id = spk_dbitem.Id; Spk model2 = new Spk(); model2.Jenis = "Truck"; model2.Permintaan = model.KetTruck; model2.Keterangan = model.KetKerjaTruck; model2.Workshop_id = model.id; model2.RevEstimasi = 0; model2.setDb(spk_dbitem); RepoSpk.save(spk_dbitem, UserPrincipal.id); } else { spk_dbitem.Permintaan = model.KetTruck; spk_dbitem.Keterangan = model.KetKerjaTruck; RepoSpk.save(spk_dbitem, UserPrincipal.id); } } return(RedirectToAction("Index")); } return(View("PpkIn", model)); }
protected override void ResourceLoader() { base.ResourceLoader(); /* create the element corresponding to the hud */ hudElement = new ImageElement(this, 0, 0, 640, 480, TranslucentIndex); hudElement.Text = String.Format(Builtins.Game_ConsolePcx, Util.RaceCharLower[(int)Game.Instance.Race]); hudElement.Visible = true; Elements.Add(hudElement); /* create the portrait playing area */ portraitElement = new MovieElement(this, 415, 415, 48, 48, false); portraitElement.Visible = true; Elements.Add(portraitElement); Pcx pcx = new Pcx(); pcx.ReadFromStream((Stream)mpq.GetResource("game\\tunit.pcx"), -1, -1); //unit_palette = pcx.Palette; pcx = new Pcx(); pcx.ReadFromStream((Stream)mpq.GetResource("tileset\\badlands\\dark.pcx"), 0, 0); tileset_palette = pcx.Palette; if (scenario.Tileset == Tileset.Platform) { Spk starfield = (Spk)mpq.GetResource("parallax\\star.spk"); starfield_layers = new Surface [starfield.Layers.Length]; for (int i = 0; i < starfield_layers.Length; i++) { starfield_layers[i] = new Surface(Painter.SCREEN_RES_X, Painter.SCREEN_RES_Y); starfield_layers[i].TransparentColor = Color.Black; for (int o = 0; o < starfield.Layers[i].Objects.Length; o++) { ParallaxObject obj = starfield.Layers[i].Objects[o]; starfield_layers[i].Fill(new Rectangle(new Point(obj.X, obj.Y), new Size(2, 2)), Color.White); } } } mapRenderer = new MapRenderer(mpq, scenario, Painter.SCREEN_RES_X, Painter.SCREEN_RES_Y); // load the cursors we'll show when scrolling with the mouse string[] cursornames = new string[] { "cursor\\ScrollUL.grp", "cursor\\ScrollU.grp", "cursor\\ScrollUR.grp", "cursor\\ScrollR.grp", "cursor\\ScrollDR.grp", "cursor\\ScrollD.grp", "cursor\\ScrollDL.grp", "cursor\\ScrollL.grp", }; ScrollCursors = new CursorAnimator [cursornames.Length]; for (int i = 0; i < cursornames.Length; i++) { ScrollCursors[i] = new CursorAnimator((Grp)mpq.GetResource(cursornames[i]), effectpal.Palette); ScrollCursors[i].SetHotSpot(60, 60); } // load the mag cursors string[] magcursornames = new string[] { "cursor\\MagG.grp", "cursor\\MagY.grp", "cursor\\MagR.grp" }; MagCursors = new CursorAnimator [magcursornames.Length]; for (int i = 0; i < magcursornames.Length; i++) { MagCursors[i] = new CursorAnimator((Grp)mpq.GetResource(magcursornames[i]), effectpal.Palette); MagCursors[i].SetHotSpot(60, 60); } // load the targeting cursors string[] targetcursornames = new string[] { "cursor\\TargG.grp", "cursor\\TargY.grp", "cursor\\TargR.grp" }; TargetCursors = new CursorAnimator [targetcursornames.Length]; for (int i = 0; i < targetcursornames.Length; i++) { TargetCursors[i] = new CursorAnimator((Grp)mpq.GetResource(targetcursornames[i]), effectpal.Palette); TargetCursors[i].SetHotSpot(60, 60); } /* the following could be made global to speed up the entry to the game screen.. */ statTxt = (Tbl)mpq.GetResource("rez\\stat_txt.tbl"); // load the wireframe image info wireframe = (Grp)mpq.GetResource("unit\\wirefram\\wirefram.grp"); // load the command icons cmdicons = (Grp)mpq.GetResource("unit\\cmdbtns\\cmdicons.grp"); pcx = new Pcx(); pcx.ReadFromStream((Stream)mpq.GetResource("unit\\cmdbtns\\ticon.pcx"), 0, 0); cmdicon_palette = pcx.Palette; // create the wireframe display element wireframeElement = new GrpElement(this, wireframe, cmdicon_palette, 170, 390); wireframeElement.Visible = false; Elements.Add(wireframeElement); labelElements = new LabelElement [(int)HudLabels.Count]; labelElements[(int)HudLabels.UnitName] = new LabelElement(this, fontpal.Palette, GuiUtil.GetFonts(Mpq)[1], 254, 390); labelElements[(int)HudLabels.ResourceUsed] = new LabelElement(this, fontpal.Palette, GuiUtil.GetFonts(Mpq)[0], 292, 420); labelElements[(int)HudLabels.ResourceProvided] = new LabelElement(this, fontpal.Palette, GuiUtil.GetFonts(Mpq)[0], 292, 434); labelElements[(int)HudLabels.ResourceTotal] = new LabelElement(this, fontpal.Palette, GuiUtil.GetFonts(Mpq)[0], 292, 448); labelElements[(int)HudLabels.ResourceMax] = new LabelElement(this, fontpal.Palette, GuiUtil.GetFonts(Mpq)[0], 292, 462); for (int i = 0; i < labelElements.Length; i++) { Elements.Add(labelElements[i]); } cmdButtonElements = new GrpButtonElement[9]; int x = 0; int y = 0; for (int i = 0; i < cmdButtonElements.Length; i++) { cmdButtonElements[i] = new GrpButtonElement(this, cmdicons, cmdicon_palette, button_xs[x], button_ys[y]); x++; if (x == 3) { x = 0; y++; } cmdButtonElements[i].Visible = false; Elements.Add(cmdButtonElements[i]); } PlaceInitialUnits(); Events.Tick += ScrollTick; }
public void delete(Spk dbitem) { context.Spk.Remove(dbitem); context.SaveChanges(); }