public ResultData CheckLogin(string id, string password) { ResultData result = new ResultData(); UPF daoUPF = new UPF(); DataTable dtUPF = daoUPF.ListDataByUserId(id); result.ReturnData = dtUPF; if (dtUPF.Rows.Count != 0) { if (password == dtUPF.Rows[0]["UPF_PASSWORD"].ToString().Trim()) { result.Status = ResultStatus.Success; } else { MessageDisplay.Error("密碼錯誤"); result.Status = ResultStatus.Fail; } } else { MessageDisplay.Error("無此帳號"); result.Status = ResultStatus.Fail; } return(result); }
public DataTable ListUPFByUserId(string UPF_USER_ID) { return(daoUPF.ListDataByUserId(UPF_USER_ID)); }
private XtraReport GenerateReport() { RZ0011 report = new RZ0011(); DataTable dtMain = daoUPF.ListDataByUserId(ddlUserId.EditValue.AsString()); report.DataSource = dtMain; report.Detail.Borders = DevExpress.XtraPrinting.BorderSide.All; XRTable table = new XRTable(); XRTableRow headerRow = new XRTableRow(); headerRow.BackColor = System.Drawing.SystemColors.Control; table.Controls.Add(headerRow); report.Detail.Controls.Add(table); XRTableRow contentRow = new XRTableRow(); table.Controls.Add(contentRow); Dictionary <string, string> reportColumns = new Dictionary <string, string>(); reportColumns.Add("UPF_USER_ID", "使用者代號"); reportColumns.Add("UPF_USER_NAME", "使用者名稱"); reportColumns.Add("UPF_EMPLOYEE_ID", "員工編號"); reportColumns.Add("DPT_ID_NAME", "部門"); reportColumns.Add("UPF_PASSWORD", "密碼"); reportColumns.Add("UPF_W_TIME", "設定時間"); XRTableCell headerCell = new XRTableCell(); XRTableCell contentCell = new XRTableCell(); foreach (DataColumn column in dtMain.Columns) { if (reportColumns.ContainsKey(column.ColumnName)) { headerCell = new XRTableCell(); headerCell.Text = reportColumns[column.ColumnName]; headerCell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; headerCell.Padding = 1; headerRow.Controls.Add(headerCell); contentCell = new XRTableCell(); contentCell.Padding = 1; if (column.ColumnName == "UPF_W_TIME") { headerCell.WidthF = 150F; contentCell.WidthF = 150F; contentCell.DataBindings.Add("Text", null, column.ColumnName, "{0:yyyy/MM/dd HH:mm:ss}"); } else if (column.ColumnName == "UPF_PASSWORD") { contentCell.Text = "**********"; } else { contentCell.DataBindings.Add("Text", null, column.ColumnName); } contentRow.Controls.Add(contentCell); } } report.lblUserIdTxt.DataBindings.Add("Text", null, "UPF_USER_ID"); report.lblUserNameTxt.DataBindings.Add("Text", null, "UPF_USER_NAME"); report.lblUserPwdTxt.DataBindings.Add("Text", null, "UPF_PASSWORD"); report.lblWdateTxt.DataBindings.Add("Text", null, "UPF_W_TIME", "{0:yyyy/MM/dd}"); table.WidthF = ((XRSubreport)report.FindControl("xrSubreportMain", true)).WidthF; return(report); }