Search in sources :

Example 6 with DataSet

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;
    }
}
Also used : DataSet(cn.cerc.jdb.core.DataSet) BuildQuery(cn.cerc.jdb.mysql.BuildQuery)

Example 7 with DataSet

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;
}
Also used : ChildGridLine(cn.cerc.jpage.grid.lines.ChildGridLine) DataSet(cn.cerc.jdb.core.DataSet) ExpenderGridLine(cn.cerc.jpage.grid.lines.ExpenderGridLine) IField(cn.cerc.jpage.core.IField) AbstractGridLine(cn.cerc.jpage.grid.lines.AbstractGridLine)

Example 8 with DataSet

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;
}
Also used : DataSet(cn.cerc.jdb.core.DataSet)

Example 9 with DataSet

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>");
}
Also used : AbstractField(cn.cerc.jpage.fields.AbstractField) DataSet(cn.cerc.jdb.core.DataSet) IColumn(cn.cerc.jpage.core.IColumn) RowCell(cn.cerc.jpage.grid.RowCell) IField(cn.cerc.jpage.core.IField)

Example 10 with DataSet

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;
    }
}
Also used : RemoteService(cn.cerc.summer.android.basis.RemoteService) DataSet(cn.cerc.jdb.core.DataSet)

Aggregations

DataSet (cn.cerc.jdb.core.DataSet)26 Record (cn.cerc.jdb.core.Record)4 LocalService (cn.cerc.jbean.client.LocalService)3 IField (cn.cerc.jpage.core.IField)3 Test (org.junit.Test)3 BuildQuery (cn.cerc.jdb.mysql.BuildQuery)2 IColumn (cn.cerc.jpage.core.IColumn)2 AbstractField (cn.cerc.jpage.fields.AbstractField)2 RowCell (cn.cerc.jpage.grid.RowCell)2 Font (com.itextpdf.text.Font)2 Paragraph (com.itextpdf.text.Paragraph)2 BaseFont (com.itextpdf.text.pdf.BaseFont)2 PdfContentByte (com.itextpdf.text.pdf.PdfContentByte)2 IOException (java.io.IOException)2 Label (jxl.write.Label)2 WritableSheet (jxl.write.WritableSheet)2 WritableWorkbook (jxl.write.WritableWorkbook)2 FileItem (org.apache.commons.fileupload.FileItem)2 Ignore (org.junit.Ignore)2 RemoteService (cn.cerc.jbean.client.RemoteService)1