Exemplo n.º 1
0
        private void frmIdentitasPerusahaan_Load(object sender, EventArgs e)
        {
            try
            {
                dt = new DataTable();
                using (Database db = new Database())
                {
                    db.Commands.Add(db.CreateCommand("usp_Perusahaan_LIST"));

                    dt = db.Commands[0].ExecuteDataTable();
                }

                DataTable dtprop = FillComboBox.DBGetProvinsi(Guid.Empty);
                dtprop.DefaultView.Sort   = "Nama ASC";
                cboProvinsi.DisplayMember = "Nama";
                cboProvinsi.ValueMember   = "RowID";
                cboProvinsi.DataSource    = dtprop.DefaultView;

                if (dt.Rows.Count > 0)
                {
                    DataTable dtKota = FillComboBox.DBGetStateAll(Guid.Empty, "", Guid.Empty, Tools.isNull(dt.Rows[0]["Kota"], "").ToString(), Guid.Empty, "", Guid.Empty, "");
                    formMode                = enumFormMode.Update;
                    _rowID                  = (Guid)(dt.Rows[0]["RowID"]);
                    txtCabangID.Text        = Tools.isNull(dt.Rows[0]["CabangID"], "").ToString();
                    txtInitPerusahaan.Text  = Tools.isNull(dt.Rows[0]["InitPerusahaan"], "").ToString();
                    txtNama.Text            = Tools.isNull(dt.Rows[0]["Nama"], "").ToString();
                    txtAlamat.Text          = Tools.isNull(dt.Rows[0]["Alamat"], "").ToString();
                    cboProvinsi.Text        = Tools.isNull(dt.Rows[0]["Propinsi"], "").ToString();
                    cboKota.Text            = Tools.isNull(dt.Rows[0]["Kota"], "").ToString();
                    txtNegara.Text          = Tools.isNull(dt.Rows[0]["Negara"], "").ToString();
                    txtTelp.Text            = Tools.isNull(dt.Rows[0]["Telp"], "").ToString();
                    txtNPWP.Text            = Tools.isNull(dt.Rows[0]["NPWP"], "").ToString();
                    txtEmail.Text           = Tools.isNull(dt.Rows[0]["Email"], "").ToString();
                    txtKodePos.Text         = Tools.isNull(dt.Rows[0]["KodePos"], "").ToString();
                    txtFax.Text             = Tools.isNull(dt.Rows[0]["Fax"], "").ToString();
                    txtWebsite.Text         = Tools.isNull(dt.Rows[0]["Website"], "").ToString();
                    txtPenanggungJawab.Text = Tools.isNull(dt.Rows[0]["PenanggungJawab"], "").ToString();
                    txtNoKTPPJ.Text         = Tools.isNull(dt.Rows[0]["NoKTP_PJ"], "").ToString();
                    txtJabatan.Text         = Tools.isNull(dt.Rows[0]["Jabatan"], "").ToString();
                    txtDirektur.Text        = Tools.isNull(dt.Rows[0]["Direktur"], "").ToString();
                }
                else
                {
                    formMode                = enumFormMode.New;
                    txtCabangID.Text        = "";
                    txtInitPerusahaan.Text  = "";
                    txtNama.Text            = "";
                    txtAlamat.Text          = "";
                    txtNegara.Text          = "";
                    txtTelp.Text            = "";
                    txtNPWP.Text            = "";
                    txtEmail.Text           = "";
                    txtKodePos.Text         = "";
                    txtFax.Text             = "";
                    txtWebsite.Text         = "";
                    txtPenanggungJawab.Text = "";
                    txtNoKTPPJ.Text         = "";
                    txtJabatan.Text         = "";
                    txtDirektur.Text        = "";
                }
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }