private bool valid() { bool x = true; string s = ""; //nama if (Cf.isEmpty(nama)) { x = false; if (s == "") { s = nama.ID; } namac.Text = "Kosong"; } else { namac.Text = ""; } //cek existing termin int cek = Db.SingleInteger("SELECT COUNT(*) FROM REF_SKOM_TERM WHERE CaraBayar = '" + carabayar.SelectedValue + "' AND SalesTipe = " + Convert.ToInt32(tipe.SelectedValue) + " AND NoTermin != " + Nomor + " AND Inaktif = 0" ); ; if (cek > 0) { x = false; } int tipesales = Db.SingleInteger("SELECT Count(ID) FROM REF_AGENT_TIPE WHERE ID = '" + tipe.SelectedValue + "' AND Project = '" + project.SelectedValue + "'"); if (tipesales == 0) { x = false; Cf.MarkError(tipe); } if (!x) { Js.Alert( this , "Input Tidak Valid.\\n\\n" + "Aturan Proses :\\n" + "1. Nama tidak boleh kosong.\\n" + "2. Termin yang terdaftar harus unik.\\n" + "3. Tipe marketing harus dipilih.\\n" + "4. Tipe marketing tidak tersedia untuk project yang dipilih.\\n" , "document.getElementById('" + s + "').focus();" + "document.getElementById('" + s + "').select();" ); } return(x); }
private bool valid() { bool x = true; if (Cf.isEmpty(note)) { x = false; Cf.MarkError(note); } return(x); }
private bool datavalid() { bool x = true; string s = ""; if (Cf.isEmpty(note)) { x = false; Cf.MarkError(note); } if (!x) { this.RegisterStartupScript( "focusScript" , "<script type='text/javascript'>" + "document.getElementById('" + s + "').focus();" + "</script>" ); } return(x); }
private bool valid() { bool x = true; if ((ket1.Text != "" && persen1.Text == "") || (ket1.Text == "" && persen1.Text != "")) { x = false; } if ((ket2.Text != "" && persen2.Text == "") || (ket2.Text == "" && persen2.Text != "")) { x = false; } if ((ket3.Text != "" && persen3.Text == "") || (ket3.Text == "" && persen3.Text != "")) { x = false; } if ((ket4.Text != "" && persen4.Text == "") || (ket4.Text == "" && persen4.Text != "")) { x = false; } if ((ket5.Text != "" && persen5.Text == "") || (ket5.Text == "" && persen5.Text != "")) { x = false; } if ((ket6.Text != "" && persen6.Text == "") || (ket6.Text == "" && persen6.Text != "")) { x = false; } if ((ket7.Text != "" && persen7.Text == "") || (ket7.Text == "" && persen7.Text != "")) { x = false; } if ((ket8.Text != "" && persen8.Text == "") || (ket8.Text == "" && persen8.Text != "")) { x = false; } if ((ket9.Text != "" && persen9.Text == "") || (ket9.Text == "" && persen9.Text != "")) { x = false; } if ((ket10.Text != "" && persen10.Text == "") || (ket10.Text == "" && persen10.Text != "")) { x = false; } if (ket1.Text != "") { if (!Cf.isMoney(persen1)) { x = false; Cf.MarkError(persen1); } else { persen1.Attributes["style"] = "bacground-color:white;"; } } else { persen1.Attributes["style"] = "bacground-color:white;"; } if (ket2.Text != "") { if (!Cf.isMoney(persen2)) { x = false; Cf.MarkError(persen2); } else { persen2.Attributes["style"] = "bacground-color:white;"; } } else { persen2.Attributes["style"] = "bacground-color:white;"; } if (ket3.Text != "") { if (!Cf.isMoney(persen3)) { x = false; Cf.MarkError(persen3); } else { persen3.Attributes["style"] = "bacground-color:white;"; } } else { persen3.Attributes["style"] = "bacground-color:white;"; } if (ket4.Text != "") { if (!Cf.isMoney(persen4)) { x = false; Cf.MarkError(persen4); } else { persen4.Attributes["style"] = "bacground-color:white;"; } } else { persen4.Attributes["style"] = "bacground-color:white;"; } if (ket5.Text != "") { if (!Cf.isMoney(persen5)) { x = false; Cf.MarkError(persen5); } else { persen5.Attributes["style"] = "bacground-color:white;"; } } else { persen5.Attributes["style"] = "bacground-color:white;"; } if (ket6.Text != "") { if (!Cf.isMoney(persen6)) { x = false; Cf.MarkError(persen6); } else { persen6.Attributes["style"] = "bacground-color:white;"; } } else { persen6.Attributes["style"] = "bacground-color:white;"; } if (ket7.Text != "") { if (!Cf.isMoney(persen7)) { x = false; Cf.MarkError(persen7); } else { persen7.Attributes["style"] = "bacground-color:white;"; } } else { persen7.Attributes["style"] = "bacground-color:white;"; } if (ket8.Text != "") { if (!Cf.isMoney(persen8)) { x = false; Cf.MarkError(persen8); } else { persen8.Attributes["style"] = "bacground-color:white;"; } } else { persen8.Attributes["style"] = "bacground-color:white;"; } if (ket9.Text != "") { if (!Cf.isMoney(persen9)) { x = false; Cf.MarkError(persen9); } else { persen9.Attributes["style"] = "bacground-color:white;"; } } else { persen9.Attributes["style"] = "bacground-color:white;"; } if (!x) { Js.Alert( this , "Input Tidak Valid.\\n\\n" + "Aturan Proses :\\n" + "1. Rumus bunga harus lengkap.\\n" , "" ); } return(x); }
private bool valid() { DateTime Dari = Convert.ToDateTime(dari.Text); DateTime Sampai = Convert.ToDateTime(sampai.Text); if (Dari > Sampai) { DateTime x1 = Sampai; Sampai = Dari; Dari = x1; } bool x = true; string s = ""; //nama if (Cf.isEmpty(nama)) { x = false; if (s == "") { s = nama.ID; } namac.Text = "Kosong"; } else { namac.Text = ""; } if (!Cf.isTgl(dari.Text)) { x = false; if (s == "") { s = dari.ID; } daric.Text = "Tanggal"; } else { daric.Text = ""; } if (!Cf.isTgl(sampai.Text)) { x = false; if (s == "") { s = sampai.ID; } sampaic.Text = "Tanggal"; } else { sampaic.Text = ""; } if (tipe.SelectedIndex == 0) { x = false; if (s == "") { s = tipe.ID; } tipec.Text = "Pilih"; } else { tipec.Text = ""; } //cek existing periode komisi int cek = Db.SingleInteger("SELECT COUNT(*) FROM REF_SKOM WHERE SalesTipe = " + Convert.ToInt32(tipe.SelectedValue) + " AND NoSkema != " + Nomor + " AND Inaktif = 0" + " AND " + " (" + " (CONVERT(VARCHAR,Dari,112) >= '" + Cf.Tgl112(Dari) + "' AND CONVERT(VARCHAR,Sampai,112) <= '" + Cf.Tgl112(Sampai) + "') OR" + " (CONVERT(VARCHAR,Dari,112) >= '" + Cf.Tgl112(Dari) + "' AND CONVERT(VARCHAR,Dari,112) <= '" + Cf.Tgl112(Sampai) + "') OR" + " (CONVERT(VARCHAR,Sampai,112) >= '" + Cf.Tgl112(Dari) + "' AND CONVERT(VARCHAR,Sampai,112) <= '" + Cf.Tgl112(Sampai) + "') OR" + " ('" + Cf.Tgl112(Dari) + "' >= CONVERT(VARCHAR,Dari,112) AND '" + Cf.Tgl112(Dari) + "' <= CONVERT(VARCHAR,Sampai,112)) OR" + " ('" + Cf.Tgl112(Sampai) + "' >= CONVERT(VARCHAR,Dari,112) AND '" + Cf.Tgl112(Sampai) + "' <= CONVERT(VARCHAR,Sampai,112))" + " )" ); ; if (cek > 0) { x = false; Cf.MarkError(dari); Cf.MarkError(sampai); } if (!x) { Js.Alert( this , "Input Tidak Valid.\\n\\n" + "Aturan Proses :\\n" + "1. Nama tidak boleh kosong.\\n" + "2. Nilai harus berupa angka.\\n" + "3. Tipe marketing harus dipilih.\\n" + "4. Periode skema terbalik.\\n" + "5. Periode skema harus berupa tanggal.\\n" + "6. Periode skema sudah terdaftar.\\n" , "document.getElementById('" + s + "').focus();" + "document.getElementById('" + s + "').select();" ); } return(x); }
private bool valid() { string s = ""; bool x = true; if (!Cf.isTgl(dari)) { x = false; if (s == "") { s = dari.ID; } daric.Text = "Tanggal"; } else { daric.Text = ""; } if (!Cf.isTgl(sampai)) { x = false; if (s == "") { s = sampai.ID; } sampaic.Text = "Tanggal"; } else { sampaic.Text = ""; } //nama if (Cf.isEmpty(nama)) { x = false; if (s == "") { s = nama.ID; } namac.Text = "Kosong"; } else { namac.Text = ""; } if (tipe.SelectedIndex == 0) { x = false; if (s == "") { s = tipe.ID; } tipec.Text = "Pilih Project & Tipe"; } if (project.SelectedIndex == 0) { x = false; if (s == "") { s = project.ID; } tipec.Text = "Pilih Project & Tipe"; } if (Cf.isTgl(dari) && Cf.isTgl(sampai)) { DateTime Dari = Convert.ToDateTime(dari.Text); DateTime Sampai = Convert.ToDateTime(sampai.Text); if (Dari > Sampai) { DateTime x1 = Sampai; Sampai = Dari; Dari = x1; } //cek existing periode komisi int cek = 0; if (tipe.SelectedIndex != 0) { cek = Db.SingleInteger("SELECT COUNT(*) FROM REF_SKOM_CF WHERE SalesTipe = " + Convert.ToInt32(tipe.SelectedValue) + " AND Inaktif = 0" + " AND " + " (" + " (CONVERT(VARCHAR,Dari,112) >= '" + Cf.Tgl112(Dari) + "' AND CONVERT(VARCHAR,Sampai,112) <= '" + Cf.Tgl112(Sampai) + "') OR" + " (CONVERT(VARCHAR,Dari,112) >= '" + Cf.Tgl112(Dari) + "' AND CONVERT(VARCHAR,Dari,112) <= '" + Cf.Tgl112(Sampai) + "') OR" + " (CONVERT(VARCHAR,Sampai,112) >= '" + Cf.Tgl112(Dari) + "' AND CONVERT(VARCHAR,Sampai,112) <= '" + Cf.Tgl112(Sampai) + "') OR" + " ('" + Cf.Tgl112(Dari) + "' >= CONVERT(VARCHAR,Dari,112) AND '" + Cf.Tgl112(Dari) + "' <= CONVERT(VARCHAR,Sampai,112)) OR" + " ('" + Cf.Tgl112(Sampai) + "' >= CONVERT(VARCHAR,Dari,112) AND '" + Cf.Tgl112(Sampai) + "' <= CONVERT(VARCHAR,Sampai,112))" + " )" ); } if (cek > 0) { x = false; Cf.MarkError(dari); Cf.MarkError(sampai); } } if (!x) { this.RegisterStartupScript( "focusScript" , "<script language='javascript'>" + " document.getElementById('" + s + "').focus();" + " document.getElementById('" + s + "').select();" + "</script>" ); } else { } return(x); }
private bool datavalid() { if (carabayar.SelectedIndex == -1) { Js.Alert( this , "Cara Bayar Tidak Valid.\\n" + "Silakan pilih salah satu cara bayar yang tersedia." , "" ); return(false); } else { string s = ""; bool x = true; if (!Cf.isTgl(tgl)) { x = false; if (s == "") { s = tgl.ID; } tglc.Text = "Tanggal"; } else { tglc.Text = ""; } if (ddlAcc.SelectedIndex == 0) { x = false; if (s == "") { s = ddlAcc.ID; } ddlAccErr.Text = "Harus dipilih"; } else { ddlAccErr.Text = ""; } if (carabayar.SelectedValue == "KK") { if (Cf.isEmpty(nokk)) { x = false; if (s == "") { s = nokk.ID; } nokkc.Text = "Kosong"; } else { nokkc.Text = ""; } if (Cf.isEmpty(bankkk)) { x = false; if (s == "") { s = bankkk.ID; } bankkkc.Text = "Kosong"; } else { bankkkc.Text = ""; } } if (carabayar.SelectedValue == "BG") { nobg.Text = Cf.Pk(nobg.Text); if (Cf.isEmpty(nobg)) { x = false; if (s == "") { s = nobg.ID; } nobgc.Text = "Kosong"; } else { nobgc.Text = ""; } if (!Cf.isTgl(tglbg)) { x = false; if (s == "") { s = tglbg.ID; } tglbgc.Text = "Tanggal"; } else { tglbgc.Text = ""; } if (!Cf.isTgl(tgljtbg)) { x = false; if (s == "") { s = tgljtbg.ID; } tgljtbgc.Text = "Tanggal"; } else { tgljtbgc.Text = ""; } } if (carabayar.SelectedValue == "KK") { if (!Cf.isMoney(biayaadmin)) { x = false; if (s == "") { s = biayaadmin.ID; } Cf.MarkError(biayaadmin); } else { Cf.ClrError(biayaadmin); } } bool adasatu = false; int b = 0; for (int i = 0; i < rsTagihan.Rows.Count; i++) { b++; TextBox lunas = (TextBox)list.FindControl("lunas_" + i); if (lunas.Text != "") { adasatu = true; try { decimal z = Convert.ToDecimal(lunas.Text); } catch { x = false; if (s == "") { s = lunas.ID; } } } } for (int a = 0; a < rsTagihan2.Rows.Count; a++) { TextBox lunas = (TextBox)list.FindControl("lunas_" + (a + b)); if (lunas.Text != "") { adasatu = true; try { decimal z = Convert.ToDecimal(lunas.Text); } catch { x = false; if (s == "") { s = lunas.ID; } } } } if (!adasatu) { x = false; if (s == "") { s = gt.ID; } gtc.Attributes["style"] = "color:red"; } else { gtc.Attributes["style"] = "color:black"; } if (!Cf.isMoney(admBank)) { x = false; if (s == "") { s = admBank.ID; } admBankc.Text = "Angka"; } else { admBankc.Text = ""; } if (!Cf.isMoney(lebihBayar)) { x = false; if (s == "") { s = lebihBayar.ID; } lebihBayarc.Text = "Angka"; } else { lebihBayarc.Text = ""; } if (!Cf.isMoney(lb)) { x = false; if (s == "") { s = lb.ID; } lbc.Text = "Angka"; } else { lbc.Text = ""; } if (anonim.SelectedIndex > 0) { decimal Ano = Db.SingleDecimal("SELECT ISNULL(Nilai, 0) FROM MS_ANONIM WHERE NoAnonim = " + anonim.SelectedValue); if (Convert.ToDecimal(grandtotal.Text) != Ano) { x = false; } } if (!x) { Js.Alert( this , "Input Tidak Valid.\\n\\n" + "Aturan Proses :\\n" + "1. Format Tanggal : Bulan / Tanggal / Tahun.\\n" + "2. Pembayaran harus berupa angka dan minimal untuk satu tagihan.\\n" + "3. Khusus Cek Giro : No. BG tidak boleh kosong.\\n" + "4. Rekening Bank harus dipilih.\\n" + "5. Kolom Admin Bank, Pembulatan dan Lebih Bayar harus angka.\\n" + "6. Apabila menggunakan anonim. Maka nilai total pembayaran harus sesuai dengan nilai anonim.\\n" , "document.getElementById('" + s + "').focus();" ); } //Js.Alert(this, "", gt.Text); return(x); } }