use of cn.cerc.jdb.core.DataSet in project summer-mis by cn-cerc.
the class SvrUserLogin method isAutoLogin.
private boolean isAutoLogin(String userCode, String deviceId) {
BuildQuery bs = new BuildQuery(this);
bs.byField("MachineCode_", deviceId);
bs.byField("Used_", true);
bs.byField("UserCode_", userCode);
bs.add("select * from %s", SystemTable.get(SystemTable.getDeviceVerify));
DataSet ds = bs.open();
if (!ds.eof()) {
return ds.getBoolean("AutoLogin_");
} else {
return false;
}
}
use of cn.cerc.jdb.core.DataSet in project summer-mis by cn-cerc.
the class DataGrid method outputGrid.
@Override
public void outputGrid(HtmlWriter html) {
DataSet dataSet = this.getDataSet();
MutiPage pages = this.getPages();
double sumFieldWidth = 0;
for (RowCell cell : this.getMasterLine().getOutputCells()) sumFieldWidth += cell.getFields().get(0).getWidth();
if (sumFieldWidth < 0)
throw new RuntimeException("总列宽不允许小于1");
if (sumFieldWidth > MaxWidth)
throw new RuntimeException("总列宽不允许大于600");
html.print("<table class=\"%s\"", this.getCSSClass());
if (this.getCSSStyle() != null)
html.print(" style=\"%s\"", this.getCSSStyle());
html.println(">");
html.println("<tr>");
for (RowCell cell : this.getMasterLine().getOutputCells()) {
IField field = cell.getFields().get(0);
html.print("<th");
if (field.getWidth() == 0)
html.print(" style=\"display:none\"");
else {
double val = roundTo(field.getWidth() / sumFieldWidth * 100, -2);
html.print(" width=\"%f%%\"", val);
}
html.print("onclick=\"gridSort(this,'%s')\"", field.getField());
html.print(">");
html.print(field.getTitle());
html.println("</th>");
}
html.println("</tr>");
if (dataSet.size() > 0) {
int i = pages.getBegin();
while (i <= pages.getEnd()) {
dataSet.setRecNo(i + 1);
for (int lineNo = 0; lineNo < this.getLines().size(); lineNo++) {
AbstractGridLine line = this.getLine(lineNo);
if (line instanceof ExpenderGridLine)
line.getCell(0).setColSpan(this.getMasterLine().getFields().size());
if (line instanceof ChildGridLine && this.beforeOutput != null)
beforeOutput.process(line);
line.output(html, lineNo);
}
// 下一行
i++;
}
}
html.println("</table>");
return;
}
use of cn.cerc.jdb.core.DataSet in project summer-mis by cn-cerc.
the class PhoneGrid method outputGrid.
@Override
public void outputGrid(HtmlWriter html) {
DataSet dataSet = this.getDataSet();
MutiPage pages = this.getPages();
if (dataSet.size() == 0)
return;
html.println(String.format("<ol class=\"%s\">", "context"));
int i = pages.getBegin();
while (i <= pages.getEnd()) {
dataSet.setRecNo(i + 1);
int flag = 0;
html.println("<li>");
for (PhoneLine line : this.lines) {
if (line.isTable()) {
if (flag == 0) {
html.println("<table>");
flag = 1;
} else if (flag == 2) {
html.println("</table>");
html.println("<table>");
}
} else {
if (flag == 1) {
html.println("</table>");
flag = 2;
}
}
line.output(html);
}
if (flag == 1) {
html.println("</table>");
}
html.println("</li>");
i++;
}
html.println("</ol>");
return;
}
use of cn.cerc.jdb.core.DataSet in project summer-mis by cn-cerc.
the class ExpenderGridLine method output.
@Override
public void output(HtmlWriter html, int lineNo) {
DataSet dataSet = dataSource.getDataSet();
html.print("<tr");
html.print(" id='%s_%s'", "tr" + dataSet.getRecNo(), lineNo);
html.print(" role=\"%s\"", dataSet.getRecNo());
if (!this.isVisible())
html.print(" style=\"display:none\"");
html.println(">");
for (RowCell item : this.getCells()) {
IField objField = item.getFields().get(0);
html.print("<td");
if (item.getColSpan() > 1)
html.print(" colspan=\"%d\"", item.getColSpan());
if (item.getStyle() != null)
html.print(" style=\"%s\"", item.getStyle());
if (item.getAlign() != null)
html.print(" align=\"%s\"", item.getAlign());
else if (objField.getAlign() != null)
html.print(" align=\"%s\"", objField.getAlign());
if (item.getRole() != null)
html.print(" role=\"%s\"", item.getRole());
html.print(">");
for (IField obj : item.getFields()) {
if (obj instanceof AbstractField) {
AbstractField field = (AbstractField) obj;
html.print("<span>");
if (!"".equals(field.getName())) {
html.print(field.getName());
html.print(": ");
}
if (field instanceof IColumn)
html.print(((IColumn) field).format(dataSource.getDataSet().getCurrent()));
else if (field instanceof AbstractField)
outputField(html, field);
else
throw new RuntimeException("暂不支持的数据类型:" + field.getClass().getName());
html.println("</span>");
}
}
html.println("</td>");
}
html.println("</tr>");
}
use of cn.cerc.jdb.core.DataSet in project summer-android by cn-cerc.
the class FrmLoginByAccount method onClick.
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.btnLogin:
String account = edtAccount.getText().toString().trim();
if ("".equals(account)) {
lblMessage.setText("用户帐号不允许为空");
return;
}
String password = edtPassword.getText().toString().trim();
if ("".equals(password)) {
lblMessage.setText("用户密码不允许为空");
return;
}
this.onPause();
new Thread(new Runnable() {
@Override
public void run() {
try {
RemoteService rs = new RemoteService(loginUrl);
DataSet dataIn = rs.getDataIn();
// dataIn.getHead().setField("usercode", edtAccount.getText().toString());
dataIn.getHead().setField("Account_", edtAccount.getText().toString());
// dataIn.getHead().setField("password", edtPassword.getText().toString());
dataIn.getHead().setField("Password_", edtPassword.getText().toString());
dataIn.getHead().setField("MachineID_", MyApp.getInstance().getClientId());
dataIn.getHead().setField("ClientName_", "android");
handler.sendMessage(rs.execByMessage(MSG_LOGIN));
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
break;
default:
break;
}
}
Aggregations