Ejemplo n.º 1
0
        MasterPulsa SetData(byte status)
        {
            MasterPulsa myModel = new MasterPulsa();

            switch (status)
            {
            case (1):
            {
                myModel.IdMasterPulsa   = MasterPulsa.GenerateId();
                myModel.IdProvider      = Convert.ToInt32(cmbProvider.SelectedValue);
                myModel.KodeMasterPulsa = txtKode.Text;
                myModel.Keterangan      = txtKeterangan.Text;
                myModel.Harga           = Convert.ToInt32(txtHarga.Text);
                myModel.IsActive        = rdAktif.Checked == true ? true : false;
                break;
            }

            case (2):
            {
                myModel.IdMasterPulsa   = myID;
                myModel.IdProvider      = Convert.ToInt32(cmbProvider.SelectedValue);
                myModel.KodeMasterPulsa = txtKode.Text;
                myModel.Keterangan      = txtKeterangan.Text;
                myModel.Harga           = Convert.ToInt32(txtHarga.Text);
                myModel.IsActive        = rdAktif.Checked == true ? true : false;
                break;
            }
            }
            return(myModel);
        }
Ejemplo n.º 2
0
 private void btnSimpan_Click(object sender, EventArgs e)
 {
     try
     {
         if (Helpers.GetValidate(panel1) == true)
         {
             if (statusDisplay == 1)
             {
                 if (MasterPulsa.InsertData(SetData(1)) == true)
                 {
                     Helpers.MsgBoxSave();
                 }
             }
             else if (statusDisplay == 2)
             {
                 if (MasterPulsa.UpdateDate(SetData(2)) == true)
                 {
                     Helpers.MsgBoxSave();
                 }
             }
             PreCreateDisplay();
         }
     }
     catch (Exception ex)
     {
         Helpers.MsgBoxError(ex.Message);
     }
 }
Ejemplo n.º 3
0
        public static Boolean InsertData(MasterPulsa masterPulsa)
        {
            string sql = "Insert into MasterPulsa values('" + masterPulsa.IdMasterPulsa + "','" + masterPulsa.IdProvider + "','" + masterPulsa.KodeMasterPulsa + "'" +
                         ",'" + masterPulsa.Keterangan + "','" + masterPulsa.Harga + "','" + masterPulsa.IsActive + "')";

            try
            {
                DataAccess.ExecuteNonQuery(sql);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Ejemplo n.º 4
0
        public static Boolean UpdateDate(MasterPulsa masterPulsa)
        {
            string sql = "Update MasterPulsa set IdProvider = '" + masterPulsa.IdProvider + "',KodeMasterPulsa = '" + masterPulsa.KodeMasterPulsa + "'" +
                         ",Keterangan = '" + masterPulsa.Keterangan + "',Harga = '" + masterPulsa.Harga + "',IsActive = " + masterPulsa.IsActive
                         + " Where IdMasterPulsa= " + masterPulsa.IdProvider + "";

            try
            {
                DataAccess.ExecuteNonQuery(sql);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Ejemplo n.º 5
0
 void ListDataBySearch()
 {
     dgv.DataSource = MasterPulsa.GetListMasterPulsaByNama(txtCari.Text, cmbCari.Text);
     dgv.ReadOnly   = true;
     HeaderGrid();
 }
Ejemplo n.º 6
0
 void ListData()
 {
     dgv.DataSource = MasterPulsa.GetListMasterPulsa(1);
     dgv.ReadOnly   = true;
     HeaderGrid();
 }