Example #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            VariableSetting VariableSetting = VariableSettingRepo.GetBy(txtKey.Text);

            if (VariableSetting == null)
            {
                MessageBox.Show("Data tidak berhasil dihapus. Data tidak ada");
            }
            if (VariableSetting.CanModify == 0)
            {
                MessageBox.Show("Data tidak berhasil dihapus. Data mandatory.");
            }
            else
            {
                int i = VariableSettingRepo.Delete(txtKey.Text);
                if (i > 0)
                {
                    MessageBox.Show("Data berhasil dihapus [" + txtKey.Text + "]");
                }
                else
                {
                    MessageBox.Show("Data tidak berhasil dihapus [" + txtKey.Text + "]");
                }
            }
            BindGrid(xcurrentPage);
            btnReset.PerformClick();
        }
Example #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         bool            IsNew           = false;
         VariableSetting VariableSetting = VariableSettingRepo.GetBy(txtKey.Text);
         if (VariableSetting == null)
         {
             IsNew           = true;
             VariableSetting = new VariableSetting();
         }
         VariableSetting.Key         = txtKey.Text;
         VariableSetting.Value       = cbEncrypt.Checked ? WFUtils.Encrypt(txtValue.Text) : txtValue.Text;
         VariableSetting.Description = txtDescription.Text;
         VariableSetting.CanModify   = cbEncrypt.Checked ? 1 : 2;
         int i = 0;
         if (IsNew)
         {
             i = VariableSettingRepo.Create(VariableSetting);
         }
         else
         {
             i = VariableSettingRepo.Edit(VariableSetting);
         }
         MessageBox.Show("Data berhasil disimpan [" + txtKey.Text + "]");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.GetFullMessage() + " - Harap periksa data input kembali");
         return;
     }
     BindGrid(xcurrentPage);
     btnReset.PerformClick();
 }
Example #3
0
        public BaseForm()
        {
            InitializeComponent();

            VariableSetting varPageSize = VariableSettingRepo.GetBy("PageSize");

            if (varPageSize == null)
            {
                PageSize = 20;
            }
            else
            {
                PageSize = Convert.ToInt32(varPageSize.Value);
            }
        }
Example #4
0
        private static void SetupConnection()
        {
            MySqlConnection      newMySQLConn;
            IVariableSettingRepo VariableSettingRepo = new VariableSettingRepo();
            VariableSetting      VariableSetting     = VariableSettingRepo.GetBy("Status");

            if (VariableSetting != null)
            {
                if (!string.IsNullOrEmpty(VariableSetting.Value) && VariableSetting.Value.ToUpper() == "PRODUCTION")
                {
                    VariableSetting VariableSettingConStr = VariableSettingRepo.GetBy("MySQLConn");
                    newMySQLConn = new MySqlConnection(WFUtils.Decrypt(VariableSettingConStr.Value));
                }
                else
                {
                    newMySQLConn = new MySqlConnection("Server=127.0.0.1;Database=tsspk1511;Uid=root;Pwd=;");
                }
            }
        }
Example #5
0
        private void appinfosaveform_Load(object sender, EventArgs e)
        {
            //OnLoad(e);
            ControlBox  = false;
            WindowState = FormWindowState.Maximized;
            BringToFront();


            string Wilayah = "wilayah";

            lstWilayah = VariablesRepo.GetVariableByType(Wilayah);


            LoadNegeri();
            LoadTBangsa();
            LoadParlimen();

            groupBox1.Text = groupBox1.Text + " " + refno_new;

            txtappdate.CustomFormat = "dd-MM-yyyy";

            VariableSetting vs = VariableSettingRepo.GetBy("UserKeyIn");

            txtcreatedby.Text = "System";
            if (vs != null)
            {
                txtcreatedby.Text = vs.Value;
            }

            //foreach (Control ctrl in Controls)
            //{
            //    ctrl.HookFocusChangeBackColor(Color.Khaki);
            //}

            if (appinfo_id > 0)
            {
                BindForm(appinfo_id);
            }

            FocusChangeBackColor();
        }
Example #6
0
        private void SettingForm_Load(object sender, EventArgs e)
        {
            //LoadGrid();
            VariableSetting varPageSize = VariableSettingRepo.GetBy("PageSize");

            if (varPageSize == null)
            {
                PageSize = 15;
            }
            else
            {
                PageSize = Convert.ToInt32(varPageSize.Value);
            }
            ControlBox  = false;
            WindowState = FormWindowState.Maximized;
            BringToFront();
            xcurrentPage = 1;


            sidx = "KEY";
            sidx = "ASC";
            BindGrid(xcurrentPage);
        }
 public override string GetValue(VariableSetting setting) => setting.Value;