Exemple #1
0
 protected void bulan_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     Reload();
     Js.Focus(this, bulan);
 }
Exemple #2
0
        //Validation SECURITY..REF_MANDATORY
        #region public static bool ValidMandatory(Page p, string Halaman)
        public static bool ValidMandatory(Page p, string Halaman, string Project)
        {
            bool x = true;

            DataTable rs = Db.Rs("SELECT NamaKolom, TipeData FROM " + Mi.DbPrefix + "SECURITY..REF_MANDATORY WHERE Halaman = '" + Halaman + "' AND Project='" + Project + "' AND HarusIsi = 1");

            for (int i = 0; i < rs.Rows.Count; i++)
            {
                string Nama     = rs.Rows[i]["NamaKolom"].ToString();
                byte   TipeData = Convert.ToByte(rs.Rows[i]["TipeData"]);

                switch (TipeData)
                {
                case (0):     //teks
                {
                    TextBox tb = (TextBox)p.FindControl(Nama);
                    if (tb != null)
                    {
                        if (Cf.isEmpty(tb))
                        {
                            Cf.MarkError(tb);
                            x = false;
                        }
                        else
                        {
                            Cf.ClrError(tb);
                        }
                    }
                }
                break;

                case (1):     //tanggal
                {
                    TextBox tb = (TextBox)p.FindControl(Nama);
                    if (tb != null)
                    {
                        if (!Cf.isTgl(tb))
                        {
                            Cf.MarkError(tb);
                            x = false;
                        }
                        else
                        {
                            Cf.ClrError(tb);
                        }
                    }
                }
                break;

                case (2):     //angka
                {
                    TextBox tb = (TextBox)p.FindControl(Nama);
                    if (tb != null)
                    {
                        if (!Cf.isMoney(tb))
                        {
                            Cf.MarkError(tb);
                            x = false;
                        }
                        else
                        {
                            Cf.ClrError(tb);
                        }
                    }
                }
                break;

                case (3):     //email
                {
                    TextBox tb = (TextBox)p.FindControl(Nama);
                    if (tb != null)
                    {
                        if (!Cf.isEmail(tb.Text))
                        {
                            Cf.MarkError(tb);
                            x = false;
                        }
                        else
                        {
                            Cf.ClrError(tb);
                        }
                    }
                }
                break;

                case (4):     //numerik
                {
                    TextBox tb = (TextBox)p.FindControl(Nama);
                    if (tb != null)
                    {
                        if (!Cf.isNumerik(tb.Text))
                        {
                            Cf.MarkError(tb);
                            x = false;
                        }
                        else
                        {
                            Cf.ClrError(tb);
                        }
                    }
                }
                break;
                }
            }

            if (!x)
            {
                Js.Alert(p, "", "Harap lengkapi mandatori yang harus diisi.");
            }

            return(x);
        }