home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
ib
/
setups
/
intrabld
/
data.z
/
DEPARTMT.JFM
< prev
next >
Wrap
Text File
|
1996-12-11
|
6KB
|
217 lines
/****************************************************************************\
* *
* Departmt.jfm -- Phone Book Department Update Form *
* *
* Departmt.jfm is part of the phone book prebuilt business solution. It is *
* used to update the list of departments. It can be called from the update *
* form if the user has access to the Phone Update resource. (see the update *
* form - update.jfm - for more information about the security features in *
* the phone book. *
* *
* Dependencies: phonbk31.gif *
* apps\shared\controls.cc *
* *
* Updated 11/12/96 by IntraBuilder Samples Group *
* $Revision: 1.7 $ *
* *
* Copyright (c) 1996, Borland International, Inc. All rights reserved. *
* *
\****************************************************************************/
// {End Header} Do not remove this comment//
// Generated on 11/12/96
//
var f = new departmtForm();
f.open();
class departmtForm extends Form {
_sys.scripts.load(_sys.env.home() + "APPS\\SHARED\\CONTROLS.CC")
with (this) {
preRender = class::Form_preRender;
color = "cae4ff";
height = 14;
left = 0;
top = 0;
width = 74;
title = "Update Departments";
}
with (this.ibapps1 = new Database()){
left = 20;
top = 2;
databaseName = "IBAPPS";
active = true;
}
with (this.department1 = new Query()){
left = 32;
top = 2;
database = parent.ibapps1;
sql = "select * from departmt";
active = true;
with (rowset) {
}
}
with (this.rule1 = new Rule(this)){
top = 4;
size = 2;
right = 70;
}
with (this.rule2 = new Rule(this)){
top = 13.5;
size = 2;
right = 70;
}
with (this.phoneLogoImage = new Image(this)){
height = 3.4167;
width = 10.25;
dataSource = "filename PHONBK31.GIF";
alignment = 4;
}
with (this.titleHTML = new HTML(this)){
height = 2;
left = 12;
width = 64;
color = "853a1a";
text = "<H1>Update Departments</H1>";
}
with (this.deptSelect = new ListBox(this)){
height = 7;
left = 30;
top = 6;
width = 24;
}
with (this.addButton = new Button(this)){
onServerClick = class::addButton_onServerClick;
left = 16;
top = 7.5;
width = 10.5;
text = " Add ";
}
with (this.deptHTML = new HTML(this)){
height = 1;
left = 30;
top = 5;
width = 24;
color = "black";
text = "Departments";
}
with (this.addText = new Text(this)){
top = 6;
width = 26;
value = "";
}
with (this.deleteButton = new Button(this)){
onServerClick = class::deleteButton_onServerClick;
left = 16;
top = 9;
width = 10.5;
text = "Delete";
}
with (this.backButton = new Button(this)){
onServerClick = class::backButton_onServerClick;
left = 16;
top = 10.5;
width = 10.5;
text = "Done";
}
with (this.GeneratedHTML1 = new GeneratedHTML(this)){
height = 1;
top = 14;
width = 70;
}
with (this.html1 = new HTML(this)){
height = 1;
top = 5;
width = 26;
color = "black";
text = "New department";
}
this.rowset = this.department1.rowset;
function Form_preRender(notForm, formRef)
{
//
// generate array from Departmt for the listbox
//
form = notForm ? formRef : this;
form.deptArray = new Array();
form.rowset.first();
while(!form.rowset.endOfSet) {
form.deptArray.add(form.rowset.fields["Department"].value);
form.rowset.next();
}
form.deptArray.sort();
form.deptSelect.options = 'array form.deptArray';
}
function addButton_onServerClick()
{
var dept = new StringEx(this.form.addText.value);
dept = new StringEx(dept.rightTrim());
dept = dept.leftTrim();
if (dept.length > 0) {
this.form.rowset.beginAppend();
this.form.rowset.fields["Department"].value = dept;
this.form.rowset.save();
// blank out the text
this.form.addText.value = "";
// re-render the form
this.form.Form_preRender(true, this.form);
}
}
function deleteButton_onServerClick()
{
var dept = new StringEx(this.form.deptSelect.value);
dept = new StringEx(dept.rightTrim());
dept = dept.leftTrim();
if (dept.length > 0) {
this.form.department1.active = false;
this.form.department1.sql = "select * from departmt where department = :dept";
this.form.department1.params["dept"] = dept;
this.form.department1.active = true;
if (!this.form.rowset.endOfSet)
this.form.rowset.delete();
this.form.department1.sql = "select * from departmt";
this.form.Form_preRender(true, this.form);
}
}
function backButton_onServerClick()
{
this.form.close();
this.form.release();
}
}