public static EntityData GetList() { EntityData data; using (SingleEntityDAO ydao = new SingleEntityDAO("StampDuty")) { data = ydao.SelectAll(); ydao.Dispose(); } return(data); }
protected void btnOK_ServerClick(object sender, System.EventArgs e) { if (this.txtFile.PostedFile.FileName == "") { Response.Write(Rms.Web.JavaScript.Alert(true, "请选择文件")); return; } string ProjectCode = this.sltProject.Value.Trim(); // if (ProjectCode == "") // { // Response.Write(Rms.Web.JavaScript.Alert(true, "请选择对应项目")); // return; // } try { //删除该项目的供应商 DAL.EntityDAO.SalDAO.DeleteSalSuplByProjectCode(ProjectCode); StreamReader m_sr = new StreamReader(this.txtFile.PostedFile.InputStream, System.Text.Encoding.Default); SingleEntityDAO dao = new SingleEntityDAO("SalSupl"); EntityData entity = new EntityData("SalSupl"); //第1行是标题 if (m_sr.Peek() >= 0) { m_sr.ReadLine(); } while (m_sr.Peek() >= 0) { string s = m_sr.ReadLine(); string[] m_strSub = s.Replace("\"", "").Split(','); if (m_strSub.Length < 3) { continue; } if (m_strSub[0].Trim() == "") { continue; } DataRow dr = entity.CurrentTable.NewRow(); dr["SystemID"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("SalSuplSystemID"); dr["ProjectCode"] = ProjectCode; dr["SuplCode"] = m_strSub[0].Trim(); dr["SuplName"] = m_strSub[1].Trim(); entity.CurrentTable.Rows.Add(dr); dao.InsertEntity(entity); } entity.Dispose(); dao.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); throw ex; } Response.Write(JavaScript.ScriptStart); Response.Write(JavaScript.Alert(false, "导入完成")); Response.Write("window.opener.location = window.opener.location;"); Response.Write(JavaScript.WinClose(false)); Response.Write(JavaScript.ScriptEnd); Response.End(); }